ATLAS Offline Software
Loading...
Searching...
No Matches
TrackCaloClusterAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5// TrackCaloClusterAlgs includes
7
10
14
17
18
19
20TrackCaloClusterAlg::TrackCaloClusterAlg( const std::string& name, ISvcLocator* pSvcLocator ) :
21 AthAlgorithm( name, pSvcLocator ) { }
22
23
24// *****************************************************
26 ATH_MSG_INFO ("Initializing " << name() << "...");
27 ATH_CHECK(m_tccTools.retrieve());
28 ATH_MSG_VERBOSE("TCCAlg::init got tcc tools");
29 ATH_CHECK(m_tccInfoHandle.initialize());
30 ATH_MSG_VERBOSE("TCCAlg::init got tcc info handle");
31 ATH_CHECK(m_outputTCCHandle.initialize());
32 ATH_MSG_VERBOSE("TCCAlg::init got output tcc handle");
33 ATH_CHECK(m_copiedTCCHandle.initialize(! m_copiedTCCHandle.empty()) );
34 ATH_MSG_VERBOSE("TCCAlg::init got copied tcc handle");
35 return StatusCode::SUCCESS;
36}
37
38// *****************************************************
40 ATH_MSG_DEBUG ("Executing " << name() << "...");
41
43
44 // Create containers
46 ATH_CHECK( tccContainer.record (std::make_unique<xAOD::FlowElementContainer>(),
47 std::make_unique<xAOD::FlowElementAuxContainer>()) );
48 ATH_MSG_DEBUG( "Recorded TrackCaloClusterContainer with key: " << m_outputTCCHandle.key() );
49
50 // Optionnaly recopy an existing container.
51 // This option is mainly to enable functionalities of the original alg.
52 if(! m_copiedTCCHandle.empty() ){
54 for(const xAOD::FlowElement* tobecopied: *tccToCopy){
56 tccContainer->push_back(tcc);
57 *tcc = *tobecopied;
58 }
59 }
60
61
62 // Loop over each TCC tool ...
63 for(const ToolHandle<ITrackCaloClusterTool> & tool : m_tccTools){
64 // .. and have it fill tccContainer
65 ATH_MSG_DEBUG("executing "<<tool.name() );
66 StatusCode sc=tool->fillTCC(tccContainer.ptr(), *tccInfo);
67 if(sc.isFailure()){
68 ATH_MSG_ERROR(" TCC tool "<< tool->name() << " failed. "); return sc;
69 }
70 ATH_MSG_DEBUG("executed "<<tool.name() << " num object= "<< tccContainer->size() );
71 }
72
73 return StatusCode::SUCCESS;
74}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
static Double_t sc
Handle class for reading a decoration on an object.
Handle class for adding a decoration to an object.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outputTCCHandle
Cluster Collection container.
ToolHandleArray< ITrackCaloClusterTool > m_tccTools
The tools implementting the creation of TCC.
virtual StatusCode initialize() override
SG::ReadHandleKey< TrackCaloClusterInfo > m_tccInfoHandle
TrackCaloClusterInfo used by this alg.
TrackCaloClusterAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute() override
SG::ReadHandleKey< xAOD::FlowElementContainer > m_copiedTCCHandle
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16