CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerEventWithRefs.h
Go to the documentation of this file.
1 #ifndef HLTReco_TriggerEventWithRefs_h
2 #define HLTReco_TriggerEventWithRefs_h
3 
21 #include <string>
22 #include <vector>
23 
24 namespace trigger
25 {
26 
29 
32 
33  public:
34 
37  public:
39  std::string filterTag_;
55 
58  filterTag_(),
59  photons_(0), electrons_(0), muons_(0), jets_(0), composites_(0), basemets_(0), calomets_(0), pixtracks_(0), l1em_(0), l1muon_(0), l1jet_(0), l1etmiss_(0), l1hfrings_(0) {
61  }
63  size_type np, size_type ne, size_type nm, size_type nj, size_type nc, size_type nB, size_type nC, size_type nt, size_type l1em, size_type l1muon, size_type l1jet, size_type l1etmiss, size_type l1hfrings) :
64  filterTag_(filterTag.encode()),
65  photons_(np), electrons_(ne), muons_(nm), jets_(nj), composites_(nc), basemets_(nB), calomets_(nC), pixtracks_(nt), l1em_(l1em), l1muon_(l1muon), l1jet_(l1jet), l1etmiss_(l1etmiss), l1hfrings_(l1hfrings) { }
66  };
67 
69  private:
71  std::string usedProcessName_;
73  std::vector<TriggerFilterObject> filterObjects_;
74 
76  public:
81  usedProcessName_(usedProcessName),
83  {
84  filterObjects_.reserve(n);
85  }
86 
89  filterObjects_.push_back(
90  TriggerFilterObject(filterTag,
91  addObjects(tfowr.photonIds(),tfowr.photonRefs()),
92  addObjects(tfowr.electronIds(),tfowr.electronRefs()),
93  addObjects(tfowr.muonIds(),tfowr.muonRefs()),
94  addObjects(tfowr.jetIds(),tfowr.jetRefs()),
95  addObjects(tfowr.compositeIds(),tfowr.compositeRefs()),
96  addObjects(tfowr.basemetIds(),tfowr.basemetRefs()),
97  addObjects(tfowr.calometIds(),tfowr.calometRefs()),
98  addObjects(tfowr.pixtrackIds(),tfowr.pixtrackRefs()),
99  addObjects(tfowr.l1emIds(),tfowr.l1emRefs()),
100  addObjects(tfowr.l1muonIds(),tfowr.l1muonRefs()),
101  addObjects(tfowr.l1jetIds(),tfowr.l1jetRefs()),
102  addObjects(tfowr.l1etmissIds(),tfowr.l1etmissRefs()),
103  addObjects(tfowr.l1hfringsIds(),tfowr.l1hfringsRefs())
104  )
105  );
106  }
107 
109  const std::string& usedProcessName() const {return usedProcessName_;}
110 
112  size_type size() const {return filterObjects_.size();}
113 
116  return edm::InputTag(filterObjects_.at(filterIndex).filterTag_);
117  }
118 
121  const std::string encodedFilterTag (filterTag.encode());
122  const size_type n(filterObjects_.size());
123  for (size_type i=0; i!=n; ++i) {
124  if (encodedFilterTag==filterObjects_[i].filterTag_) {return i;}
125  }
126  return n;
127  }
128 
130 
131  std::pair<size_type,size_type> photonSlice(size_type filter) const {
132  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).photons_);
133  const size_type end(filterObjects_.at(filter).photons_);
134  return std::pair<size_type,size_type>(begin,end);
135  }
136 
137  std::pair<size_type,size_type> electronSlice(size_type filter) const {
138  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).electrons_);
139  const size_type end(filterObjects_.at(filter).electrons_);
140  return std::pair<size_type,size_type>(begin,end);
141  }
142 
143  std::pair<size_type,size_type> muonSlice(size_type filter) const {
144  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).muons_);
145  const size_type end(filterObjects_.at(filter).muons_);
146  return std::pair<size_type,size_type>(begin,end);
147  }
148 
149  std::pair<size_type,size_type> jetSlice(size_type filter) const {
150  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).jets_);
151  const size_type end(filterObjects_.at(filter).jets_);
152  return std::pair<size_type,size_type>(begin,end);
153  }
154 
155  std::pair<size_type,size_type> compositeSlice(size_type filter) const {
156  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).composites_);
157  const size_type end(filterObjects_.at(filter).composites_);
158  return std::pair<size_type,size_type>(begin,end);
159  }
160 
161  std::pair<size_type,size_type> basemetSlice(size_type filter) const {
162  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).basemets_);
163  const size_type end(filterObjects_.at(filter).basemets_);
164  return std::pair<size_type,size_type>(begin,end);
165  }
166 
167  std::pair<size_type,size_type> calometSlice(size_type filter) const {
168  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).calomets_);
169  const size_type end(filterObjects_.at(filter).calomets_);
170  return std::pair<size_type,size_type>(begin,end);
171  }
172 
173  std::pair<size_type,size_type> pixtrackSlice(size_type filter) const {
174  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pixtracks_);
175  const size_type end(filterObjects_.at(filter).pixtracks_);
176  return std::pair<size_type,size_type>(begin,end);
177  }
178 
179  std::pair<size_type,size_type> l1emSlice(size_type filter) const {
180  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1em_);
181  const size_type end(filterObjects_.at(filter).l1em_);
182  return std::pair<size_type,size_type>(begin,end);
183  }
184 
185  std::pair<size_type,size_type> l1muonSlice(size_type filter) const {
186  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1muon_);
187  const size_type end(filterObjects_.at(filter).l1muon_);
188  return std::pair<size_type,size_type>(begin,end);
189  }
190 
191  std::pair<size_type,size_type> l1jetSlice(size_type filter) const {
192  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1jet_);
193  const size_type end(filterObjects_.at(filter).l1jet_);
194  return std::pair<size_type,size_type>(begin,end);
195  }
196 
197  std::pair<size_type,size_type> l1etmissSlice(size_type filter) const {
198  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1etmiss_);
199  const size_type end(filterObjects_.at(filter).l1etmiss_);
200  return std::pair<size_type,size_type>(begin,end);
201  }
202 
203  std::pair<size_type,size_type> l1hfringsSlice(size_type filter) const {
204  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1hfrings_);
205  const size_type end(filterObjects_.at(filter).l1hfrings_);
206  return std::pair<size_type,size_type>(begin,end);
207  }
208 
209 
211 
213  const size_type begin(photonSlice(filter).first);
214  const size_type end(photonSlice(filter).second);
215  TriggerRefsCollections::getObjects(ids,photons,begin,end);
216  }
217  void getObjects(size_type filter, int id, VRphoton& photons) const {
218  const size_type begin(photonSlice(filter).first);
219  const size_type end(photonSlice(filter).second);
220  TriggerRefsCollections::getObjects(id,photons,begin,end);
221  }
222 
223  void getObjects(size_type filter, Vids& ids, VRelectron& electrons) const {
224  const size_type begin(electronSlice(filter).first);
225  const size_type end(electronSlice(filter).second);
226  TriggerRefsCollections::getObjects(ids,electrons,begin,end);
227  }
228  void getObjects(size_type filter, int id, VRelectron& electrons) const {
229  const size_type begin(electronSlice(filter).first);
230  const size_type end(electronSlice(filter).second);
231  TriggerRefsCollections::getObjects(id,electrons,begin,end);
232  }
233 
234  void getObjects(size_type filter, Vids& ids, VRmuon& muons) const {
235  const size_type begin(muonSlice(filter).first);
236  const size_type end(muonSlice(filter).second);
237  TriggerRefsCollections::getObjects(ids,muons,begin,end);
238  }
239  void getObjects(size_type filter, int id, VRmuon& muons) const {
240  const size_type begin(muonSlice(filter).first);
241  const size_type end(muonSlice(filter).second);
242  TriggerRefsCollections::getObjects(id,muons,begin,end);
243  }
244 
245  void getObjects(size_type filter, Vids& ids, VRjet& jets) const {
246  const size_type begin(jetSlice(filter).first);
247  const size_type end(jetSlice(filter).second);
248  TriggerRefsCollections::getObjects(ids,jets,begin,end);
249  }
250  void getObjects(size_type filter, int id, VRjet& jets) const {
251  const size_type begin(jetSlice(filter).first);
252  const size_type end(jetSlice(filter).second);
253  TriggerRefsCollections::getObjects(id,jets,begin,end);
254  }
255 
256  void getObjects(size_type filter, Vids& ids, VRcomposite& composites) const {
257  const size_type begin(compositeSlice(filter).first);
258  const size_type end(compositeSlice(filter).second);
259  TriggerRefsCollections::getObjects(ids,composites,begin,end);
260  }
261  void getObjects(size_type filter, int id, VRcomposite& composites) const {
262  const size_type begin(compositeSlice(filter).first);
263  const size_type end(compositeSlice(filter).second);
264  TriggerRefsCollections::getObjects(id,composites,begin,end);
265  }
266 
267  void getObjects(size_type filter, Vids& ids, VRbasemet& basemets) const {
268  const size_type begin(basemetSlice(filter).first);
269  const size_type end(basemetSlice(filter).second);
270  TriggerRefsCollections::getObjects(ids,basemets,begin,end);
271  }
272  void getObjects(size_type filter, int id, VRbasemet& basemets) const {
273  const size_type begin(basemetSlice(filter).first);
274  const size_type end(basemetSlice(filter).second);
275  TriggerRefsCollections::getObjects(id,basemets,begin,end);
276  }
277 
278  void getObjects(size_type filter, Vids& ids, VRcalomet& calomets) const {
279  const size_type begin(calometSlice(filter).first);
280  const size_type end(calometSlice(filter).second);
281  TriggerRefsCollections::getObjects(ids,calomets,begin,end);
282  }
283  void getObjects(size_type filter, int id, VRcalomet& calomets) const {
284  const size_type begin(calometSlice(filter).first);
285  const size_type end(calometSlice(filter).second);
286  TriggerRefsCollections::getObjects(id,calomets,begin,end);
287  }
288 
289  void getObjects(size_type filter, Vids& ids, VRpixtrack& pixtracks) const {
290  const size_type begin(pixtrackSlice(filter).first);
291  const size_type end(pixtrackSlice(filter).second);
292  TriggerRefsCollections::getObjects(ids,pixtracks,begin,end);
293  }
294  void getObjects(size_type filter, int id, VRpixtrack& pixtracks) const {
295  const size_type begin(pixtrackSlice(filter).first);
296  const size_type end(pixtrackSlice(filter).second);
297  TriggerRefsCollections::getObjects(id,pixtracks,begin,end);
298  }
299 
300  void getObjects(size_type filter, Vids& ids, VRl1em& l1em) const {
301  const size_type begin(l1emSlice(filter).first);
302  const size_type end(l1emSlice(filter).second);
303  TriggerRefsCollections::getObjects(ids,l1em,begin,end);
304  }
305  void getObjects(size_type filter, int id, VRl1em& l1em) const {
306  const size_type begin(l1emSlice(filter).first);
307  const size_type end(l1emSlice(filter).second);
308  TriggerRefsCollections::getObjects(id,l1em,begin,end);
309  }
310 
311  void getObjects(size_type filter, Vids& ids, VRl1muon& l1muon) const {
312  const size_type begin(l1muonSlice(filter).first);
313  const size_type end(l1muonSlice(filter).second);
314  TriggerRefsCollections::getObjects(ids,l1muon,begin,end);
315  }
316  void getObjects(size_type filter, int id, VRl1muon& l1muon) const {
317  const size_type begin(l1muonSlice(filter).first);
318  const size_type end(l1muonSlice(filter).second);
319  TriggerRefsCollections::getObjects(id,l1muon,begin,end);
320  }
321 
322  void getObjects(size_type filter, Vids& ids, VRl1jet& l1jet) const {
323  const size_type begin(l1jetSlice(filter).first);
324  const size_type end(l1jetSlice(filter).second);
325  TriggerRefsCollections::getObjects(ids,l1jet,begin,end);
326  }
327  void getObjects(size_type filter, int id, VRl1jet& l1jet) const {
328  const size_type begin(l1jetSlice(filter).first);
329  const size_type end(l1jetSlice(filter).second);
330  TriggerRefsCollections::getObjects(id,l1jet,begin,end);
331  }
332 
333  void getObjects(size_type filter, Vids& ids, VRl1etmiss& l1etmiss) const {
334  const size_type begin(l1etmissSlice(filter).first);
335  const size_type end(l1etmissSlice(filter).second);
336  TriggerRefsCollections::getObjects(ids,l1etmiss,begin,end);
337  }
338  void getObjects(size_type filter, int id, VRl1etmiss& l1etmiss) const {
339  const size_type begin(l1etmissSlice(filter).first);
340  const size_type end(l1etmissSlice(filter).second);
341  TriggerRefsCollections::getObjects(id,l1etmiss,begin,end);
342  }
343 
344  void getObjects(size_type filter, Vids& ids, VRl1hfrings& l1hfrings) const {
345  const size_type begin(l1hfringsSlice(filter).first);
346  const size_type end(l1hfringsSlice(filter).second);
347  TriggerRefsCollections::getObjects(ids,l1hfrings,begin,end);
348  }
349  void getObjects(size_type filter, int id, VRl1hfrings& l1hfrings) const {
350  const size_type begin(l1hfringsSlice(filter).first);
351  const size_type end(l1hfringsSlice(filter).second);
352  TriggerRefsCollections::getObjects(id,l1hfrings,begin,end);
353  }
354 
355  };
356 
357 }
358 
359 #endif
void getObjects(size_type filter, int id, VRelectron &electrons) const
void getObjects(size_type filter, Vids &ids, VRl1em &l1em) const
int i
Definition: DBlmapReader.cc:9
size_type addObjects(const Vids &ids, const VRphoton &refs)
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
void getObjects(size_type filter, Vids &ids, VRl1jet &l1jet) const
std::vector< TriggerFilterObject > filterObjects_
the filters recorded here
const VRbasemet & basemetRefs() const
std::pair< size_type, size_type > compositeSlice(size_type filter) const
void addFilterObject(const edm::InputTag &filterTag, const TriggerFilterObjectWithRefs &tfowr)
setters - to build EDProduct
std::pair< size_type, size_type > l1etmissSlice(size_type filter) const
const VRcalomet & calometRefs() const
std::vector< reco::METRef > VRbasemet
void getObjects(size_type filter, Vids &ids, VRbasemet &basemets) const
const std::string & usedProcessName() const
getters - for user access
void getObjects(size_type filter, Vids &ids, VRjet &jets) const
const edm::InputTag filterTag(size_type filterIndex) const
tag from index
std::string usedProcessName_
data members
std::pair< size_type, size_type > calometSlice(size_type filter) const
uint16_t size_type
std::string encode() const
Definition: InputTag.cc:72
std::vector< l1extra::L1MuonParticleRef > VRl1muon
std::pair< size_type, size_type > jetSlice(size_type filter) const
U second(std::pair< T, U > const &p)
std::vector< l1extra::L1HFRingsRef > VRl1hfrings
void getObjects(size_type filter, int id, VRl1etmiss &l1etmiss) const
std::vector< reco::IsolatedPixelTrackCandidateRef > VRpixtrack
void getObjects(size_type filter, Vids &ids, VRmuon &muons) const
void getObjects(size_type filter, int id, VRbasemet &basemets) const
const VRl1muon & l1muonRefs() const
std::vector< l1extra::L1EtMissParticleRef > VRl1etmiss
std::pair< size_type, size_type > l1muonSlice(size_type filter) const
std::pair< size_type, size_type > muonSlice(size_type filter) const
void getObjects(size_type filter, int id, VRcalomet &calomets) const
void getObjects(size_type filter, int id, VRl1em &l1em) const
void getObjects(size_type filter, Vids &ids, VRl1muon &l1muon) const
const VRcomposite & compositeRefs() const
void getObjects(size_type filter, Vids &ids, VRcalomet &calomets) const
void getObjects(size_type filter, int id, VRl1hfrings &l1hfrings) const
std::pair< size_type, size_type > l1jetSlice(size_type filter) const
#define end
Definition: vmac.h:38
std::vector< l1extra::L1EmParticleRef > VRl1em
void getObjects(size_type filter, Vids &ids, VRcomposite &composites) const
const VRl1hfrings & l1hfringsRefs() const
void getObjects(size_type filter, int id, VRjet &jets) const
bool first
Definition: L1TdeRCT.cc:79
int nt
Definition: AMPTWrapper.h:32
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
void getObjects(size_type filter, int id, VRl1jet &l1jet) const
void getObjects(size_type filter, int id, VRpixtrack &pixtracks) const
const VRl1etmiss & l1etmissRefs() const
std::vector< reco::CaloJetRef > VRjet
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
Definition: align_tpl.py:86
void getObjects(size_type filter, Vids &ids, VRl1etmiss &l1etmiss) const
void getObjects(size_type filter, Vids &ids, VRl1hfrings &l1hfrings) const
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref&lt;C&gt;s for a specific filter and of specific physics type
void getObjects(size_type filter, int id, VRmuon &muons) const
size_type size() const
number of filters
std::vector< reco::CompositeCandidateRef > VRcomposite
const VRphoton & photonRefs() const
std::vector< reco::RecoChargedCandidateRef > VRmuon
std::pair< size_type, size_type > photonSlice(size_type filter) const
slices of objects for a specific filter: [begin,end[
void getObjects(size_type filter, Vids &ids, VRelectron &electrons) const
std::pair< size_type, size_type > l1emSlice(size_type filter) const
TriggerFilterObject(const edm::InputTag &filterTag, size_type np, size_type ne, size_type nm, size_type nj, size_type nc, size_type nB, size_type nC, size_type nt, size_type l1em, size_type l1muon, size_type l1jet, size_type l1etmiss, size_type l1hfrings)
const VRelectron & electronRefs() const
#define begin
Definition: vmac.h:31
tuple muons
Definition: patZpeak.py:38
void getObjects(size_type filter, int id, VRcomposite &composites) const
TriggerEventWithRefs(const std::string &usedProcessName, size_type n)
std::pair< size_type, size_type > pixtrackSlice(size_type filter) const
const VRpixtrack & pixtrackRefs() const
void getObjects(size_type filter, Vids &ids, VRpixtrack &pixtracks) const
std::vector< reco::ElectronRef > VRelectron
std::pair< size_type, size_type > l1hfringsSlice(size_type filter) const
std::vector< reco::CaloMETRef > VRcalomet
Helper class: trigger objects firing a single filter.
std::vector< reco::RecoEcalCandidateRef > VRphoton
void getObjects(size_type filter, int id, VRphoton &photons) const
std::vector< l1extra::L1JetParticleRef > VRl1jet
std::vector< int > Vids
void getObjects(size_type filter, int id, VRl1muon &l1muon) const
std::pair< size_type, size_type > basemetSlice(size_type filter) const
std::pair< size_type, size_type > electronSlice(size_type filter) const
std::string filterTag_
encoded InputTag of filter product