ATLAS Offline Software
Loading...
Searching...
No Matches
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
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.
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
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
const std::vector< Trig::Combination > & getCombinations () const
 gives back reference to combinations collected through append
void addWithChecking (const Combination &newComb)
 add new combination to the container checking for overlap
void append (const FeatureContainer &other)

Private Member Functions

const HLT::TrigNavStructurenavigation () const

Private Attributes

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

Detailed Description

Definition at line 41 of file FeatureContainer.h.

Member Typedef Documentation

◆ combination_const_iterator

◆ ELEMENT_OF

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

Definition at line 70 of file FeatureContainer.h.

Constructor & Destructor Documentation

◆ FeatureContainer()

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

constructors, destructor

Definition at line 48 of file FeatureContainer.h.

48: m_cgm(cgm) {}
const Trig::CacheGlobalMemory * m_cgm

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}
std::vector< Trig::Combination > m_combinations
container preserving insertion order
std::unordered_set< Trig::Combination > m_combinations_unique
set for ensuring uniqueness in the above container

◆ 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}
void addWithChecking(const Combination &newComb)
add new combination to the container checking for overlap

◆ 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 79 of file FeatureContainer.h.

79 {
80 auto features = typelessGet(ClassID_traits<CONTAINER>::ID(),label,condition,teName);
82 }
const 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
const HLT::TrigNavStructure * navigation() const
std::string label(const std::string &format, int i)
Definition label.h:19
std::vector< Trig::Feature< REQUESTED > > typedGet(const std::vector< TypelessFeature > &features, const HLT::TrigNavStructure *navigation, const asg::EventStoreType *store, const std::string &container_name=ClassID_traits< CONTAINER >::typeName())

◆ 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 73 of file FeatureContainer.h.

73 {
74 auto features = typelessGet(ClassID_traits<ELEMENT_OF<CONTAINER> >::ID(),label,condition,teName);
76 }
std::vector< Identifier > ID
typename CONTAINER::base_value_type ELEMENT_OF

◆ 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 85 of file FeatureContainer.h.

85 {
86 auto features = typelessGet(ClassID_traits<CONTAINER>::ID(),label,condition,teName);
87 return FeatureAccessImpl::typedGet<ELEMENT_OF<CONTAINER>,CONTAINER,CONTAINER>(features,navigation(),m_cgm->store());
88 }

◆ 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 : std::views::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}
unsigned long long T

◆ getCombinations()

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

gives back reference to combinations collected through append

Definition at line 111 of file FeatureContainer.h.

111{ return m_combinations; }

◆ 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
198 TrigPassFlags pf;
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}
const TrigPassFlags * getFlags(size_t size, const HLT::TriggerElement *te, const std::string &label, const HLT::NavigationCore *navigation)

◆ 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 62 of file FeatureContainer.h.

62 {
63 auto features = typelessGet(clid,label,condition,teName);
65 navigation(),
66 m_cgm->store(),
67 container_name);
68 }

◆ 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 128 of file FeatureContainer.h.

128{nullptr};

◆ m_combinations

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

container preserving insertion order

Definition at line 124 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 126 of file FeatureContainer.h.


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