ATLAS Offline Software
Loading...
Searching...
No Matches
Trig::IParticleRetrievalTool Class Referencefinal

#include <IParticleRetrievalTool.h>

Inheritance diagram for Trig::IParticleRetrievalTool:
Collaboration diagram for Trig::IParticleRetrievalTool:

Public Member Functions

 IParticleRetrievalTool (const std::string &name)
 Standard constructor.
 ~IParticleRetrievalTool () override
 Default destructor.
StatusCode initialize () override
 Initialise the tool.
StatusCode retrieveParticles (std::vector< std::vector< const xAOD::IParticle * > > &combinations, const std::string &chain, bool rerun=false) const override
 Retrieve the particles that caused this trigger to fire.
StatusCode retrieveParticles (std::vector< const xAOD::IParticle * > &combination, const HLT::TriggerElement *te, bool &navFailure) const
 Retrieve particles that caused this trigger element to pass.
xAOD::Type::ObjectType getEGammaTEType (const HLT::TriggerElement *te) const
 Get the type of particle that should be retrieved from this TE.
StatusCode retrieveFeatureParticle (const xAOD::IParticle *&particle, const HLT::TriggerElement::FeatureAccessHelper &feature, const HLT::TriggerElement *te, bool &navFailure) const
 Retrieve an IParticle from a feature.
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 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
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.

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

ToolHandle< Trig::TrigDecisionToolm_tdt
 The TrigDecisionTool that will be used to get the navigation.
bool m_warnOnNavigationFailure
 Be forgiving about the navigation not matching our expectations.
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 16 of file IParticleRetrievalTool.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

◆ IParticleRetrievalTool()

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

Standard constructor.

Definition at line 54 of file IParticleRetrievalTool.cxx.

54 :
55 asg::AsgTool(name)
56 {
57 declareProperty("TrigDecisionTool", m_tdt,
58 "The trigger decision tool to use.");
59 declareProperty("WarnOnNavigationError", m_warnOnNavigationFailure = true,
60 "Only spit a warning on a navigation error, don't cause a job failure.");
61
62 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool m_warnOnNavigationFailure
Be forgiving about the navigation not matching our expectations.
ToolHandle< Trig::TrigDecisionTool > m_tdt
The TrigDecisionTool that will be used to get the navigation.

◆ ~IParticleRetrievalTool()

Trig::IParticleRetrievalTool::~IParticleRetrievalTool ( )
override

Default destructor.

Definition at line 64 of file IParticleRetrievalTool.cxx.

64{}

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 }

◆ 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

◆ getEGammaTEType()

xAOD::Type::ObjectType Trig::IParticleRetrievalTool::getEGammaTEType ( const HLT::TriggerElement * te) const

Get the type of particle that should be retrieved from this TE.

Parameters
egammaTEThe TE to query
Returns
The type of object that caused this TE to fire.

This function should only be called on a TE from a single leg of an EGamma trigger.

Definition at line 226 of file IParticleRetrievalTool.cxx.

228 {
229 // We need to check the TE name for this
230 std::string teName = Trig::getTEName(*te);
231 if (teName.find("etcut") != std::string::npos &&
232 teName.find("trkcut") == std::string::npos)
234 else if (teName.starts_with( "EF_e"))
236 else if (teName.starts_with( "EF_g"))
237 return xAOD::Type::Photon;
238 else
239 return xAOD::Type::Other;
240 }
std::string getTEName(const HLT::TriggerElement &te)
converts TEid to TE name (this may not always work, it depends on the availability of config)
@ Photon
The object is a photon.
Definition ObjectType.h:47
@ Other
An object not falling into any of the other categories.
Definition ObjectType.h:34
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
@ Electron
The object is an electron.
Definition ObjectType.h:46

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

◆ initialize()

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

Initialise the tool.

Reimplemented from asg::AsgTool.

Definition at line 66 of file IParticleRetrievalTool.cxx.

67 {
68 ATH_MSG_INFO("Initializing " << name() );
69 ATH_CHECK( m_tdt.retrieve() );
70 return StatusCode::SUCCESS;
71 }
#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.

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

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

◆ retrieveFeatureParticle()

StatusCode Trig::IParticleRetrievalTool::retrieveFeatureParticle ( const xAOD::IParticle *& particle,
const HLT::TriggerElement::FeatureAccessHelper & feature,
const HLT::TriggerElement * te,
bool & navFailure ) const

Retrieve an IParticle from a feature.

Parameters
[out]particleThe retrieved particle
featureThe feature containing the particle
teThe trigger element containing this feature
[out]navFailureUse to communicate a failure in the navigation without an error.

Expand the typedGet function here

Definition at line 242 of file IParticleRetrievalTool.cxx.

247 {
248 // Get the right container type name
249 std::string containerType;
250 if (!CLIDToContainerType(containerType, feature.getCLID() ) ) {
251 ATH_MSG_ERROR("Unrecognised CLID " << feature.getCLID() << " received!");
252 // This isn't a navigation error - this is a failure in the tool's
253 // internal logic!
254 return StatusCode::FAILURE;
255 }
256 // Build a vector of typeless features so that we can use the central
257 // functions.
258 const HLT::TrigNavStructure* navigation =
259 m_tdt->ExperimentalAndExpertMethods().getNavigation();
260
261
263 auto typelessHolder = navigation->getHolder(feature);
264
265 if (!typelessHolder) {
266 std::string message = "Typeless holder for feature not present!";
267 navFailure = true;
269 ATH_MSG_WARNING(message);
270 return StatusCode::SUCCESS;
271 }
272 else {
273 ATH_MSG_ERROR(message);
274 return StatusCode::FAILURE;
275 }
276 }
277 const xAOD::IParticleContainer* cont(nullptr);
278 // Get the name used in the event store
279 std::string key = HLTNavDetails::formatSGkey(
280 "HLT", containerType, typelessHolder->label() );
281 // Now things are *much* more familiar
283 std::string message = "Store does not contain " + key + "!";
284 navFailure = true;
286 ATH_MSG_WARNING(message);
287 return StatusCode::SUCCESS;
288 }
289 else {
290 ATH_MSG_ERROR(message);
291 return StatusCode::FAILURE;
292 }
293 }
294 ATH_CHECK( evtStore()->retrieve(cont, key) );
295 HLT::TriggerElement::ObjectIndex idx = feature.getIndex();
296 if (cont->size() < idx.objectsEnd() ) {
297 std::ostringstream os;
298 os << "Featured object end " << idx.objectsEnd()
299 << " is *after* the end of container " << key;
300 navFailure = true;
302 ATH_MSG_WARNING( os.str() );
303 return StatusCode::SUCCESS;
304 }
305 else {
306 ATH_MSG_ERROR( os.str() );
307 return StatusCode::FAILURE;
308 }
309 }
310 std::vector<const xAOD::IParticle*> particleFeatures;
311 particleFeatures.reserve(idx.objectsEnd() - idx.objectsBegin() );
312 auto begin = cont->begin();
313 auto end = cont->begin();
314 std::advance(begin, idx.objectsBegin() );
315 std::advance(end, idx.objectsEnd() );
316 particleFeatures.insert(particleFeatures.end(), begin, end);
317
318 // Make sure the answer is what we expect
319 std::ostringstream os;
320 switch (particleFeatures.size() ) {
321 case 0:
322 os << "No particles retrieved from feature "
323 << navigation->label(feature.getCLID(), feature.getIndex().subTypeIndex() )
324 << " from TE " << Trig::getTEName(*te);
325 navFailure = true;
327 ATH_MSG_WARNING(os.str() );
328 return StatusCode::SUCCESS;
329 }
330 else {
331 ATH_MSG_ERROR(os.str() );
332 return StatusCode::FAILURE;
333 }
334 case 1:
335 // Set the output.
336 particle = particleFeatures.at(0);
337 break;
338 default:
339 // Some TEs can end up reporting multiple outputs within the same RoI.
340 // AFAIK this only happens within EGamma TEs but I don't know that for
341 // sure. In any case this shouldn't matter too much for the matching
342 // given that they will be nearby each other. Just return the highest pT
343 // object.
344 particle = *(std::max_element(
345 particleFeatures.begin(), particleFeatures.end(),
346 [] (const xAOD::IParticle* lhs, const xAOD::IParticle* rhs)
347 { return lhs->pt() < rhs->pt(); }) );
348 }
349 return StatusCode::SUCCESS;
350 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
const BaseHolder * getHolder(const TriggerElement::FeatureAccessHelper &fea) const
std::string label(class_id_type clid, const index_or_label_type &sti_or_label) const
const ObjectIndex & getIndex() const
index in the external ojects array
sub_index_type subTypeIndex() const
to get collection index
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
std::string formatSGkey(const std::string &prefix, const std::string &containername, const std::string &label)
declaration of formatting function.
Definition Holder.cxx:122
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.

◆ retrieveParticles() [1/2]

StatusCode Trig::IParticleRetrievalTool::retrieveParticles ( std::vector< const xAOD::IParticle * > & combination,
const HLT::TriggerElement * te,
bool & navFailure ) const

Retrieve particles that caused this trigger element to pass.

Parameters
[out]combinationAll particles that caused this TE to fire.
teThe trigger element to be interrogated.
[out]navFailureUse to communicate a failure in the navigation without an error.

Definition at line 124 of file IParticleRetrievalTool.cxx.

128 {
129 ATH_MSG_DEBUG( "Processing TE " << Trig::getTEName(*te) );
130 // Keep track of whether or not we found a particle here.
131 const xAOD::IParticle* part = nullptr;
132 for (const auto& feature : te->getFeatureAccessHelpers() ) {
134 if (!CLIDToObjectType(type, feature.getCLID() ) )
135 // Skip any features that don't hold 'final' state particles
136 continue;
137 if (type == xAOD::Type::Electron || type == xAOD::Type::Photon) {
138 // If this is an egamma type we have to check if we are meant to be
139 // looking for a CaloCluster instead!
141 if (egType == xAOD::Type::Other) {
142 std::string message =
143 "Unable to determine the correct type for TE " + Trig::getTEName(*te);
144 navFailure = true;
146 ATH_MSG_WARNING( message );
147 return StatusCode::SUCCESS;
148 }
149 else {
150 ATH_MSG_ERROR( message );
151 return StatusCode::FAILURE;
152 }
153 }
154 else if (egType == xAOD::Type::CaloCluster) {
155 HLT::class_id_type clid = 0;
156 ObjectTypeToCLID(clid, egType);
157 // This will be where we store the TE containing the calo cluster
158 // feature
159 const HLT::TriggerElement* sourceTE = nullptr;
160 const HLT::TrigNavStructure* navigation =
161 m_tdt->ExperimentalAndExpertMethods().getNavigation();
162 HLT::TriggerElement::FeatureAccessHelper egFeature =
163 navigation->getFeatureRecursively(te, clid, "", sourceTE);
164 if (!sourceTE) {
165 std::ostringstream os;
166 os << "Unable to retrieve feature of type " << egType
167 << " from TE " << Trig::getTEName(*te);
168 navFailure = true;
170 ATH_MSG_WARNING( os.str() );
171 return StatusCode::SUCCESS;
172 }
173 else {
174 ATH_MSG_ERROR( os.str() );
175 return StatusCode::FAILURE;
176 }
177 }
178 ATH_CHECK( retrieveFeatureParticle(part, egFeature, sourceTE, navFailure) );
179 if (navFailure)
180 return StatusCode::SUCCESS;
181 // If it's a calo-cluster like TE then stop here, otherwise we'll
182 // encounter the other EG type again and fail...
183 break;
184 }
185 else if (egType != type) {
186 // This is the wrong feature to be looking at
187 continue;
188 }
189 // Otherwise we continue as before
190 }
191 // If we found a particle from another feature access helper then this is
192 // a problem. Our assumption is that there is only one particle per leg!
193 if (part) {
194 std::string message = "TE" + Trig::getTEName(*te) + "has multiple " +
195 "'final' particles attached to it! This breaks this tool's asumptions!";
196 navFailure = true;
198 ATH_MSG_WARNING(message);
199 return StatusCode::SUCCESS;
200 }
201 else {
202 ATH_MSG_ERROR(message);
203 return StatusCode::FAILURE;
204 }
205 }
206 ATH_CHECK( retrieveFeatureParticle(part, feature, te, navFailure) );
207 if (navFailure)
208 return StatusCode::SUCCESS;
209 } //> end loop over features
210
211 // If we found a particle then we can stop going through this branch of the
212 // tree
213 if (part) {
214 combination.push_back(part);
215 return StatusCode::SUCCESS;
216 }
217
218 // Otherwise look at each of the next TEs separately
219 for (const HLT::TriggerElement* nextTE :
221 ATH_CHECK( retrieveParticles(combination, nextTE, navFailure) );
222
223 return StatusCode::SUCCESS;
224 }
#define ATH_MSG_DEBUG(x)
TriggerElement::FeatureAccessHelper getFeatureRecursively(const TriggerElement *startTE, class_id_type clid, const index_or_label_type &index_or_label, const TriggerElement *&sourceTE) const
recursive search for features the function is similar to the above butif th features is not found at ...
static const std::vector< TriggerElement * > & getDirectPredecessors(const TriggerElement *te)
returns list of direct predecessors (nodes seeding me)
const std::vector< FeatureAccessHelper > & getFeatureAccessHelpers() const
returns all features which ara attached to this TE
xAOD::Type::ObjectType getEGammaTEType(const HLT::TriggerElement *te) const
Get the type of particle that should be retrieved from this TE.
StatusCode retrieveFeatureParticle(const xAOD::IParticle *&particle, const HLT::TriggerElement::FeatureAccessHelper &feature, const HLT::TriggerElement *te, bool &navFailure) const
Retrieve an IParticle from a feature.
StatusCode retrieveParticles(std::vector< std::vector< const xAOD::IParticle * > > &combinations, const std::string &chain, bool rerun=false) const override
Retrieve the particles that caused this trigger to fire.
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition ObjectType.h:32

◆ retrieveParticles() [2/2]

StatusCode Trig::IParticleRetrievalTool::retrieveParticles ( std::vector< std::vector< const xAOD::IParticle * > > & combinations,
const std::string & chain,
bool rerun = false ) const
overridevirtual

Retrieve the particles that caused this trigger to fire.

Parameters
[out]combinationsAll combinations of particles that could have caused the trigger to fire.
chainThe name of the chain.
rerunWhether to look at the chain in 'rerun' mode. The provided vector will be cleared before use! Note that this also only returns electrons, photons, muons, taus or (for egamma etcut triggers) calo clusters. This tool will not return (b-)jets. For combined (b-)jet+X triggers (where X is one of the above) only the X will be returned. This tool may not work if too much trigger information has been removed.

Implements Trig::IIParticleRetrievalTool.

Definition at line 73 of file IParticleRetrievalTool.cxx.

77 {
78 // Make sure what we're getting is cleared.
79 combinations.clear();
80 // Start by getting the chain group
81 const ChainGroup* cg = m_tdt->getChainGroup(chain);
82 // Make sure that this group actually contains triggers. If it doesn't then
83 // this is very wrong and the job shouldn't be allowed to continue
84 if (cg->getListOfTriggers().size() == 0) {
85 ATH_MSG_ERROR("Chain group " << chain
86 << " is empty! This means that no matching chains were found!");
87 return StatusCode::FAILURE;
88 }
89 unsigned int condition = TrigDefs::Physics;
90 if (rerun)
92 if (!cg->isPassed(condition) ) {
93 ATH_MSG_DEBUG("Chain: " << chain << " was not passed!");
94 return StatusCode::SUCCESS;
95 }
96
97 FeatureContainer features = cg->features(condition);
98 for (const Combination& combo : features.getCombinations() ) {
99 // The assumption here is that each combination represents a *single* way
100 // in which the trigger could have been passed. This should be true for
101 // the types of trigger that this tool expects to examine. It won't be
102 // true for (e.g.) jet triggers.
103 std::vector<const xAOD::IParticle*> currentCombination;
104 bool navFailure = false;
105 for (const HLT::TriggerElement* te : combo.tes() ) {
106 if (!retrieveParticles(currentCombination, te, navFailure).isSuccess() ) {
107 // Interpret a failure this way so that we can report the chain name
108 ATH_MSG_ERROR("Failed to retrieve particles for chain " << chain );
109 return StatusCode::FAILURE;
110 }
111 // If the navigation failed for this combination ignore it completely
112 if (navFailure)
113 break;
114 }
115 if (navFailure)
116 ATH_MSG_WARNING("Skipping combination for chain " << chain
117 << " due to navigation failure");
118 else
119 combinations.push_back(currentCombination);
120 }
121 return StatusCode::SUCCESS;
122 }
combinations(items, n)
Definition combo.py:84

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

ToolHandle<Trig::TrigDecisionTool> Trig::IParticleRetrievalTool::m_tdt
private
Initial value:
{
"Trig::TrigDecisionTool/TrigDecisionTool"}

The TrigDecisionTool that will be used to get the navigation.

Definition at line 88 of file IParticleRetrievalTool.h.

88 {
89 "Trig::TrigDecisionTool/TrigDecisionTool"};

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

◆ m_warnOnNavigationFailure

bool Trig::IParticleRetrievalTool::m_warnOnNavigationFailure
private

Be forgiving about the navigation not matching our expectations.

Definition at line 91 of file IParticleRetrievalTool.h.


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