Example #1
0
//-----------------------------------------------------------------------------
StatusCode RootHistCnv::PersSvc::createRep(DataObject* pObject,
                                           IOpaqueAddress*& refpAddress)
//-----------------------------------------------------------------------------
{
  // There are objects in the HDS to be stored
  if( m_outputEnabled && undefFileName != m_defFileName )  {
    SmartDataPtr<DataObject> top(dataProvider(), stat_dir);
    if ( 0 != top )    {
      IRegistry* pReg = top->registry();
      if ( pReg )   {
        if ( top.ptr() == pObject )   {
          TDirectory* pDir = m_hfile;
          refpAddress = new RootObjAddress( repSvcType(),
                                            CLID_DataObject,
                                            stat_dir,
                                            m_defFileName,
                                            long(pDir),
                                            long(0));
          return StatusCode::SUCCESS;
        }
        else    {
          StatusCode sc = ConversionSvc::createRep(pObject, refpAddress);
          if( sc.isFailure() )   {
            MsgStream log( msgSvc(), name() );
            log << MSG::ERROR
                << "Error while creating persistent Histogram:"
                << pReg->identifier()
                << endmsg;
          }
          return sc;
        }
      }
    }
    MsgStream err( msgSvc(), name() );
    err << MSG::ERROR
        << "Internal error while creating Histogram persistent representations"
        << endmsg;
    return StatusCode::FAILURE;
  } else {
    if (m_outputEnabled && !m_prtWar) {
      m_prtWar = true;
      MsgStream log( msgSvc(), name() );
      log << MSG::WARNING
	  << "no ROOT output file name, "
	  << "Histograms cannot be persistified" << endmsg;
    }
  }
  return StatusCode::SUCCESS;
}
Example #2
0
// ============================================================================
// Initialization
// ============================================================================
StatusCode RecordOutputStream::initialize() {
  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
  if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm

  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;

  if (m_streamName.empty()) {
    m_streamName = "Deferred:" + name();
    debug() << "Using default OutputStreamName: '"
            << m_streamName << "'" << endmsg;
  }

  m_flagLocation = locationRoot() + "/" + m_streamName;
  return StatusCode::SUCCESS;
}
Example #3
0
StatusCode NoiseCaloCellsTool::initialize() {
  StatusCode sc = GaudiTool::initialize();
  if (sc.isFailure()) return sc;

  //Initialize random service
  if(service( "RndmGenSvc" , m_randSvc ).isFailure()) {
    error() << "Couldn't get RndmGenSvc" << endmsg;
    return StatusCode::FAILURE;
  }
  m_gauss.initialize(m_randSvc, Rndm::Gauss(0,m_cellNoise));

  info() << "Sigma of the cell noise: " <<  m_cellNoise << " MeV" << endmsg;
  info() << "Filter noise threshold: " <<  m_filterThreshold << "*sigma" << endmsg;
  return sc;
}
Example #4
0
// ============================================================================
StatusCode Gaudi::Parsers::parse 
( std::vector<Gaudi::StringKey>&  result , 
  const std::string&              input  ) 
{
  result.clear() ;
  typedef std::vector<std::string> Strings ;
  Strings _result ;
  StatusCode sc = parse ( _result , input ) ;
  if ( sc.isFailure() ) { return sc ; }                              // RETURN 
  result.reserve ( _result.size() ) ;
  //
  std::copy ( _result.begin() , 
              _result.end  () , std::back_inserter ( result ) ) ;
  //
  return StatusCode::SUCCESS ;
}
Example #5
0
//------------------------------------------------------------------------------
StatusCode MyAlgorithm::initialize() {
//------------------------------------------------------------------------------

  MsgStream log(msgSvc(), name());
  StatusCode sc;
  log << MSG::INFO << "initializing...." << endmsg;

  sc = toolSvc()->retrieveTool(m_toolName, m_tool, this );
  if( sc.isFailure() ) {
    log << MSG::ERROR<< "Error retrieving the tool" << endmsg;
    return sc;
  }
  log << MSG::INFO << "....initialization done" << endmsg;

  return StatusCode::SUCCESS;
}
Example #6
0
// ============================================================================
Tuples::TupleObj::Char* Tuples::TupleObj::chars
( const std::string& name ,
  const char         minv ,
  const char         maxv )
{
  Chars::iterator found = m_chars.find( name ) ;
  if( m_chars.end() != found ) { return found->second ; }
  Char* item = new Char() ;
  m_chars[ name ] = item ;
  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
  if( sc.isFailure() )
  { Error ( "chars ('" + name + "'): item is not added",  sc ) ; }
  if ( !addItem ( name , "I" ) )
  { Error ( "chars ('" + name + "'): item is not unique"     ) ; }
  return item ;
}
Example #7
0
// ============================================================================
Tuples::TupleObj::UInt* Tuples::TupleObj::uints
( const std::string& name ,
  const unsigned int minv ,
  const unsigned int maxv )
{
  UInts::iterator found = m_uints.find( name ) ;
  if( m_uints.end() != found ) { return found->second ; }
  UInt* item = new UInt() ;
  m_uints[ name ] = item ;
  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
  if( sc.isFailure() )
  { Error ( "uints ('" + name + "'): item is not added",  sc ) ; }
  if ( !addItem ( name , "I" ) )
  { Error ( "uints ('" + name + "'): item is not unique"     ) ; }
  return item ;
}
Example #8
0
// ============================================================================
Tuples::TupleObj::ULongLong* Tuples::TupleObj::ulonglongs
( const std::string&       name ,
  const unsigned long long minv ,
  const unsigned long long maxv )
{
  ULongLongs::iterator found = m_ulonglongs.find( name ) ;
  if( m_ulonglongs.end() != found ) { return found->second ; }
  ULongLong* item = new ULongLong() ;
  m_ulonglongs[ name ] = item ;
  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
  if( sc.isFailure() )
  { Error ( "ulonglongs ('" + name + "'): item is not added",  sc ) ; }
  if ( !addItem ( name , "ULL" ) )
  { Error ( "ulonglongs ('" + name + "'): item is not unique"     ) ; }
  return item ;
}
Example #9
0
//=============================================================================
// Initialization
//=============================================================================
StatusCode TbTracking::initialize() {

  // Initialise the base class.
  StatusCode sc = TbAlgorithm::initialize();
  if (sc.isFailure()) return sc;
  // Setup the track fit tool.
  m_trackFit = tool<ITbTrackFit>("TbTrackFit", "Fitter", this);
  // Set up the cluster finder.
  m_clusterFinder =
      new TbClusterFinder(m_ClusterFinderSearchAlgorithm, m_nPlanes);
  
  // setup Kalman histos
  setup_hists();
  
  return StatusCode::SUCCESS;
}
Example #10
0
//=============================================================================
// Initialization
//=============================================================================
StatusCode TbChargeCalib::initialize() {

  // Initialise the base class.
  StatusCode sc = TbAlgorithm::initialize();
  if (sc.isFailure()) return sc;
  info() << "Booking histograms for Chargecalib ... " << endmsg;
  m_ToTHists.reserve(256*256);
  for( unsigned int i = 0 ; i < 256*256; ++i){
    const std::string name = "c=" + std::to_string( i/256 ) + ", r=" + std::to_string(i%256);
    if( i % 256 == 0 ) info() << "Booked histogram for column " << i << endmsg;
    m_ToTHists.push_back(book1D(name, name, 0.5, 200.5, 200));
    setAxisLabels(m_ToTHists[i], "ToT", "Entries");
  }
  info() << "Booked 60000 ish hists" << endmsg; 
  return StatusCode::SUCCESS;
}
Example #11
0
//=============================================================================
// Initialisation
//=============================================================================
StatusCode TbKalmanTrackFit::initialize() {

  // Initialise the base class.
  StatusCode sc = GaudiTool::initialize();
  if (sc.isFailure()) return sc;
  // Get the straight-line fit tool (used for seeding the Kalman filter).
  m_fitter = tool<ITbTrackFit>("TbTrackFit", "StraightLineFitter", this);
  // Get the number of telescope planes.
  const auto nPlanes = geomSvc()->modules().size();
  // Set the flags whether a plane is masked or not.
  m_masked.resize(nPlanes, false);
  for (const unsigned int plane : m_maskedPlanes) {
    m_masked[plane] = true;
    m_fitter->maskPlane(plane);
  }
  return StatusCode::SUCCESS;
}
Example #12
0
// ============================================================================
// retrieve (book on demand) array-items for ntuple (fixed)
// ============================================================================
Tuples::TupleObj::FArray* Tuples::TupleObj::fArray
( const std::string&              name ,
  const Tuples::TupleObj::MIndex& rows )
{
  // existing array ?
  FArrays::iterator found = m_arraysf.find( name ) ;
  if( m_arraysf.end() != found ) { return found->second ; }
  // create new array
  FArray* array = new FArray () ;
  m_arraysf[ name] =      array    ;
  const StatusCode sc = tuple() -> addItem ( name , rows , *array) ;
  if( sc.isFailure() )
  { Error ( "array ('" + name + "'): item is not added",  sc ) ; }
  if ( !addItem ( name , "FArray" ) )
  { Error ( "array ('" + name + "'): item is not unique"     ) ; }
  return array ;
}
Example #13
0
    StatusCode execute() {
      info() << "Getting " << m_paths.size() << " objects from " << m_dataSvc << endmsg;
      bool missing = false;
      for (auto& p: m_paths) {
        info() << "Getting '" << p << "'" << endmsg;
        DataObject *obj;
        StatusCode sc = m_dataProvider->retrieveObject(p, obj);
        if (sc.isFailure()) {
          warning() << "Cannot retrieve object '" << p << "'" << endmsg;
          missing = true;
        }
      }

      return (missing && ! m_ignoreMissing)
          ? StatusCode::FAILURE
          : StatusCode::SUCCESS;
    }
Example #14
0
// Re-initialize
StatusCode EventSelector::reinitialize() {
  if ( FSMState() != Gaudi::StateMachine::INITIALIZED ) {
    MsgStream logger(msgSvc(), name());
    logger << MSG::ERROR << "Cannot reinitialize: service not in state initialized" << endmsg;
    return StatusCode::FAILURE;
  }

  if( m_streamSpecsLast != m_streamSpecs ) {
    StatusCode status = m_streamtool->clear();
    if ( status.isFailure() ) return status;
    m_streamSpecsLast = m_streamSpecs;
    m_reconfigure = true;
    return m_streamtool->addStreams(m_streamSpecs);
  }

  return StatusCode::SUCCESS;
}
Example #15
0
//=============================================================================
// Initialize
//=============================================================================
StatusCode HTBlob::initialize() 
{

    debug() << "Initializing HTBlob..." << endmsg;
    StatusCode sc = this->MinervaHistoTool::initialize();
    if( sc.isFailure() ) { return Error( "Failed to initialize!", sc ); }

    try {
        m_mathTool = tool<IMinervaMathTool>("MinervaMathTool");
    }
    catch( GaudiException& e ) {
        error() << "Could not obtain tool: MinervaMathTool!" << endmsg;
        return StatusCode::FAILURE;
    }

    return sc;
}
Example #16
0
StatusCode DataOnDemandSvc::i_setAlgHandler(const std::string &name, const Gaudi::Utils::TypeNameString &alg){
  Leaf leaf(alg.type(), alg.name());
  if (m_init)
  {
    StatusCode sc = configureHandler(leaf);
    if (sc.isFailure()) {
      if (m_allowInitFailure) {
        // re-store the content of the leaf object to try again to initialize
        // the algorithm later (on demand)
        leaf = Leaf(alg.type(), alg.name());
      }
      else
        return sc;
    }
  }
  m_algs[name] = leaf;
  return StatusCode::SUCCESS;
}
Example #17
0
// Use the job options service to set declared properties
StatusCode Service::setProperties() {
  const bool CREATEIF(true);
  SmartIF<IJobOptionsSvc> jos(serviceLocator()->service("JobOptionsSvc", CREATEIF));
  if( !jos.isValid() ) {
    throw GaudiException("Service [JobOptionsSvc] not found", name(), StatusCode::FAILURE);
  }
  // set first generic Properties
  StatusCode sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this );
  if( sc.isFailure() ) return sc;

  // set specific Properties
  if (isGaudiThreaded(name())) {
    if (jos->setMyProperties( name(), this ).isFailure()) {
      return StatusCode::FAILURE;
    }
  }
  return StatusCode::SUCCESS;
}
Example #18
0
/// Rewind the dataset
StatusCode EventSelector::rewind(Context& refCtxt) const  {
  EvtSelectorContext *ctxt  = dynamic_cast<EvtSelectorContext*>(&refCtxt);
  if ( ctxt )    {
    ctxt->set(0, -1, 0, 0);
    firstOfNextStream(true, *ctxt);
    long nskip = m_firstEvent;
    while( --nskip > 0 )    {
      StatusCode sc = next(*ctxt);
      if ( sc.isFailure() ) {
        MsgStream log(msgSvc(), name());
        log << MSG::ERROR << "rewind() failed to start with event number "
            << m_firstEvent << endmsg;
        return StatusCode::FAILURE;
      }
    }
    return StatusCode::SUCCESS;
  }
  return StatusCode::FAILURE;
}
Example #19
0
StatusCode TubeLayerPhiEtaCaloTool::initialize() {
  StatusCode sc = GaudiTool::initialize();
  if (sc.isFailure()) return sc;
  m_geoSvc = service("GeoSvc");
  if (!m_geoSvc) {
    error() << "Unable to locate Geometry Service. "
            << "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg;
    return StatusCode::FAILURE;
  }
  if (m_readoutName != "") {
    // Check if readouts exist
    info() << "Readout: " << m_readoutName << endmsg;
    if (m_geoSvc->lcdd()->readouts().find(m_readoutName) == m_geoSvc->lcdd()->readouts().end()) {
      error() << "Readout <<" << m_readoutName << ">> does not exist." << endmsg;
      return StatusCode::FAILURE;
    }
  }
  return sc;
}
Example #20
0
//=============================================================================
// Initialisation. Check parameters
//=============================================================================
StatusCode ParticleGunAlg::initialize() {
  StatusCode sc = GaudiAlgorithm::initialize( ) ; // Initialize base class
  if ( sc.isFailure() ) return sc ;
  debug() << "==> Initialise" << endmsg ;

  // Retrieve generation method tool
  if ( "" == m_particleGunToolName )
    return Error( "No ParticleGun Generation Tool is defined. This is mandatory" ) ;

  m_particleGunTool = tool< IParticleGunTool >( m_particleGunToolName , this ) ;

  // Retrieve smearing tool, if required
  if ( "" != m_vertexSmearingToolName )
	  m_vertexSmearTool = tool< IVertexSmearingTool >( m_vertexSmearingToolName , this ) ;

  // Retrieve

  return StatusCode::SUCCESS;
}
Example #21
0
StatusCode MergeHits::initialize() {
  info() << "MergeHits initialize" << endmsg;

  m_geoSvc = service("GeoSvc");
  if (!m_geoSvc) {
    error() << "Unable to locate Geometry Service. "
            << "Make sure you have GeoSvc and SimSvc in the right order in the "
               "configuration."
            << endmsg;
    return StatusCode::FAILURE;
  }


  StatusCode sc = GaudiAlgorithm::initialize();
  if (sc.isFailure()) 
    {
      return sc;
    }
  return sc;
}
Example #22
0
// ============================================================================
// retrieve (book on demand) matrix-items for ntuple (fixed)
// ============================================================================
Tuples::TupleObj::FMatrix*
Tuples::TupleObj::fMatrix
( const std::string&              name   ,
  const Tuples::TupleObj::MIndex& rows   ,
  const Tuples::TupleObj::MIndex& cols   )
{
  // existing array ?
  FMatrices::iterator found = m_matricesf.find( name ) ;
  if( m_matricesf.end() != found ) { return found->second ; }
  // create new array
  FMatrix* matrix = new FMatrix () ;
  m_matricesf[ name] =  matrix   ;
  const StatusCode sc =
    tuple() -> addItem( name , rows , cols , *matrix ) ;
  if( sc.isFailure() )
  { Error ( "matrix ('" + name + "'): item is not added",  sc ) ; }
  if ( !addItem ( name , "FMatrix" ) )
  { Error ( "matrix ('" + name + "'): item is not unique"     ) ; }
  return matrix ;
}
Example #23
0
StatusCode CreateCaloCells::initialize() {

  StatusCode sc = GaudiAlgorithm::initialize();
  if (sc.isFailure()) return sc;

  info() << "CreateCaloCells initialized" << endmsg;
  info() << "doCellCalibration : " << m_doCellCalibration << endmsg;
  info() << "addCellNoise      : " << m_addCellNoise << endmsg;
  info() << "filterCellNoise   : " << m_filterCellNoise << endmsg;

  //Initialization of various tools
  //Merge hits
  if (!m_mergeTool.retrieve()) {
    error()<<"Unable to retrieve the merge hits to cells tool!!!"<<endmsg;
    return StatusCode::FAILURE;
  }

  //Calibrate Geant4 energy to EM scale tool
  if (m_doCellCalibration) {
    if (!m_calibTool.retrieve()) {
      error()<<"Unable to retrieve the calo cells calibration tool!!!"<<endmsg;
      return StatusCode::FAILURE;
    }
  }

  //Cell noise tool
  if (m_addCellNoise) {
    if (!m_noiseTool.retrieve()) {
      error()<<"Unable to retrieve the calo cells noise tool!!!"<<endmsg;
      return StatusCode::FAILURE;
    }
    //Prepare a vector of all cells in calorimeter with their cellID
    StatusCode sc_prepareCells = prepareEmptyCells(m_edmHitsNoiseVector);
    if (sc_prepareCells.isFailure()) {
      error()<<"Unable to create empty cells!!! Check the input for readout"<<endmsg;
      return StatusCode::FAILURE;
    }
  }
    
  return sc;
}
Example #24
0
//=============================================================================
// Initialisation
//=============================================================================
StatusCode TbPacketRecycler::initialize() {

  // Initialise the base class.
  StatusCode sc = TbAlgorithm::initialize();
  if (sc.isFailure()) return sc;
  IToolSvc* toolsvc = nullptr;
  sc = service("ToolSvc", toolsvc);
  if (!sc.isSuccess()) {
    return Error("Unable to get a handle to the tool service", sc);
  }
  for (unsigned int i = 0; i < m_nPlanes; ++i) {
    TbRawStream* foo = nullptr;
    sc = toolSvc()->retrieveTool("TbRawStream/" + std::to_string(i), foo);
    if (!sc.isSuccess()) {
      return Error("Unable to retrieve TbRawStream for plane " + 
                   std::to_string(i), sc);
    }
    m_streams.push_back(foo);
  }
  return StatusCode::SUCCESS;
}
StatusCode FastGaussSmearDigi::initialize() {
  info() << "initialize" << endmsg;

  m_geoSvc = service("GeoSvc");

  StatusCode sc = GaudiAlgorithm::initialize();
  if (sc.isFailure()) return sc;

  auto lcdd = m_geoSvc->lcdd();
  auto readout = lcdd->readout(m_readoutName);
  m_decoder = readout.idSpec().decoder();
  auto segmentationXZ = dynamic_cast<DD4hep::DDSegmentation::CartesianGridXZ*>(readout.segmentation().segmentation());
  if (nullptr == segmentationXZ) {
    error() << "Could not retrieve segmentation!" << endmsg;
    return StatusCode::FAILURE;
  }
  m_segGridSizeX = segmentationXZ->gridSizeX();
  m_segGridSizeZ = segmentationXZ->gridSizeZ();
  m_volman = lcdd->volumeManager();
  return sc;
}
StatusCode TupleToolGeometry::initialize()
{
  const StatusCode sc = TupleToolBase::initialize();
  if ( sc.isFailure() ) return sc;

  m_dva = Gaudi::Utils::getIDVAlgorithm ( contextSvc(), this ) ;
  if (!m_dva) return Error("Couldn't get parent DVAlgorithm");

  m_dist = m_dva->distanceCalculator();
  if ( !m_dist )
  {
    return Error("Unable to retrieve the IDistanceCalculator tool");
  }

  m_pvReFitter = tool<IPVReFitter>( m_pvReFitterName, this );
  if ( !m_pvReFitter )
  {
    return Error( "Unable to retrieve IPVReFitter instance" );
  }

  return sc;
}
//=============================================================================
StatusCode IncidentListenerTestAlg::initialize() {
  StatusCode sc = GaudiAlgorithm::initialize();
  if (sc.isFailure()) return sc;

  // get a the incident service
  m_incSvc = svc<IIncidentSvc>("IncidentSvc",true);

  // instantiate listeners
  m_listener[0] =
    std::auto_ptr<IncidentListenerTest>(new IncidentListenerTest("Listener 0",serviceLocator()));
  m_listener[1] =
    std::auto_ptr<IncidentListenerTest>(new IncidentListenerTest("Listener 1",serviceLocator(),3));
  m_listener[2] =
    std::auto_ptr<IncidentListenerTest>(new IncidentListenerTest("Listener 2",serviceLocator()));
  m_listener[3] =
    std::auto_ptr<IncidentListenerTest>(new IncidentListenerTest("Listener 3",serviceLocator()));
  m_listener[4] =
    std::auto_ptr<IncidentListenerTest>(new IncidentListenerTest("EventBoundary",serviceLocator()));
  m_listener[5] =
    std::auto_ptr<IncidentListenerTest>(new IncidentListenerTest("Generic Listener",serviceLocator()));

  info() << "Registering incident listeners" << endmsg;

  const bool rethrow = false;
  const bool singleShot = true;
  const long priority = -10;
  m_incSvc->addListener(m_listener[3].get(),incident(),priority,rethrow,singleShot);

  m_incSvc->addListener(m_listener[0].get(),incident());
  m_incSvc->addListener(m_listener[1].get(),incident());
  m_incSvc->addListener(m_listener[2].get(),incident());

  m_incSvc->addListener(m_listener[4].get(),IncidentType::BeginEvent);
  m_incSvc->addListener(m_listener[4].get(),IncidentType::EndEvent);

  m_incSvc->addListener(m_listener[5].get());

  return StatusCode::SUCCESS;
}
Example #28
0
//--------------------------------------------------------------------
// Initialize
//--------------------------------------------------------------------
StatusCode ReadAlg::initialize() {
  StatusCode sc = Algorithm::initialize();
  if (sc.isFailure()) return sc;

  MsgStream log(msgSvc(), name());
  if (outputLevel() <= MSG::DEBUG)
    log << MSG::DEBUG << "Reading " << m_addressfile << endmsg;
  m_addresses.clear();
  std::ifstream input(m_addressfile.c_str());
  while (input.good()) {
    RootAddressArgs addr;
    input >> addr;
    if (input.eof()) break;
    m_addresses.push_back(addr);
  }
  if (outputLevel() <= MSG::DEBUG)
    log << MSG::DEBUG << "Read " << m_addresses.size() << " addresses" << endmsg;

  m_count = 0;

  return StatusCode::SUCCESS;
}
Example #29
0
//=============================================================================
// Initialisation
//=============================================================================
StatusCode TbClusterFinder::initialize() {

  // Initialise the base class.
  StatusCode sc = GaudiTool::initialize();
  if (sc.isFailure()) return sc;

  // Get the number of telescope planes from the geometry service.
  ITbGeometrySvc* geomSvc = svc<ITbGeometrySvc>("TbGeometrySvc", true);
  if (!geomSvc) {
    error() << "Cannot access geometry service" << endmsg;
    return StatusCode::FAILURE;
  }
  const unsigned int nPlanes = geomSvc->modules().size();
  m_first.resize(nPlanes);
  m_last.resize(nPlanes);
  m_end.resize(nPlanes);
  m_nClusters.resize(nPlanes);
  m_empty.resize(nPlanes);
  m_prev_ts.resize(nPlanes);
  m_prev.resize(nPlanes);
  return StatusCode::SUCCESS;
}
Example #30
0
// ============================================================================
// standard finalization method
// ============================================================================
StatusCode    GaudiTool::finalize   ()
{
  if ( msgLevel(MSG::DEBUG) )
    debug() << " ==> Finalize the base class GaudiTool " << endmsg;

  // clear "explicit services"
    m_evtSvc    = 0 ;
    m_detSvc    = 0 ;
    m_chronoSvc = 0 ;
    m_incSvc    = 0 ;
    m_histoSvc  = 0 ;

  // finalize the base class
  const StatusCode sc = GaudiCommon<AlgTool>::finalize() ;
  if ( sc.isFailure() ) { return sc; }

  // Decrement the counter
  GaudiToolLocal::s_FinalizeCounter.decrement( m_local ) ;

  // return
  return sc;
}