ATLAS Offline Software
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 
20 TrackCaloClusterAlg::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");
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 }
FlowElementContainer.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TrackCaloClusterAlg::initialize
virtual StatusCode initialize() override
Definition: TrackCaloClusterAlg.cxx:25
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
TrackCaloClusterAuxContainer.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrackCaloClusterAlg::m_tccInfoHandle
SG::ReadHandleKey< TrackCaloClusterInfo > m_tccInfoHandle
TrackCaloClusterInfo used by this alg.
Definition: TrackCaloClusterAlg.h:42
TrackParametersIdHelper.h
FlowElementAuxContainer.h
TrackCaloClusterAlg::m_copiedTCCHandle
SG::ReadHandleKey< xAOD::FlowElementContainer > m_copiedTCCHandle
Definition: TrackCaloClusterAlg.h:47
TrackCaloClusterAlg::m_tccTools
ToolHandleArray< ITrackCaloClusterTool > m_tccTools
The tools implementting the creation of TCC.
Definition: TrackCaloClusterAlg.h:39
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::FlowElement
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition: FlowElement.h:16
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TrackCaloClusterAlg::TrackCaloClusterAlg
TrackCaloClusterAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackCaloClusterAlg.cxx:20
AthAlgorithm
Definition: AthAlgorithm.h:47
TrackCaloClusterAlg::m_outputTCCHandle
SG::WriteHandleKey< xAOD::FlowElementContainer > m_outputTCCHandle
Cluster Collection container.
Definition: TrackCaloClusterAlg.h:45
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ReadDecorHandle.h
Handle class for reading a decoration on an object.
TrackCaloClusterAlg.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25
TrackCaloClusterAlg::execute
virtual StatusCode execute() override
Definition: TrackCaloClusterAlg.cxx:39