ATLAS Offline Software
Loading...
Searching...
No Matches
Trig::TrigEgammaMatchingTool Class Reference

#include <TrigEgammaMatchingTool.h>

Inheritance diagram for Trig::TrigEgammaMatchingTool:
Collaboration diagram for Trig::TrigEgammaMatchingTool:

Public Types

Definition of the StoreGate-like object's definition
typedef ServiceHandle< StoreGateSvcMetaStore_t
 Type of the metadata store object in Athena.
typedef const ServiceHandle< StoreGateSvc > & MetaStorePtr_t
 Type of the metadata store pointer in standalone mode.

Public Member Functions

 TrigEgammaMatchingTool (const std::string &name)
virtual ~TrigEgammaMatchingTool ()
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual bool match (const xAOD::Egamma *, const std::string &, const HLT::TriggerElement *&) override
 Egamma trigger matching which returns TE.
virtual bool match (const xAOD::Egamma *, const std::string &) override
 Egamma trigger matching to HLT Electron/Photon with DeactivatedTE.
virtual bool matchHLT (const xAOD::Egamma *, const std::string &) override
 Egamma trigger matching to HLT Electron/Photon Only.
virtual const xAOD::EgammaclosestHLTObject (const xAOD::Egamma *, const std::string &) override
 Egamma trigger matching to HLT Electron/Photon only – returns nearest object.
double dR (const double, const double, const double, const double)
virtual StatusCode sysInitialize ()
 Function initialising the tool in the correct way in Athena.
virtual void print () const
 Print the state of the tool.
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 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
Functions providing access to the input/output metadata
MetaStorePtr_t inputMetaStore () const
 Accessor for the input metadata store.
MetaStorePtr_t outputMetaStore () const
 Accessor for the output metadata store.
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Public Attributes

double m_dR
double m_dRL1

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.
Callback functions helping in metadata reading/writing
void setUseIncidents (const bool flag)
virtual void handle (const Incident &inc)
 Function receiving incidents from IncidentSvc/TEvent.
virtual StatusCode beginInputFile ()
 Function called when a new input file is opened.
virtual StatusCode endInputFile ()
 Function called when the currently open input file got completely processed.
virtual StatusCode beginEvent ()
 Function called when a new events is loaded.
virtual StatusCode metaDataStop ()
 Function called when the tool should write out its metadata.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

template<class T>
const T * getFeature (const HLT::TriggerElement *te)
template<class T>
bool ancestorPassed (const HLT::TriggerElement *te)
bool matchHLTElectron (const xAOD::Electron *, const std::string &, const HLT::TriggerElement *&)
bool matchHLTPhoton (const xAOD::Photon *, const std::string &, const HLT::TriggerElement *&)
bool matchHLTCalo (const xAOD::Egamma *, const std::string &, const HLT::TriggerElement *&)
bool matchL2Electron (const xAOD::Electron *, const std::string &, const HLT::TriggerElement *&)
bool matchL2Photon (const xAOD::Photon *, const std::string &, const HLT::TriggerElement *&)
bool matchL2Calo (const xAOD::Egamma *, const std::string &, const HLT::TriggerElement *&)
bool matchL1 (const xAOD::Egamma *, const std::string &, const HLT::TriggerElement *&)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Trig::TrigDecisionToolm_trigDecTool
MetaStore_t m_inputMetaStore
 Object accessing the input metadata store.
MetaStore_t m_outputMetaStore
 Object accessing the output metadata store.
bool m_beginInputFileCalled
 Flag helping to discover when the tool misses the opening of the first input file.
bool m_useIncidents
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

Definition at line 19 of file TrigEgammaMatchingTool.h.

Member Typedef Documentation

◆ MetaStore_t

Type of the metadata store object in Athena.

Definition at line 66 of file AsgMetadataTool.h.

◆ MetaStorePtr_t

Type of the metadata store pointer in standalone mode.

Definition at line 68 of file AsgMetadataTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrigEgammaMatchingTool()

Trig::TrigEgammaMatchingTool::TrigEgammaMatchingTool ( const std::string & name)

Definition at line 20 of file TrigEgammaMatchingTool.cxx.

21 : asg::AsgMetadataTool( name ),
22 m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool")
23 {
24 declareProperty( "TriggerTool", m_trigDecTool);
25 declareProperty( "DeltaR", m_dR=0.07);
26 declareProperty( "L1DeltaR", m_dRL1=0.15);
27 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< Trig::TrigDecisionTool > m_trigDecTool

◆ ~TrigEgammaMatchingTool()

Trig::TrigEgammaMatchingTool::~TrigEgammaMatchingTool ( )
virtual

Definition at line 29 of file TrigEgammaMatchingTool.cxx.

29 {
30 }

Member Function Documentation

◆ ancestorPassed()

template<class T>
bool Trig::TrigEgammaMatchingTool::ancestorPassed ( const HLT::TriggerElement * te)
private

◆ beginEvent()

StatusCode asg::AsgMetadataTool::beginEvent ( )
protectedvirtualinherited

◆ beginInputFile()

StatusCode asg::AsgMetadataTool::beginInputFile ( )
protectedvirtualinherited

Function called when a new input file is opened.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in AsgElectronEfficiencyCorrectionTool, BookkeeperDumperTool, BookkeeperTool, PMGTools::PMGTruthWeightTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, TauAnalysisTools::TauSmearingTool, Trig::TrigDecisionTool, Trig::xAODBunchCrossingTool, TrigConf::xAODConfigTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 185 of file AsgMetadataTool.cxx.

185 {
186
187 // Return gracefully:
188 return StatusCode::SUCCESS;
189 }

◆ closestHLTObject()

const xAOD::Egamma * Trig::TrigEgammaMatchingTool::closestHLTObject ( const xAOD::Egamma * eg,
const std::string & trigger )
overridevirtual

Egamma trigger matching to HLT Electron/Photon only – returns nearest object.

Calls match with a FeatureContainer for a given triggerfor HLT only Note does not use DeactiviateTEs Returns closest EF object to offline object Requires TrigPassBits only works in Athena.

Implements Trig::ITrigEgammaMatchingTool.

Definition at line 53 of file TrigEgammaMatchingTool.cxx.

53 {
54
55 if(eg==nullptr) {
56 ATH_MSG_DEBUG("nullptr Offline object");
57 return nullptr;
58 }
59 Trig::FeatureContainer fc = m_trigDecTool->features(trigger);
60 double deltaR=0.;
61 double dRMax = 100;
62 const xAOD::Electron *elEF = 0;
63 const xAOD::Photon *phEF = 0;
64 if(eg->type()==xAOD::Type::Electron){
65 const xAOD::Electron* elOff =static_cast<const xAOD::Electron*> (eg);
66 const std::vector< Trig::Feature<xAOD::ElectronContainer> > vec = fc.get<xAOD::ElectronContainer>("egamma_Electrons");
67
68 for(auto feat : vec){
69 const xAOD::ElectronContainer *cont = feat.cptr();
70 if(cont == nullptr) {
71 ATH_MSG_DEBUG("Electron container from TE nullptr");
72 continue;
73 }
74 for(const auto el : *cont){
75 if(el == nullptr) {
76 ATH_MSG_DEBUG("Electron from TE nullptr");
77 continue;
78 }
79 deltaR = dR(elOff->trackParticle()->eta(),elOff->trackParticle()->phi(), el->trackParticle()->eta(),el->trackParticle()->phi());
80 if (deltaR < dRMax) {
81 dRMax = deltaR;
82 elEF =el;
83 }
84 }
85 }
86 if(dRMax < m_dR) return elEF;
87 }
88 else if(eg->type()==xAOD::Type::Photon){
89 const xAOD::Photon* phOff =static_cast<const xAOD::Photon*> (eg);
90 const std::vector< Trig::Feature<xAOD::PhotonContainer> > vec = fc.get<xAOD::PhotonContainer>("egamma_Photons");
91 for(auto feat : vec){
92 const xAOD::PhotonContainer *cont = feat.cptr();
93 if(cont == nullptr) {
94 ATH_MSG_DEBUG("Photon Container from TE nullptr");
95 continue;
96 }
97 for(const auto ph : *cont){
98 if(ph == nullptr) {
99 ATH_MSG_DEBUG("Photon from TE nullptr");
100 continue;
101 }
102 deltaR = dR(phOff->caloCluster()->eta(),phOff->caloCluster()->phi(), ph->caloCluster()->eta(),ph->caloCluster()->phi());
103 if (deltaR < dRMax) {
104 dRMax = deltaR;
105 phEF =ph;
106 }
107 }
108 }
109 if(dRMax < m_dR) return phEF;
110 }
111 return 0; // No match
112 }
Scalar deltaR(const MatrixBase< Derived > &vec) const
#define ATH_MSG_DEBUG(x)
std::vector< size_t > vec
const std::vector< Trig::Feature< T > > get(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
returns flattened vector of Features of given type This method is in fact sullied by 3 arguments.
double dR(const double, const double, const double, const double)
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
@ Photon
The object is a photon.
Definition ObjectType.h:47
@ Electron
The object is an electron.
Definition ObjectType.h:46
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".

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

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

◆ dR()

double Trig::TrigEgammaMatchingTool::dR ( const double eta1,
const double phi1,
const double eta2,
const double phi2 )

Definition at line 42 of file TrigEgammaMatchingTool.cxx.

42 {
43 double deta = fabs(eta1 - eta2);
44 double dphi = fabs(phi1 - phi2) < TMath::Pi() ? fabs(phi1 - phi2) : 2*TMath:: \
45 Pi() - fabs(phi1 - phi2);
46 return sqrt(deta*deta + dphi*dphi);
47 }
static const double Pi

◆ endInputFile()

StatusCode asg::AsgMetadataTool::endInputFile ( )
protectedvirtualinherited

Function called when the currently open input file got completely processed.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperDumperTool, BookkeeperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 193 of file AsgMetadataTool.cxx.

193 {
194
195 // Return gracefully:
196 return StatusCode::SUCCESS;
197 }

◆ 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

◆ getFeature()

template<class T>
const T * Trig::TrigEgammaMatchingTool::getFeature ( const HLT::TriggerElement * te)
private

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ handle()

void asg::AsgMetadataTool::handle ( const Incident & inc)
protectedvirtualinherited

Function receiving incidents from IncidentSvc/TEvent.

Reimplemented in Trig::TrigDecisionTool.

Definition at line 135 of file AsgMetadataTool.cxx.

135 {
136
137 // Tell the user what's happening:
138 ATH_MSG_VERBOSE( "Callback received with incident: " << inc.type() );
139
140 // Call the appropriate member function:
141 if( inc.type() == IncidentType::BeginInputFile ) {
143 if( beginInputFile().isFailure() ) {
144 ATH_MSG_FATAL( "Failed to call beginInputFile()" );
145 throw std::runtime_error( "Couldn't call beginInputFile()" );
146 }
147 } else if( inc.type() == IncidentType::EndInputFile ) {
148 if( endInputFile().isFailure() ) {
149 ATH_MSG_FATAL( "Failed to call endInputFile()" );
150 throw std::runtime_error( "Couldn't call endInputFile()" );
151 }
152 } else if( inc.type() == IncidentType::BeginEvent ) {
153 // If the tool didn't catch the begin input file incident for the
154 // first input file of the job, then call the appropriate function
155 // now.
156 if( ! m_beginInputFileCalled ) {
158 if( beginInputFile().isFailure() ) {
159 ATH_MSG_FATAL( "Failed to call beginInputFile()" );
160 throw std::runtime_error( "Couldn't call beginInputFile()" );
161 }
162 }
163 if( beginEvent().isFailure() ) {
164 ATH_MSG_FATAL( "Failed to call beginEvent()" );
165 throw std::runtime_error( "Couldn't call beginEvent()" );
166 }
167
168 #ifdef XAOD_STANDALONE
169 } else if( inc.type() == IncidentType::MetaDataStop ) {
170 if( metaDataStop().isFailure() ) {
171 ATH_MSG_FATAL( "Failed to call metaDataStop()" );
172 throw std::runtime_error( "Couldn't call metaDataStop()" );
173 }
174
175 #endif // XAOD_STANDALONE
176 } else {
177 ATH_MSG_WARNING( "Unknown incident type received in AsgMetaDataTool: " << inc.type() );
178 }
179
180 return;
181 }
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
virtual StatusCode beginInputFile()
Function called when a new input file is opened.
virtual StatusCode beginEvent()
Function called when a new events is loaded.
bool m_beginInputFileCalled
Flag helping to discover when the tool misses the opening of the first input file.
virtual StatusCode endInputFile()
Function called when the currently open input file got completely processed.
virtual StatusCode metaDataStop()
Function called when the tool should write out its metadata.

◆ initialize()

StatusCode Trig::TrigEgammaMatchingTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 33 of file TrigEgammaMatchingTool.cxx.

33 {
34 // Greet the user:
35 ATH_MSG_INFO( "Initialising... " );
36
37 ATH_CHECK(m_trigDecTool.retrieve());
38
39 return StatusCode::SUCCESS;
40 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#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.

◆ inputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::inputMetaStore ( ) const
inherited

Accessor for the input metadata store.

Definition at line 93 of file AsgMetadataTool.cxx.

93 {
94
95#ifdef XAOD_STANDALONE
96 return &m_inputMetaStore;
97#else // XAOD_STANDALONE
98 return m_inputMetaStore;
99#endif // XAOD_STANDALONE
100 }
MetaStore_t m_inputMetaStore
Object accessing the input metadata store.

◆ match() [1/2]

bool Trig::TrigEgammaMatchingTool::match ( const xAOD::Egamma * eg,
const std::string & trigger )
overridevirtual

Egamma trigger matching to HLT Electron/Photon with DeactivatedTE.

Calls match with a TE, so recursive matching to L1 Check that the HLT Electron or Photon ancester passed.

Implements Trig::ITrigEgammaMatchingTool.

Definition at line 486 of file TrigEgammaMatchingTool.cxx.

486 {
487 const HLT::TriggerElement* finalFC;
488 bool passed = false;
489 if( match(eg,trigger,finalFC) ){
490 if( finalFC == nullptr) return false;
492 if ( (m_trigDecTool->ancestor<xAOD::ElectronContainer>(finalFC)).te() != nullptr){
493 if( (m_trigDecTool->ancestor<xAOD::ElectronContainer>(finalFC)).te()->getActiveState())
494 passed = true;
495 }
496 }
498 if ( (m_trigDecTool->ancestor<xAOD::PhotonContainer>(finalFC)).te() != nullptr){
499 if( (m_trigDecTool->ancestor<xAOD::PhotonContainer>(finalFC)).te()->getActiveState())
500 passed = true;
501 }
502 }
503 }
504 return passed;
505 }
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
virtual bool match(const xAOD::Egamma *, const std::string &, const HLT::TriggerElement *&) override
Egamma trigger matching which returns TE.
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon

◆ match() [2/2]

bool Trig::TrigEgammaMatchingTool::match ( const xAOD::Egamma * eg,
const std::string & trigger,
const HLT::TriggerElement *& finalFC )
overridevirtual

Egamma trigger matching which returns TE.

Implements Trig::ITrigEgammaMatchingTool.

Definition at line 451 of file TrigEgammaMatchingTool.cxx.

451 {
452 // Set TE to nullptr
453 // If no match easy check
454 finalFC=nullptr;
455
456 ATH_MSG_DEBUG("Match objec with trigger " << trigger);
458 const xAOD::Electron* el =static_cast<const xAOD::Electron*> (eg);
459 if( matchHLTElectron(el,trigger,finalFC) ) {
460 ATH_MSG_DEBUG("Matchched!");
461 return true;
462 }
463 }
465 const xAOD::Photon* ph =static_cast<const xAOD::Photon*> (eg);
466 if( matchHLTPhoton(ph,trigger,finalFC) ) return true;
467 }
468 if( matchHLTCalo(eg,trigger,finalFC) ) return true;
470 const xAOD::Electron* el =static_cast<const xAOD::Electron*> (eg);
471 if( matchL2Electron(el,trigger,finalFC) ) return true;
472 }
474 const xAOD::Photon* ph =static_cast<const xAOD::Photon*> (eg);
475 //if( matchL2Photon(ph,fc,trigger,finalFC) ) return true;
476 if( matchL2Photon(ph,trigger,finalFC) ) return true;
477 }
478 if( matchL2Calo(eg,trigger,finalFC) ) return true;
479 if( matchL1(eg,trigger,finalFC) ) return true;
480 ATH_MSG_DEBUG("match() failed!");
481 return false;// otherwise, someone matched!*/
482 }
bool matchHLTElectron(const xAOD::Electron *, const std::string &, const HLT::TriggerElement *&)
bool matchL2Electron(const xAOD::Electron *, const std::string &, const HLT::TriggerElement *&)
bool matchHLTCalo(const xAOD::Egamma *, const std::string &, const HLT::TriggerElement *&)
bool matchL2Calo(const xAOD::Egamma *, const std::string &, const HLT::TriggerElement *&)
bool matchL2Photon(const xAOD::Photon *, const std::string &, const HLT::TriggerElement *&)
bool matchHLTPhoton(const xAOD::Photon *, const std::string &, const HLT::TriggerElement *&)
bool matchL1(const xAOD::Egamma *, const std::string &, const HLT::TriggerElement *&)

◆ matchHLT()

bool Trig::TrigEgammaMatchingTool::matchHLT ( const xAOD::Egamma * eg,
const std::string & trigger )
overridevirtual

Egamma trigger matching to HLT Electron/Photon Only.

Calls match with a FeatureContainer for a given triggerfor HLT only Note does not use DeactiviateTEs.

Implements Trig::ITrigEgammaMatchingTool.

Definition at line 116 of file TrigEgammaMatchingTool.cxx.

116 {
117 ATH_MSG_DEBUG("matchHLT");
118 Trig::FeatureContainer fc = m_trigDecTool->features(trigger);
119 ATH_MSG_DEBUG("FeatureContainer");
120 double deltaR=0.;
122 ATH_MSG_DEBUG("Electron");
123 //const xAOD::Electron* elOff =static_cast<const xAOD::Electron*> (eg);
124#ifdef XAOD_ANALYSIS
125 const auto vec = fc.containerFeature<xAOD::ElectronContainer>("egamma_Electrons");
126#else
127 const auto vec = fc.get<xAOD::ElectronContainer>("egamma_Electrons");
128#endif // XAOD_ANALYSIS
129 ATH_MSG_DEBUG("Container Feature");
130 for(const auto& feat : vec){
131 const xAOD::ElectronContainer *cont = feat.cptr();
132 if(cont == nullptr) {
133 ATH_MSG_DEBUG("Electron container from TE nullptr");
134 continue;
135 }
136 for(const auto el : *cont){
137 if(el == nullptr) {
138 ATH_MSG_WARNING("Electron from TE nullptr");
139 continue;
140 }
141 deltaR = dR(eg->eta(),eg->phi(), el->eta(),el->phi());
142 if(deltaR < m_dR){
143 return true;
144 }
145 }
146 }
147 }
149 std::string key = "egamma_Photons";
150 if(boost::contains(trigger,"icaloloose") || boost::contains(trigger,"icalovloose") || boost::contains(trigger,"icalotight")) key = "egamma_Iso_Photons";
151 //key="";
152
153 const xAOD::Photon* phOff =static_cast<const xAOD::Photon*> (eg);
154#ifdef XAOD_ANALYSIS
156#else
157 const auto vec = fc.get<xAOD::PhotonContainer>(key);
158#endif // XAOD_ANALYSIS
159 for(const auto& feat : vec){
160 const xAOD::PhotonContainer *cont = feat.cptr();
161 if(cont == nullptr) {
162 ATH_MSG_DEBUG("Photon Container from TE nullptr");
163 continue;
164 }
165 for(const auto ph : *cont){
166 if(ph == nullptr) {
167 ATH_MSG_DEBUG("Photon from TE nullptr");
168 continue;
169 }
170 deltaR = dR(phOff->eta(),phOff->phi(), ph->eta(),ph->phi());
171 if(deltaR < m_dR){
172 return true;
173 }
174 }
175 }
176 }
177 return false; // No match
178 }
std::vector< Feature< CONTAINER > > containerFeature(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition Egamma_v1.cxx:71
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
Definition Egamma_v1.cxx:76

◆ matchHLTCalo()

bool Trig::TrigEgammaMatchingTool::matchHLTCalo ( const xAOD::Egamma * eg,
const std::string & trigger,
const HLT::TriggerElement *& finalFC )
private

Definition at line 256 of file TrigEgammaMatchingTool.cxx.

256 {
257 ATH_MSG_DEBUG("Match HLT CaloCluster");
258 finalFC=nullptr;
259 auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs));
260#ifdef XAOD_ANALYSIS
261 const auto vec = fc.containerFeature<xAOD::CaloClusterContainer>("TrigEFCaloCalibFex",TrigDefs::alsoDeactivateTEs);
262#else
263 const auto vec = fc.get<xAOD::CaloClusterContainer>("TrigEFCaloCalibFex",TrigDefs::alsoDeactivateTEs);
264#endif // XAOD_ANALYSIS
265
266 ATH_MSG_DEBUG("EFCal FC Size " << vec.size());
267 double deltaR=0.;
268 for(auto feat : vec){
269 const xAOD::CaloClusterContainer *cont = feat.cptr();
270 if(cont == nullptr) {
271 ATH_MSG_DEBUG("CaloCluster Container from TE nullptr");
272 continue;
273 }
274 ATH_MSG_DEBUG("EF Calo Size " << cont->size());
275 for(const auto clus : *cont){
276 if(clus == nullptr) {
277 ATH_MSG_DEBUG("CaloCluster from TE nullptr");
278 continue;
279 }
280 deltaR = dR(eg->eta(),eg->phi(), clus->eta(),clus->phi());
281 if(deltaR < m_dR){
282 finalFC = (feat.te());
283 return true;
284 }
285 }
286 }
287 return false;
288
289 }
size_type size() const noexcept
Returns the number of elements in the collection.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.

◆ matchHLTElectron()

bool Trig::TrigEgammaMatchingTool::matchHLTElectron ( const xAOD::Electron * eg,
const std::string & trigger,
const HLT::TriggerElement *& finalFC )
private

Definition at line 219 of file TrigEgammaMatchingTool.cxx.

219 {
220 ATH_MSG_DEBUG("Match HLT electron");
221 finalFC=nullptr;
222 // Get the container of online electrons associated to passed items
223 auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs));
224
225#ifdef XAOD_ANALYSIS
226 const auto vec = fc.containerFeature<xAOD::ElectronContainer>("",TrigDefs::alsoDeactivateTEs);
227#else
229#endif // XAOD_ANALYSIS
230 ATH_MSG_DEBUG("EF FC Size " << vec.size());
231 double deltaR=0.;
232 for(auto feat : vec){
233 const xAOD::ElectronContainer *cont = feat.cptr();
234 if(cont == nullptr) {
235 ATH_MSG_WARNING("Electron Container from TE nullptr");
236 continue;
237 }
238 ATH_MSG_DEBUG("EF Size " << cont->size());
239 for(const auto el : *cont){
240 if(el == nullptr) {
241 ATH_MSG_DEBUG("Electron from TE nullptr");
242 continue;
243 }
244 deltaR = dR(eg->eta(),eg->phi(), el->eta(),el->phi());
245 if(deltaR < m_dR){
246 finalFC = (feat.te());
247 ATH_MSG_DEBUG("Electron finalFC matches offline");
248 return true;
249 }
250 }
251 }
252 ATH_MSG_DEBUG("Reached the end in matchHLTElectron. So didn't match!");
253 return false;
254 }

◆ matchHLTPhoton()

bool Trig::TrigEgammaMatchingTool::matchHLTPhoton ( const xAOD::Photon * eg,
const std::string & trigger,
const HLT::TriggerElement *& finalFC )
private

Definition at line 180 of file TrigEgammaMatchingTool.cxx.

180 {
181 finalFC=nullptr;
182 ATH_MSG_DEBUG("Match HLT Photon");
183 // Get the container of online electrons associated to passed items
184 auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs));
185 std::string key = "egamma_Photons";
186 if(boost::contains(trigger,"iloose") || boost::contains(trigger,"ivloose") || boost::contains(trigger,"itight")) key = "egamma_Iso_Photons";
187 key="";
188
189
190#ifdef XAOD_ANALYSIS
191 const auto vec = fc.containerFeature<xAOD::PhotonContainer>(key,TrigDefs::alsoDeactivateTEs);
192#else
194#endif // XAOD_ANALYSIS
195 ATH_MSG_DEBUG("EF FC Size " << vec.size());
196 double deltaR=0.;
197 for(auto feat : vec){
198 const xAOD::PhotonContainer *cont = feat.cptr();
199 if(cont == nullptr) {
200 ATH_MSG_DEBUG("Photon Container from TE nullptr");
201 continue;
202 }
203 ATH_MSG_DEBUG("EF Size " << cont->size());
204 for(const auto ph : *cont){
205 if(ph == nullptr) {
206 ATH_MSG_DEBUG("Photon from TE nullptr");
207 continue;
208 }
209 deltaR = dR(eg->eta(),eg->phi(), ph->eta(),ph->phi());
210 if(deltaR < m_dR){
211 finalFC = (feat.te());
212 return true;
213 }
214 }
215 }
216 return false;
217 }

◆ matchL1()

bool Trig::TrigEgammaMatchingTool::matchL1 ( const xAOD::Egamma * eg,
const std::string & trigger,
const HLT::TriggerElement *& finalFC )
private

Definition at line 388 of file TrigEgammaMatchingTool.cxx.

388 {
389 finalFC=nullptr;
390
391#ifdef XAOD_ANALYSIS
392 if(m_trigDecTool->isPassed("L1_EM.*")) return true;
393#else
394 double deltaR=0.;
395 auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs));
396 auto initRois = fc.get<TrigRoiDescriptor>();
397 if ( initRois.size() < 1 ) return false;
398 for (auto initRoi: initRois) {
399 auto itEmTau = m_trigDecTool->ancestor<xAOD::EmTauRoI>(initRoi);
400 const xAOD::EmTauRoI *l1 = itEmTau.cptr();
401 if(l1 == nullptr) {
402 ATH_MSG_DEBUG("EMTauRoI from TE nullptr");
403 return false;
404 }
405 deltaR = dR(eg->eta(),eg->phi(), l1->eta(),l1->phi());
406
407 if(deltaR < m_dRL1){
408 finalFC = (itEmTau.te());
409 return true;
410 }
411 }
412#endif
413 return false; // otherwise, someone matched!*/
414
415 }
Athena::TPCnvVers::Current TrigRoiDescriptor
EmTauRoI_v2 EmTauRoI
Definition EmTauRoI.h:16

◆ matchL2Calo()

bool Trig::TrigEgammaMatchingTool::matchL2Calo ( const xAOD::Egamma * eg,
const std::string & trigger,
const HLT::TriggerElement *& finalFC )
private

Definition at line 359 of file TrigEgammaMatchingTool.cxx.

359 {
360 finalFC=nullptr;
361 auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs));
362#ifdef XAOD_ANALYSIS
363 ATH_MSG_DEBUG("No matching for TrigEMCluster in AnalysisBase");
364 return false;
365#else
367
368 ATH_MSG_DEBUG("L2 FC Size " << vec.size());
369 for(auto feat : vec){
370 const xAOD::TrigEMCluster *em = feat.cptr();
371 if(em == nullptr) {
372 ATH_MSG_DEBUG("TrigEMCluster from TE nullptr");
373 continue;
374 }
375 ATH_MSG_DEBUG("TrigEMCluster << " << em->et() );
376 double deltaR=0.;
377 deltaR = dR(eg->eta(),eg->phi(), em->eta(),em->phi());
378 if(deltaR < m_dR){
379 finalFC = (feat.te());
380 return true;
381 }
382 }
383#endif
384 return false;
385
386 }
float et() const
get Et (calibrated)
float eta() const
get Eta (calibrated)
float phi() const
get Phi (calibrated)
TrigEMCluster_v1 TrigEMCluster
Define the latest version of the trigger EM cluster class.

◆ matchL2Electron()

bool Trig::TrigEgammaMatchingTool::matchL2Electron ( const xAOD::Electron * eg,
const std::string & trigger,
const HLT::TriggerElement *& finalFC )
private

Definition at line 325 of file TrigEgammaMatchingTool.cxx.

325 {
326 finalFC=nullptr;
327 ATH_MSG_DEBUG("Match L2 Electron");
328 auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs));
329#ifdef XAOD_ANALYSIS
330 auto vec = fc.containerFeature<xAOD::TrigElectronContainer>("",TrigDefs::alsoDeactivateTEs);
331#else
333#endif
334 ATH_MSG_DEBUG("L2 FC Size " << vec.size());
335 double deltaR=0.;
336 for(auto feat : vec){
337 const xAOD::TrigElectronContainer *cont = feat.cptr();
338 if(cont == nullptr) {
339 ATH_MSG_DEBUG("TrigElectron Container from TE nullptr");
340 continue;
341 }
342 ATH_MSG_DEBUG("L2 Size " << cont->size());
343 for(const auto l2 : *cont){
344 if(l2 == nullptr) {
345 ATH_MSG_DEBUG("TrigElectron from TE nullptr");
346 continue;
347 }
348 deltaR = dR(eg->eta(),eg->phi(), l2->eta(),l2->phi());
349 if(deltaR < m_dR){
350 finalFC = (feat.te());
351 return true;
352 }
353 }
354 }
355 return false;
356
357 }
TrigElectronContainer_v1 TrigElectronContainer
Declare the latest version of the container.

◆ matchL2Photon()

bool Trig::TrigEgammaMatchingTool::matchL2Photon ( const xAOD::Photon * eg,
const std::string & trigger,
const HLT::TriggerElement *& finalFC )
private

Definition at line 291 of file TrigEgammaMatchingTool.cxx.

291 {
292 finalFC=nullptr;
293 ATH_MSG_DEBUG("Match L2 Photon");
294 auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs));
295
296#ifdef XAOD_ANALYSIS
297 auto vec = fc.containerFeature<xAOD::TrigPhotonContainer>("",TrigDefs::alsoDeactivateTEs);
298#else
300#endif
301 ATH_MSG_DEBUG("L2 FC Size " << vec.size());
302 double deltaR=0.;
303 for(auto feat : vec){
304 const xAOD::TrigPhotonContainer *cont = feat.cptr();
305 if(cont == nullptr) {
306 ATH_MSG_WARNING("TrigPhoton Container from TE nullptr");
307 continue;
308 }
309 ATH_MSG_DEBUG("L2 Size " << cont->size());
310 for(const auto l2 : *cont){
311 if(l2 == nullptr) {
312 ATH_MSG_DEBUG("TrigElectron from TE nullptr");
313 continue;
314 }
315 deltaR = dR(eg->eta(),eg->phi(), l2->eta(),l2->phi());
316 if(deltaR < m_dR){
317 finalFC = (feat.te());
318 return true;
319 }
320 }
321 }
322 return false;
323 }
TrigPhotonContainer_v1 TrigPhotonContainer
Declare the latest version of the container.

◆ metaDataStop()

StatusCode asg::AsgMetadataTool::metaDataStop ( )
protectedvirtualinherited

Function called when the tool should write out its metadata.

Dummy implementation that can be overridden by the derived tool.

Reimplemented in BookkeeperDumperTool, BookkeeperTool, xAODMaker::TriggerMenuMetaDataTool, and xAODMaker::TruthMetaDataTool.

Definition at line 209 of file AsgMetadataTool.cxx.

209 {
210
211 // Return gracefully:
212 return StatusCode::SUCCESS;
213 }

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

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

◆ outputMetaStore()

AsgMetadataTool::MetaStorePtr_t asg::AsgMetadataTool::outputMetaStore ( ) const
inherited

Accessor for the output metadata store.

Definition at line 102 of file AsgMetadataTool.cxx.

102 {
103
104#ifdef XAOD_STANDALONE
105 return &m_outputMetaStore;
106#else // XAOD_STANDALONE
107 return m_outputMetaStore;
108#endif // XAOD_STANDALONE
109 }
MetaStore_t m_outputMetaStore
Object accessing the output metadata store.

◆ print()

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

◆ setUseIncidents()

void asg::AsgMetadataTool::setUseIncidents ( const bool flag)
inlineprotectedinherited

Definition at line 132 of file AsgMetadataTool.h.

133 {
135 }
bool flag
Definition master.py:29

◆ sysInitialize()

StatusCode asg::AsgMetadataTool::sysInitialize ( )
virtualinherited

Function initialising the tool in the correct way in Athena.

This function is used to set up the callbacks from IncidentSvc in Athena at the right time during initialisation, without the user having to do anything special in his/her code.

Reimplemented from AthCommonDataStore< AthCommonMsg< AlgTool > >.

Definition at line 115 of file AsgMetadataTool.cxx.

115 {
116
117#ifndef XAOD_STANDALONE
118 if (m_useIncidents) {
119 // Connect to the IncidentSvc:
120 ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
121 ATH_CHECK( incSvc.retrieve() );
122
123 // Set up the right callbacks: don't rethrow exceptions, any failure and we should end
124 incSvc->addListener( this, IncidentType::BeginEvent, 0, false );
125 }
126 // Let the base class do its thing:
127 ATH_CHECK( AlgTool::sysInitialize() );
128
129#endif // not XAOD_STANDALONE
130
131 // Return gracefully:
132 return StatusCode::SUCCESS;
133 }

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

bool asg::AsgMetadataTool::m_beginInputFileCalled
privateinherited

Flag helping to discover when the tool misses the opening of the first input file.

Definition at line 126 of file AsgMetadataTool.h.

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

double Trig::TrigEgammaMatchingTool::m_dR

Definition at line 44 of file TrigEgammaMatchingTool.h.

◆ m_dRL1

double Trig::TrigEgammaMatchingTool::m_dRL1

Definition at line 45 of file TrigEgammaMatchingTool.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_inputMetaStore

MetaStore_t asg::AsgMetadataTool::m_inputMetaStore
privateinherited

Object accessing the input metadata store.

Definition at line 119 of file AsgMetadataTool.h.

◆ m_outputMetaStore

MetaStore_t asg::AsgMetadataTool::m_outputMetaStore
privateinherited

Object accessing the output metadata store.

Definition at line 121 of file AsgMetadataTool.h.

◆ m_trigDecTool

ToolHandle<Trig::TrigDecisionTool> Trig::TrigEgammaMatchingTool::m_trigDecTool
private

Definition at line 48 of file TrigEgammaMatchingTool.h.

◆ m_useIncidents

bool asg::AsgMetadataTool::m_useIncidents
privateinherited

Definition at line 128 of file AsgMetadataTool.h.

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