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 
19 #include <string>
20 #include <vector>
21 
22 namespace trigger
23 {
24 
27 
30 
31  public:
32 
35  public:
56 
59  filterTag_(),
60  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), pfjets_(0), pftaus_(0), pfmets_(0) {
61  filterTag_=edm::InputTag().encode();
62  }
64  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, size_type pfjets, size_type pftaus, size_type pfmets) :
65  filterTag_(filterTag.encode()),
66  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), pfjets_(pfjets), pftaus_(pftaus), pfmets_(pfmets) { }
67  };
68 
70  private:
74  std::vector<TriggerFilterObject> filterObjects_;
75 
77  public:
82  usedProcessName_(usedProcessName),
84  {
85  filterObjects_.reserve(n);
86  }
87 
90  filterObjects_.push_back(
91  TriggerFilterObject(filterTag,
92  addObjects(tfowr.photonIds(),tfowr.photonRefs()),
93  addObjects(tfowr.electronIds(),tfowr.electronRefs()),
94  addObjects(tfowr.muonIds(),tfowr.muonRefs()),
95  addObjects(tfowr.jetIds(),tfowr.jetRefs()),
96  addObjects(tfowr.compositeIds(),tfowr.compositeRefs()),
97  addObjects(tfowr.basemetIds(),tfowr.basemetRefs()),
98  addObjects(tfowr.calometIds(),tfowr.calometRefs()),
99  addObjects(tfowr.pixtrackIds(),tfowr.pixtrackRefs()),
100  addObjects(tfowr.l1emIds(),tfowr.l1emRefs()),
101  addObjects(tfowr.l1muonIds(),tfowr.l1muonRefs()),
102  addObjects(tfowr.l1jetIds(),tfowr.l1jetRefs()),
103  addObjects(tfowr.l1etmissIds(),tfowr.l1etmissRefs()),
104  addObjects(tfowr.l1hfringsIds(),tfowr.l1hfringsRefs()),
105  addObjects(tfowr.pfjetIds(),tfowr.pfjetRefs()),
106  addObjects(tfowr.pftauIds(),tfowr.pftauRefs()),
107  addObjects(tfowr.pfmetIds(),tfowr.pfmetRefs())
108  )
109  );
110  }
111 
114 
116  size_type size() const {return filterObjects_.size();}
117 
120  return edm::InputTag(filterObjects_.at(filterIndex).filterTag_);
121  }
122 
125  const std::string encodedFilterTag (filterTag.encode());
126  const size_type n(filterObjects_.size());
127  for (size_type i=0; i!=n; ++i) {
128  if (encodedFilterTag==filterObjects_[i].filterTag_) {return i;}
129  }
130  return n;
131  }
132 
134 
135  std::pair<size_type,size_type> photonSlice(size_type filter) const {
136  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).photons_);
137  const size_type end(filterObjects_.at(filter).photons_);
138  return std::pair<size_type,size_type>(begin,end);
139  }
140 
141  std::pair<size_type,size_type> electronSlice(size_type filter) const {
142  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).electrons_);
143  const size_type end(filterObjects_.at(filter).electrons_);
144  return std::pair<size_type,size_type>(begin,end);
145  }
146 
147  std::pair<size_type,size_type> muonSlice(size_type filter) const {
148  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).muons_);
149  const size_type end(filterObjects_.at(filter).muons_);
150  return std::pair<size_type,size_type>(begin,end);
151  }
152 
153  std::pair<size_type,size_type> jetSlice(size_type filter) const {
154  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).jets_);
155  const size_type end(filterObjects_.at(filter).jets_);
156  return std::pair<size_type,size_type>(begin,end);
157  }
158 
159  std::pair<size_type,size_type> compositeSlice(size_type filter) const {
160  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).composites_);
161  const size_type end(filterObjects_.at(filter).composites_);
162  return std::pair<size_type,size_type>(begin,end);
163  }
164 
165  std::pair<size_type,size_type> basemetSlice(size_type filter) const {
166  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).basemets_);
167  const size_type end(filterObjects_.at(filter).basemets_);
168  return std::pair<size_type,size_type>(begin,end);
169  }
170 
171  std::pair<size_type,size_type> calometSlice(size_type filter) const {
172  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).calomets_);
173  const size_type end(filterObjects_.at(filter).calomets_);
174  return std::pair<size_type,size_type>(begin,end);
175  }
176 
177  std::pair<size_type,size_type> pixtrackSlice(size_type filter) const {
178  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pixtracks_);
179  const size_type end(filterObjects_.at(filter).pixtracks_);
180  return std::pair<size_type,size_type>(begin,end);
181  }
182 
183  std::pair<size_type,size_type> l1emSlice(size_type filter) const {
184  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1em_);
185  const size_type end(filterObjects_.at(filter).l1em_);
186  return std::pair<size_type,size_type>(begin,end);
187  }
188 
189  std::pair<size_type,size_type> l1muonSlice(size_type filter) const {
190  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1muon_);
191  const size_type end(filterObjects_.at(filter).l1muon_);
192  return std::pair<size_type,size_type>(begin,end);
193  }
194 
195  std::pair<size_type,size_type> l1jetSlice(size_type filter) const {
196  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1jet_);
197  const size_type end(filterObjects_.at(filter).l1jet_);
198  return std::pair<size_type,size_type>(begin,end);
199  }
200 
201  std::pair<size_type,size_type> l1etmissSlice(size_type filter) const {
202  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1etmiss_);
203  const size_type end(filterObjects_.at(filter).l1etmiss_);
204  return std::pair<size_type,size_type>(begin,end);
205  }
206 
207  std::pair<size_type,size_type> l1hfringsSlice(size_type filter) const {
208  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1hfrings_);
209  const size_type end(filterObjects_.at(filter).l1hfrings_);
210  return std::pair<size_type,size_type>(begin,end);
211  }
212 
213  std::pair<size_type,size_type> pfjetSlice(size_type filter) const {
214  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pfjets_);
215  const size_type end(filterObjects_.at(filter).pfjets_);
216  return std::pair<size_type,size_type>(begin,end);
217  }
218 
219  std::pair<size_type,size_type> pftauSlice(size_type filter) const {
220  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pftaus_);
221  const size_type end(filterObjects_.at(filter).pftaus_);
222  return std::pair<size_type,size_type>(begin,end);
223  }
224 
225  std::pair<size_type,size_type> pfmetSlice(size_type filter) const {
226  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pfmets_);
227  const size_type end(filterObjects_.at(filter).pfmets_);
228  return std::pair<size_type,size_type>(begin,end);
229  }
230 
231 
233 
235  const size_type begin(photonSlice(filter).first);
236  const size_type end(photonSlice(filter).second);
237  TriggerRefsCollections::getObjects(ids,photons,begin,end);
238  }
239  void getObjects(size_type filter, int id, VRphoton& photons) const {
240  const size_type begin(photonSlice(filter).first);
241  const size_type end(photonSlice(filter).second);
242  TriggerRefsCollections::getObjects(id,photons,begin,end);
243  }
244 
245  void getObjects(size_type filter, Vids& ids, VRelectron& electrons) const {
246  const size_type begin(electronSlice(filter).first);
247  const size_type end(electronSlice(filter).second);
248  TriggerRefsCollections::getObjects(ids,electrons,begin,end);
249  }
250  void getObjects(size_type filter, int id, VRelectron& electrons) const {
251  const size_type begin(electronSlice(filter).first);
252  const size_type end(electronSlice(filter).second);
253  TriggerRefsCollections::getObjects(id,electrons,begin,end);
254  }
255 
256  void getObjects(size_type filter, Vids& ids, VRmuon& muons) const {
257  const size_type begin(muonSlice(filter).first);
258  const size_type end(muonSlice(filter).second);
259  TriggerRefsCollections::getObjects(ids,muons,begin,end);
260  }
261  void getObjects(size_type filter, int id, VRmuon& muons) const {
262  const size_type begin(muonSlice(filter).first);
263  const size_type end(muonSlice(filter).second);
264  TriggerRefsCollections::getObjects(id,muons,begin,end);
265  }
266 
267  void getObjects(size_type filter, Vids& ids, VRjet& jets) const {
268  const size_type begin(jetSlice(filter).first);
269  const size_type end(jetSlice(filter).second);
270  TriggerRefsCollections::getObjects(ids,jets,begin,end);
271  }
272  void getObjects(size_type filter, int id, VRjet& jets) const {
273  const size_type begin(jetSlice(filter).first);
274  const size_type end(jetSlice(filter).second);
275  TriggerRefsCollections::getObjects(id,jets,begin,end);
276  }
277 
278  void getObjects(size_type filter, Vids& ids, VRcomposite& composites) const {
279  const size_type begin(compositeSlice(filter).first);
280  const size_type end(compositeSlice(filter).second);
281  TriggerRefsCollections::getObjects(ids,composites,begin,end);
282  }
283  void getObjects(size_type filter, int id, VRcomposite& composites) const {
284  const size_type begin(compositeSlice(filter).first);
285  const size_type end(compositeSlice(filter).second);
286  TriggerRefsCollections::getObjects(id,composites,begin,end);
287  }
288 
289  void getObjects(size_type filter, Vids& ids, VRbasemet& basemets) const {
290  const size_type begin(basemetSlice(filter).first);
291  const size_type end(basemetSlice(filter).second);
292  TriggerRefsCollections::getObjects(ids,basemets,begin,end);
293  }
294  void getObjects(size_type filter, int id, VRbasemet& basemets) const {
295  const size_type begin(basemetSlice(filter).first);
296  const size_type end(basemetSlice(filter).second);
297  TriggerRefsCollections::getObjects(id,basemets,begin,end);
298  }
299 
300  void getObjects(size_type filter, Vids& ids, VRcalomet& calomets) const {
301  const size_type begin(calometSlice(filter).first);
302  const size_type end(calometSlice(filter).second);
303  TriggerRefsCollections::getObjects(ids,calomets,begin,end);
304  }
305  void getObjects(size_type filter, int id, VRcalomet& calomets) const {
306  const size_type begin(calometSlice(filter).first);
307  const size_type end(calometSlice(filter).second);
308  TriggerRefsCollections::getObjects(id,calomets,begin,end);
309  }
310 
311  void getObjects(size_type filter, Vids& ids, VRpixtrack& pixtracks) const {
312  const size_type begin(pixtrackSlice(filter).first);
313  const size_type end(pixtrackSlice(filter).second);
314  TriggerRefsCollections::getObjects(ids,pixtracks,begin,end);
315  }
316  void getObjects(size_type filter, int id, VRpixtrack& pixtracks) const {
317  const size_type begin(pixtrackSlice(filter).first);
318  const size_type end(pixtrackSlice(filter).second);
319  TriggerRefsCollections::getObjects(id,pixtracks,begin,end);
320  }
321 
322  void getObjects(size_type filter, Vids& ids, VRl1em& l1em) const {
323  const size_type begin(l1emSlice(filter).first);
324  const size_type end(l1emSlice(filter).second);
325  TriggerRefsCollections::getObjects(ids,l1em,begin,end);
326  }
327  void getObjects(size_type filter, int id, VRl1em& l1em) const {
328  const size_type begin(l1emSlice(filter).first);
329  const size_type end(l1emSlice(filter).second);
330  TriggerRefsCollections::getObjects(id,l1em,begin,end);
331  }
332 
333  void getObjects(size_type filter, Vids& ids, VRl1muon& l1muon) const {
334  const size_type begin(l1muonSlice(filter).first);
335  const size_type end(l1muonSlice(filter).second);
336  TriggerRefsCollections::getObjects(ids,l1muon,begin,end);
337  }
338  void getObjects(size_type filter, int id, VRl1muon& l1muon) const {
339  const size_type begin(l1muonSlice(filter).first);
340  const size_type end(l1muonSlice(filter).second);
341  TriggerRefsCollections::getObjects(id,l1muon,begin,end);
342  }
343 
344  void getObjects(size_type filter, Vids& ids, VRl1jet& l1jet) const {
345  const size_type begin(l1jetSlice(filter).first);
346  const size_type end(l1jetSlice(filter).second);
347  TriggerRefsCollections::getObjects(ids,l1jet,begin,end);
348  }
349  void getObjects(size_type filter, int id, VRl1jet& l1jet) const {
350  const size_type begin(l1jetSlice(filter).first);
351  const size_type end(l1jetSlice(filter).second);
352  TriggerRefsCollections::getObjects(id,l1jet,begin,end);
353  }
354 
355  void getObjects(size_type filter, Vids& ids, VRl1etmiss& l1etmiss) const {
356  const size_type begin(l1etmissSlice(filter).first);
357  const size_type end(l1etmissSlice(filter).second);
358  TriggerRefsCollections::getObjects(ids,l1etmiss,begin,end);
359  }
360  void getObjects(size_type filter, int id, VRl1etmiss& l1etmiss) const {
361  const size_type begin(l1etmissSlice(filter).first);
362  const size_type end(l1etmissSlice(filter).second);
363  TriggerRefsCollections::getObjects(id,l1etmiss,begin,end);
364  }
365 
366  void getObjects(size_type filter, Vids& ids, VRl1hfrings& l1hfrings) const {
367  const size_type begin(l1hfringsSlice(filter).first);
368  const size_type end(l1hfringsSlice(filter).second);
369  TriggerRefsCollections::getObjects(ids,l1hfrings,begin,end);
370  }
371  void getObjects(size_type filter, int id, VRl1hfrings& l1hfrings) const {
372  const size_type begin(l1hfringsSlice(filter).first);
373  const size_type end(l1hfringsSlice(filter).second);
374  TriggerRefsCollections::getObjects(id,l1hfrings,begin,end);
375  }
376 
377  void getObjects(size_type filter, Vids& ids, VRpfjet& pfjets) const {
378  const size_type begin(pfjetSlice(filter).first);
379  const size_type end(pfjetSlice(filter).second);
380  TriggerRefsCollections::getObjects(ids,pfjets,begin,end);
381  }
382  void getObjects(size_type filter, int id, VRpfjet& pfjets) const {
383  const size_type begin(pfjetSlice(filter).first);
384  const size_type end(pfjetSlice(filter).second);
385  TriggerRefsCollections::getObjects(id,pfjets,begin,end);
386  }
387 
388  void getObjects(size_type filter, Vids& ids, VRpftau& pftaus) const {
389  const size_type begin(pftauSlice(filter).first);
390  const size_type end(pftauSlice(filter).second);
391  TriggerRefsCollections::getObjects(ids,pftaus,begin,end);
392  }
393  void getObjects(size_type filter, int id, VRpftau& pftaus) const {
394  const size_type begin(pftauSlice(filter).first);
395  const size_type end(pftauSlice(filter).second);
396  TriggerRefsCollections::getObjects(id,pftaus,begin,end);
397  }
398 
399  void getObjects(size_type filter, Vids& ids, VRpfmet& pfmets) const {
400  const size_type begin(pfmetSlice(filter).first);
401  const size_type end(pfmetSlice(filter).second);
402  TriggerRefsCollections::getObjects(ids,pfmets,begin,end);
403  }
404  void getObjects(size_type filter, int id, VRpfmet& pfmets) const {
405  const size_type begin(pfmetSlice(filter).first);
406  const size_type end(pfmetSlice(filter).second);
407  TriggerRefsCollections::getObjects(id,pfmets,begin,end);
408  }
409 
410  };
411 
412 }
413 
414 #endif
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, size_type pfjets, size_type pftaus, size_type pfmets)
void getObjects(size_type filter, int id, VRelectron &electrons) const
void getObjects(size_type filter, Vids &ids, VRl1em &l1em) const
std::pair< size_type, size_type > pftauSlice(size_type filter) const
int i
Definition: DBlmapReader.cc:9
size_type addObjects(const Vids &ids, const VRphoton &refs)
void getObjects(size_type filter, int id, VRpfjet &pfjets) const
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
void getObjects(size_type filter, int id, VRpftau &pftaus) const
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
void getObjects(size_type filter, Vids &ids, VRpfmet &pfmets) const
std::vector< reco::METRef > VRbasemet
void getObjects(size_type filter, Vids &ids, VRbasemet &basemets) const
void getObjects(size_type filter, int id, VRpfmet &pfmets) const
std::pair< size_type, size_type > pfmetSlice(size_type filter) 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:164
std::vector< l1extra::L1MuonParticleRef > VRl1muon
std::pair< size_type, size_type > jetSlice(size_type filter) const
U second(std::pair< T, U > const &p)
void getObjects(size_type filter, Vids &ids, VRpftau &pftaus) const
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
int np
Definition: AMPTWrapper.h:33
std::pair< size_type, size_type > muonSlice(size_type filter) const
void getObjects(size_type filter, int id, VRcalomet &calomets) const
vector< PseudoJet > jets
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:37
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
void getObjects(size_type filter, Vids &ids, VRpfjet &pfjets) const
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
std::pair< size_type, size_type > pfjetSlice(size_type filter) const
const VRl1etmiss & l1etmissRefs() const
std::vector< reco::CaloJetRef > VRjet
void getObjects(size_type filter, Vids &ids, VRl1etmiss &l1etmiss) const
void getObjects(size_type filter, Vids &ids, VRl1hfrings &l1hfrings) const
std::vector< reco::PFJetRef > VRpfjet
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
const VRelectron & electronRefs() const
#define begin
Definition: vmac.h:30
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::PFMETRef > VRpfmet
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
std::vector< reco::PFTauRef > VRpftau
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