CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DataFormats/HLTReco/interface/TriggerEventWithRefs.h

Go to the documentation of this file.
00001 #ifndef HLTReco_TriggerEventWithRefs_h
00002 #define HLTReco_TriggerEventWithRefs_h
00003 
00016 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00017 #include "DataFormats/HLTReco/interface/TriggerRefsCollections.h"
00018 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
00019 #include "FWCore/Utilities/interface/InputTag.h"
00020 #include "DataFormats/Common/interface/traits.h"
00021 #include <string>
00022 #include <vector>
00023 
00024 namespace trigger
00025 {
00026 
00029 
00030   class TriggerEventWithRefs : public TriggerRefsCollections, 
00031                                public edm::DoNotRecordParents {
00032 
00033   public:
00034 
00036     class TriggerFilterObject {
00037     public:
00039       std::string filterTag_;
00042       size_type photons_;
00043       size_type electrons_;
00044       size_type muons_;
00045       size_type jets_;
00046       size_type composites_;
00047       size_type basemets_;
00048       size_type calomets_;
00049       size_type pixtracks_;
00050       size_type l1em_;
00051       size_type l1muon_;
00052       size_type l1jet_;
00053       size_type l1etmiss_;
00054       size_type l1hfrings_;
00055 
00057       TriggerFilterObject() :
00058         filterTag_(),
00059         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) {
00060       filterTag_=edm::InputTag().encode();
00061       }
00062       TriggerFilterObject(const edm::InputTag& filterTag,
00063         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) :
00064         filterTag_(filterTag.encode()),
00065         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) { }
00066     };
00067 
00069   private:
00071     std::string usedProcessName_;    
00073     std::vector<TriggerFilterObject> filterObjects_;
00074 
00076   public:
00078     TriggerEventWithRefs(): TriggerRefsCollections(), usedProcessName_(), filterObjects_() { }
00079     TriggerEventWithRefs(const std::string& usedProcessName, size_type n):
00080       TriggerRefsCollections(),
00081       usedProcessName_(usedProcessName),
00082       filterObjects_()
00083     {
00084       filterObjects_.reserve(n);
00085     }
00086 
00088     void addFilterObject(const edm::InputTag& filterTag, const TriggerFilterObjectWithRefs& tfowr) {
00089       filterObjects_.push_back(
00090         TriggerFilterObject(filterTag, 
00091                             addObjects(tfowr.photonIds(),tfowr.photonRefs()),
00092                             addObjects(tfowr.electronIds(),tfowr.electronRefs()),
00093                             addObjects(tfowr.muonIds(),tfowr.muonRefs()),
00094                             addObjects(tfowr.jetIds(),tfowr.jetRefs()),
00095                             addObjects(tfowr.compositeIds(),tfowr.compositeRefs()),
00096                             addObjects(tfowr.basemetIds(),tfowr.basemetRefs()),
00097                             addObjects(tfowr.calometIds(),tfowr.calometRefs()),
00098                             addObjects(tfowr.pixtrackIds(),tfowr.pixtrackRefs()),
00099                             addObjects(tfowr.l1emIds(),tfowr.l1emRefs()),
00100                             addObjects(tfowr.l1muonIds(),tfowr.l1muonRefs()),
00101                             addObjects(tfowr.l1jetIds(),tfowr.l1jetRefs()),
00102                             addObjects(tfowr.l1etmissIds(),tfowr.l1etmissRefs()),
00103                             addObjects(tfowr.l1hfringsIds(),tfowr.l1hfringsRefs())
00104                            )
00105         );
00106     }
00107 
00109     const std::string& usedProcessName() const {return usedProcessName_;}
00110 
00112     size_type size() const {return filterObjects_.size();}
00113 
00115     const edm::InputTag filterTag(size_type filterIndex) const {
00116       return edm::InputTag(filterObjects_.at(filterIndex).filterTag_);
00117     }
00118 
00120     size_type filterIndex(const edm::InputTag& filterTag) const {
00121       const std::string encodedFilterTag (filterTag.encode());
00122       const size_type n(filterObjects_.size());
00123       for (size_type i=0; i!=n; ++i) {
00124         if (encodedFilterTag==filterObjects_[i].filterTag_) {return i;}
00125       }
00126       return n;
00127     }
00128 
00130 
00131     std::pair<size_type,size_type> photonSlice(size_type filter) const {
00132       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).photons_);
00133       const size_type end(filterObjects_.at(filter).photons_);
00134       return std::pair<size_type,size_type>(begin,end);
00135     }
00136 
00137     std::pair<size_type,size_type> electronSlice(size_type filter) const {
00138       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).electrons_);
00139       const size_type end(filterObjects_.at(filter).electrons_);
00140       return std::pair<size_type,size_type>(begin,end);
00141     }
00142 
00143     std::pair<size_type,size_type> muonSlice(size_type filter) const {
00144       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).muons_);
00145       const size_type end(filterObjects_.at(filter).muons_);
00146       return std::pair<size_type,size_type>(begin,end);
00147     }
00148 
00149     std::pair<size_type,size_type> jetSlice(size_type filter) const {
00150       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).jets_);
00151       const size_type end(filterObjects_.at(filter).jets_);
00152       return std::pair<size_type,size_type>(begin,end);
00153     }
00154 
00155     std::pair<size_type,size_type> compositeSlice(size_type filter) const {
00156       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).composites_);
00157       const size_type end(filterObjects_.at(filter).composites_);
00158       return std::pair<size_type,size_type>(begin,end);
00159     }
00160 
00161     std::pair<size_type,size_type> basemetSlice(size_type filter) const {
00162       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).basemets_);
00163       const size_type end(filterObjects_.at(filter).basemets_);
00164       return std::pair<size_type,size_type>(begin,end);
00165     }
00166 
00167     std::pair<size_type,size_type> calometSlice(size_type filter) const {
00168       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).calomets_);
00169       const size_type end(filterObjects_.at(filter).calomets_);
00170       return std::pair<size_type,size_type>(begin,end);
00171     }
00172 
00173     std::pair<size_type,size_type> pixtrackSlice(size_type filter) const {
00174       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pixtracks_);
00175       const size_type end(filterObjects_.at(filter).pixtracks_);
00176       return std::pair<size_type,size_type>(begin,end);
00177     }
00178 
00179     std::pair<size_type,size_type> l1emSlice(size_type filter) const {
00180       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1em_);
00181       const size_type end(filterObjects_.at(filter).l1em_);
00182       return std::pair<size_type,size_type>(begin,end);
00183     }
00184 
00185     std::pair<size_type,size_type> l1muonSlice(size_type filter) const {
00186       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1muon_);
00187       const size_type end(filterObjects_.at(filter).l1muon_);
00188       return std::pair<size_type,size_type>(begin,end);
00189     }
00190 
00191     std::pair<size_type,size_type> l1jetSlice(size_type filter) const {
00192       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1jet_);
00193       const size_type end(filterObjects_.at(filter).l1jet_);
00194       return std::pair<size_type,size_type>(begin,end);
00195     }
00196 
00197     std::pair<size_type,size_type> l1etmissSlice(size_type filter) const {
00198       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1etmiss_);
00199       const size_type end(filterObjects_.at(filter).l1etmiss_);
00200       return std::pair<size_type,size_type>(begin,end);
00201     }
00202 
00203     std::pair<size_type,size_type> l1hfringsSlice(size_type filter) const {
00204       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1hfrings_);
00205       const size_type end(filterObjects_.at(filter).l1hfrings_);
00206       return std::pair<size_type,size_type>(begin,end);
00207     }
00208 
00209 
00211 
00212     void getObjects(size_type filter, Vids& ids, VRphoton& photons) const {
00213       const size_type begin(photonSlice(filter).first);
00214       const size_type   end(photonSlice(filter).second);
00215       TriggerRefsCollections::getObjects(ids,photons,begin,end);
00216     }
00217     void getObjects(size_type filter, int id, VRphoton& photons) const {
00218       const size_type begin(photonSlice(filter).first);
00219       const size_type   end(photonSlice(filter).second);
00220       TriggerRefsCollections::getObjects(id,photons,begin,end);
00221     }
00222 
00223     void getObjects(size_type filter, Vids& ids, VRelectron& electrons) const {
00224       const size_type begin(electronSlice(filter).first);
00225       const size_type   end(electronSlice(filter).second);
00226       TriggerRefsCollections::getObjects(ids,electrons,begin,end);
00227     }
00228     void getObjects(size_type filter, int id, VRelectron& electrons) const {
00229       const size_type begin(electronSlice(filter).first);
00230       const size_type   end(electronSlice(filter).second);
00231       TriggerRefsCollections::getObjects(id,electrons,begin,end);
00232     }
00233 
00234     void getObjects(size_type filter, Vids& ids, VRmuon& muons) const {
00235       const size_type begin(muonSlice(filter).first);
00236       const size_type   end(muonSlice(filter).second);
00237       TriggerRefsCollections::getObjects(ids,muons,begin,end);
00238     }
00239     void getObjects(size_type filter, int id, VRmuon& muons) const {
00240       const size_type begin(muonSlice(filter).first);
00241       const size_type   end(muonSlice(filter).second);
00242       TriggerRefsCollections::getObjects(id,muons,begin,end);
00243     }
00244 
00245     void getObjects(size_type filter, Vids& ids, VRjet& jets) const {
00246       const size_type begin(jetSlice(filter).first);
00247       const size_type   end(jetSlice(filter).second);
00248       TriggerRefsCollections::getObjects(ids,jets,begin,end);
00249     }
00250     void getObjects(size_type filter, int id, VRjet& jets) const {
00251       const size_type begin(jetSlice(filter).first);
00252       const size_type   end(jetSlice(filter).second);
00253       TriggerRefsCollections::getObjects(id,jets,begin,end);
00254     }
00255 
00256     void getObjects(size_type filter, Vids& ids, VRcomposite& composites) const {
00257       const size_type begin(compositeSlice(filter).first);
00258       const size_type   end(compositeSlice(filter).second);
00259       TriggerRefsCollections::getObjects(ids,composites,begin,end);
00260     }
00261     void getObjects(size_type filter, int id, VRcomposite& composites) const {
00262       const size_type begin(compositeSlice(filter).first);
00263       const size_type   end(compositeSlice(filter).second);
00264       TriggerRefsCollections::getObjects(id,composites,begin,end);
00265     }
00266 
00267     void getObjects(size_type filter, Vids& ids, VRbasemet& basemets) const {
00268       const size_type begin(basemetSlice(filter).first);
00269       const size_type   end(basemetSlice(filter).second);
00270       TriggerRefsCollections::getObjects(ids,basemets,begin,end);
00271     }
00272     void getObjects(size_type filter, int id, VRbasemet& basemets) const {
00273       const size_type begin(basemetSlice(filter).first);
00274       const size_type   end(basemetSlice(filter).second);
00275       TriggerRefsCollections::getObjects(id,basemets,begin,end);
00276     }
00277 
00278     void getObjects(size_type filter, Vids& ids, VRcalomet& calomets) const {
00279       const size_type begin(calometSlice(filter).first);
00280       const size_type   end(calometSlice(filter).second);
00281       TriggerRefsCollections::getObjects(ids,calomets,begin,end);
00282     }
00283     void getObjects(size_type filter, int id, VRcalomet& calomets) const {
00284       const size_type begin(calometSlice(filter).first);
00285       const size_type   end(calometSlice(filter).second);
00286       TriggerRefsCollections::getObjects(id,calomets,begin,end);
00287     }
00288 
00289     void getObjects(size_type filter, Vids& ids, VRpixtrack& pixtracks) const {
00290       const size_type begin(pixtrackSlice(filter).first);
00291       const size_type   end(pixtrackSlice(filter).second);
00292       TriggerRefsCollections::getObjects(ids,pixtracks,begin,end);
00293     }
00294     void getObjects(size_type filter, int id, VRpixtrack& pixtracks) const {
00295       const size_type begin(pixtrackSlice(filter).first);
00296       const size_type   end(pixtrackSlice(filter).second);
00297       TriggerRefsCollections::getObjects(id,pixtracks,begin,end);
00298     }
00299 
00300     void getObjects(size_type filter, Vids& ids, VRl1em& l1em) const {
00301       const size_type begin(l1emSlice(filter).first);
00302       const size_type   end(l1emSlice(filter).second);
00303       TriggerRefsCollections::getObjects(ids,l1em,begin,end);
00304     }
00305     void getObjects(size_type filter, int id, VRl1em& l1em) const {
00306       const size_type begin(l1emSlice(filter).first);
00307       const size_type   end(l1emSlice(filter).second);
00308       TriggerRefsCollections::getObjects(id,l1em,begin,end);
00309     }
00310 
00311     void getObjects(size_type filter, Vids& ids, VRl1muon& l1muon) const {
00312       const size_type begin(l1muonSlice(filter).first);
00313       const size_type   end(l1muonSlice(filter).second);
00314       TriggerRefsCollections::getObjects(ids,l1muon,begin,end);
00315     }
00316     void getObjects(size_type filter, int id, VRl1muon& l1muon) const {
00317       const size_type begin(l1muonSlice(filter).first);
00318       const size_type   end(l1muonSlice(filter).second);
00319       TriggerRefsCollections::getObjects(id,l1muon,begin,end);
00320     }
00321 
00322     void getObjects(size_type filter, Vids& ids, VRl1jet& l1jet) const {
00323       const size_type begin(l1jetSlice(filter).first);
00324       const size_type   end(l1jetSlice(filter).second);
00325       TriggerRefsCollections::getObjects(ids,l1jet,begin,end);
00326     }
00327     void getObjects(size_type filter, int id, VRl1jet& l1jet) const {
00328       const size_type begin(l1jetSlice(filter).first);
00329       const size_type   end(l1jetSlice(filter).second);
00330       TriggerRefsCollections::getObjects(id,l1jet,begin,end);
00331     }
00332 
00333     void getObjects(size_type filter, Vids& ids, VRl1etmiss& l1etmiss) const {
00334       const size_type begin(l1etmissSlice(filter).first);
00335       const size_type   end(l1etmissSlice(filter).second);
00336       TriggerRefsCollections::getObjects(ids,l1etmiss,begin,end);
00337     }
00338     void getObjects(size_type filter, int id, VRl1etmiss& l1etmiss) const {
00339       const size_type begin(l1etmissSlice(filter).first);
00340       const size_type   end(l1etmissSlice(filter).second);
00341       TriggerRefsCollections::getObjects(id,l1etmiss,begin,end);
00342     }
00343 
00344     void getObjects(size_type filter, Vids& ids, VRl1hfrings& l1hfrings) const {
00345       const size_type begin(l1hfringsSlice(filter).first);
00346       const size_type   end(l1hfringsSlice(filter).second);
00347       TriggerRefsCollections::getObjects(ids,l1hfrings,begin,end);
00348     }
00349     void getObjects(size_type filter, int id, VRl1hfrings& l1hfrings) const {
00350       const size_type begin(l1hfringsSlice(filter).first);
00351       const size_type   end(l1hfringsSlice(filter).second);
00352       TriggerRefsCollections::getObjects(id,l1hfrings,begin,end);
00353     }
00354 
00355   };
00356 
00357 }
00358 
00359 #endif