ATLAS Offline Software
Loading...
Searching...
No Matches
Trig::FeatureAccessImpl Namespace Reference

This is the implementation of the Feature collection for Athena. More...

Classes

struct  false_type
struct  get_type
struct  get_type< false >
struct  get_type< true >
struct  getFlagsHelper
struct  getFlagsHelper< T, STORED, false >
struct  getFlagsHelper< T, STORED, true >
struct  insert_and_flatten
struct  isDataVector
struct  print_features
struct  true_type

Functions

HLT::TriggerElement::FeatureAccessHelper getTypelessBits (const HLT::TriggerElement *te, const HLT::TrigNavStructure *navigation)
void typelessCollect (const HLT::TriggerElement *te, HLT::class_id_type clid, std::vector< Trig::TypelessFeature > &data, const std::string &label, unsigned int condition, const HLT::TrigNavStructure *navigation)
const TrigPassBitsgetBits (size_t sz, const HLT::TriggerElement *te, const std::string &, const HLT::NavigationCore *navigation)
const TrigPassFlagsgetFlags (size_t size, const HLT::TriggerElement *te, const std::string &label, const HLT::NavigationCore *navigation)
template<class T>
void l1collect (const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, unsigned int condition, const std::vector< T > &(LVL1_ROI::*method)() const, const HLT::TrigNavStructure *navstructure)
template<>
void collect< Muon_ROI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< Muon_ROI > > &data, const std::string &, unsigned int condition, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< EmTau_ROI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< EmTau_ROI > > &data, const std::string &, unsigned int condition, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< Jet_ROI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< Jet_ROI > > &data, const std::string &, unsigned int condition, const std::string &, const HLT::TrigNavStructure *navigation)
template<typename ROI, typename ROICONTAINER>
void xAODcollect (const HLT::TriggerElement *te, std::vector< Trig::Feature< ROI > > &data, unsigned int condition, const HLT::TrigNavStructure *navstructure, const std::string &sgkey)
template<>
void collect< xAOD::EmTauRoI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< xAOD::EmTauRoI > > &data, const std::string &, unsigned int condition, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< xAOD::MuonRoI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< xAOD::MuonRoI > > &data, const std::string &, unsigned int condition, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< xAOD::JetRoI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< xAOD::JetRoI > > &data, const std::string &, unsigned int condition, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
TrigPassFlags getFlags (const Trig::Feature< EmTau_ROI > &, const TrigPassFlags *, HLT::NavigationCore *)
template<>
TrigPassFlags getFlags (const Trig::Feature< Muon_ROI > &, const TrigPassFlags *, HLT::NavigationCore *)
template<>
TrigPassFlags getFlags (const Trig::Feature< Jet_ROI > &, const TrigPassFlags *, HLT::NavigationCore *)
template<class T>
const std::enable_if<!isDataVector< T >::value, T >::typeuse_or_construct (const T *source, const HLT::TriggerElement *, const std::string &, unsigned int, const HLT::NavigationCore *)
template<class T>
const std::enable_if< isDataVector< T >::value, T >::typeuse_or_construct (const T *source, const HLT::TriggerElement *te, const std::string &label, unsigned int condition, const HLT::NavigationCore *navigation)
template<class T>
void collect (const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, const std::string &label, unsigned int condition, const std::string &teName, const HLT::TrigNavStructure *navstructure)
 actual feature acceess implementation It has (thanks to the ClassTraits) functionality to flatten containers of containers.
template<>
void collect< Muon_ROI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< Muon_ROI > > &data, const std::string &, unsigned int, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< EmTau_ROI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< EmTau_ROI > > &data, const std::string &, unsigned int, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< Jet_ROI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< Jet_ROI > > &data, const std::string &, unsigned int, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< xAOD::EmTauRoI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< xAOD::EmTauRoI > > &data, const std::string &, unsigned int, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< xAOD::MuonRoI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< xAOD::MuonRoI > > &data, const std::string &, unsigned int, const std::string &, const HLT::TrigNavStructure *navigation)
template<>
void collect< xAOD::JetRoI > (const HLT::TriggerElement *te, std::vector< Trig::Feature< xAOD::JetRoI > > &data, const std::string &, unsigned int, const std::string &, const HLT::TrigNavStructure *navigation)
template<class CONT>
TrigPassFlags build_flags (const typename std::enable_if< isDataVector< CONT >::value, CONT >::type *orig_cont, const CONT *cont, const TrigPassFlags *orig_tpf)
template<class T>
TrigPassFlags build_flags (const typename std::enable_if<!isDataVector< T >::value, T >::type *orig, const T *feature, const TrigPassFlags *orig_tpf)
template<class T, class STORED>
TrigPassFlags build_flags2 (const STORED *orig_cont, const T *obj, const TrigPassFlags *orig_tpf)
template<class T>
TrigPassFlags getFlags (const Trig::Feature< T > &f, const TrigPassFlags *orig_tpf, HLT::NavigationCore *navigation)
template<>
TrigPassFlags getFlags (const Trig::Feature< EmTau_ROI > &f, const TrigPassFlags *orig_tpf, HLT::NavigationCore *navigation)
template<>
TrigPassFlags getFlags (const Trig::Feature< Muon_ROI > &f, const TrigPassFlags *orig_tpf, HLT::NavigationCore *navigation)
template<>
TrigPassFlags getFlags (const Trig::Feature< Jet_ROI > &f, const TrigPassFlags *orig_tpf, HLT::NavigationCore *navigation)
template<typename REQUESTED, typename STORED, typename CONTAINER>
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())
template<typename STORED, typename REQUESTED>
void insert_element (std::vector< Trig::Feature< REQUESTED > > &, Trig::TypelessFeature &, const STORED *)
template<typename REQUESTED>
void insert_element (std::vector< Trig::Feature< REQUESTED > > &result, Trig::TypelessFeature &feature, const REQUESTED *element)
template<typename STORED>
void insert_flatten_if (std::vector< Trig::Feature< STORED > > &result, const Trig::TypelessFeature &feature, const std::shared_ptr< const STORED > &newfeature)
template<typename REQUESTED, typename STORED>
void insert_flatten_if (std::vector< Trig::Feature< REQUESTED > > &result, const Trig::TypelessFeature &feature, const std::shared_ptr< const STORED > &newfeature)
template<typename STORED>
std::shared_ptr< const STORED > filter_if (std::true_type is_same, std::shared_ptr< const STORED > &original, const TrigPassBits *bits)
template<typename STORED>
std::shared_ptr< const STORED > filter_if (std::false_type, std::shared_ptr< const STORED > &original, const TrigPassBits *)

Detailed Description

This is the implementation of the Feature collection for Athena.

This is the implementation of the Feature collection for ASG.

Function Documentation

◆ build_flags() [1/2]

template<class CONT>
TrigPassFlags Trig::FeatureAccessImpl::build_flags ( const typename std::enable_if< isDataVector< CONT >::value, CONT >::type * orig_cont,
const CONT * cont,
const TrigPassFlags * orig_tpf )

Definition at line 344 of file FeatureCollectAthena.h.

344 {
345 TrigPassFlags tpf(cont->size(), orig_tpf->flagSize());
346
347 if(orig_cont->size() != orig_tpf->size()) {
348 //std::cout << "WARNING: original constainer size (" << orig_cont->size() << ") different for size of TrigPassFlags (" << orig_tpf->size() << ")." << std::endl;
349 return tpf;
350 }
351
352 unsigned int currentPos=0;
353 for(const typename CONT::base_value_type* obj : *cont) {
354 typename CONT::const_iterator orig_obj = std::find(orig_cont->begin(),orig_cont->end(),obj);
355
356 if(orig_obj == orig_cont->end()) {
357 //std::cout << "WARNING: object in reduced container can' be found in original." << std::endl;
358 } else {
359 size_t idx = orig_obj-orig_cont->begin();
360 tpf.setFlag(currentPos, orig_tpf->getFlag(idx));
361 }
362 currentPos++;
363 }
364
365 return tpf;
366 }
A Flag is an ordered collection of bits (vector<bool>) that can hold additional (boolean) information...
unsigned int flagSize() const
gets size of the flag vector for the object at index
const std::vector< bool > & getFlag(const unsigned int position) const
Returns the flag (vector<bool>) at index position.
unsigned int size() const
gets size of the container object vector

◆ build_flags() [2/2]

template<class T>
TrigPassFlags Trig::FeatureAccessImpl::build_flags ( const typename std::enable_if<!isDataVector< T >::value, T >::type * orig,
const T * feature,
const TrigPassFlags * orig_tpf )

Definition at line 370 of file FeatureCollectAthena.h.

370 {
371 if(orig != feature) return TrigPassFlags(); // a problem TODO: print a ERROR
372
373 TrigPassFlags tpf(1, orig_tpf->flagSize());
374 tpf.setFlag(0,orig_tpf->getFlag(0));
375 return tpf;
376 }

◆ build_flags2()

template<class T, class STORED>
TrigPassFlags Trig::FeatureAccessImpl::build_flags2 ( const STORED * orig_cont,
const T * obj,
const TrigPassFlags * orig_tpf )

Definition at line 382 of file FeatureCollectAthena.h.

383 {
384 if(orig_cont->size() != orig_tpf->size()) {
385 //std::cout << "WARNING: original constainer size (" << orig_cont->size() << ") different for size of TrigPassFlags (" << orig_tpf->size() << ")." << std::endl;
386 return TrigPassFlags();
387 }
388
389 TrigPassFlags tpf(1, orig_tpf->flagSize());
390
391 typename STORED::const_iterator orig_obj = std::find(orig_cont->begin(),orig_cont->end(), obj);
392
393 if(orig_obj == orig_cont->end()) {
394 //std::cout << "WARNING: object in reduced container can' be found in original." << std::endl;
395 } else {
396 size_t idx = orig_obj-orig_cont->begin();
397 tpf.setFlag(0, orig_tpf->getFlag(idx));
398 }
399 return tpf;
400 }

◆ collect()

template<class T>
void Trig::FeatureAccessImpl::collect ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< T > > & data,
const std::string & label,
unsigned int condition,
const std::string & teName,
const HLT::TrigNavStructure * navstructure )

actual feature acceess implementation It has (thanks to the ClassTraits) functionality to flatten containers of containers.

Definition at line 281 of file FeatureCollectAthena.h.

282 {
283
284 auto navigation = dynamic_cast<const HLT::NavigationCore*>(navstructure);
285
286 //std::cout << "Collecting " << label << " for TE " << te << std::endl;
287
288 if (condition == TrigDefs::Physics && !te->getActiveState() ) return;
289 const HLT::TriggerElement* sourceTE(0);
290 std::string sourceLabel;
291
292
293 bool result = true;
294#ifndef __GCCXML__
295 //typedef typename Features2Container<T>::type container_type;
296 typedef typename Features2Object<T>::type object_type;
297 typedef typename Object2Features<object_type>::type feature_list;
298 get_links<T,TypeInfo_EDM> link_getter( te, &data, label, condition, teName, navigation, &result, &sourceTE);
300#endif
301
302 if (result){/*do nothing anymore*/
303 } else {
304 // getRecentFeature returned false -> bifurcation?
305 const std::vector<HLT::TriggerElement*> bif_tes = navigation->getDirectPredecessors(sourceTE);
306 if ( bif_tes.size() <= 1 ) {
307 return; // that means it is plain error (it will be printed by the Navigation)
308 } else {
309 // bifurcation point
310 for( const HLT::TriggerElement* predecesor_te : bif_tes )
311 collect(predecesor_te, data, label, condition, teName, navigation);
312 }
313 }
314 //std::cout << "Size after collecting " << data.size() << std::endl;
315 }
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
The NavigationCore class, adds on top of the TrigNavStructure the EDM read-only handling.
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
bool getActiveState() const
get state of the TriggerElement
std::string label(const std::string &format, int i)
Definition label.h:19
void collect(const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, const std::string &label, unsigned int condition, const std::string &teName, const HLT::TrigNavStructure *navstructure)
actual feature acceess implementation It has (thanks to the ClassTraits) functionality to flatten con...
master_search< typenameEDMLIST::map, HLT::TypeInformation::get_feat, FEATURE >::result::search_result::object type
master_search< typenameEDMLIST::map, HLT::TypeInformation::get_objt, OBJECT >::result::search_result::list_of_features type

◆ collect< EmTau_ROI >() [1/2]

template<>
void Trig::FeatureAccessImpl::collect< EmTau_ROI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< EmTau_ROI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 83 of file FeatureCollectAthena.cxx.

83 {
84 l1collect<EmTau_ROI>(te, data, condition, &LVL1_ROI::getEmTauROIs, navigation);
85 }
const emtaus_type & getEmTauROIs() const
Get all the em/tau RoIs in the event.
Definition LVL1_ROI.h:65
void l1collect(const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, unsigned int condition, const std::vector< T > &(LVL1_ROI::*method)() const, const HLT::TrigNavStructure *navstructure)

◆ collect< EmTau_ROI >() [2/2]

template<>
void Trig::FeatureAccessImpl::collect< EmTau_ROI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< EmTau_ROI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 83 of file FeatureCollectAthena.cxx.

83 {
84 l1collect<EmTau_ROI>(te, data, condition, &LVL1_ROI::getEmTauROIs, navigation);
85 }

◆ collect< Jet_ROI >() [1/2]

template<>
void Trig::FeatureAccessImpl::collect< Jet_ROI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< Jet_ROI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 88 of file FeatureCollectAthena.cxx.

88 {
89 l1collect<Jet_ROI>(te, data, condition, &LVL1_ROI::getJetROIs, navigation);
90 }
const jets_type & getJetROIs() const
Get all the jet RoIs in the event.
Definition LVL1_ROI.h:67

◆ collect< Jet_ROI >() [2/2]

template<>
void Trig::FeatureAccessImpl::collect< Jet_ROI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< Jet_ROI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 88 of file FeatureCollectAthena.cxx.

88 {
89 l1collect<Jet_ROI>(te, data, condition, &LVL1_ROI::getJetROIs, navigation);
90 }

◆ collect< Muon_ROI >() [1/2]

template<>
void Trig::FeatureAccessImpl::collect< Muon_ROI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< Muon_ROI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 78 of file FeatureCollectAthena.cxx.

78 {
79 l1collect<Muon_ROI>(te, data, condition, &LVL1_ROI::getMuonROIs, navigation);
80 }
const muons_type & getMuonROIs() const
Get all the muon RoIs in the event.
Definition LVL1_ROI.h:63

◆ collect< Muon_ROI >() [2/2]

template<>
void Trig::FeatureAccessImpl::collect< Muon_ROI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< Muon_ROI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 78 of file FeatureCollectAthena.cxx.

78 {
79 l1collect<Muon_ROI>(te, data, condition, &LVL1_ROI::getMuonROIs, navigation);
80 }

◆ collect< xAOD::EmTauRoI >() [1/2]

template<>
void Trig::FeatureAccessImpl::collect< xAOD::EmTauRoI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< xAOD::EmTauRoI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 126 of file FeatureCollectAthena.cxx.

126 {
127 xAODcollect<xAOD::EmTauRoI,xAOD::EmTauRoIContainer>(te, data, condition, navigation,"LVL1EmTauRoIs");
128 }
void xAODcollect(const HLT::TriggerElement *te, std::vector< Trig::Feature< ROI > > &data, unsigned int condition, const HLT::TrigNavStructure *navstructure, const std::string &sgkey)

◆ collect< xAOD::EmTauRoI >() [2/2]

template<>
void Trig::FeatureAccessImpl::collect< xAOD::EmTauRoI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< xAOD::EmTauRoI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 126 of file FeatureCollectAthena.cxx.

126 {
127 xAODcollect<xAOD::EmTauRoI,xAOD::EmTauRoIContainer>(te, data, condition, navigation,"LVL1EmTauRoIs");
128 }

◆ collect< xAOD::JetRoI >() [1/2]

template<>
void Trig::FeatureAccessImpl::collect< xAOD::JetRoI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< xAOD::JetRoI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 136 of file FeatureCollectAthena.cxx.

136 {
137 xAODcollect<xAOD::JetRoI,xAOD::JetRoIContainer>(te, data, condition, navigation,"LVL1JetRoIs");
138 }

◆ collect< xAOD::JetRoI >() [2/2]

template<>
void Trig::FeatureAccessImpl::collect< xAOD::JetRoI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< xAOD::JetRoI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 136 of file FeatureCollectAthena.cxx.

136 {
137 xAODcollect<xAOD::JetRoI,xAOD::JetRoIContainer>(te, data, condition, navigation,"LVL1JetRoIs");
138 }

◆ collect< xAOD::MuonRoI >() [1/2]

template<>
void Trig::FeatureAccessImpl::collect< xAOD::MuonRoI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< xAOD::MuonRoI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 131 of file FeatureCollectAthena.cxx.

131 {
132 xAODcollect<xAOD::MuonRoI,xAOD::MuonRoIContainer>(te, data, condition, navigation,"LVL1MuonRoIs");
133 }

◆ collect< xAOD::MuonRoI >() [2/2]

template<>
void Trig::FeatureAccessImpl::collect< xAOD::MuonRoI > ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< xAOD::MuonRoI > > & data,
const std::string & ,
unsigned int condition,
const std::string & ,
const HLT::TrigNavStructure * navigation )

Definition at line 131 of file FeatureCollectAthena.cxx.

131 {
132 xAODcollect<xAOD::MuonRoI,xAOD::MuonRoIContainer>(te, data, condition, navigation,"LVL1MuonRoIs");
133 }

◆ filter_if() [1/2]

template<typename STORED>
std::shared_ptr< const STORED > Trig::FeatureAccessImpl::filter_if ( std::false_type ,
std::shared_ptr< const STORED > & original,
const TrigPassBits *  )

Definition at line 122 of file FeatureCollectStandalone.h.

122 {
123 //nothing
124 return original;
125 }

◆ filter_if() [2/2]

template<typename STORED>
std::shared_ptr< const STORED > Trig::FeatureAccessImpl::filter_if ( std::true_type is_same,
std::shared_ptr< const STORED > & original,
const TrigPassBits * bits )

Definition at line 97 of file FeatureCollectStandalone.h.

97 {
98 (void)is_same;
99
100
101 if(bits==nullptr){
102 std::cerr << "WARNING: nullptr TrigPassBits" << std::endl;
103 return original;
104 }
105 if(original->size() != bits->size()){
106 std::cerr << "WARNING: bits size and owned size" << std::endl;
107 return original;
108 }
110
111 for(auto obj : *original){
112 if(HLT::isPassing(bits,obj,original.get())){
113 f->push_back(obj);
114 }
115 }
116 //manage the memory
117 std::shared_ptr<const STORED> filtered(f->asDataVector());
118 return filtered;
119 }
DataVector adapter that acts like it holds const pointers.
unsigned int size() const
gets size of the bits array
bool isPassing(const TrigPassBits *bits, const T *obj, const CONTAINER *container)
Check the bit for the object in the associated bits object.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts

◆ getBits()

const TrigPassBits * Trig::FeatureAccessImpl::getBits ( size_t sz,
const HLT::TriggerElement * te,
const std::string & ,
const HLT::NavigationCore * navigation )

Definition at line 21 of file FeatureCollectAthena.cxx.

21 {
22 if (!sz)
23 return 0;
24
25 const TrigPassBits* bits(0);
26
27 if ( navigation->getFeature(te, bits, "passbits" ) ){
28 // We have to apply (vague) verification if there are any bits and that they match the feature container
29 // this is if there are any bits,
30 // if so that they come from the same TE
31 // if so that they match by size
32
33 if ( bits && sz == bits->size() )
34 return bits; // they are good and can be used
35 }
36 return 0; // bits recording was problematic (Navigation will complain bitterly, no need to handle it here).
37 }
static Double_t sz
bool getFeature(const TriggerElement *te, const T *&features, const std::string &label="", std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const

◆ getFlags() [1/8]

template<>
TrigPassFlags Trig::FeatureAccessImpl::getFlags ( const Trig::Feature< EmTau_ROI > & f,
const TrigPassFlags * orig_tpf,
HLT::NavigationCore * navigation )

Definition at line 142 of file FeatureCollectAthena.cxx.

142 {
143 return TrigPassFlags();
144 }

◆ getFlags() [2/8]

template<>
TrigPassFlags Trig::FeatureAccessImpl::getFlags ( const Trig::Feature< EmTau_ROI > & f,
const TrigPassFlags * orig_tpf,
HLT::NavigationCore * navigation )

Definition at line 142 of file FeatureCollectAthena.cxx.

142 {
143 return TrigPassFlags();
144 }

◆ getFlags() [3/8]

template<>
TrigPassFlags Trig::FeatureAccessImpl::getFlags ( const Trig::Feature< Jet_ROI > & f,
const TrigPassFlags * orig_tpf,
HLT::NavigationCore * navigation )

Definition at line 150 of file FeatureCollectAthena.cxx.

150 {
151 return TrigPassFlags();
152 }

◆ getFlags() [4/8]

template<>
TrigPassFlags Trig::FeatureAccessImpl::getFlags ( const Trig::Feature< Jet_ROI > & f,
const TrigPassFlags * orig_tpf,
HLT::NavigationCore * navigation )

Definition at line 150 of file FeatureCollectAthena.cxx.

150 {
151 return TrigPassFlags();
152 }

◆ getFlags() [5/8]

template<>
TrigPassFlags Trig::FeatureAccessImpl::getFlags ( const Trig::Feature< Muon_ROI > & f,
const TrigPassFlags * orig_tpf,
HLT::NavigationCore * navigation )

Definition at line 146 of file FeatureCollectAthena.cxx.

146 {
147 return TrigPassFlags();
148 }

◆ getFlags() [6/8]

template<>
TrigPassFlags Trig::FeatureAccessImpl::getFlags ( const Trig::Feature< Muon_ROI > & f,
const TrigPassFlags * orig_tpf,
HLT::NavigationCore * navigation )

Definition at line 146 of file FeatureCollectAthena.cxx.

146 {
147 return TrigPassFlags();
148 }

◆ getFlags() [7/8]

template<class T>
TrigPassFlags Trig::FeatureAccessImpl::getFlags ( const Trig::Feature< T > & f,
const TrigPassFlags * orig_tpf,
HLT::NavigationCore * navigation )

Definition at line 428 of file FeatureCollectAthena.h.

428 {
429
430 typedef typename TrigDec::ClassTraits<T>::type STORED;
431
432 const STORED* orig(0);
433 const HLT::TriggerElement* sourceTE(0);
434 std::string sourceLabel("");
435 if (navigation->getRecentFeature(f.te(), orig, f.label(), sourceTE, sourceLabel)) {
436 TrigPassFlags tpf = getFlagsHelper<T,STORED, std::is_same<T,STORED>::value>::do_build(orig, f.cptr(), orig_tpf);
437 return tpf;
438 }
439 return TrigPassFlags();
440
441 }
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

◆ getFlags() [8/8]

const TrigPassFlags * Trig::FeatureAccessImpl::getFlags ( size_t size,
const HLT::TriggerElement * te,
const std::string & label,
const HLT::NavigationCore * navigation )

Definition at line 39 of file FeatureCollectAthena.cxx.

39 {
40 if(size==0) return 0;
41
42 const TrigPassFlags* flags(0);
43 if(navigation->getFeature(te, flags, label) && flags && flags->size()==size)
44 return flags;
45
46 return 0;
47 }

◆ getTypelessBits()

HLT::TriggerElement::FeatureAccessHelper Trig::FeatureAccessImpl::getTypelessBits ( const HLT::TriggerElement * te,
const HLT::TrigNavStructure * navigation )

Definition at line 26 of file FeatureCollectStandalone.cxx.

26 {
27
28 //completely disabled for now. should be reenabled once we have more recent TNS tag in Athena
30 #ifndef XAOD_STANDALONE
31 answer = navigation->getFeature(te,ClassID_traits<TrigPassBits>::ID(),"passbits");
32 #else
33 (void)te;
34 (void)navigation;
35 #endif
36
37
38 if(answer.valid()){
39#ifdef XAOD_STANDALONE // AnalysisBase
40 // In AnalysisBase we can't access TrigPassBits. So warn the user about
41 // this, and pretend that no TrigPassBits is available for this element.
42 static bool warningPrinted = false;
43 if( ! warningPrinted ) {
44 std::cerr << "FeatureAccessImpl::getTypelessBits WARNING "
45 << "Retrieving a container that has TrigPassBits attached "
46 << "to it" << std::endl;
47 std::cerr << "FeatureAccessImpl::getTypelessBits WARNING "
48 << "But it's not possible to use TrigPassBits in "
49 << "standalone mode" << std::endl;
50 std::cerr << "FeatureAccessImpl::getTypelessBits WARNING "
51 << "So, keep in mind that some of the returned objects "
52 << "didn't actually pass the required chain"
53 << std::endl;
54 warningPrinted = true;
55 }
57#else
58 return answer;
59#endif // XAOD_STANDALONE
60 }
62 }
TriggerElement::FeatureAccessHelper getFeature(const TriggerElement *te, class_id_type clid, const index_or_label_type &index_or_label) const
typeless feature access metod
the FeatureAccessHelper is a class used to keep track of features attached to this TE.

◆ insert_element() [1/2]

template<typename STORED, typename REQUESTED>
void Trig::FeatureAccessImpl::insert_element ( std::vector< Trig::Feature< REQUESTED > > & ,
Trig::TypelessFeature & ,
const STORED *  )

◆ insert_element() [2/2]

template<typename REQUESTED>
void Trig::FeatureAccessImpl::insert_element ( std::vector< Trig::Feature< REQUESTED > > & result,
Trig::TypelessFeature & feature,
const REQUESTED * element )

Definition at line 78 of file FeatureCollectStandalone.h.

78 {
79 result.push_back(Trig::Feature<REQUESTED>(feature,element));
80 }
is basic vehicle of object access in TDT
Definition Feature.h:112

◆ insert_flatten_if() [1/2]

template<typename REQUESTED, typename STORED>
void Trig::FeatureAccessImpl::insert_flatten_if ( std::vector< Trig::Feature< REQUESTED > > & result,
const Trig::TypelessFeature & feature,
const std::shared_ptr< const STORED > & newfeature )

Definition at line 89 of file FeatureCollectStandalone.h.

89 {
90 for(auto element : *newfeature){
91 result.push_back(Trig::Feature<REQUESTED>(feature,element));
92 }
93 }

◆ insert_flatten_if() [2/2]

template<typename STORED>
void Trig::FeatureAccessImpl::insert_flatten_if ( std::vector< Trig::Feature< STORED > > & result,
const Trig::TypelessFeature & feature,
const std::shared_ptr< const STORED > & newfeature )

Definition at line 84 of file FeatureCollectStandalone.h.

84 {
85 result.push_back(Trig::Feature<STORED>(feature,newfeature));
86 }

◆ l1collect()

template<class T>
void Trig::FeatureAccessImpl::l1collect ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< T > > & data,
unsigned int condition,
const std::vector< T > &(LVL1_ROI::* method )() const,
const HLT::TrigNavStructure * navstructure )

Definition at line 51 of file FeatureCollectAthena.cxx.

53 {
54
55 auto navigation = dynamic_cast<const HLT::NavigationCore*>(navstructure);
56
57 // first we need to collect RoI descriptors
58 std::vector<Trig::Feature<TrigRoiDescriptor> > rois;
59 collect<TrigRoiDescriptor>(te, rois, "initialRoI", condition, "", navigation);
60
61 const LVL1_ROI* lvl1(0);
62
63 if ( !navigation || navigation->getAccessProxy()->retrieve(lvl1, "LVL1_ROI").isFailure() || lvl1 == 0 ) {
64 return;
65 }
66
67 for(const Trig::Feature<TrigRoiDescriptor>& roi : rois) {
68 for(const T& specific : (lvl1->*(method))() ) {
69 if (specific.getROIWord() == roi.cptr()->roiWord()) {
70 data.push_back( Trig::Feature<T>( &specific, roi.te(), "") );
71 break;
72 }
73 }
74 }
75 }
Top level AOD object storing LVL1 RoIs.
Definition LVL1_ROI.h:43

◆ typedGet()

template<typename REQUESTED, typename STORED, typename CONTAINER>
std::vector< Trig::Feature< REQUESTED > > Trig::FeatureAccessImpl::typedGet ( const std::vector< TypelessFeature > & features,
const HLT::TrigNavStructure * navigation,
const asg::EventStoreType * store,
const std::string & container_name = ClassID_traits<CONTAINER>::typeName() )

Definition at line 128 of file FeatureCollectStandalone.h.

128 {
129 std::vector<Trig::Feature<REQUESTED> > typedvec;
130
131 for(auto feature : features){
132 auto typelessholder = navigation->getHolder(feature.accessHelper());
133 if(!typelessholder){
134 std::cerr << "ERROR, holder not present" << std::endl;
135 continue;
136 }
137 HLT::TypedHolder<STORED,CONTAINER> typedholder(*typelessholder,store,container_name);
138 const STORED* dest = 0;
139
140 StatusCode sc = typedholder.get(dest,feature.accessHelper().getIndex());
141 if(sc.isFailure()){
142 std::cerr << "TrigDecisionTool WARNING: Feature access failed for feature: " << feature.accessHelper() << std::endl;
143 continue;
144 }
145
146 if(std::is_same<STORED, CONTAINER>::value){
147 //take ownership because typedholder.get created VIEW container with 'new'
148 std::shared_ptr<const STORED> owned(dest);
149
150 auto passbitsFeatureAccessHelper = FeatureAccessImpl::getTypelessBits(feature.te(),navigation);
151 if(passbitsFeatureAccessHelper.valid()){
152#ifndef __CLING__
153 auto passbitsHolder = navigation->getHolder(passbitsFeatureAccessHelper);
154 HLT::TypedHolder<TrigPassBits,TrigPassBitsCollection> typedBits(*passbitsHolder,store);
155 const TrigPassBits* bits = 0;
156 if(typedBits.get(bits,passbitsFeatureAccessHelper.getIndex()).isFailure()){
157 std::cerr << "WARNING: couldn't get passbits from Holder" << std::endl;
158 }
159 owned = filter_if(std::is_same<STORED, CONTAINER>(),owned,bits);
160#endif
161 }
162 //if REQUESTED != STORED we assume REQUESTED is element type
163 //and we flatten the vector
164 insert_flatten_if(typedvec,feature,owned);
165 }
166 else{
167 if(std::is_same<STORED,TrigRoiDescriptor>::value){
168 std::shared_ptr<const STORED> owned(dest);
169 //TrigRoiDescriptor needs deletiong by us.. a bit hacky but oh well...
170 insert_flatten_if(typedvec,feature,owned);
171 }
172 else{
173 //storegate owns the pointer
174 insert_element(typedvec,feature,dest);
175 }
176 }
177 }
178 return typedvec;
179 }
static Double_t sc
const BaseHolder * getHolder(const TriggerElement::FeatureAccessHelper &fea) const
doubly templated class interfacing access to feature containers in StoreGate.
Definition TypedHolder.h:55
HLT::TriggerElement::FeatureAccessHelper getTypelessBits(const HLT::TriggerElement *te, const HLT::TrigNavStructure *navigation)
void insert_flatten_if(std::vector< Trig::Feature< STORED > > &result, const Trig::TypelessFeature &feature, const std::shared_ptr< const STORED > &newfeature)
std::shared_ptr< const STORED > filter_if(std::true_type is_same, std::shared_ptr< const STORED > &original, const TrigPassBits *bits)
void insert_element(std::vector< Trig::Feature< REQUESTED > > &, Trig::TypelessFeature &, const STORED *)

◆ typelessCollect()

void Trig::FeatureAccessImpl::typelessCollect ( const HLT::TriggerElement * te,
HLT::class_id_type clid,
std::vector< Trig::TypelessFeature > & data,
const std::string & label,
unsigned int condition,
const HLT::TrigNavStructure * navigation )

Definition at line 65 of file FeatureCollectStandalone.cxx.

68 {
69 //collect recursively features for this trigger element
70 if (condition == TrigDefs::Physics && !te->getActiveState() ) return;
71
72 const HLT::TriggerElement* source = 0;
73 HLT::TriggerElement::FeatureAccessHelper answer = navigation->getFeatureRecursively(te,clid,label,source);
74 if(!answer.valid() && source){
75 //source was set but answer invalid -> bifurcation
76 for(auto& predecessor : navigation->getDirectPredecessors(source)){
77 typelessCollect(predecessor,clid,data,label,condition,navigation);
78 }
79 }
80 if(answer.valid()){
81 auto typelessholder = navigation->getHolder(answer);
82 if(!typelessholder){
83 //this can happen, because features were thinned away (which deletes the Holders, but doesn't touch the TE structure)
84 //so we'll let this slip silently
85 return;
86 }
87 data.push_back(Trig::TypelessFeature(answer,source,typelessholder->label()));
88 }
89 }
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 ...
static const std::vector< TriggerElement * > & getDirectPredecessors(const TriggerElement *te)
returns list of direct predecessors (nodes seeding me)
void typelessCollect(const HLT::TriggerElement *te, HLT::class_id_type clid, std::vector< Trig::TypelessFeature > &data, const std::string &label, unsigned int condition, const HLT::TrigNavStructure *navigation)

◆ use_or_construct() [1/2]

template<class T>
const std::enable_if<!isDataVector< T >::value, T >::type * Trig::FeatureAccessImpl::use_or_construct ( const T * source,
const HLT::TriggerElement * ,
const std::string & ,
unsigned int ,
const HLT::NavigationCore *  )

Definition at line 95 of file FeatureCollectAthena.h.

95 {
96 return source;
97 }

◆ use_or_construct() [2/2]

template<class T>
const std::enable_if< isDataVector< T >::value, T >::type * Trig::FeatureAccessImpl::use_or_construct ( const T * source,
const HLT::TriggerElement * te,
const std::string & label,
unsigned int condition,
const HLT::NavigationCore * navigation )

Definition at line 103 of file FeatureCollectAthena.h.

103 {
104
105 const TrigPassBits* bits(0);
106 if ( condition == TrigDefs::Physics ) {// only passing objects
107 bits = getBits(source->size(), te, label , navigation);
108 }
109 if ( bits ) { // the actual filtering
110 auto destination = new ConstDataVector<T>(SG::VIEW_ELEMENTS);
111
112 for(const typename T::base_value_type *obj : *source) {
113 if ( HLT::isPassing(bits, obj, source) ) // if bits are missing or obj is realy marked as passing
114 destination->push_back(obj);
115 }
116 return destination->asDataVector();
117 }
118 // else
119 return source;
120 }
const TrigPassBits * getBits(size_t sz, const HLT::TriggerElement *te, const std::string &, const HLT::NavigationCore *navigation)

◆ xAODcollect()

template<typename ROI, typename ROICONTAINER>
void Trig::FeatureAccessImpl::xAODcollect ( const HLT::TriggerElement * te,
std::vector< Trig::Feature< ROI > > & data,
unsigned int condition,
const HLT::TrigNavStructure * navstructure,
const std::string & sgkey )

Definition at line 93 of file FeatureCollectAthena.cxx.

93 {
94 // first we need to collect RoI descriptors
95
96 auto navigation = dynamic_cast<const HLT::NavigationCore*>(navstructure);
97
98
99 std::vector<Trig::Feature<TrigRoiDescriptor> > rois;
100 collect<TrigRoiDescriptor>(te, rois, "initialRoI", condition, "", navigation);
101
102 //get all EmTau RoIs
103 const ROICONTAINER* cont;
104 if (!navigation || navigation->getAccessProxy()->retrieve(cont,sgkey).isFailure()) {
105 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR,"Feature.cxx:xAODcollect") << "failed retrieving RoI container" << endmsg;
106
107 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR,"Feature.cxx:xAODcollect") << "\n" << (navigation ? navigation->getAccessProxy()->dump() : "") << endmsg;
108
109
110 return;
111 }
112
113 typename ROICONTAINER::const_iterator emtauit;
114 //ROI* found(0);
115 for(const auto& it : rois){
116 for(emtauit=cont->begin();emtauit!=cont->end();++emtauit){
117 if((*emtauit)->roiWord() == it.cptr()->roiWord()){
118 data.push_back( Trig::Feature<ROI>(*emtauit, it.te(), "") );
119 break;
120 }
121 }
122 }
123 }
#define endmsg
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
-event-from-file