ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCalibClusterDecoratorTool Class Reference

Calibration hit truth information decoration of xAOD::CaloClusters. More...

#include <CaloCalibClusterDecoratorTool.h>

Inheritance diagram for CaloCalibClusterDecoratorTool:
Collaboration diagram for CaloCalibClusterDecoratorTool:

Public Member Functions

 CaloCalibClusterDecoratorTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor.
virtual StatusCode execute (const EventContext &ctx, xAOD::CaloClusterContainer *theClusColl) const override final
 Execute on an entire collection of clusters.
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual ~CaloCalibClusterDecoratorTool ()
 Destructor.
virtual StatusCode execute (xAOD::CaloClusterContainer *collection) final
 Execute on an entire collection of clusters.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
 DeclareInterfaceID (CaloClusterCollectionProcessor, 1, 0)

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode calculateTruthEnergies (const xAOD::CaloCluster &theCaloCluster, unsigned int numTruthParticles, const std::map< Identifier, std::vector< const CaloCalibrationHit * > > &identifierToCaloHitMap, std::vector< std::pair< unsigned int, double > > &truthIDTrueCalHitEnergy) const
 Calculate truth energies for a given cluster.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

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::CaloClusterContainerm_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
 Write handle key to decorate CaloCluster with threeN leading truth particle barcode and energy.
Gaudi::Property< unsigned int > m_numTruthParticles
 Allow user to set the number of truth particles per clusterCaloCluster or PFO, in descending pt order, for which to store calibration hit enery.
Gaudi::Property< bool > m_useCellWeights
 Toggle whether to use cell weights or not to calculate calibration hit contribution.
Gaudi::Property< bool > m_storeFullTruthEnergy
 Toggle whether to store full truth energy (include invisible + escaped)
ToolHandle< ICaloCalibClusterTruthAttributerToolm_truthAttributerTool
 External tool that handles calculation logic of truth energies.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Calibration hit truth information decoration of xAOD::CaloClusters.

This algorithm decorates xAOD::CaloCluster with calibration hit truth information. It relies on upstream creation of several maps in CaloCalibClusterTruthMapMakerAlgorithm, stored in Storegate, to provide fast access to required information. The actual calculations are taken care of by an ICaloCalibClusterTruthAttributerTool. The user may toggle how many truth particles to consider per xAOD::CaloCluster, ordered in leading calibration hit truth pt, via a Gaudi Property "NumTruthParticles".

Definition at line 40 of file CaloCalibClusterDecoratorTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CaloCalibClusterDecoratorTool()

CaloCalibClusterDecoratorTool::CaloCalibClusterDecoratorTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor.

Definition at line 10 of file CaloCalibClusterDecoratorTool.cxx.

14 : AthAlgTool(type, name, parent)
15{}
AthAlgTool()
Default constructor:

◆ ~CaloCalibClusterDecoratorTool()

virtual CaloCalibClusterDecoratorTool::~CaloCalibClusterDecoratorTool ( )
inlinevirtual

Destructor.

Definition at line 65 of file CaloCalibClusterDecoratorTool.h.

65{};

Member Function Documentation

◆ calculateTruthEnergies()

StatusCode CaloCalibClusterDecoratorTool::calculateTruthEnergies ( const xAOD::CaloCluster & theCaloCluster,
unsigned int numTruthParticles,
const std::map< Identifier, std::vector< const CaloCalibrationHit * > > & identifierToCaloHitMap,
std::vector< std::pair< unsigned int, double > > & truthIDTrueCalHitEnergy ) const
private

Calculate truth energies for a given cluster.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ DeclareInterfaceID()

CaloClusterCollectionProcessor::DeclareInterfaceID ( CaloClusterCollectionProcessor ,
1 ,
0  )
inherited

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute() [1/2]

StatusCode CaloCalibClusterDecoratorTool::execute ( const EventContext & ctx,
xAOD::CaloClusterContainer * collection ) const
finaloverridevirtual

Execute on an entire collection of clusters.

Parameters
collectionThe container of clusters. param ctx The event context.

Implements CaloClusterCollectionProcessor.

Definition at line 27 of file CaloCalibClusterDecoratorTool.cxx.

30{
31 SG::ReadHandle<std::map<Identifier,std::vector<const CaloCalibrationHit*> > > mapIdentifierToCalibHitsReadHandle(
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
39 SG::WriteDecorHandle<xAOD::CaloClusterContainer,
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
ToolHandle< ICaloCalibClusterTruthAttributerTool > m_truthAttributerTool
External tool that handles calculation logic of truth energies.
Gaudi::Property< unsigned int > m_numTruthParticles
Allow user to set the number of truth particles per clusterCaloCluster or PFO, in descending pt order...
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.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.

◆ execute() [2/2]

virtual StatusCode CaloClusterCollectionProcessor::execute ( xAOD::CaloClusterContainer * collection)
inlinefinalvirtual

Execute on an entire collection of clusters.

Parameters
collectionThe container of clusters. (deprecated)

Reimplemented from CaloClusterCollectionProcessor.

Definition at line 50 of file CaloClusterCollectionProcessor.h.

51 {
52 return execute (Gaudi::Hive::currentContext(), collection);
53 }
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *theClusColl) const override final
Execute on an entire collection of clusters.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode CaloCalibClusterDecoratorTool::finalize ( )
overridevirtual

Definition at line 70 of file CaloCalibClusterDecoratorTool.cxx.

70 {
71 return StatusCode::SUCCESS;
72}

◆ initialize()

StatusCode CaloCalibClusterDecoratorTool::initialize ( )
overridevirtual

Definition at line 17 of file CaloCalibClusterDecoratorTool.cxx.

17 {
19 ATH_MSG_DEBUG("Recording truth map with key: " << m_mapIdentifierToCalibHitsReadHandleKey.key());
23
24 return StatusCode::SUCCESS;
25}
#define ATH_MSG_INFO(x)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles

SG::WriteDecorHandleKey<xAOD::CaloClusterContainer> CaloCalibClusterDecoratorTool::m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
private
Initial value:
{
this,
"CaloClusterWriteDecorHandleKey_NLeadingTruthParticles",
"CaloTopoClustersNew.calclus_NLeadingTruthParticleBarcodeEnergyPairs"}

Write handle key to decorate CaloCluster with threeN leading truth particle barcode and energy.

Definition at line 88 of file CaloCalibClusterDecoratorTool.h.

88 {
89 this,
90 "CaloClusterWriteDecorHandleKey_NLeadingTruthParticles",
91 "CaloTopoClustersNew.calclus_NLeadingTruthParticleBarcodeEnergyPairs"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_mapIdentifierToCalibHitsReadHandleKey

SG::ReadHandleKey<std::map<Identifier,std::vector<const CaloCalibrationHit*> > > CaloCalibClusterDecoratorTool::m_mapIdentifierToCalibHitsReadHandleKey
private
Initial value:
{this,"IdentifierToCalibHitsMapName","IdentifierToCalibHitsMap",
"ReadHandleKey for the map between Identifiers and sets of calibration hits"}

ReadHandleKey for the map between Identifiers and sets of calibration hits.

Definition at line 81 of file CaloCalibClusterDecoratorTool.h.

81 {this,"IdentifierToCalibHitsMapName","IdentifierToCalibHitsMap",
82 "ReadHandleKey for the map between Identifiers and sets of calibration hits"};

◆ m_numTruthParticles

Gaudi::Property<unsigned int> CaloCalibClusterDecoratorTool::m_numTruthParticles
private
Initial value:
{
this,"NumTruthParticles",100,
"Set number of truth particles per CaloCluster/PFO for which we store calibration hit energy"}

Allow user to set the number of truth particles per clusterCaloCluster or PFO, in descending pt order, for which to store calibration hit enery.

Definition at line 97 of file CaloCalibClusterDecoratorTool.h.

97 {
98 this,"NumTruthParticles",100,
99 "Set number of truth particles per CaloCluster/PFO for which we store calibration hit energy"};

◆ m_storeFullTruthEnergy

Gaudi::Property<bool> CaloCalibClusterDecoratorTool::m_storeFullTruthEnergy
private
Initial value:
{
this,"StoreFullTruthEnergy",false,
"If true, include escaped + invisible energy in truth energy calculation"}

Toggle whether to store full truth energy (include invisible + escaped)

Definition at line 111 of file CaloCalibClusterDecoratorTool.h.

111 {
112 this,"StoreFullTruthEnergy",false,
113 "If true, include escaped + invisible energy in truth energy calculation"};

◆ m_truthAttributerTool

ToolHandle<ICaloCalibClusterTruthAttributerTool> CaloCalibClusterDecoratorTool::m_truthAttributerTool
private
Initial value:
{
this,"TruthAttributerTool","",
"ToolHandle to a tool to create the calibration hit truth information that we need for the decoration"}

External tool that handles calculation logic of truth energies.

Definition at line 119 of file CaloCalibClusterDecoratorTool.h.

119 {
120 this,"TruthAttributerTool","",
121 "ToolHandle to a tool to create the calibration hit truth information that we need for the decoration"};

◆ m_useCellWeights

Gaudi::Property<bool> CaloCalibClusterDecoratorTool::m_useCellWeights
private
Initial value:
{
this,"useCellWeights",true,
"Toggle whether to use cell weights or not to calculate calibration hit contribution"}

Toggle whether to use cell weights or not to calculate calibration hit contribution.

Definition at line 104 of file CaloCalibClusterDecoratorTool.h.

104 {
105 this,"useCellWeights",true,
106 "Toggle whether to use cell weights or not to calculate calibration hit contribution"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: