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:
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), pfjets_(0), pftaus_(0) {
60  filterTag_=edm::InputTag().encode();
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, size_type pfjets, size_type pftaus) :
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), pfjets_(pfjets), pftaus_(pftaus) { }
66  };
67 
69  private:
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  addObjects(tfowr.pfjetIds(),tfowr.pfjetRefs()),
105  addObjects(tfowr.pftauIds(),tfowr.pftauRefs())
106  )
107  );
108  }
109 
112 
114  size_type size() const {return filterObjects_.size();}
115 
118  return edm::InputTag(filterObjects_.at(filterIndex).filterTag_);
119  }
120 
123  const std::string encodedFilterTag (filterTag.encode());
124  const size_type n(filterObjects_.size());
125  for (size_type i=0; i!=n; ++i) {
126  if (encodedFilterTag==filterObjects_[i].filterTag_) {return i;}
127  }
128  return n;
129  }
130 
132 
133  std::pair<size_type,size_type> photonSlice(size_type filter) const {
134  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).photons_);
135  const size_type end(filterObjects_.at(filter).photons_);
136  return std::pair<size_type,size_type>(begin,end);
137  }
138 
139  std::pair<size_type,size_type> electronSlice(size_type filter) const {
140  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).electrons_);
141  const size_type end(filterObjects_.at(filter).electrons_);
142  return std::pair<size_type,size_type>(begin,end);
143  }
144 
145  std::pair<size_type,size_type> muonSlice(size_type filter) const {
146  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).muons_);
147  const size_type end(filterObjects_.at(filter).muons_);
148  return std::pair<size_type,size_type>(begin,end);
149  }
150 
151  std::pair<size_type,size_type> jetSlice(size_type filter) const {
152  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).jets_);
153  const size_type end(filterObjects_.at(filter).jets_);
154  return std::pair<size_type,size_type>(begin,end);
155  }
156 
157  std::pair<size_type,size_type> compositeSlice(size_type filter) const {
158  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).composites_);
159  const size_type end(filterObjects_.at(filter).composites_);
160  return std::pair<size_type,size_type>(begin,end);
161  }
162 
163  std::pair<size_type,size_type> basemetSlice(size_type filter) const {
164  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).basemets_);
165  const size_type end(filterObjects_.at(filter).basemets_);
166  return std::pair<size_type,size_type>(begin,end);
167  }
168 
169  std::pair<size_type,size_type> calometSlice(size_type filter) const {
170  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).calomets_);
171  const size_type end(filterObjects_.at(filter).calomets_);
172  return std::pair<size_type,size_type>(begin,end);
173  }
174 
175  std::pair<size_type,size_type> pixtrackSlice(size_type filter) const {
176  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pixtracks_);
177  const size_type end(filterObjects_.at(filter).pixtracks_);
178  return std::pair<size_type,size_type>(begin,end);
179  }
180 
181  std::pair<size_type,size_type> l1emSlice(size_type filter) const {
182  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1em_);
183  const size_type end(filterObjects_.at(filter).l1em_);
184  return std::pair<size_type,size_type>(begin,end);
185  }
186 
187  std::pair<size_type,size_type> l1muonSlice(size_type filter) const {
188  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1muon_);
189  const size_type end(filterObjects_.at(filter).l1muon_);
190  return std::pair<size_type,size_type>(begin,end);
191  }
192 
193  std::pair<size_type,size_type> l1jetSlice(size_type filter) const {
194  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1jet_);
195  const size_type end(filterObjects_.at(filter).l1jet_);
196  return std::pair<size_type,size_type>(begin,end);
197  }
198 
199  std::pair<size_type,size_type> l1etmissSlice(size_type filter) const {
200  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1etmiss_);
201  const size_type end(filterObjects_.at(filter).l1etmiss_);
202  return std::pair<size_type,size_type>(begin,end);
203  }
204 
205  std::pair<size_type,size_type> l1hfringsSlice(size_type filter) const {
206  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1hfrings_);
207  const size_type end(filterObjects_.at(filter).l1hfrings_);
208  return std::pair<size_type,size_type>(begin,end);
209  }
210 
211  std::pair<size_type,size_type> pfjetSlice(size_type filter) const {
212  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pfjets_);
213  const size_type end(filterObjects_.at(filter).pfjets_);
214  return std::pair<size_type,size_type>(begin,end);
215  }
216 
217  std::pair<size_type,size_type> pftauSlice(size_type filter) const {
218  const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pftaus_);
219  const size_type end(filterObjects_.at(filter).pftaus_);
220  return std::pair<size_type,size_type>(begin,end);
221  }
222 
223 
225 
227  const size_type begin(photonSlice(filter).first);
228  const size_type end(photonSlice(filter).second);
229  TriggerRefsCollections::getObjects(ids,photons,begin,end);
230  }
231  void getObjects(size_type filter, int id, VRphoton& photons) const {
232  const size_type begin(photonSlice(filter).first);
233  const size_type end(photonSlice(filter).second);
234  TriggerRefsCollections::getObjects(id,photons,begin,end);
235  }
236 
238  const size_type begin(electronSlice(filter).first);
239  const size_type end(electronSlice(filter).second);
240  TriggerRefsCollections::getObjects(ids,electrons,begin,end);
241  }
243  const size_type begin(electronSlice(filter).first);
244  const size_type end(electronSlice(filter).second);
245  TriggerRefsCollections::getObjects(id,electrons,begin,end);
246  }
247 
248  void getObjects(size_type filter, Vids& ids, VRmuon& muons) const {
249  const size_type begin(muonSlice(filter).first);
250  const size_type end(muonSlice(filter).second);
251  TriggerRefsCollections::getObjects(ids,muons,begin,end);
252  }
253  void getObjects(size_type filter, int id, VRmuon& muons) const {
254  const size_type begin(muonSlice(filter).first);
255  const size_type end(muonSlice(filter).second);
256  TriggerRefsCollections::getObjects(id,muons,begin,end);
257  }
258 
259  void getObjects(size_type filter, Vids& ids, VRjet& jets) const {
260  const size_type begin(jetSlice(filter).first);
261  const size_type end(jetSlice(filter).second);
262  TriggerRefsCollections::getObjects(ids,jets,begin,end);
263  }
264  void getObjects(size_type filter, int id, VRjet& jets) const {
265  const size_type begin(jetSlice(filter).first);
266  const size_type end(jetSlice(filter).second);
267  TriggerRefsCollections::getObjects(id,jets,begin,end);
268  }
269 
270  void getObjects(size_type filter, Vids& ids, VRcomposite& composites) const {
271  const size_type begin(compositeSlice(filter).first);
272  const size_type end(compositeSlice(filter).second);
273  TriggerRefsCollections::getObjects(ids,composites,begin,end);
274  }
275  void getObjects(size_type filter, int id, VRcomposite& composites) const {
276  const size_type begin(compositeSlice(filter).first);
277  const size_type end(compositeSlice(filter).second);
278  TriggerRefsCollections::getObjects(id,composites,begin,end);
279  }
280 
281  void getObjects(size_type filter, Vids& ids, VRbasemet& basemets) const {
282  const size_type begin(basemetSlice(filter).first);
283  const size_type end(basemetSlice(filter).second);
284  TriggerRefsCollections::getObjects(ids,basemets,begin,end);
285  }
286  void getObjects(size_type filter, int id, VRbasemet& basemets) const {
287  const size_type begin(basemetSlice(filter).first);
288  const size_type end(basemetSlice(filter).second);
289  TriggerRefsCollections::getObjects(id,basemets,begin,end);
290  }
291 
292  void getObjects(size_type filter, Vids& ids, VRcalomet& calomets) const {
293  const size_type begin(calometSlice(filter).first);
294  const size_type end(calometSlice(filter).second);
295  TriggerRefsCollections::getObjects(ids,calomets,begin,end);
296  }
297  void getObjects(size_type filter, int id, VRcalomet& calomets) const {
298  const size_type begin(calometSlice(filter).first);
299  const size_type end(calometSlice(filter).second);
300  TriggerRefsCollections::getObjects(id,calomets,begin,end);
301  }
302 
303  void getObjects(size_type filter, Vids& ids, VRpixtrack& pixtracks) const {
304  const size_type begin(pixtrackSlice(filter).first);
305  const size_type end(pixtrackSlice(filter).second);
306  TriggerRefsCollections::getObjects(ids,pixtracks,begin,end);
307  }
308  void getObjects(size_type filter, int id, VRpixtrack& pixtracks) const {
309  const size_type begin(pixtrackSlice(filter).first);
310  const size_type end(pixtrackSlice(filter).second);
311  TriggerRefsCollections::getObjects(id,pixtracks,begin,end);
312  }
313 
314  void getObjects(size_type filter, Vids& ids, VRl1em& l1em) const {
315  const size_type begin(l1emSlice(filter).first);
316  const size_type end(l1emSlice(filter).second);
317  TriggerRefsCollections::getObjects(ids,l1em,begin,end);
318  }
319  void getObjects(size_type filter, int id, VRl1em& l1em) const {
320  const size_type begin(l1emSlice(filter).first);
321  const size_type end(l1emSlice(filter).second);
322  TriggerRefsCollections::getObjects(id,l1em,begin,end);
323  }
324 
325  void getObjects(size_type filter, Vids& ids, VRl1muon& l1muon) const {
326  const size_type begin(l1muonSlice(filter).first);
327  const size_type end(l1muonSlice(filter).second);
328  TriggerRefsCollections::getObjects(ids,l1muon,begin,end);
329  }
330  void getObjects(size_type filter, int id, VRl1muon& l1muon) const {
331  const size_type begin(l1muonSlice(filter).first);
332  const size_type end(l1muonSlice(filter).second);
333  TriggerRefsCollections::getObjects(id,l1muon,begin,end);
334  }
335 
336  void getObjects(size_type filter, Vids& ids, VRl1jet& l1jet) const {
337  const size_type begin(l1jetSlice(filter).first);
338  const size_type end(l1jetSlice(filter).second);
339  TriggerRefsCollections::getObjects(ids,l1jet,begin,end);
340  }
341  void getObjects(size_type filter, int id, VRl1jet& l1jet) const {
342  const size_type begin(l1jetSlice(filter).first);
343  const size_type end(l1jetSlice(filter).second);
344  TriggerRefsCollections::getObjects(id,l1jet,begin,end);
345  }
346 
347  void getObjects(size_type filter, Vids& ids, VRl1etmiss& l1etmiss) const {
348  const size_type begin(l1etmissSlice(filter).first);
349  const size_type end(l1etmissSlice(filter).second);
350  TriggerRefsCollections::getObjects(ids,l1etmiss,begin,end);
351  }
352  void getObjects(size_type filter, int id, VRl1etmiss& l1etmiss) const {
353  const size_type begin(l1etmissSlice(filter).first);
354  const size_type end(l1etmissSlice(filter).second);
355  TriggerRefsCollections::getObjects(id,l1etmiss,begin,end);
356  }
357 
358  void getObjects(size_type filter, Vids& ids, VRl1hfrings& l1hfrings) const {
359  const size_type begin(l1hfringsSlice(filter).first);
360  const size_type end(l1hfringsSlice(filter).second);
361  TriggerRefsCollections::getObjects(ids,l1hfrings,begin,end);
362  }
363  void getObjects(size_type filter, int id, VRl1hfrings& l1hfrings) const {
364  const size_type begin(l1hfringsSlice(filter).first);
365  const size_type end(l1hfringsSlice(filter).second);
366  TriggerRefsCollections::getObjects(id,l1hfrings,begin,end);
367  }
368 
369  void getObjects(size_type filter, Vids& ids, VRpfjet& pfjets) const {
370  const size_type begin(pfjetSlice(filter).first);
371  const size_type end(pfjetSlice(filter).second);
372  TriggerRefsCollections::getObjects(ids,pfjets,begin,end);
373  }
374  void getObjects(size_type filter, int id, VRpfjet& pfjets) const {
375  const size_type begin(pfjetSlice(filter).first);
376  const size_type end(pfjetSlice(filter).second);
377  TriggerRefsCollections::getObjects(id,pfjets,begin,end);
378  }
379 
380  void getObjects(size_type filter, Vids& ids, VRpftau& pftaus) const {
381  const size_type begin(pftauSlice(filter).first);
382  const size_type end(pftauSlice(filter).second);
383  TriggerRefsCollections::getObjects(ids,pftaus,begin,end);
384  }
385  void getObjects(size_type filter, int id, VRpftau& pftaus) const {
386  const size_type begin(pftauSlice(filter).first);
387  const size_type end(pftauSlice(filter).second);
388  TriggerRefsCollections::getObjects(id,pftaus,begin,end);
389  }
390 
391  };
392 
393 }
394 
395 #endif
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
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: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::CaloMETRef > VRcalomet
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)
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