ATLAS Offline Software
CaloCalibClusterDecoratorAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 //Core classes
9 
11 
13 
15 
16  ATH_CHECK(m_truthAttributerTool.retrieve());
17 
18  return StatusCode::SUCCESS;
19 }
20 
22 
24  if(!mapIdentifierToCalibHitsReadHandle.isValid()){
25  ATH_MSG_WARNING("Could not retrieve map between Identifier and calibraiton hits from Storegae");
26  return StatusCode::FAILURE;
27  }
28 
30  StatusCode sc;
31 
32  for (const auto *thisCaloCluster : *caloClusterWriteDecorHandleNLeadingTruthParticles){
33 
34  std::vector<std::pair<unsigned int, double > > newBarCodeTruthPairs;
35  sc = m_truthAttributerTool->calculateTruthEnergies(*thisCaloCluster, m_numTruthParticles, *mapIdentifierToCalibHitsReadHandle, newBarCodeTruthPairs);
36  if (sc == StatusCode::FAILURE) return sc;
37 
38  for (const auto& thisPair : newBarCodeTruthPairs) ATH_MSG_DEBUG("Cluster Final loop: Particle with barcode " << thisPair.first << " has truth energy of " << thisPair.second << " for cluster with e, eta " << thisCaloCluster->e() << " and " << thisCaloCluster->eta());
39  caloClusterWriteDecorHandleNLeadingTruthParticles(*thisCaloCluster) = newBarCodeTruthPairs;
40  }
41 
42  return StatusCode::SUCCESS;
43 }
44 
46  return StatusCode::SUCCESS;
47 }
CaloCalibClusterDecoratorAlgorithm::finalize
virtual StatusCode finalize() override
Definition: CaloCalibClusterDecoratorAlgorithm.cxx:45
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CaloCalibClusterDecoratorAlgorithm::m_truthAttributerTool
ToolHandle< ICaloCalibClusterTruthAttributerTool > m_truthAttributerTool
ToolHandle to a tool to create the calibration hit truth information that we need for the decoration.
Definition: CaloCalibClusterDecoratorAlgorithm.h:51
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CaloCalibClusterDecoratorAlgorithm::initialize
virtual StatusCode initialize() override
Definition: CaloCalibClusterDecoratorAlgorithm.cxx:10
CaloCalibClusterDecoratorAlgorithm::m_mapIdentifierToCalibHitsReadHandleKey
SG::ReadHandleKey< std::map< Identifier, std::vector< const CaloCalibrationHit * > > > m_mapIdentifierToCalibHitsReadHandleKey
ReadHandleKey for the map between Identifiers and sets of calibration hits.
Definition: CaloCalibClusterDecoratorAlgorithm.h:45
CaloCalibClusterDecoratorAlgorithm::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: CaloCalibClusterDecoratorAlgorithm.cxx:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCalibClusterDecoratorAlgorithm::m_numTruthParticles
Gaudi::Property< unsigned int > m_numTruthParticles
Allow user to set the number of truth particles per clusterCaloCluster or PFO, in descending pt order...
Definition: CaloCalibClusterDecoratorAlgorithm.h:54
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
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloCalibClusterDecoratorAlgorithm.h
CaloCalibClusterDecoratorAlgorithm::m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
Write handle key to decorate CaloCluster with threeN leading truth particle barcode and energy.
Definition: CaloCalibClusterDecoratorAlgorithm.h:48