ATLAS Offline Software
Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef TRIGGER_DECISION_TOOL_Combination_H
8 #define TRIGGER_DECISION_TOOL_Combination_H
9 
10 /**********************************************************************************
11  * @Project:
12  * @Package: TrigDecision
13  * @class : TrigDecision
14  *
15  * @brief combination of TEs storage
16  *
17  * @author Nicolas Berger <Nicolas.Berger@cern.ch> - LAPP Annecy
18  *
19  ***********************************************************************************/
20 
21 
27 #include <vector>
28 
29 #include "xAODBase/IParticle.h"
31 
32 #if !defined(XAOD_STANDALONE) && !defined(XAOD_ANALYSIS) // Full athena
34 #endif
35 
37 
38 #include "boost/container_hash/hash_fwd.hpp"
39 
40 class HltNaviChecker;
41 
42 namespace Trig {
43 
44  class CacheGlobalMemory;
45 
54  class Combination
55  {
56  public:
57 
58  Combination() = default;
59 
63  Combination(const std::vector<HLT::TriggerElement*>& tes, const Trig::CacheGlobalMemory* cgm);
64 
65 
71  std::vector<Trig::TypelessFeature> typelessGet(HLT::class_id_type clid, const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string & teName = "" ) const;
72 
80  template<class T>
81  std::vector<Trig::Feature<T> > get(const std::string& label = "", unsigned int condition=TrigDefs::Physics, const std::string& teName = "") const;
82 
83 
84  template<typename CONTAINER> using ELEMENT_OF = typename CONTAINER::base_value_type;
85 
91  std::vector<Trig::Feature<xAOD::IParticle> > getIParticle(HLT::class_id_type clid, const std::string& container_name, const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string & teName = "" ) const{
92  auto features = typelessGet(clid,label,condition,teName);
93  return FeatureAccessImpl::typedGet<xAOD::IParticle,xAOD::IParticleContainer,xAOD::IParticleContainer>(features,
94  navigation(),
95  m_cgm->store(),
96  container_name);
97  }
98 
102  template<typename CONTAINER>
103  std::vector<Feature<ELEMENT_OF<CONTAINER> > > elementFeature(const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string& teName = "") const{
105  return FeatureAccessImpl::typedGet<ELEMENT_OF<CONTAINER>,ELEMENT_OF<CONTAINER>,CONTAINER>(features,navigation(),m_cgm->store());
106  }
107 
111  template<typename CONTAINER>
112  std::vector<Feature<CONTAINER> > containerFeature(const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string& teName = "") const{
114  return FeatureAccessImpl::typedGet<CONTAINER,CONTAINER,CONTAINER>(features,navigation(),m_cgm->store());
115  }
116 
120  template<typename CONTAINER>
121  std::vector<Feature<ELEMENT_OF<CONTAINER> > > flattenedContainerFeature(const std::string& label = "", unsigned int condition = TrigDefs::Physics, const std::string& teName = "") const{
123  return FeatureAccessImpl::typedGet<ELEMENT_OF<CONTAINER>,CONTAINER,CONTAINER>(features,navigation(),m_cgm->store());
124  }
125 
129  unsigned int size() const { return m_tes.size(); }
130 
135  bool active() const;
136 
141  const std::vector<const HLT::TriggerElement*>& tes() const {return m_tes; }
142 
147  template<class T>
148  void collect(const HLT::TriggerElement* te, std::vector<Trig::Feature<T> >& data,
149  const std::string& label, unsigned int condition, const std::string& teName) const;
150 
151  bool operator==(const Combination& other) const { return m_tes == other.m_tes; }
152  bool operator<(const Combination& other) const { return m_tes < other.m_tes; }
153 
154 
155  private:
156  friend class ::HltNaviChecker;
157 
158  // helper functionality for collect using traits class to determine how to access
159  // the navigation
160 
161  const HLT::TrigNavStructure* navigation() const;
162 
163  std::vector<const HLT::TriggerElement*> m_tes;
165  };
166 } // EOF namespace Trig
167 
168 
169 template <class T>
170 std::vector<Trig::Feature<T> > Trig::Combination::get(const std::string& label, unsigned int condition, const std::string& teName) const
171 {
172  std::vector<Feature<T> > data;
173 
174 #if !defined(XAOD_STANDALONE) && !defined(XAOD_ANALYSIS) // Full athena
175  for( const HLT::TriggerElement* te : m_tes )
176  FeatureAccessImpl::collect<T>(te, data, label, condition, teName, navigation());
177  for( Feature<T>& f : data ) {
178  if ( f.owned() ) {
179  m_cgm->deleteAtTheEndOfEvent( f.cptr() );
180  }
181  }
182 #else
183  std::cerr << "WARNING: Trig::Combination::get is only available in Athena proper" << std::endl;
184  (void)label;
185  (void)condition;
186  (void)teName;
187 #endif
188  return data;
189 }
190 
191 namespace std {
193  template <>
195  {
196  std::size_t operator()(const Trig::Combination& comb) const {
197  return boost::hash_range(comb.tes().begin(), comb.tes().end());
198  }
199  };
200 }
201 
202 MsgStream& operator<< ( MsgStream& m, const Trig::Combination& c );
203 
204 
205 #endif
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Trig::Feature
Definition: Feature.h:112
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trig::Combination::size
unsigned int size() const
Size of combination.
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:129
IParticle.h
Trig::Combination::m_cgm
const Trig::CacheGlobalMemory * m_cgm
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:164
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
TrigNavStructure.h
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
Feature.h
Trig::CacheGlobalMemory::deleteAtTheEndOfEvent
void deleteAtTheEndOfEvent(T t) const
Definition: CacheGlobalMemory.h:156
navigation2dot.teName
def teName(teid)
Definition: navigation2dot.py:59
Trig::Combination::collect
void collect(const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, const std::string &label, unsigned int condition, const std::string &teName) const
Method used to get objects.
FeatureCollectStandalone.h
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
Trig::CacheGlobalMemory
Definition: CacheGlobalMemory.h:67
Trig::Combination::operator<
bool operator<(const Combination &other) const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:152
Trig::Combination::ELEMENT_OF
typename CONTAINER::base_value_type ELEMENT_OF
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:84
HLT::TrigNavStructure
Definition: TrigNavStructure.h:40
Trig::Combination::navigation
const HLT::TrigNavStructure * navigation() const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/Root/Combination.cxx:35
Trig::Combination::flattenedContainerFeature
std::vector< Feature< ELEMENT_OF< CONTAINER > > > flattenedContainerFeature(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
get container type features flattened as Features (those attached to TE as container of a trigger typ...
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:121
Trig::operator<<
std::ostream & operator<<(std::ostream &, const Trig::TypelessFeature &)
Definition: FeatureCollectStandalone.cxx:18
Trig::CacheGlobalMemory::store
const asg::EventStoreType * store() const
Get the event store that the object is using.
Definition: CacheGlobalMemory.h:139
CacheGlobalMemory.h
Trig::Combination
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:55
IParticleContainer.h
HLT::TriggerElement
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:27
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
std::hash< Trig::Combination >::operator()
std::size_t operator()(const Trig::Combination &comb) const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:196
Trig::Combination::elementFeature
std::vector< Feature< ELEMENT_OF< CONTAINER > > > elementFeature(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
get element type features (those attached to TE as single instance of a trigger type)
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:103
hist_file_dump.f
f
Definition: hist_file_dump.py:135
HLT::class_id_type
uint32_t class_id_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:11
Combination
Trig::Combination::m_tes
std::vector< const HLT::TriggerElement * > m_tes
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:163
Trig::Combination::typelessGet
std::vector< Trig::TypelessFeature > typelessGet(HLT::class_id_type clid, const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
Typeless version of get method.
Definition: Trigger/TrigAnalysis/TrigDecisionTool/Root/Combination.cxx:40
Trig::Combination::tes
const std::vector< const HLT::TriggerElement * > & tes() const
trigger elements in the combination can be used directly with ancestor method
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:141
Trig::Combination::active
bool active() const
Returns the state of the combination i.e.
Definition: Trigger/TrigAnalysis/TrigDecisionTool/Root/Combination.cxx:28
Trig::Combination::containerFeature
std::vector< Feature< CONTAINER > > containerFeature(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
get container type features (those attached to TE as container of a trigger type)
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:112
Trig::Combination::getIParticle
std::vector< Trig::Feature< xAOD::IParticle > > getIParticle(HLT::class_id_type clid, const std::string &container_name, const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
Experimental flattened get for IParticle types.
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:91
Conditions.h
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
Trig::Combination::get
std::vector< Trig::Feature< T > > get(const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
Method used to get objects.
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:170
Trig::Combination::operator==
bool operator==(const Combination &other) const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:151
TypelessFeature.h
FeatureCollectAthena.h
python.compressB64.c
def c
Definition: compressB64.py:93
Trig::Combination::Combination
Combination()=default