Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Trig::FeatureContainer Class Reference

#include <FeatureContainer.h>

Collaboration diagram for Trig::FeatureContainer:

Classes

class  ordering_by_objects_attached
 helper class to support ordered set of features More...
 

Public Types

typedef std::vector< Combination >::const_iterator combination_const_iterator
 
template<typename CONTAINER >
using ELEMENT_OF = typename CONTAINER::base_value_type
 

Public Member Functions

 FeatureContainer (const CacheGlobalMemory *cgm=0)
 constructors, destructor More...
 
template<class T >
const std::vector< Trig::Feature< T > > get (const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
 returns flattened vector of Features of given type This method is in fact sullied by 3 arguments. More...
 
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
 
template<typename CONTAINER >
std::vector< Feature< ELEMENT_OF< CONTAINER > > > elementFeature (const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
 
template<typename CONTAINER >
std::vector< Feature< CONTAINER > > containerFeature (const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
 
template<typename CONTAINER >
std::vector< Feature< ELEMENT_OF< CONTAINER > > > flattenedContainerFeature (const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
 
const std::vector< Trig::TypelessFeaturetypelessGet (HLT::class_id_type clid, const std::string &label="", unsigned int condition=TrigDefs::Physics, const std::string &teName="") const
 typeless version of get More...
 
template<class T >
TrigPassFlags getFlags (const Trig::Feature< T > &f, const std::string &flagsLabel="") const
 access to TrigPassFlags for given trigger object or container in given TE More...
 
const std::vector< Trig::Combination > & getCombinations () const
 gives back reference to combinations collected through append More...
 
void addWithChecking (const Combination &newComb)
 add new combination to the container checking for overlap More...
 
void append (const FeatureContainer &other)
 

Private Member Functions

const HLT::TrigNavStructurenavigation () const
 

Private Attributes

std::vector< Trig::Combinationm_combinations
 container preserving insertion order More...
 
std::unordered_set< Trig::Combinationm_combinations_unique
 set for ensuring uniqueness in the above container More...
 
const Trig::CacheGlobalMemorym_cgm {nullptr}
 

Detailed Description

Definition at line 53 of file FeatureContainer.h.

Member Typedef Documentation

◆ combination_const_iterator

Definition at line 69 of file FeatureContainer.h.

◆ ELEMENT_OF

template<typename CONTAINER >
using Trig::FeatureContainer::ELEMENT_OF = typename CONTAINER::base_value_type

Definition at line 94 of file FeatureContainer.h.

Constructor & Destructor Documentation

◆ FeatureContainer()

Trig::FeatureContainer::FeatureContainer ( const CacheGlobalMemory cgm = 0)
inline

constructors, destructor

Definition at line 72 of file FeatureContainer.h.

Member Function Documentation

◆ addWithChecking()

void Trig::FeatureContainer::addWithChecking ( const Combination newComb)

add new combination to the container checking for overlap

Definition at line 19 of file FeatureContainer.cxx.

20 {
21  /* Keep unique combinations and preserve insertion order to guarantee
22  reproducibility. We achieve this by an additional set (faster than doing
23  a linear search in the vector each time). */
24  if (m_combinations_unique.insert(newComb).second) { // true if element was inserted (not known yet)
25  m_combinations.push_back(newComb);
26  }
27 }

◆ append()

void Trig::FeatureContainer::append ( const FeatureContainer other)

Definition at line 29 of file FeatureContainer.cxx.

30 {
31  for(const Trig::Combination& comb : other.m_combinations)
32  addWithChecking(comb);
33 }

◆ containerFeature()

template<typename CONTAINER >
std::vector<Feature<CONTAINER> > Trig::FeatureContainer::containerFeature ( const std::string &  label = "",
unsigned int  condition = TrigDefs::Physics,
const std::string &  teName = "" 
) const
inline

Definition at line 103 of file FeatureContainer.h.

◆ elementFeature()

template<typename CONTAINER >
std::vector<Feature<ELEMENT_OF<CONTAINER> > > Trig::FeatureContainer::elementFeature ( const std::string &  label = "",
unsigned int  condition = TrigDefs::Physics,
const std::string &  teName = "" 
) const
inline

Definition at line 97 of file FeatureContainer.h.

◆ flattenedContainerFeature()

template<typename CONTAINER >
std::vector<Feature<ELEMENT_OF<CONTAINER> > > Trig::FeatureContainer::flattenedContainerFeature ( const std::string &  label = "",
unsigned int  condition = TrigDefs::Physics,
const std::string &  teName = "" 
) const
inline

Definition at line 109 of file FeatureContainer.h.

111  { return m_combinations; }
112 

◆ get()

template<class T >
const std::vector< Trig::Feature< T > > Trig::FeatureContainer::get ( const std::string &  label = "",
unsigned int  condition = TrigDefs::Physics,
const std::string &  teName = "" 
) const

returns flattened vector of Features of given type This method is in fact sullied by 3 arguments.

One of them is type, another is object label and another is eventually TE name.

Parameters
labelis label assigned to feature at HLT algorithm
teNameis name of TE to which the object has to be attached (default is 0 and would suffice for most of applications)

Definition at line 151 of file FeatureContainer.h.

152 {
153  if ( condition != TrigDefs::Physics && condition != TrigDefs::alsoDeactivateTEs ) {
154  throw std::runtime_error("Only two flags can be supplied to features");
155  }
156 
157  //std::cout << " in FC::get, after call to getCombinations(), now looping over them" << std::endl;
158 
159  std::set<Trig::Feature<T>, Trig::FeatureContainer::ordering_by_objects_attached > uniqnessHelper;
160 
161 
162  for(const Trig::Combination& comb : m_combinations ) {
163  //std::cout << " ---- combination has size " << comb.tes().size() << " tes[0] " << comb.tes()[0] << std::endl;
164  // for (std::vector<Trig::Combination>::const_iterator it = m_combinations.begin(); it != m_combinations.end(); ++it){
165  if (condition == TrigDefs::Physics) {
166  if (!comb.active()) continue;
167  }
168  std::vector<Trig::Feature<T> > features = comb.get<T>(label, condition, teName);
169 
170  //typedef std::vector< Trig::Feature<T> > FTV;
171  //typename FTV::const_iterator fIt;
172  //for (fIt = features.begin(); fIt != features.end(); ++fIt ) {
173  for(const Trig::Feature<T>& f : boost::adaptors::reverse(features)) {
174  //std::cout << "in FC::get, insertion of feature " << std::endl;
175  uniqnessHelper.insert(f);
176 
177  }
178  }
179 
180  //std::cout << " in FC::get, at the end: uniqnessHelper size = " << uniqnessHelper.size() << std::endl;
181 
182  return std::vector<Trig::Feature<T> >(uniqnessHelper.begin(), uniqnessHelper.end());
183 
184 }

◆ getCombinations()

const std::vector<Trig::Combination>& Trig::FeatureContainer::getCombinations ( ) const
inline

gives back reference to combinations collected through append

Definition at line 135 of file FeatureContainer.h.

◆ getFlags()

template<class T >
TrigPassFlags Trig::FeatureContainer::getFlags ( const Trig::Feature< T > &  f,
const std::string &  flagsLabel = "" 
) const

access to TrigPassFlags for given trigger object or container in given TE

Parameters
fis the Feature that holds the trigger object (container)
flagsLabelis the label of the TrigPassFlags object

Definition at line 196 of file FeatureContainer.h.

196  {
197 
199 
200  // get the trigPassFlag (only works if the flags are created in the same TE as the objects
201  const TrigPassFlags* flags(0);
202  const HLT::TriggerElement* sourceTE(0);
203  std::string sourceLabel;
204 
205  auto fullnavi = dynamic_cast<const HLT::NavigationCore*>(navigation());
206 
207  bool success = fullnavi->getRecentFeature(f.te(), flags, flagsLabel, sourceTE, sourceLabel);
208 
209  if(!success || !flags) // navigation failed or did not return a flags
210  return pf;
211 
212 
213  return FeatureAccessImpl::getFlags(f, flags, fullnavi);
214 
215 }

◆ getIParticle()

std::vector<Trig::Feature<xAOD::IParticle> > Trig::FeatureContainer::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
inline

Definition at line 86 of file FeatureContainer.h.

◆ navigation()

const HLT::TrigNavStructure * Trig::FeatureContainer::navigation ( ) const
private

Definition at line 37 of file FeatureContainer.cxx.

37  {
38  return m_cgm->navigation();
39 }

◆ typelessGet()

const std::vector< Trig::TypelessFeature > Trig::FeatureContainer::typelessGet ( HLT::class_id_type  clid,
const std::string &  label = "",
unsigned int  condition = TrigDefs::Physics,
const std::string &  teName = "" 
) const

typeless version of get

Parameters
clidmust be pointing directly to stored type (no flattening supported)

Definition at line 92 of file FeatureContainer.cxx.

92  {
93  if ( condition != TrigDefs::Physics && condition != TrigDefs::alsoDeactivateTEs ) {
94  throw std::runtime_error("Only two flags can be supplied to features");
95  }
96 
97  std::set<Trig::TypelessFeature,::order_by_clid_and_index> uniqnessHelper;
98  for(auto& comb : m_combinations ) {
99  if (condition == TrigDefs::Physics) {
100  if (!comb.active()) continue;
101  }
102 
103  std::vector<Trig::TypelessFeature> features = comb.typelessGet(clid, label, condition, teName);
104  for(auto& f : features) {
105  uniqnessHelper.insert(f);
106  }
107  }
108  return std::vector<Trig::TypelessFeature>(uniqnessHelper.begin(), uniqnessHelper.end());
109 }

Member Data Documentation

◆ m_cgm

const Trig::CacheGlobalMemory* Trig::FeatureContainer::m_cgm {nullptr}
private

Definition at line 152 of file FeatureContainer.h.

◆ m_combinations

std::vector<Trig::Combination> Trig::FeatureContainer::m_combinations
private

container preserving insertion order

Definition at line 148 of file FeatureContainer.h.

◆ m_combinations_unique

std::unordered_set<Trig::Combination> Trig::FeatureContainer::m_combinations_unique
private

set for ensuring uniqueness in the above container

Definition at line 150 of file FeatureContainer.h.


The documentation for this class was generated from the following files:
Trig::Feature
Definition: Feature.h:112
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
Trig::FeatureContainer::m_combinations_unique
std::unordered_set< Trig::Combination > m_combinations_unique
set for ensuring uniqueness in the above container
Definition: FeatureContainer.h:150
Trig::FeatureContainer::ordering_by_objects_attached
helper class to support ordered set of features
Definition: FeatureContainer.h:155
navigation2dot.teName
def teName(teid)
Definition: navigation2dot.py:59
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
Trig::FeatureAccessImpl::getFlags
const TrigPassFlags * getFlags(size_t size, const HLT::TriggerElement *te, const std::string &label, const HLT::NavigationCore *navigation)
Definition: FeatureCollectAthena.cxx:39
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
HLT::NavigationCore
The NavigationCore class, adds on top of the TrigNavStructure the EDM read-only handling.
Definition: NavigationCore.h:96
Trig::CacheGlobalMemory::navigation
const HLT::TrigNavStructure * navigation() const
Definition: CacheGlobalMemory.h:104
Trig::Combination
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Combination.h:55
HLT::TriggerElement
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:27
add-xsec-uncert-quadrature-N.label
label
Definition: add-xsec-uncert-quadrature-N.py:104
Trig::FeatureContainer::navigation
const HLT::TrigNavStructure * navigation() const
Definition: FeatureContainer.cxx:37
hist_file_dump.f
f
Definition: hist_file_dump.py:141
Trig::FeatureContainer::m_combinations
std::vector< Trig::Combination > m_combinations
container preserving insertion order
Definition: FeatureContainer.h:148
Trig::FeatureContainer::m_cgm
const Trig::CacheGlobalMemory * m_cgm
Definition: FeatureContainer.h:152
HLT::NavigationCore::getRecentFeature
bool getRecentFeature(const TriggerElement *te, const T *&feature, const std::string &label="", const TriggerElement *&source=::HLT::TrigNavStructure::m_unspecifiedTE, std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
python.output.AtlRunQueryRoot.pf
pf
Definition: AtlRunQueryRoot.py:988
Trig::FeatureContainer::addWithChecking
void addWithChecking(const Combination &newComb)
add new combination to the container checking for overlap
Definition: FeatureContainer.cxx:19
TrigPassFlags
A Flag is an ordered collection of bits (vector<bool>) that can hold additional (boolean) information...
Definition: TrigPassFlags.h:29
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35