ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Trig::IParticleRetrievalTool Class Referencefinalabstract

#include <IParticleRetrievalTool.h>

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

Public Member Functions

 IParticleRetrievalTool (const std::string &name)
 Standard constructor. More...
 
 ~IParticleRetrievalTool () override
 Default destructor. More...
 
StatusCode initialize () override
 Initialise the tool. More...
 
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. More...
 
StatusCode retrieveParticles (std::vector< const xAOD::IParticle * > &combination, const HLT::TriggerElement *te, bool &navFailure) const
 Retrieve particles that caused this trigger element to pass. More...
 
xAOD::Type::ObjectType getEGammaTEType (const HLT::TriggerElement *te) const
 Get the type of particle that should be retrieved from this TE. More...
 
StatusCode retrieveFeatureParticle (const xAOD::IParticle *&particle, const HLT::TriggerElement::FeatureAccessHelper &feature, const HLT::TriggerElement *te, bool &navFailure) const
 Retrieve an IParticle from a feature. More...
 
virtual void print () const =0
 Print the state of the tool. More...
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ToolHandle< Trig::TrigDecisionToolm_tdt
 The TrigDecisionTool that will be used to get the navigation. More...
 
bool m_warnOnNavigationFailure
 Be forgiving about the navigation not matching our expectations. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
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 55 of file IParticleRetrievalTool.cxx.

55  :
57  {
58  declareProperty("TrigDecisionTool", m_tdt,
59  "The trigger decision tool to use.");
60  declareProperty("WarnOnNavigationError", m_warnOnNavigationFailure = true,
61  "Only spit a warning on a navigation error, don't cause a job failure.");
62 
63  }

◆ ~IParticleRetrievalTool()

Trig::IParticleRetrievalTool::~IParticleRetrievalTool ( )
override

Default destructor.

Definition at line 65 of file IParticleRetrievalTool.cxx.

65 {}

Member Function Documentation

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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 227 of file IParticleRetrievalTool.cxx.

229  {
230  // We need to check the TE name for this
231  std::string teName = Trig::getTEName(*te);
232  if (teName.find("etcut") != std::string::npos &&
233  teName.find("trkcut") == std::string::npos)
235  else if (CxxUtils::starts_with (teName, "EF_e"))
236  return xAOD::Type::Electron;
237  else if (CxxUtils::starts_with (teName, "EF_g"))
238  return xAOD::Type::Photon;
239  else
240  return xAOD::Type::Other;
241  }

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

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

Initialise the tool.

Reimplemented from asg::AsgTool.

Definition at line 67 of file IParticleRetrievalTool.cxx.

68  {
69  ATH_MSG_INFO("Initializing " << name() );
70  ATH_CHECK( m_tdt.retrieve() );
71  return StatusCode::SUCCESS;
72  }

◆ 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() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

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

◆ 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() [1/2]

void asg::AsgTool::print ( ) const
virtualinherited

◆ print() [2/2]

virtual void asg::IAsgTool::print ( ) const
pure virtualinherited

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
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 243 of file IParticleRetrievalTool.cxx.

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

◆ 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 125 of file IParticleRetrievalTool.cxx.

129  {
130  ATH_MSG_DEBUG( "Processing TE " << Trig::getTEName(*te) );
131  // Keep track of whether or not we found a particle here.
132  const xAOD::IParticle* part = nullptr;
133  for (const auto& feature : te->getFeatureAccessHelpers() ) {
135  if (!CLIDToObjectType(type, feature.getCLID() ) )
136  // Skip any features that don't hold 'final' state particles
137  continue;
139  // If this is an egamma type we have to check if we are meant to be
140  // looking for a CaloCluster instead!
142  if (egType == xAOD::Type::Other) {
143  std::string message =
144  "Unable to determine the correct type for TE " + Trig::getTEName(*te);
145  navFailure = true;
148  return StatusCode::SUCCESS;
149  }
150  else {
152  return StatusCode::FAILURE;
153  }
154  }
155  else if (egType == xAOD::Type::CaloCluster) {
156  HLT::class_id_type clid = 0;
157  ObjectTypeToCLID(clid, egType);
158  // This will be where we store the TE containing the calo cluster
159  // feature
160  const HLT::TriggerElement* sourceTE = nullptr;
161  const HLT::TrigNavStructure* navigation =
162  m_tdt->ExperimentalAndExpertMethods().getNavigation();
164  navigation->getFeatureRecursively(te, clid, "", sourceTE);
165  if (!sourceTE) {
166  std::ostringstream os;
167  os << "Unable to retrieve feature of type " << egType
168  << " from TE " << Trig::getTEName(*te);
169  navFailure = true;
171  ATH_MSG_WARNING( os.str() );
172  return StatusCode::SUCCESS;
173  }
174  else {
175  ATH_MSG_ERROR( os.str() );
176  return StatusCode::FAILURE;
177  }
178  }
179  ATH_CHECK( retrieveFeatureParticle(part, egFeature, sourceTE, navFailure) );
180  if (navFailure)
181  return StatusCode::SUCCESS;
182  // If it's a calo-cluster like TE then stop here, otherwise we'll
183  // encounter the other EG type again and fail...
184  break;
185  }
186  else if (egType != type) {
187  // This is the wrong feature to be looking at
188  continue;
189  }
190  // Otherwise we continue as before
191  }
192  // If we found a particle from another feature access helper then this is
193  // a problem. Our assumption is that there is only one particle per leg!
194  if (part) {
195  std::string message = "TE" + Trig::getTEName(*te) + "has multiple " +
196  "'final' particles attached to it! This breaks this tool's asumptions!";
197  navFailure = true;
200  return StatusCode::SUCCESS;
201  }
202  else {
204  return StatusCode::FAILURE;
205  }
206  }
207  ATH_CHECK( retrieveFeatureParticle(part, feature, te, navFailure) );
208  if (navFailure)
209  return StatusCode::SUCCESS;
210  } //> end loop over features
211 
212  // If we found a particle then we can stop going through this branch of the
213  // tree
214  if (part) {
215  combination.push_back(part);
216  return StatusCode::SUCCESS;
217  }
218 
219  // Otherwise look at each of the next TEs separately
220  for (const HLT::TriggerElement* nextTE :
222  ATH_CHECK( retrieveParticles(combination, nextTE, navFailure) );
223 
224  return StatusCode::SUCCESS;
225  }

◆ 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 74 of file IParticleRetrievalTool.cxx.

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

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

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.

◆ 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:
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
Trig::IParticleRetrievalTool::getEGammaTEType
xAOD::Type::ObjectType getEGammaTEType(const HLT::TriggerElement *te) const
Get the type of particle that should be retrieved from this TE.
Definition: IParticleRetrievalTool.cxx:227
HLT::TriggerElement::ObjectIndex
Helper class for conversion from/to int stored in TE and pair of ints used in Navigation Object point...
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:75
Trig::getTEName
std::string getTEName(const HLT::TriggerElement &te)
converts TEid to TE name (this may not always work, it depends on the availability of config)
Definition: TDTUtilities.cxx:61
Trig::IParticleRetrievalTool::m_tdt
ToolHandle< Trig::TrigDecisionTool > m_tdt
The TrigDecisionTool that will be used to get the navigation.
Definition: IParticleRetrievalTool.h:88
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
CxxUtils::starts_with
bool starts_with(const char *s, const char *prefix)
Test whether one null-terminated byte string starts with another.
Trig::IParticleRetrievalTool::m_warnOnNavigationFailure
bool m_warnOnNavigationFailure
Be forgiving about the navigation not matching our expectations.
Definition: IParticleRetrievalTool.h:91
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
HLT::TrigNavStructure::label
std::string label(class_id_type clid, const index_or_label_type &sti_or_label) const
Definition: TrigNavStructure.cxx:775
ObjectType
ObjectType
Definition: BaseObject.h:11
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
HLT::TriggerElement::FeatureAccessHelper::getCLID
class_id_type getCLID() const
Class ID of object.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:208
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
navigation2dot.teName
def teName(teid)
Definition: navigation2dot.py:59
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
HLTNavDetails::formatSGkey
std::string formatSGkey(const std::string &prefix, const std::string &containername, const std::string &label)
declaration of formatting function.
Definition: Holder.cxx:122
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
HLT::TrigNavStructure
Definition: TrigNavStructure.h:40
ReweightUtils.message
message
Definition: ReweightUtils.py:15
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
HLT::TriggerElement::ObjectIndex::subTypeIndex
sub_index_type subTypeIndex() const
to get collection index
Definition: TrigNavStructure/Root/TriggerElement.cxx:247
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HLT::TrigNavStructure::getDirectPredecessors
static const std::vector< TriggerElement * > & getDirectPredecessors(const TriggerElement *te)
returns list of direct predecessors (nodes seeding me)
Definition: TrigNavStructure.cxx:120
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HLT::TriggerElement
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:27
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
HLT::class_id_type
uint32_t class_id_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:11
Combination
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trig::IParticleRetrievalTool::retrieveFeatureParticle
StatusCode retrieveFeatureParticle(const xAOD::IParticle *&particle, const HLT::TriggerElement::FeatureAccessHelper &feature, const HLT::TriggerElement *te, bool &navFailure) const
Retrieve an IParticle from a feature.
Definition: IParticleRetrievalTool.cxx:243
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
HLT::TrigNavStructure::getFeatureRecursively
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 ...
Definition: TrigNavStructure.cxx:797
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
python.combo.combinations
def combinations(items, n)
Definition: combo.py:85
a
TList * a
Definition: liststreamerinfos.cxx:10
HLT::TriggerElement::FeatureAccessHelper::getIndex
const ObjectIndex & getIndex() const
index in the external ojects array
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:209
h
HLT::TriggerElement::FeatureAccessHelper
the FeatureAccessHelper is a class used to keep track of features attached to this TE.
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:192
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
HLT::TriggerElement::getFeatureAccessHelpers
const std::vector< FeatureAccessHelper > & getFeatureAccessHelpers() const
returns all features which ara attached to this TE
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:238
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
SG::DataProxy
Definition: DataProxy.h:44
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trig::IParticleRetrievalTool::retrieveParticles
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.
Definition: IParticleRetrievalTool.cxx:74
HLT::TrigNavStructure::getHolder
const BaseHolder * getHolder(const TriggerElement::FeatureAccessHelper &fea) const
Definition: TrigNavStructure.cxx:923
fitman.k
k
Definition: fitman.py:528
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37