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

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

Classes

Concepts

concept  isDataVector

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 T * use_or_construct (const T *source, const HLT::TriggerElement *te, const std::string &label, unsigned int condition, const HLT::NavigationCore *navigation)
template<class T, class STORED, bool flatten, class LINK>
void insert_and_flatten (std::vector< Trig::Feature< T > > &destination, const STORED *source, const HLT::TriggerElement *te, const std::string &label, unsigned int condition, const HLT::NavigationCore *navigation, const LINK &lnk)
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<isDataVector CONT>
TrigPassFlags build_flags (const CONT *orig_cont, const CONT *cont, const TrigPassFlags *orig_tpf)
template<class T>
TrigPassFlags build_flags (const T *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<isDataVector CONT>
TrigPassFlags Trig::FeatureAccessImpl::build_flags ( const CONT * orig_cont,
const CONT * cont,
const TrigPassFlags * orig_tpf )

Definition at line 262 of file FeatureCollectAthena.h.

262 {
263
264 TrigPassFlags tpf(cont->size(), orig_tpf->flagSize());
265
266 if(orig_cont->size() != orig_tpf->size()) {
267 //std::cout << "WARNING: original constainer size (" << orig_cont->size() << ") different for size of TrigPassFlags (" << orig_tpf->size() << ")." << std::endl;
268 return tpf;
269 }
270
271 unsigned int currentPos=0;
272 for(const typename CONT::base_value_type* obj : *cont) {
273 const auto orig_obj = std::find(orig_cont->begin(),orig_cont->end(),obj);
274
275 if(orig_obj == orig_cont->end()) {
276 //std::cout << "WARNING: object in reduced container can' be found in original." << std::endl;
277 } else {
278 size_t idx = orig_obj-orig_cont->begin();
279 tpf.setFlag(currentPos, orig_tpf->getFlag(idx));
280 }
281 currentPos++;
282 }
283
284 return tpf;
285 }
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 T * orig,
const T * feature,
const TrigPassFlags * orig_tpf )

Definition at line 288 of file FeatureCollectAthena.h.

288 {
289 if(orig != feature) return TrigPassFlags(); // a problem TODO: print a ERROR
290
291 TrigPassFlags tpf(1, orig_tpf->flagSize());
292 tpf.setFlag(0,orig_tpf->getFlag(0));
293 return tpf;
294 }

◆ 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 298 of file FeatureCollectAthena.h.

299 {
300 if(orig_cont->size() != orig_tpf->size()) {
301 //std::cout << "WARNING: original constainer size (" << orig_cont->size() << ") different for size of TrigPassFlags (" << orig_tpf->size() << ")." << std::endl;
302 return TrigPassFlags();
303 }
304
305 TrigPassFlags tpf(1, orig_tpf->flagSize());
306
307 const auto orig_obj = std::find(orig_cont->begin(),orig_cont->end(), obj);
308
309 if(orig_obj == orig_cont->end()) {
310 //std::cout << "WARNING: object in reduced container can' be found in original." << std::endl;
311 } else {
312 size_t idx = orig_obj-orig_cont->begin();
313 tpf.setFlag(0, orig_tpf->getFlag(idx));
314 }
315 return tpf;
316 }

◆ 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 203 of file FeatureCollectAthena.h.

205 {
206
207 auto navigation = dynamic_cast<const HLT::NavigationCore*>(navstructure);
208
209 if (condition == TrigDefs::Physics && !te->getActiveState() ) return;
210
211 const HLT::TriggerElement* sourceTE{};
212 bool result = true;
213#ifndef __GCCXML__
214 using object_type = Features2Object_t<T>;
215 using feature_list = Object2Features_t<object_type>;
216 get_links<T,TypeInfo_EDM> link_getter{te, &data, label, condition, teName, navigation, &result, &sourceTE};
218#endif
219
220 if (result){
221 /*do nothing anymore*/
222 } else {
223 // getRecentFeature returned false -> bifurcation?
224 const std::vector<HLT::TriggerElement*> bif_tes = navigation->getDirectPredecessors(sourceTE);
225 if ( bif_tes.size() <= 1 ) {
226 return; // that means it is plain error (it will be printed by the Navigation)
227 } else {
228 // bifurcation point
229 for( const HLT::TriggerElement* predecesor_te : bif_tes )
230 collect(predecesor_te, data, label, condition, teName, navigation);
231 }
232 }
233 }
Object2Features< FEATURE, EDMLIST >::type Object2Features_t
Features2Object< FEATURE, EDMLIST >::type Features2Object_t
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...

◆ 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 319 of file FeatureCollectAthena.h.

319 {
320
321 using STORED = TrigDec::ClassTraits<T>::type;
322
323 const STORED* orig{};
324 const HLT::TriggerElement* sourceTE{};
325 std::string sourceLabel;
326 if (navigation->getRecentFeature(f.te(), orig, f.label(), sourceTE, sourceLabel)) {
327 if constexpr (std::is_same_v<T,STORED>)
328 return build_flags(orig, f.cptr(), orig_tpf);
329 else
330 return build_flags2(orig, f.cptr(), orig_tpf);
331 }
332 return TrigPassFlags();
333
334 }
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
TrigPassFlags build_flags(const CONT *orig_cont, const CONT *cont, const TrigPassFlags *orig_tpf)
TrigPassFlags build_flags2(const STORED *orig_cont, const T *obj, const TrigPassFlags *orig_tpf)

◆ 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_and_flatten()

template<class T, class STORED, bool flatten, class LINK>
void Trig::FeatureAccessImpl::insert_and_flatten ( std::vector< Trig::Feature< T > > & destination,
const STORED * source,
const HLT::TriggerElement * te,
const std::string & label,
unsigned int condition,
const HLT::NavigationCore * navigation,
const LINK & lnk )

Definition at line 117 of file FeatureCollectAthena.h.

119 {
120
121 if constexpr(flatten) {
122 const TrigPassBits* bits{nullptr};
123 if ( condition == TrigDefs::Physics ) {// only passing objects
124 bits = getBits(source->size(), te, label , navigation);
125 }
126
127 for(const T* obj : *source) {
128 if ( bits==nullptr || HLT::isPassing(bits, obj, source) ) {// if no bits or obj is marked as passing
129 destination.push_back(Trig::Feature<T>(obj, te, label,
130 false, // do not delete
132 }
133 }
134 }
135 else {
136 const T* possibly_reduced_container = use_or_construct<T>(source, te, label, condition, navigation);
137
138 destination.push_back(Trig::Feature<T>(possibly_reduced_container, te, label,
139 // true: Feature<T> deletes container at deletion
140 possibly_reduced_container != source,
141 lnk));
142 }
143 }
is basic vehicle of object access in TDT
Definition Feature.h:112
unsigned long long T
const TrigPassBits * getBits(size_t sz, const HLT::TriggerElement *te, const std::string &, const HLT::NavigationCore *navigation)
const T * use_or_construct(const T *source, const HLT::TriggerElement *te, const std::string &label, unsigned int condition, const HLT::NavigationCore *navigation)

◆ 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 }

◆ 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()

template<class T>
const T * 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 82 of file FeatureCollectAthena.h.

83 {
84
85 if constexpr(!isDataVector<T>) {
86 return source;
87 }
88 else {
89 const TrigPassBits* bits{nullptr};
90 if ( condition == TrigDefs::Physics ) {// only passing objects
91 bits = getBits(source->size(), te, label , navigation);
92 }
93 if ( bits ) { // the actual filtering
94 auto destination = new ConstDataVector<T>(SG::VIEW_ELEMENTS);
95
96 for(const typename T::base_value_type *obj : *source) {
97 if ( HLT::isPassing(bits, obj, source) ) // if bits are missing or obj is realy marked as passing
98 destination->push_back(obj);
99 }
100 return destination->asDataVector();
101 }
102 return source;
103 }
104 }

◆ 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