ATLAS Offline Software
Loading...
Searching...
No Matches
FeatureCollectAthena.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef XAOD_ANALYSIS // Full Athena only
6
7
10
13
15
16namespace Trig{
17 namespace FeatureAccessImpl {
18 // returns TrigPassBits object appropriate for given object
19 // if there is none returns 0 pointer
20 // not this is not templated function, can be changed anytime needed
21 const TrigPassBits* getBits(size_t sz, const HLT::TriggerElement* te, const std::string& /*label*/, const HLT::NavigationCore* navigation ) {
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 }
38
39 const TrigPassFlags* getFlags(size_t size, const HLT::TriggerElement* te, const std::string& label, const HLT::NavigationCore* navigation ) {
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 }
48
49 // L1 specific access ( objects not in the navigation, we need to pick them from different container in SG)
50 template<class T>
51 void l1collect(const HLT::TriggerElement* te, std::vector<Trig::Feature<T> >& data, unsigned int condition,
52 const std::vector<T>& (LVL1_ROI::*method)() const,
53 const HLT::TrigNavStructure* navstructure) {
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 }
76
77 template<>
78 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) {
79 l1collect<Muon_ROI>(te, data, condition, &LVL1_ROI::getMuonROIs, navigation);
80 }
81
82 template<>
83 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) {
84 l1collect<EmTau_ROI>(te, data, condition, &LVL1_ROI::getEmTauROIs, navigation);
85 }
86
87 template<>
88 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) {
89 l1collect<Jet_ROI>(te, data, condition, &LVL1_ROI::getJetROIs, navigation);
90 }
91
92 template<typename ROI,typename ROICONTAINER>
93 void xAODcollect(const HLT::TriggerElement* te, std::vector<Trig::Feature<ROI> >& data, unsigned int condition, const HLT::TrigNavStructure* navstructure, const std::string& sgkey){
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 }
124
125 template<>
126 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) {
127 xAODcollect<xAOD::EmTauRoI,xAOD::EmTauRoIContainer>(te, data, condition, navigation,"LVL1EmTauRoIs");
128 }
129
130 template<>
131 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) {
132 xAODcollect<xAOD::MuonRoI,xAOD::MuonRoIContainer>(te, data, condition, navigation,"LVL1MuonRoIs");
133 }
134
135 template<>
136 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) {
137 xAODcollect<xAOD::JetRoI,xAOD::JetRoIContainer>(te, data, condition, navigation,"LVL1JetRoIs");
138 }
139
140
141 template<>
145 template<>
149 template<>
153 } // EOF namespace FeatureAccessImpl
154} // EOF namespace Trig
155#endif // full Athena env
#define endmsg
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t sz
The NavigationCore class, adds on top of the TrigNavStructure the EDM read-only handling.
bool getFeature(const TriggerElement *te, const T *&features, const std::string &label="", std::string &sourcelabel=::HLT::TrigNavStructure::m_unspecifiedLabel) const
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
Top level AOD object storing LVL1 RoIs.
Definition LVL1_ROI.h:43
const emtaus_type & getEmTauROIs() const
Get all the em/tau RoIs in the event.
Definition LVL1_ROI.h:65
const muons_type & getMuonROIs() const
Get all the muon RoIs in the event.
Definition LVL1_ROI.h:63
const jets_type & getJetROIs() const
Get all the jet RoIs in the event.
Definition LVL1_ROI.h:67
unsigned int size() const
gets size of the bits array
A Flag is an ordered collection of bits (vector<bool>) that can hold additional (boolean) information...
is basic vehicle of object access in TDT
Definition Feature.h:112
std::string label(const std::string &format, int i)
Definition label.h:19
This is the implementation of the Feature collection for Athena.
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)
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)
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...
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)
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)
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)
const TrigPassFlags * getFlags(size_t size, const HLT::TriggerElement *te, const std::string &label, const HLT::NavigationCore *navigation)
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)
const TrigPassBits * getBits(size_t sz, const HLT::TriggerElement *te, const std::string &, const HLT::NavigationCore *navigation)
void xAODcollect(const HLT::TriggerElement *te, std::vector< Trig::Feature< ROI > > &data, unsigned int condition, const HLT::TrigNavStructure *navstructure, const std::string &sgkey)
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)
The common trigger namespace for trigger analysis tools.
-event-from-file