ATLAS Offline Software
TrigMatchToolCore.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id$
8 #ifndef TRIGOBJECTMATCHING_TRIGMATCHTOOLCORE_H
9 #define TRIGOBJECTMATCHING_TRIGMATCHTOOLCORE_H
10 
11 #define TRIG_OBJECT_MATCHING_VERSION_1
12 
13 // STL include(s):
14 #include <vector>
15 #include <unordered_map>
16 #include <mutex>
17 
18 // includes for trigger matching framework
23 
24 // includes for navigation access
26 
29 
30 namespace Trig {
31  class FeatureContainer;
32 }
33 
41 
42 private:
43  struct SlotCache;
44 
45 
46 public:
47  // Default constructor and destructor
49  virtual ~TrigMatchToolCore();
50 
51  /**************************************************
52  * Trigger Access Functions *
53  **************************************************/
54 
61  template< typename trigType >
62  std::vector< const trigType* >
63  getTriggerObjects( const std::string& chainName,
64  bool onlyPassedFeatures ) const;
65 
66  /**************************************************
67  * Offline -> Trigger Object matching *
68  **************************************************/
69 
75  template< typename trigType, typename baseType >
76  std::vector< const trigType* >
77  matchToTriggerObjects( const baseType* baseObject,
78  const std::string& chainName,
79  float maxDistance,
80  bool onlyPassedFeatures,
81  const DistanceFunctor< trigType, baseType >* metric ) const;
82 
83  // matching using the default metric - same as above except
84  // will match using deltaR, so no metric is needed
85  template< typename trigType, typename baseType >
86  std::vector< const trigType* >
87  matchToTriggerObjects( const baseType *baseObject,
88  const std::string& chainName,
89  float maxDistance = 0.1,
90  bool onlyPassedFeatures = false ) const;
91 
97  template< typename trigType, typename baseType >
98  const trigType*
99  matchToTriggerObject( const baseType* baseObject,
100  const std::string& chainName,
101  float maxDistance,
102  bool onlyPassedFeatures,
103  const DistanceFunctor< trigType, baseType >* metric ) const;
104 
105  // matching using the default metric - same as above except
106  // will use match using deltaR, so no metric is needed
107  template< typename trigType, typename baseType >
108  const trigType*
109  matchToTriggerObject( const baseType* baseObject,
110  const std::string& chainName,
111  float maxDistance = 0.1,
112  bool onlyPassedFeatures = false ) const;
113 
114  // C++ will happily cast a bool to a float, which means you can
115  // call the above like matchToTriggerObject(object, chain, false)
116  // which is clearly not intended. This will warn people
117  template< typename trigType, typename baseType >
118  const trigType*
119  matchToTriggerObject( const baseType * /*baseObject*/,
120  const std::string& /*chainName*/,
121  bool /*onlyPassedFeatures*/ ) const {
122 
123  this->warning( "You have called matchToTriggerObject incorrectly.");
124  this->warning( "Note that the correct use is: object to match to, "
125  "chainName, maxDistance, onlyPassedFeatures");
126  this->warning( "Your current call is of the form: object to match "
127  "to, chainName, onlyPassedFeatures");
128 
129  return 0;
130  }
131 
140  template< typename trigType, typename baseType >
141  std::vector< const trigType* >
143  const std::string& chainName,
144  float maxDistance,
145  bool onlyBestMatch,
146  bool onlyPassedFeatures,
147  const DistanceFunctor< trigType, baseType >* metric ) const;
148 
149  // matching using the default metric - same as above except
150  // will use match using deltaR, so no metric is needed
151  template< typename trigType, typename baseType >
152  std::vector< const trigType* >
154  const std::string& chainName,
155  float maxDistance = 0.1,
156  bool onlyBestMatch = true,
157  bool onlyPassedFeatures = false ) const;
158 
159  // Versions with std::vector instead of DataVector
160  template< typename trigType, typename baseType >
161  std::vector< const trigType* >
162  matchedTriggerObjects( const std::vector< const baseType* >& baseObjects,
163  const std::string& chainName,
164  float maxDistance,
165  bool onlyBestMatch,
166  bool onlyPassedFeatures,
167  const DistanceFunctor< trigType, baseType > *metric ) const;
168 
169  template< typename trigType, typename baseType >
170  std::vector< const trigType* >
171  matchedTriggerObjects( const std::vector< const baseType* >& baseObjects,
172  const std::string& chainName,
173  float maxDistance = 0.1,
174  bool onlyBestMatch = true,
175  bool onlyPassedFeatures = false ) const;
176 
185  template< typename trigType, typename baseType >
186  std::vector< const trigType* >
188  const std::string& chainName,
189  float maxDistance,
190  bool onlyBestMatch,
191  bool onlyPassedFeatures,
192  const DistanceFunctor< trigType, baseType >* metric ) const;
193 
194  // matching using the default metric - same as above except
195  // will use match using deltaR, so no metric is needed
196  template< typename trigType, typename baseType >
197  std::vector< const trigType* >
199  const std::string& chainName,
200  float maxDistance = 0.1,
201  bool onlyBestMatch = true,
202  bool onlyPassedFeatures = false ) const;
203 
204  // versions with std::vectors instead of DataVectors
205  template< typename trigType, typename baseType >
206  std::vector< const trigType* >
207  unmatchedTriggerObjects( const std::vector<const baseType*>& baseObjects,
208  const std::string& chainName,
209  float maxDistance,
210  bool onlyBestMatch,
211  bool onlyPassedFeatures,
212  const DistanceFunctor< trigType, baseType >* metric ) const;
213 
214  template< typename trigType, typename baseType >
215  std::vector< const trigType* >
216  unmatchedTriggerObjects( const std::vector< const baseType* >& baseObjects,
217  const std::string& chainName,
218  float maxDistance = 0.1,
219  bool onlyBestMatch = true,
220  bool onlyPassedFeatures = false ) const;
221 
222  /**************************************************
223  * Offline -> Trigger Chain matching *
224  **************************************************/
225 
236  template< typename trigType, typename baseType >
237  bool
238  chainPassedByObject( const baseType* baseObject,
239  const std::string& chainName,
240  float maxDistance,
241  const DistanceFunctor< trigType, baseType > *metric ) const;
242 
243  // default metric version - matching will be done via deltaR,
244  // so it is not necessary to supply a metric
245  template< typename trigType, typename baseType >
246  bool
247  chainPassedByObject( const baseType *baseObject,
248  const std::string &chainName,
249  float maxDistance = 0.1 ) const;
250 
261  template< typename trigType, typename baseType >
262  std::vector< std::string >
263  chainsPassedByObject( const baseType* baseObject,
264  float maxDistance,
265  const DistanceFunctor< trigType, baseType >* metric ) const;
266 
267  // default metric version - matching will be done via
268  // deltaR, so a metric is not required
269  template< typename trigType, typename baseType >
270  std::vector< std::string >
271  chainsPassedByObject( const baseType *baseObject,
272  float maxDistance = 0.1 ) const;
273 
274  /**************************************************
275  * Trigger Chain -> Offline matching *
276  **************************************************/
277 
286  template< typename trigType, typename baseType >
287  std::vector< const baseType* >
288  objectsInChain( const std::vector< const baseType* >& baseObjects,
289  const std::string& chainName,
290  bool onlyPassedFeatures,
291  float maxDistance,
292  const DistanceFunctor< trigType, baseType >* metric ) const;
293 
294  // default metric version - matching will be done via deltaR,
295  // and so it is not necessary to supply a metric
296  template< typename trigType, typename baseType >
297  std::vector< const baseType* >
298  objectsInChain( const std::vector< const baseType* >& baseObjects,
299  const std::string& chainName,
300  bool onlyPassedFeatures = false,
301  float maxDistance = 0.1 ) const;
302 
308  template< typename trigType, typename baseType >
309  std::map< const trigType*, std::vector< std::string > >
310  matchToAllTriggerObjects( const baseType* baseObject,
311  float maxDistance,
312  bool onlyPassedFeatures,
313  const DistanceFunctor< trigType, baseType >* metric ) const;
314 
315  // default metric version - matching will be done via deltaR,
316  // and so it is not necessary to supply a metric
317  template< typename trigType, typename baseType >
318  std::map< const trigType*, std::vector< std::string > >
319  matchToAllTriggerObjects( const baseType* baseObject,
320  float maxDistance = 0.1,
321  bool onlyPassedFeatures = false ) const;
322 
323  /**********************************************************/
324  /* Setting running parameters */
325  /**********************************************************/
326  class FeatureLabelHolder;
327 
342  setFeatureLabel( const std::string& label ) {
343  SlotCache& slotCache = *m_slotCache;
344  std::unique_lock<SlotCache::mutex_t> lock (slotCache.m_mutex);
345  slotCache.m_featureLabel = label;
346  slotCache.m_caches = &slotCache.m_cacheMap[label];
347  return FeatureLabelHolder( this, slotCache, std::move(lock) );
348  }
349 
350  // This class does two things for us
351  // (1) It remembers when it was created, so that it can reset the feature label
352  // after it goes out of scope. This prevents users from accidentally setting
353  // the label and then not resetting it properly.
354  // (2) It allows us to overload the operators to make access to the trig match tool
355  // uniform
357 
358  public:
360  SlotCache& slotCache,
361  std::unique_lock<std::recursive_mutex>&& lock)
362  : m_matchTool( matchTool ),
363  m_slotCache( slotCache ),
364  m_lock( std::move (lock) )
365  {}
366 
369  }
370 
372  return m_matchTool;
373  }
374 
376  return m_matchTool;
377  }
378 
379  private:
382  std::unique_lock<std::recursive_mutex> m_lock;
383  }; // class FeatureLabelHolder
384 
385 
386 protected:
389  }
390 
391  // called on end event if we're able to get access to such information
392  virtual void endEvent();
393 
394 
395  // Clear saved chain name -> index mapping and rebuild from current
396  // configuration.
397  void clearChainIndex();
398 
399 
400 private:
401  // Associate from chain name to integer index, and l1l2map.
402  // Methods of this class are thread-safe.
404  {
405  public:
407  size_t chainNameToIndex (const std::string& chainName);
408  std::vector<std::string> configuredChainNames();
409  std::string chainName (size_t index);
410  void clear();
411  std::string propagateChainNames (const std::string& chainName);
412 
413 
414  private:
416 
418  typedef std::lock_guard<mutex_t> lock_t;
419 
421 
423 
424  // List of chain names.
425  // The first m_nConfiguredChainNames are those that come from
426  // the configuration. The remainder are those added for user
427  // queries (they could be regexps).
428  std::vector< std::string > m_chainNames;
430 
431  // Map from chain names to indices.
432  typedef std::unordered_map<std::string, size_t> chainIndexMap_t ;
434 
435  // cache the map from l1 items to the combined l2
436  // string for access in the tdt
437  std::map< std::string, std::string > m_l1l2Map;
438  };
439  mutable ChainNameIndex m_chainNameIndex ATLAS_THREAD_SAFE;
440 
441 
442  // function for printing warnings - note that this depends on whether
443  // you are in ARA or not
444  virtual void warning( const std::string& w ) const = 0;
445 
446  // status functions for determining what information we have access to
447  // This allows the correct caching to take place based upon whether or
448  // not the tool is running in athena. In athena, we can register with
449  // store gate to get call backs when the trig decision changes, but
450  // we cannot get this info in ARA.
451  virtual bool changedDecisionAware() const { return false; };
452 
453  // return configured chain names. Note that
454  // this is different for ARA and athena versions of the tool.
455  virtual std::vector<std::string> getConfiguredChainNames() const = 0;
456 
457  // Functionality for loading the trigger objects from the navigation
458 
459  // Getting a container from the trig decision tool. Note that this is
460  // an abstract function, as the exact method is different for
461  // ARA and Athena.
462  virtual Trig::FeatureContainer
463  getFeatureContainer( const std::string &chainName, const int condition ) const = 0;
464 
465  // determine how to propagate L1 chain names to L2 chain names
466  template< typename trait >
467  std::string propagateChainNames( const std::string& chainName,
468  const trait* ) const
469  {
470  return chainName;
471  }
472  std::string propagateChainNames( const std::string& chainName,
473  const TrigMatch::AncestorAttached* ) const
474  {
475  return this->propagateChainNames( chainName );
476  }
477  virtual std::string propagateChainNames( const std::string& chainName ) const;
478  virtual std::string lowerChainName( const std::string& chainName ) const = 0;
479 
480  // fills objects with the trigger objects from the chain name
481  // with only passed features as desired. Queries cache first
482  // if possible
483  template< typename trigType >
484  void getObjects( std::vector< const trigType* >& objects,
485  const std::string& chainName,
486  bool onlyPassedFeatures ) const;
487 
488  template< typename trigType >
489  void getObjects( std::vector< const trigType* >& objects,
490  size_t chainIndex,
491  bool onlyPassedFeatures ) const;
492 
493  // function for loading objects that are attached directly
494  // to the navigation
495  template< typename trigType >
496  void collectObjects( const std::string& featureLabel,
497  std::vector< const trigType* >& objects,
498  const Trig::FeatureContainer &featureContainer,
499  bool onlyPassedFeatures,
500  const TrigMatch::DirectAttached* ) const;
501 
502  // function for loading objects that are attached as
503  // containers to the navigation
504  template< typename trigType, typename contType >
505  void collectObjects( const std::string& featureLabel,
506  std::vector< const trigType* >& objects,
507  const Trig::FeatureContainer& featureContainer,
508  bool onlyPassedFeatures,
509  const contType* ) const;
510 
511  // function for loading l1 objects from the navigation
512  template<typename trigType>
513  void collectObjects( const std::string& featureLabel,
514  std::vector< const trigType* >& objects,
515  const Trig::FeatureContainer& featureContainer,
516  bool onlyPassedFeatures,
517  const TrigMatch::AncestorAttached* ) const;
518 
519  size_t chainNameToIndex (const std::string& chainName) const;
520 
524  template< typename trigType >
525  std::vector< const trigType* >
526  getTriggerObjects( size_t chainIndex,
527  bool onlyPassedFeatures ) const;
528 
534  template< typename trigType, typename baseType >
535  std::vector< const trigType* >
536  matchToTriggerObjects( const baseType* baseObject,
537  size_t chainIndex,
538  float maxDistance,
539  bool onlyPassedFeatures,
540  const DistanceFunctor< trigType, baseType >* metric ) const;
541 
542  template< typename trigType, typename baseType >
543  bool
544  chainPassedByObject( const baseType* baseObject,
545  size_t chainIndex,
546  float maxDistance,
547  const DistanceFunctor< trigType, baseType > *metric ) const;
548 
549  // cache from chainName and onlyPassedFeatures to std::vector<Trig::Feature<trigType> >
551  public:
553  virtual void clear() = 0;
554  }; // class TrigFeatureCacheBase
555 
556  template<typename trigType>
558  public:
560  {
561  m_size[0] = m_size[1] = 0;
562  }
563 
564  virtual void clear()
565  {
566  for (int i = 0; i < 2; i++) {
567  cacheDatavec_t().swap (m_data[i]);
568  }
569  }
570 
571  bool get (size_t chainIndex,
572  bool onlyPassedFeatures,
573  std::vector< const trigType* >& objects)
574  {
575  cacheDatavec_t& v = m_data[onlyPassedFeatures];
576  if (chainIndex < v.size() && v[chainIndex].valid) {
577  objects = v[chainIndex].data;
578  return true;
579  }
580  return false;
581 
582  }
583 
584  void add( size_t chainIndex,
585  bool onlyPassedFeatures,
586  const std::vector< const trigType* >& data)
587  {
588  cacheDatavec_t& v = m_data[onlyPassedFeatures];
589  if (chainIndex >= v.size()) {
590  size_t& sz = m_size[onlyPassedFeatures];
591  if (chainIndex >= sz)
592  sz = chainIndex + 1;
593  v.resize (sz);
594  }
595  v[chainIndex].valid = true;
596  v[chainIndex].data = data;
597  }
598 
599  private:
600  struct cacheData_t {
601  bool valid;
602  std::vector<const trigType*> data;
603  cacheData_t() : valid(false) {}
604  void clear()
605  {
606  valid = false;
607  std::vector<const trigType*>().swap (data);
608  }
609  };
610  typedef std::vector<cacheData_t> cacheDatavec_t;
612  size_t m_size[2];
613  }; // class TrigFeatureCache
614 
615  // TDT access
617 
618 
619  class TypeMap
620  {
621  public:
622  int key (const std::type_info* tid);
623 
624  private:
626  typedef std::lock_guard<mutex_t> lock_t;
627 
628  typedef std::unordered_map<const std::type_info*, int> typeMap_t;
631  };
632  mutable TypeMap m_typeMap ATLAS_THREAD_SAFE;
633 
634 
635  struct SlotCache
636  {
638  {
639  m_caches = &m_cacheMap[""];
640  }
641 
643  {
644  for (const cacheMap_t::value_type& p : m_cacheMap) {
645  for (TrigFeatureCacheBase* cache : p.second) {
646  delete cache;
647  }
648  }
649  }
650 
651  void clear()
652  {
653  lock_t lock (m_mutex);
654  for (const cacheMap_t::value_type& p : m_cacheMap) {
655  for (TrigFeatureCacheBase* cache : p.second) {
656  cache->clear();
657  }
658  }
659  std::vector<Trig::FeatureContainer>().swap (m_featureContainers);
660  std::vector<bool>().swap (m_featureContainersValid);
661  }
662 
670  {
671  m_featureLabel = "";
672  m_caches = &m_cacheMap[""];
673  }
674 
675  std::string m_featureLabel;
676 
677  typedef std::vector<TrigFeatureCacheBase*> cacheVec_t;
678 
679  // Current cache vector.
681 
682  typedef std::unordered_map<std::string, cacheVec_t> cacheMap_t;
684 
685  std::vector<Trig::FeatureContainer> m_featureContainers;
686  std::vector<bool> m_featureContainersValid;
687  size_t m_nFeatureContainers = 100;
688 
689  typedef std::recursive_mutex mutex_t;
690  typedef std::lock_guard<mutex_t> lock_t;
692  };
694 
695  template <typename trigType>
697  SlotCache& slotCache,
698  const SlotCache::lock_t& lock) const;
699 
700  TrigFeatureCacheBase*& getCache1 (const std::type_info* tid, int type_key,
701  SlotCache& slotCache,
702  const SlotCache::lock_t& lock) const;
703 
705  getCachedFeatureContainer (size_t chainIndex,
706  SlotCache& cache,
707  const SlotCache::lock_t& lock) const;
708 
709 }; // end TrigMatchToolCore declaration
710 
711 // Include the implementation:
713 
714 #endif // TRIGOBJECTMATCHING_TRIGMATCHTOOLCORE_H
TrigMatchToolCore::unmatchedTriggerObjects
std::vector< const trigType * > unmatchedTriggerObjects(const std::vector< const baseType * > &baseObjects, const std::string &chainName, float maxDistance, bool onlyBestMatch, bool onlyPassedFeatures, const DistanceFunctor< trigType, baseType > *metric) const
TrigMatchToolCore::SlotCache::m_featureContainers
std::vector< Trig::FeatureContainer > m_featureContainers
Definition: TrigMatchToolCore.h:685
TrigMatchToolCore::getCache1
TrigFeatureCacheBase *& getCache1(const std::type_info *tid, int type_key, SlotCache &slotCache, const SlotCache::lock_t &lock) const
Definition: TrigMatchToolCore.cxx:47
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TrigMatchToolCore::matchToAllTriggerObjects
std::map< const trigType *, std::vector< std::string > > matchToAllTriggerObjects(const baseType *baseObject, float maxDistance=0.1, bool onlyPassedFeatures=false) const
TrigMatchToolCore::TypeMap::lock_t
std::lock_guard< mutex_t > lock_t
Definition: TrigMatchToolCore.h:626
TrigMatchToolCore::TrigFeatureCacheBase
Definition: TrigMatchToolCore.h:550
TrigMatchToolCore::TypeMap::key
int key(const std::type_info *tid)
Definition: TrigMatchToolCore.cxx:234
fitman.sz
sz
Definition: fitman.py:527
TrigMatchToolCore::matchToTriggerObjects
std::vector< const trigType * > matchToTriggerObjects(const baseType *baseObject, size_t chainIndex, float maxDistance, bool onlyPassedFeatures, const DistanceFunctor< trigType, baseType > *metric) const
matchToTriggerObjects returns the objects of type trigType from chain chainName, which match to baseO...
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
TrigMatchToolCore::SlotCache::m_featureLabel
std::string m_featureLabel
Definition: TrigMatchToolCore.h:675
TrigMatchToolCore::TrigFeatureCache::m_size
size_t m_size[2]
Definition: TrigMatchToolCore.h:612
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:56
TrigMatchToolCore::setTDT
void setTDT(Trig::TrigDecisionToolCore *tdt)
Definition: TrigMatchToolCore.h:387
TrigMatchToolCore::ChainNameIndex::m_mutex
mutex_t m_mutex
Definition: TrigMatchToolCore.h:420
TrigMatchToolCore::TypeMap::m_typeMap
typeMap_t m_typeMap
Definition: TrigMatchToolCore.h:629
TrigMatchToolCore::FeatureLabelHolder::FeatureLabelHolder
FeatureLabelHolder(TrigMatchToolCore *matchTool, SlotCache &slotCache, std::unique_lock< std::recursive_mutex > &&lock)
Definition: TrigMatchToolCore.h:359
TrigMatchToolCore::chainsPassedByObject
std::vector< std::string > chainsPassedByObject(const baseType *baseObject, float maxDistance=0.1) const
Trig
The common trigger namespace for trigger analysis tools.
Definition: CaloTowerVecMon.h:44
TrigMatchToolCore::FeatureLabelHolder::matchTool
TrigMatchToolCore * matchTool() const
Definition: TrigMatchToolCore.h:375
TrigMatchToolCore::ChainNameIndex::propagateChainNames
std::string propagateChainNames(const std::string &chainName)
Definition: TrigMatchToolCore.cxx:187
TrigMatchToolCore::matchedTriggerObjects
std::vector< const trigType * > matchedTriggerObjects(const DataVector< baseType > &baseObjects, const std::string &chainName, float maxDistance=0.1, bool onlyBestMatch=true, bool onlyPassedFeatures=false) const
TrigMatchToolCore::chainsPassedByObject
std::vector< std::string > chainsPassedByObject(const baseType *baseObject, float maxDistance, const DistanceFunctor< trigType, baseType > *metric) const
chainsPassedByObject returns a list of the chains which are marked as passed in the navigation,...
index
Definition: index.py:1
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
TrigMatchToolCore::SlotCache::m_cacheMap
cacheMap_t m_cacheMap
Definition: TrigMatchToolCore.h:683
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
TrigMatchToolCore::TrigFeatureCache::cacheData_t::valid
bool valid
Definition: TrigMatchToolCore.h:601
TrigMatch::AncestorAttached
Definition: TraitDefs.h:34
TrigMatchToolCore::getObjects
void getObjects(std::vector< const trigType * > &objects, size_t chainIndex, bool onlyPassedFeatures) const
TrigMatchToolCore::SlotCache
Definition: TrigMatchToolCore.h:636
TrigMatchToolCore::ChainNameIndex::chainNameToIndex
size_t chainNameToIndex(const std::string &chainName)
Definition: TrigMatchToolCore.cxx:139
TrigMatchToolCore::TrigFeatureCache
Definition: TrigMatchToolCore.h:557
LArDigits2NtupleDumper.tdt
tdt
Definition: LArDigits2NtupleDumper.py:121
TrigMatchToolCore::TrigFeatureCacheBase::~TrigFeatureCacheBase
virtual ~TrigFeatureCacheBase()
Definition: TrigMatchToolCore.h:552
TrigMatchToolCore::TrigFeatureCache::cacheDatavec_t
std::vector< cacheData_t > cacheDatavec_t
Definition: TrigMatchToolCore.h:610
TrigMatchToolCore::SlotCache::cacheVec_t
std::vector< TrigFeatureCacheBase * > cacheVec_t
Definition: TrigMatchToolCore.h:677
TrigMatchToolCore::TrigMatchToolCore
TrigMatchToolCore()
Definition: TrigMatchToolCore.cxx:13
Trig::TrigDecisionToolCore
Definition: TrigDecisionToolCore.h:52
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
TrigMatchToolCore::FeatureLabelHolder::m_lock
std::unique_lock< std::recursive_mutex > m_lock
Definition: TrigMatchToolCore.h:382
TrigMatchToolCore::TypeMap::m_mutex
mutex_t m_mutex
Definition: TrigMatchToolCore.h:630
TrigMatchToolCore::getFeatureContainer
virtual Trig::FeatureContainer getFeatureContainer(const std::string &chainName, const int condition) const =0
TrigMatchToolCore::chainPassedByObject
bool chainPassedByObject(const baseType *baseObject, const std::string &chainName, float maxDistance=0.1) const
TrigMatchToolCore::ChainNameIndex::assertConfiguredChainNames
void assertConfiguredChainNames()
Definition: TrigMatchToolCore.cxx:109
TrigMatchToolCore::chainPassedByObject
bool chainPassedByObject(const baseType *baseObject, const std::string &chainName, float maxDistance, const DistanceFunctor< trigType, baseType > *metric) const
chainPassedByObject returns true if the supplied object matches a trigger object of type trigType in ...
TrigMatchToolCore::setFeatureLabel
TrigMatchToolCore::FeatureLabelHolder setFeatureLabel(const std::string &label)
setFeatureLabel is used to set the label to be used when extracting features from the navigation.
Definition: TrigMatchToolCore.h:342
TrigMatchToolCore::TypeMap::mutex_t
std::mutex mutex_t
Definition: TrigMatchToolCore.h:625
ObjectMatching
ObjectMatching is a base class that performs generic matching of objects using the distance functor f...
Definition: ObjectMatching.h:20
TrigMatchToolCore::matchToTriggerObject
const trigType * matchToTriggerObject(const baseType *, const std::string &, bool) const
Definition: TrigMatchToolCore.h:119
TrigMatchToolCore::ChainNameIndex::m_chainIndexMap
chainIndexMap_t m_chainIndexMap
Definition: TrigMatchToolCore.h:433
TrigMatchToolCore::unmatchedTriggerObjects
std::vector< const trigType * > unmatchedTriggerObjects(const DataVector< baseType > &baseObjects, const std::string &chainName, float maxDistance, bool onlyBestMatch, bool onlyPassedFeatures, const DistanceFunctor< trigType, baseType > *metric) const
unmatchedTriggerObjects returns a vector of trigger objects from chain chainName that do not match to...
Trig::FeatureContainer
Definition: FeatureContainer.h:54
TrigMatchToolCore::changedDecisionAware
virtual bool changedDecisionAware() const
Definition: TrigMatchToolCore.h:451
TrigMatchToolCore::collectObjects
void collectObjects(const std::string &featureLabel, std::vector< const trigType * > &objects, const Trig::FeatureContainer &featureContainer, bool onlyPassedFeatures, const contType *) const
TrigMatchToolCore::ChainNameIndex::configuredChainNames
std::vector< std::string > configuredChainNames()
Definition: TrigMatchToolCore.cxx:156
TrigMatchToolCore::chainNameToIndex
size_t chainNameToIndex(const std::string &chainName) const
Definition: TrigMatchToolCore.cxx:62
TrigMatchToolCore::propagateChainNames
std::string propagateChainNames(const std::string &chainName, const TrigMatch::AncestorAttached *) const
Definition: TrigMatchToolCore.h:472
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition: AthenaKernel/AthenaKernel/SlotSpecificObj.h:70
TrigMatchToolCore::ChainNameIndex::chainIndexMap_t
std::unordered_map< std::string, size_t > chainIndexMap_t
Definition: TrigMatchToolCore.h:432
TrigMatchToolCore::FeatureLabelHolder
Definition: TrigMatchToolCore.h:356
TrigMatchToolCore::TrigFeatureCache::get
bool get(size_t chainIndex, bool onlyPassedFeatures, std::vector< const trigType * > &objects)
Definition: TrigMatchToolCore.h:571
TrigMatchToolCore::collectObjects
void collectObjects(const std::string &featureLabel, std::vector< const trigType * > &objects, const Trig::FeatureContainer &featureContainer, bool onlyPassedFeatures, const TrigMatch::AncestorAttached *) const
TrigMatchToolCore::TypeMap::typeMap_t
std::unordered_map< const std::type_info *, int > typeMap_t
Definition: TrigMatchToolCore.h:628
lumiFormat.i
int i
Definition: lumiFormat.py:92
TrigMatchToolCore::ChainNameIndex::m_chainNames
std::vector< std::string > m_chainNames
Definition: TrigMatchToolCore.h:428
TrigMatchToolCore::ATLAS_THREAD_SAFE
TypeMap m_typeMap ATLAS_THREAD_SAFE
Definition: TrigMatchToolCore.h:632
TrigMatchToolCore::SlotCache::lock_t
std::lock_guard< mutex_t > lock_t
Definition: TrigMatchToolCore.h:690
TrigMatchToolCore::SlotCache::mutex_t
std::recursive_mutex mutex_t
Definition: TrigMatchToolCore.h:689
TrigMatchDefs.h
TrigMatchToolCore::TrigFeatureCache::TrigFeatureCache
TrigFeatureCache()
Definition: TrigMatchToolCore.h:559
TrigMatchToolCore::SlotCache::m_featureContainersValid
std::vector< bool > m_featureContainersValid
Definition: TrigMatchToolCore.h:686
TrigMatchToolCore::ChainNameIndex
Definition: TrigMatchToolCore.h:404
TrigMatchToolCore::matchedTriggerObjects
std::vector< const trigType * > matchedTriggerObjects(const std::vector< const baseType * > &baseObjects, const std::string &chainName, float maxDistance, bool onlyBestMatch, bool onlyPassedFeatures, const DistanceFunctor< trigType, baseType > *metric) const
TrigMatchToolCore::getObjects
void getObjects(std::vector< const trigType * > &objects, const std::string &chainName, bool onlyPassedFeatures) const
TrigMatchToolCore::matchToTriggerObject
const trigType * matchToTriggerObject(const baseType *baseObject, const std::string &chainName, float maxDistance, bool onlyPassedFeatures, const DistanceFunctor< trigType, baseType > *metric) const
matchToTriggerObject returns the object of type trigType from chain chainName, which has the lowest d...
TrigMatchToolCore::collectObjects
void collectObjects(const std::string &featureLabel, std::vector< const trigType * > &objects, const Trig::FeatureContainer &featureContainer, bool onlyPassedFeatures, const TrigMatch::DirectAttached *) const
TrigMatchToolCore::ChainNameIndex::m_l1l2Map
std::map< std::string, std::string > m_l1l2Map
Definition: TrigMatchToolCore.h:437
TrigMatchToolCore::matchToTriggerObjects
std::vector< const trigType * > matchToTriggerObjects(const baseType *baseObject, const std::string &chainName, float maxDistance=0.1, bool onlyPassedFeatures=false) const
DistanceFunctor
Definition: DistanceFunctor.h:11
TrigMatchToolCore::FeatureLabelHolder::m_slotCache
SlotCache & m_slotCache
Definition: TrigMatchToolCore.h:381
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TrigMatchToolCore::endEvent
virtual void endEvent()
Definition: TrigMatchToolCore.cxx:30
TrigMatchToolCore
The TrigMatchToolCore defines the core functionality of the TrigMatchTool and is used for matching tr...
Definition: TrigMatchToolCore.h:40
TrigMatchToolCore::matchToTriggerObjects
std::vector< const trigType * > matchToTriggerObjects(const baseType *baseObject, const std::string &chainName, float maxDistance, bool onlyPassedFeatures, const DistanceFunctor< trigType, baseType > *metric) const
matchToTriggerObjects returns the objects of type trigType from chain chainName, which match to baseO...
TrigMatchToolCore::ChainNameIndex::mutex_t
std::mutex mutex_t
Definition: TrigMatchToolCore.h:417
TrigMatchToolCore::matchToAllTriggerObjects
std::map< const trigType *, std::vector< std::string > > matchToAllTriggerObjects(const baseType *baseObject, float maxDistance, bool onlyPassedFeatures, const DistanceFunctor< trigType, baseType > *metric) const
matchToAllObjects returns a map from matched objects to the chains they were found in.
TrigMatchToolCore::unmatchedTriggerObjects
std::vector< const trigType * > unmatchedTriggerObjects(const std::vector< const baseType * > &baseObjects, const std::string &chainName, float maxDistance=0.1, bool onlyBestMatch=true, bool onlyPassedFeatures=false) const
TrigMatchToolCore::SlotCache::m_caches
cacheVec_t * m_caches
Definition: TrigMatchToolCore.h:680
TrigMatchToolCore::TrigFeatureCache::m_data
cacheDatavec_t m_data[2]
Definition: TrigMatchToolCore.h:611
TrigMatchToolCore::TrigFeatureCacheBase::clear
virtual void clear()=0
TraitDefs.h
TrigMatchToolCore::m_trigDecisionToolCore
Trig::TrigDecisionToolCore * m_trigDecisionToolCore
Definition: TrigMatchToolCore.h:616
TrigMatchToolCore::getTriggerObjects
std::vector< const trigType * > getTriggerObjects(const std::string &chainName, bool onlyPassedFeatures) const
getTriggerObjects returns the objects of the specified type from the specified chain.
TrigMatchToolCore::SlotCache::m_nFeatureContainers
size_t m_nFeatureContainers
Definition: TrigMatchToolCore.h:687
TrigMatchToolCore::propagateChainNames
std::string propagateChainNames(const std::string &chainName, const trait *) const
Definition: TrigMatchToolCore.h:467
python.PyAthena.v
v
Definition: PyAthena.py:157
TrigDecisionToolCore.h
TrigMatchToolCore::TrigFeatureCache::cacheData_t::data
std::vector< const trigType * > data
Definition: TrigMatchToolCore.h:602
TrigMatchToolCore::SlotCache::clear
void clear()
Definition: TrigMatchToolCore.h:651
TrigMatchToolCore::getTriggerObjects
std::vector< const trigType * > getTriggerObjects(size_t chainIndex, bool onlyPassedFeatures) const
Alternate version of getTriggerObjects taking a chain index.
TrigMatchToolCore::TrigFeatureCache::clear
virtual void clear()
Definition: TrigMatchToolCore.h:564
TrigMatchToolCore::clearChainIndex
void clearChainIndex()
Definition: TrigMatchToolCore.cxx:40
TrigMatchToolCore::chainPassedByObject
bool chainPassedByObject(const baseType *baseObject, size_t chainIndex, float maxDistance, const DistanceFunctor< trigType, baseType > *metric) const
DistanceFunctor.h
ObjectMatching.h
TrigMatchToolCore::ChainNameIndex::lock_t
std::lock_guard< mutex_t > lock_t
Definition: TrigMatchToolCore.h:418
TrigMatchToolCore::lowerChainName
virtual std::string lowerChainName(const std::string &chainName) const =0
TrigMatchToolCore::SlotCache::cacheMap_t
std::unordered_map< std::string, cacheVec_t > cacheMap_t
Definition: TrigMatchToolCore.h:682
TrigMatchToolCore::ATLAS_THREAD_SAFE
ChainNameIndex m_chainNameIndex ATLAS_THREAD_SAFE
Definition: TrigMatchToolCore.h:439
TrigMatchToolCore::unmatchedTriggerObjects
std::vector< const trigType * > unmatchedTriggerObjects(const DataVector< baseType > &baseObjects, const std::string &chainName, float maxDistance=0.1, bool onlyBestMatch=true, bool onlyPassedFeatures=false) const
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:353
TrigMatchToolCore::TrigFeatureCache::add
void add(size_t chainIndex, bool onlyPassedFeatures, const std::vector< const trigType * > &data)
Definition: TrigMatchToolCore.h:584
TrigMatchToolCore::FeatureLabelHolder::operator->
TrigMatchToolCore * operator->() const
Definition: TrigMatchToolCore.h:371
TrigMatchToolCore::TypeMap
Definition: TrigMatchToolCore.h:620
TrigMatchToolCore::ChainNameIndex::m_core
TrigMatchToolCore * m_core
Definition: TrigMatchToolCore.h:422
TrigMatch::DirectAttached
Definition: TraitDefs.h:33
TrigMatchToolCore::SlotCache::m_mutex
mutex_t m_mutex
Definition: TrigMatchToolCore.h:691
SlotSpecificObj.h
Maintain a set of objects, one per slot.
TrigMatchToolCore::TrigFeatureCache::cacheData_t
Definition: TrigMatchToolCore.h:600
TrigMatchToolCore::SlotCache::SlotCache
SlotCache()
Definition: TrigMatchToolCore.h:637
TrigMatchToolCore::matchToTriggerObject
const trigType * matchToTriggerObject(const baseType *baseObject, const std::string &chainName, float maxDistance=0.1, bool onlyPassedFeatures=false) const
TrigMatchToolCore::objectsInChain
std::vector< const baseType * > objectsInChain(const std::vector< const baseType * > &baseObjects, const std::string &chainName, bool onlyPassedFeatures, float maxDistance, const DistanceFunctor< trigType, baseType > *metric) const
objectsInChain returns a container of reco objects which match to objects of type trigType in the spe...
TrigMatchToolCore::ChainNameIndex::chainName
std::string chainName(size_t index)
Definition: TrigMatchToolCore.cxx:166
TrigMatchToolCore::TrigFeatureCache::cacheData_t::clear
void clear()
Definition: TrigMatchToolCore.h:604
TrigMatchToolCore::getCachedFeatureContainer
const Trig::FeatureContainer & getCachedFeatureContainer(size_t chainIndex, SlotCache &cache, const SlotCache::lock_t &lock) const
Definition: TrigMatchToolCore.cxx:69
TrigMatchToolCore::FeatureLabelHolder::~FeatureLabelHolder
~FeatureLabelHolder()
Definition: TrigMatchToolCore.h:367
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
TrigMatchToolCore::warning
virtual void warning(const std::string &w) const =0
TrigMatchToolCore::getCache
TrigFeatureCache< trigType > & getCache(int type_key, SlotCache &slotCache, const SlotCache::lock_t &lock) const
TrigMatchToolCore.icc
TrigMatchToolCore::FeatureLabelHolder::m_matchTool
TrigMatchToolCore * m_matchTool
Definition: TrigMatchToolCore.h:380
checker_macros.h
Define macros for attributes used to control the static checker.
TrigMatchToolCore::ATLAS_THREAD_SAFE
SG::SlotSpecificObj< SlotCache > m_slotCache ATLAS_THREAD_SAFE
Definition: TrigMatchToolCore.h:693
TrigMatchToolCore::TrigFeatureCache::cacheData_t::cacheData_t
cacheData_t()
Definition: TrigMatchToolCore.h:603
TrigMatchToolCore::SlotCache::resetFeatureLabel
void resetFeatureLabel()
resetFeatureLabel is used to reset the label to be used when extracting features from the navigation.
Definition: TrigMatchToolCore.h:669
TrigMatchToolCore::getConfiguredChainNames
virtual std::vector< std::string > getConfiguredChainNames() const =0
TrigMatchToolCore::ChainNameIndex::m_nConfiguredChainNames
size_t m_nConfiguredChainNames
Definition: TrigMatchToolCore.h:429
TrigMatchToolCore::SlotCache::~SlotCache
~SlotCache()
Definition: TrigMatchToolCore.h:642
TrigMatchToolCore::matchedTriggerObjects
std::vector< const trigType * > matchedTriggerObjects(const std::vector< const baseType * > &baseObjects, const std::string &chainName, float maxDistance=0.1, bool onlyBestMatch=true, bool onlyPassedFeatures=false) const
TrigMatchToolCore::ChainNameIndex::clear
void clear()
Definition: TrigMatchToolCore.cxx:175
TrigMatchToolCore::matchedTriggerObjects
std::vector< const trigType * > matchedTriggerObjects(const DataVector< baseType > &baseObjects, const std::string &chainName, float maxDistance, bool onlyBestMatch, bool onlyPassedFeatures, const DistanceFunctor< trigType, baseType > *metric) const
matchedTriggerObjects returns a vector of trigger objects from chain chainName that match to one or m...
TrigMatchToolCore::~TrigMatchToolCore
virtual ~TrigMatchToolCore()
Definition: TrigMatchToolCore.cxx:19
TrigMatchToolCore::objectsInChain
std::vector< const baseType * > objectsInChain(const std::vector< const baseType * > &baseObjects, const std::string &chainName, bool onlyPassedFeatures=false, float maxDistance=0.1) const
TrigMatchToolCore::ChainNameIndex::ChainNameIndex
ChainNameIndex(TrigMatchToolCore *core)
Definition: TrigMatchToolCore.cxx:102