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

egamma tool to add selector outputs to the egamma objects Note: Subject to change after the PAT selectors evolve More...

#include <EMPIDBuilder.h>

Inheritance diagram for EMPIDBuilder:
Collaboration diagram for EMPIDBuilder:

Public Member Functions

 EMPIDBuilder (const std::string &type, const std::string &name, const IInterface *parent)
 Default constructor.
virtual ~EMPIDBuilder ()=default
 Destructor.
virtual StatusCode initialize () override final
 initialize method
virtual StatusCode execute (const EventContext &ctx, xAOD::Egamma *) const override final
 standard execute method
virtual StatusCode finalize () override
 finalize method
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 ()
 AthAlgTool 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

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandleArray< IAsgElectronIsEMSelectorm_electronIsEMselectors
 Handle to the selectors.
Gaudi::Property< std::vector< std::string > > m_electronIsEMselectorResultNames
ToolHandleArray< IAsgElectronLikelihoodToolm_electronLHselectors
Gaudi::Property< std::vector< std::string > > m_electronLHselectorResultNames
ToolHandleArray< IAsgSelectionToolm_genericIsEMselectors
Gaudi::Property< std::vector< std::string > > m_genericIsEMselectorResultNames
ToolHandleArray< IAsgPhotonIsEMSelectorm_photonIsEMselectors
Gaudi::Property< std::vector< std::string > > m_photonIsEMselectorResultNames
ToolHandle< ILumiBlockMuToolm_lumiBlockMuTool
Gaudi::Property< std::string > m_LHValueName
Gaudi::Property< bool > m_UselumiBlockMuTool
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

egamma tool to add selector outputs to the egamma objects Note: Subject to change after the PAT selectors evolve

Author
Jovan Mitrevski Jovan.nosp@m..Mit.nosp@m.revsk.nosp@m.i@ce.nosp@m.rn.ch

Definition at line 28 of file EMPIDBuilder.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

◆ EMPIDBuilder()

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

Default constructor.

Definition at line 14 of file EMPIDBuilder.cxx.

17 : egammaBaseTool(type, name, parent)
18{
19 // declare interface
20 declareInterface<IegammaBaseTool>(this);
21}
egammaBaseTool(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.

◆ ~EMPIDBuilder()

virtual EMPIDBuilder::~EMPIDBuilder ( )
virtualdefault

Destructor.

Member Function Documentation

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

◆ execute()

StatusCode EMPIDBuilder::execute ( const EventContext & ctx,
xAOD::Egamma * eg ) const
finaloverridevirtual

standard execute method

Implements IegammaBaseTool.

Definition at line 75 of file EMPIDBuilder.cxx.

76{
77
78 ATH_MSG_DEBUG("Executing EMPIDBuilder::execute");
79
80 // Protection against bad pointers
81 if (eg == nullptr) {
82 ATH_MSG_WARNING("NULL egamma object given to execute function");
83 return StatusCode::SUCCESS;
84 }
85
86 size_t size = m_electronIsEMselectors.size();
87
88 for (size_t i = 0; i < size; ++i) {
89 asg::AcceptData accept = m_electronIsEMselectors[i]->accept(ctx, eg);
90 // save the bool result
91 eg->setPassSelection(static_cast<bool>(accept),
93 // save the isem
94 unsigned int isEM = (~0);
95 if (m_electronIsEMselectors[i]->execute(ctx, eg, isEM).isFailure()) {
96 ATH_MSG_ERROR("problem to get isEM for "
98 return StatusCode::FAILURE;
99 }
100 eg->setSelectionisEM(isEM, "isEM" + m_electronIsEMselectorResultNames[i]);
101 }
102
103 size_t sizePh = m_photonIsEMselectors.size();
104
105 for (size_t i = 0; i < sizePh; ++i) {
106 asg::AcceptData accept = m_photonIsEMselectors[i]->accept(ctx, eg);
107 // save the bool result
108 eg->setPassSelection(static_cast<bool>(accept),
110 // save the isem
111 unsigned int isEM = ~0;
112 if (m_photonIsEMselectors[i]->execute(ctx, eg, isEM).isFailure()) {
113 ATH_MSG_ERROR("problem to get isEM for "
115 return StatusCode::FAILURE;
116 }
117 eg->setSelectionisEM(isEM, "isEM" + m_photonIsEMselectorResultNames[i]);
118 }
119
120 size_t sizeLH = m_electronLHselectors.size();
121
122 // negative mu means the default behaviour --> retrieve the one in xAOD
123 double mu = -99.;
124 double avg_mu = -99.;
125 if (m_UselumiBlockMuTool) { //
126 mu = m_lumiBlockMuTool->actualInteractionsPerCrossing(ctx);
127 avg_mu = m_lumiBlockMuTool->averageInteractionsPerCrossing(ctx);
128 ATH_MSG_DEBUG("REGTEST: Retrieved Mu Value : " << mu);
129 ATH_MSG_DEBUG("REGTEST: Average Mu Value : " << avg_mu);
130 }
131
132 for (size_t i = 0; i < sizeLH; ++i) {
133 asg::AcceptData accept = m_electronLHselectors[i]->accept(ctx, eg, avg_mu);
134 // save the bool result
135 eg->setPassSelection(static_cast<bool>(accept),
137 // save the isem
138 eg->setSelectionisEM(
139 static_cast<unsigned int>(accept.getCutResultInverted()),
141
142 // save the LHValue only once
143 if (i == 0) {
144 accLH(*eg) = static_cast<float>(
145 m_electronLHselectors[i]->calculate(ctx, eg, avg_mu));
146 }
147 }
148
149 size_t sizeGen = m_genericIsEMselectors.size();
150 for (size_t i = 0; i < sizeGen; ++i) {
151 asg::AcceptData accept = m_genericIsEMselectors[i]->accept(eg);
152 // save the bool result
153 eg->setPassSelection(static_cast<bool>(accept),
155 // save the isem
156 eg->setSelectionisEM(
157 static_cast<unsigned int>(accept.getCutResultInverted()),
159 }
160
161 return StatusCode::SUCCESS;
162}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
ToolHandle< ILumiBlockMuTool > m_lumiBlockMuTool
ToolHandleArray< IAsgPhotonIsEMSelector > m_photonIsEMselectors
Gaudi::Property< std::vector< std::string > > m_electronIsEMselectorResultNames
ToolHandleArray< IAsgElectronIsEMSelector > m_electronIsEMselectors
Handle to the selectors.
Gaudi::Property< std::vector< std::string > > m_genericIsEMselectorResultNames
Gaudi::Property< std::vector< std::string > > m_photonIsEMselectorResultNames
Gaudi::Property< bool > m_UselumiBlockMuTool
Gaudi::Property< std::vector< std::string > > m_electronLHselectorResultNames
ToolHandleArray< IAsgElectronLikelihoodTool > m_electronLHselectors
virtual StatusCode execute(const EventContext &ctx, xAOD::Egamma *) const override final
standard execute method
ToolHandleArray< IAsgSelectionTool > m_genericIsEMselectors
StatusCode accept(const xAOD::Muon *mu)

◆ 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 egammaBaseTool::finalize ( )
overridevirtualinherited

finalize method

Implements IegammaBaseTool.

Definition at line 22 of file egammaBaseTool.cxx.

23{
24 return StatusCode::SUCCESS;
25}

◆ initialize()

StatusCode EMPIDBuilder::initialize ( )
finaloverridevirtual

initialize method

Reimplemented from egammaBaseTool.

Definition at line 24 of file EMPIDBuilder.cxx.

25{
26 ATH_MSG_DEBUG(" Initializing EMPIDBuilder");
27
29
30 if (m_electronIsEMselectors.size() !=
32 ATH_MSG_ERROR("The number of selectors does not match the number of given "
33 "electronIsEMselector names");
34 return StatusCode::FAILURE;
35 }
36
38
40 ATH_MSG_ERROR("The number of selectors does not match the number of given "
41 "electron LH selector names");
42 return StatusCode::FAILURE;
43 }
44
46
47 if (m_genericIsEMselectors.size() !=
49 ATH_MSG_ERROR("The number of selectors does not match the number of given "
50 "generic selector names");
51 return StatusCode::FAILURE;
52 }
53
55
57 ATH_MSG_ERROR("The number of selectors does not match the number of given "
58 "photon selector names");
59 return StatusCode::FAILURE;
60 }
61
63 if (m_lumiBlockMuTool.retrieve().isFailure()) {
64 ATH_MSG_FATAL("Unable to retrieve Luminosity Tool");
65 return StatusCode::FAILURE;
66 }
67 ATH_MSG_DEBUG("Successfully retrieved Luminosity Tool");
68 } else {
69 m_lumiBlockMuTool.disable();
70 }
71 return StatusCode::SUCCESS;
72}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(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.

◆ interfaceID()

const InterfaceID & IegammaBaseTool::interfaceID ( )
inlinestaticinherited

AthAlgTool interface methods.

Definition at line 48 of file IegammaBaseTool.h.

49{
51}
static const InterfaceID IID_IegammaBaseTool("IegammaBaseTool", 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 }

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

Gaudi::Property<std::vector<std::string> > EMPIDBuilder::m_electronIsEMselectorResultNames
private
Initial value:
{
this,
"electronIsEMselectorResultNames",
{},
"The selector result names"
}

Definition at line 53 of file EMPIDBuilder.h.

53 {
54 this,
55 "electronIsEMselectorResultNames",
56 {},
57 "The selector result names"
58 };

◆ m_electronIsEMselectors

ToolHandleArray<IAsgElectronIsEMSelector> EMPIDBuilder::m_electronIsEMselectors
private
Initial value:
{
this,
"electronIsEMselectors",
{},
"The selectors that we need to apply to the Electron object"
}

Handle to the selectors.

Definition at line 47 of file EMPIDBuilder.h.

47 {
48 this,
49 "electronIsEMselectors",
50 {},
51 "The selectors that we need to apply to the Electron object"
52 };

◆ m_electronLHselectorResultNames

Gaudi::Property<std::vector<std::string> > EMPIDBuilder::m_electronLHselectorResultNames
private
Initial value:
{
this,
"electronLHselectorResultNames",
{},
"The selector result names"
}

Definition at line 66 of file EMPIDBuilder.h.

66 {
67 this,
68 "electronLHselectorResultNames",
69 {},
70 "The selector result names"
71 };

◆ m_electronLHselectors

ToolHandleArray<IAsgElectronLikelihoodTool> EMPIDBuilder::m_electronLHselectors
private
Initial value:
{
this,
"electronLHselectors",
{},
"The selectors that we need to apply to the LH electron object"
}

Definition at line 60 of file EMPIDBuilder.h.

60 {
61 this,
62 "electronLHselectors",
63 {},
64 "The selectors that we need to apply to the LH electron object"
65 };

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

Gaudi::Property<std::vector<std::string> > EMPIDBuilder::m_genericIsEMselectorResultNames
private
Initial value:
{
this,
"genericIsEMselectorResultNames",
{},
"The selector result names"
}

Definition at line 80 of file EMPIDBuilder.h.

80 {
81 this,
82 "genericIsEMselectorResultNames",
83 {},
84 "The selector result names"
85 };

◆ m_genericIsEMselectors

ToolHandleArray<IAsgSelectionTool> EMPIDBuilder::m_genericIsEMselectors
private
Initial value:
{
this,
"genericIsEMselectors",
{},
"The selectors that we need to apply to the generic object"
}

Definition at line 73 of file EMPIDBuilder.h.

73 {
74 this,
75 "genericIsEMselectors",
76 {},
77 "The selectors that we need to apply to the generic object"
78 };

◆ m_LHValueName

Gaudi::Property<std::string> EMPIDBuilder::m_LHValueName
private
Initial value:
{ this,
"LHValueName",
"LHValue",
"The LH Value name" }

Definition at line 107 of file EMPIDBuilder.h.

107 { this,
108 "LHValueName",
109 "LHValue",
110 "The LH Value name" };

◆ m_lumiBlockMuTool

ToolHandle<ILumiBlockMuTool> EMPIDBuilder::m_lumiBlockMuTool
private
Initial value:
{
this,
"LuminosityTool",
"LumiBlockMuTool/LumiBlockMuTool",
"Luminosity Tool"
}

Definition at line 100 of file EMPIDBuilder.h.

100 {
101 this,
102 "LuminosityTool",
103 "LumiBlockMuTool/LumiBlockMuTool",
104 "Luminosity Tool"
105 };

◆ m_photonIsEMselectorResultNames

Gaudi::Property<std::vector<std::string> > EMPIDBuilder::m_photonIsEMselectorResultNames
private
Initial value:
{
this,
"photonIsEMselectorResultNames",
{},
"The selector result names"
}

Definition at line 93 of file EMPIDBuilder.h.

93 {
94 this,
95 "photonIsEMselectorResultNames",
96 {},
97 "The selector result names"
98 };

◆ m_photonIsEMselectors

ToolHandleArray<IAsgPhotonIsEMSelector> EMPIDBuilder::m_photonIsEMselectors
private
Initial value:
{
this,
"photonIsEMselectors",
{},
"The selectors that we need to apply to the pothon object"
}

Definition at line 87 of file EMPIDBuilder.h.

87 {
88 this,
89 "photonIsEMselectors",
90 {},
91 "The selectors that we need to apply to the pothon object"
92 };

◆ m_UselumiBlockMuTool

Gaudi::Property<bool> EMPIDBuilder::m_UselumiBlockMuTool
private
Initial value:
{
this,
"UseLuminosityTool",
false,
"Use Luminosity Tool instead of value stored in xAOD"
}

Definition at line 112 of file EMPIDBuilder.h.

112 {
113 this,
114 "UseLuminosityTool",
115 false,
116 "Use Luminosity Tool instead of value stored in xAOD"
117 };

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