ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCalibClusterDecoratorTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6//Core classes
8#include <typeinfo>
9
11 const std::string& type,
12 const std::string& name,
13 const IInterface* parent)
14 : AthAlgTool(type, name, parent)
15{}
16
26
28 const EventContext& ctx,
29 xAOD::CaloClusterContainer* theClusColl) const
30{
33
34 if (!mapIdentifierToCalibHitsReadHandle.isValid()) {
35 ATH_MSG_WARNING("Could not retrieve map between Identifier and calibraiton hits from Storegae");
36 return StatusCode::FAILURE;
37 }
38
40 std::vector<std::pair<unsigned int, double> > >
41 caloClusterWriteDecorHandleNLeadingTruthParticles(
43
44 for (const xAOD::CaloCluster* thisCaloCluster : *theClusColl) {
45
46 std::vector<std::pair<unsigned int, double> > newTruthIDTruthPairs;
48 m_truthAttributerTool->calculateTruthEnergies(
49 *thisCaloCluster,
51 *mapIdentifierToCalibHitsReadHandle,
52 newTruthIDTruthPairs
53 )
54 );
55
56 for (const auto& thisPair : newTruthIDTruthPairs)
58 "Cluster Final loop: Particle with truthID " << thisPair.first
59 << " has truth energy of " << thisPair.second
60 << " for cluster with e, eta " << thisCaloCluster->e()
61 << " and " << thisCaloCluster->eta()
62 );
63
64 caloClusterWriteDecorHandleNLeadingTruthParticles(*thisCaloCluster) = std::move(newTruthIDTruthPairs);
65 }
66
67 return StatusCode::SUCCESS;
68}
69
71 return StatusCode::SUCCESS;
72}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Handle class for adding a decoration to an object.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
ToolHandle< ICaloCalibClusterTruthAttributerTool > m_truthAttributerTool
External tool that handles calculation logic of truth energies.
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *theClusColl) const override final
Execute on an entire collection of clusters.
Gaudi::Property< unsigned int > m_numTruthParticles
Allow user to set the number of truth particles per clusterCaloCluster or PFO, in descending pt order...
CaloCalibClusterDecoratorTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
SG::ReadHandleKey< std::map< Identifier, std::vector< const CaloCalibrationHit * > > > m_mapIdentifierToCalibHitsReadHandleKey
ReadHandleKey for the map between Identifiers and sets of calibration hits.
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
Write handle key to decorate CaloCluster with threeN leading truth particle barcode and energy.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Handle class for adding a decoration to an object.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.