ATLAS Offline Software
Loading...
Searching...
No Matches
EMClusterTool Class Referencefinal

This tool makes the EM CaloCluster used by egamma objects. More...

#include <EMClusterTool.h>

Inheritance diagram for EMClusterTool:
Collaboration diagram for EMClusterTool:

Public Member Functions

 EMClusterTool (const std::string &type, const std::string &name, const IInterface *parent)
 constructor
virtual ~EMClusterTool ()=default
 destructor
virtual StatusCode initialize () override final
 initialize method
virtual StatusCode contExecute (const EventContext &ctx, xAOD::ElectronContainer *electronContainer, xAOD::PhotonContainer *photonContainer) const override final
 execute on container
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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface methods.

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

void setNewCluster (const EventContext &ctx, xAOD::Egamma *eg, xAOD::CaloClusterContainer *outputClusterContainer) const
 Set new cluster to the egamma object, decorate the new cluster with a link to the old one.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::WriteHandleKey< xAOD::CaloClusterContainerm_outputClusterContainerKey
 Key of the output cluster container.
SG::WriteHandleKey< CaloClusterCellLinkContainerm_outputClusterContainerCellLinkKey
 Key of the output cluster container cell links: name taken from containter name; only dummy configurable.
ServiceHandle< IegammaMVASvcm_MVACalibSvc
 Handle to the MVA calibration service.
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

This tool makes the EM CaloCluster used by egamma objects.

and applies the right cluster corrections depending on classification as electron, unconverted photon or converted photon

Author
Thomas Koffas
F. Derue
B. Lenzi
C. Anastopoulos

Definition at line 37 of file EMClusterTool.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

◆ EMClusterTool()

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

constructor

Definition at line 19 of file EMClusterTool.cxx.

22 : AthAlgTool(type, name, parent)
23{
24 declareInterface<IEMClusterTool>(this);
25}
AthAlgTool()
Default constructor:

◆ ~EMClusterTool()

virtual EMClusterTool::~EMClusterTool ( )
virtualdefault

destructor

Member Function Documentation

◆ contExecute()

StatusCode EMClusterTool::contExecute ( const EventContext & ctx,
xAOD::ElectronContainer * electronContainer,
xAOD::PhotonContainer * photonContainer ) const
finaloverridevirtual

execute on container

Implements IEMClusterTool.

Definition at line 48 of file EMClusterTool.cxx.

51{
52
53 // Create output cluster container and register in StoreGate
54 SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer(
56
58
59 SG::WriteHandle<CaloClusterCellLinkContainer> outputClusterContainerCellLink(
61
62 ATH_CHECK(outputClusterContainerCellLink.record(
63 std::make_unique<CaloClusterCellLinkContainer>()));
64
65 // Loop over electrons and create new clusters
67 for (auto electron : *electronContainer) {
68 setNewCluster(ctx, electron, outputClusterContainer.ptr());
69 }
70 }
71
72 if (photonContainer) {
73 // Loop over photons and create new clusters
74 for (auto photon : *photonContainer) {
75 setNewCluster(ctx, photon, outputClusterContainer.ptr());
76 }
77 }
78
80 ctx,
81 outputClusterContainer,
82 outputClusterContainerCellLink);
83
84 return StatusCode::SUCCESS;
85}
#define ATH_CHECK
Evaluate an expression and check for errors.
xAOD::ElectronContainer * electronContainer
xAOD::PhotonContainer * photonContainer
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
static StatusCode finalizeClusters(SG::WriteHandle< CaloClusterCellLinkContainer > &h, xAOD::CaloClusterContainer *pClusterColl)
Finalize clusters (move CaloClusterCellLink to a separate container).
SG::WriteHandleKey< CaloClusterCellLinkContainer > m_outputClusterContainerCellLinkKey
Key of the output cluster container cell links: name taken from containter name; only dummy configura...
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outputClusterContainerKey
Key of the output cluster container.
void setNewCluster(const EventContext &ctx, xAOD::Egamma *eg, xAOD::CaloClusterContainer *outputClusterContainer) const
Set new cluster to the egamma object, decorate the new cluster with a link to the old one.

◆ 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)

◆ 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.

◆ 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

◆ initialize()

StatusCode EMClusterTool::initialize ( )
finaloverridevirtual

initialize method

Implements IEMClusterTool.

Definition at line 28 of file EMClusterTool.cxx.

29{
30
31 ATH_MSG_DEBUG("Initializing " << name() << "...");
32
34
36 m_outputClusterContainerKey.key() + "_links";
38
39 // Get the cluster correction tool
40 ATH_CHECK(m_MVACalibSvc.retrieve());
41
42 ATH_MSG_DEBUG("Initialization successful");
43
44 return StatusCode::SUCCESS;
45}
#define ATH_MSG_DEBUG(x)
ServiceHandle< IegammaMVASvc > m_MVACalibSvc
Handle to the MVA calibration service.

◆ 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.

◆ interfaceID()

const InterfaceID & IEMClusterTool::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 41 of file IEMClusterTool.h.

42{
43 return IID_IEMClusterTool;
44}
static const InterfaceID IID_IEMClusterTool("IEMClusterTool", 1, 0)

◆ 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 }

◆ setNewCluster()

void EMClusterTool::setNewCluster ( const EventContext & ctx,
xAOD::Egamma * eg,
xAOD::CaloClusterContainer * outputClusterContainer ) const
private

Set new cluster to the egamma object, decorate the new cluster with a link to the old one.

Definition at line 88 of file EMClusterTool.cxx.

92{
93 if (!eg) {
94 return;
95 }
96 if (!eg->caloCluster()) {
97 ATH_MSG_DEBUG("egamma object does not have a cluster associated");
98 return;
99 }
100 using ClusterLink_t = ElementLink<xAOD::CaloClusterContainer>;
101 //create new cluster
102xAOD::CaloCluster* cluster = outputClusterContainer->push_back(std::make_unique<xAOD::CaloCluster>());
103 //copy over
104 (*cluster)=*(eg->caloCluster());
105 //and do final calibration
106 if (m_MVACalibSvc->execute(*cluster, *eg).isFailure()) {
107 ATH_MSG_ERROR("Problem executing MVA cluster tool");
108 }
109 // Set the link to the new cluster
110 ClusterLink_t clusterLink(cluster, *outputClusterContainer, ctx);
111 const std::vector<ClusterLink_t> clusterLinks{ clusterLink };
112 eg->setCaloClusterLinks(clusterLinks);
113}
#define ATH_MSG_ERROR(x)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementLink< xAOD::CaloClusterContainer > ClusterLink_t
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ 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_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_MVACalibSvc

ServiceHandle<IegammaMVASvc> EMClusterTool::m_MVACalibSvc
private
Initial value:
{ this,
"MVACalibSvc",
"egammaMVASvc",
"calibration service" }

Handle to the MVA calibration service.

Definition at line 86 of file EMClusterTool.h.

86 { this,
87 "MVACalibSvc",
88 "egammaMVASvc",
89 "calibration service" };

◆ m_outputClusterContainerCellLinkKey

SG::WriteHandleKey<CaloClusterCellLinkContainer> EMClusterTool::m_outputClusterContainerCellLinkKey
private
Initial value:
{
this,
"DoNotSet_OutputClusterContainerLinks",
"",
"Key of the output cluster container cell links; Do not set! Name taken "
"from associated container"
}

Key of the output cluster container cell links: name taken from containter name; only dummy configurable.

Definition at line 77 of file EMClusterTool.h.

77 {
78 this,
79 "DoNotSet_OutputClusterContainerLinks",
80 "",
81 "Key of the output cluster container cell links; Do not set! Name taken "
82 "from associated container"
83 };

◆ m_outputClusterContainerKey

SG::WriteHandleKey<xAOD::CaloClusterContainer> EMClusterTool::m_outputClusterContainerKey
private
Initial value:
{
this,
"OutputClusterContainerName",
"",
"Name of the output cluster container"
}

Key of the output cluster container.

Definition at line 67 of file EMClusterTool.h.

67 {
68 this,
69 "OutputClusterContainerName",
70 "",
71 "Name of the output cluster container"
72 };

◆ 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: