CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_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       size_type pfjets_;
00056       size_type pftaus_;
00057 
00059       TriggerFilterObject() :
00060         filterTag_(),
00061         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) {
00062       filterTag_=edm::InputTag().encode();
00063       }
00064       TriggerFilterObject(const edm::InputTag& filterTag,
00065                           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) :
00066         filterTag_(filterTag.encode()),
00067         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) { }
00068     };
00069 
00071   private:
00073     std::string usedProcessName_;    
00075     std::vector<TriggerFilterObject> filterObjects_;
00076 
00078   public:
00080     TriggerEventWithRefs(): TriggerRefsCollections(), usedProcessName_(), filterObjects_() { }
00081     TriggerEventWithRefs(const std::string& usedProcessName, size_type n):
00082       TriggerRefsCollections(),
00083       usedProcessName_(usedProcessName),
00084       filterObjects_()
00085     {
00086       filterObjects_.reserve(n);
00087     }
00088 
00090     void addFilterObject(const edm::InputTag& filterTag, const TriggerFilterObjectWithRefs& tfowr) {
00091       filterObjects_.push_back(
00092         TriggerFilterObject(filterTag, 
00093                             addObjects(tfowr.photonIds(),tfowr.photonRefs()),
00094                             addObjects(tfowr.electronIds(),tfowr.electronRefs()),
00095                             addObjects(tfowr.muonIds(),tfowr.muonRefs()),
00096                             addObjects(tfowr.jetIds(),tfowr.jetRefs()),
00097                             addObjects(tfowr.compositeIds(),tfowr.compositeRefs()),
00098                             addObjects(tfowr.basemetIds(),tfowr.basemetRefs()),
00099                             addObjects(tfowr.calometIds(),tfowr.calometRefs()),
00100                             addObjects(tfowr.pixtrackIds(),tfowr.pixtrackRefs()),
00101                             addObjects(tfowr.l1emIds(),tfowr.l1emRefs()),
00102                             addObjects(tfowr.l1muonIds(),tfowr.l1muonRefs()),
00103                             addObjects(tfowr.l1jetIds(),tfowr.l1jetRefs()),
00104                             addObjects(tfowr.l1etmissIds(),tfowr.l1etmissRefs()),
00105                             addObjects(tfowr.l1hfringsIds(),tfowr.l1hfringsRefs()),
00106                             addObjects(tfowr.pfjetIds(),tfowr.pfjetRefs()),
00107                             addObjects(tfowr.pftauIds(),tfowr.pftauRefs())
00108                            )
00109         );
00110     }
00111 
00113     const std::string& usedProcessName() const {return usedProcessName_;}
00114 
00116     size_type size() const {return filterObjects_.size();}
00117 
00119     const edm::InputTag filterTag(size_type filterIndex) const {
00120       return edm::InputTag(filterObjects_.at(filterIndex).filterTag_);
00121     }
00122 
00124     size_type filterIndex(const edm::InputTag& filterTag) const {
00125       const std::string encodedFilterTag (filterTag.encode());
00126       const size_type n(filterObjects_.size());
00127       for (size_type i=0; i!=n; ++i) {
00128         if (encodedFilterTag==filterObjects_[i].filterTag_) {return i;}
00129       }
00130       return n;
00131     }
00132 
00134 
00135     std::pair<size_type,size_type> photonSlice(size_type filter) const {
00136       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).photons_);
00137       const size_type end(filterObjects_.at(filter).photons_);
00138       return std::pair<size_type,size_type>(begin,end);
00139     }
00140 
00141     std::pair<size_type,size_type> electronSlice(size_type filter) const {
00142       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).electrons_);
00143       const size_type end(filterObjects_.at(filter).electrons_);
00144       return std::pair<size_type,size_type>(begin,end);
00145     }
00146 
00147     std::pair<size_type,size_type> muonSlice(size_type filter) const {
00148       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).muons_);
00149       const size_type end(filterObjects_.at(filter).muons_);
00150       return std::pair<size_type,size_type>(begin,end);
00151     }
00152 
00153     std::pair<size_type,size_type> jetSlice(size_type filter) const {
00154       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).jets_);
00155       const size_type end(filterObjects_.at(filter).jets_);
00156       return std::pair<size_type,size_type>(begin,end);
00157     }
00158 
00159     std::pair<size_type,size_type> compositeSlice(size_type filter) const {
00160       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).composites_);
00161       const size_type end(filterObjects_.at(filter).composites_);
00162       return std::pair<size_type,size_type>(begin,end);
00163     }
00164 
00165     std::pair<size_type,size_type> basemetSlice(size_type filter) const {
00166       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).basemets_);
00167       const size_type end(filterObjects_.at(filter).basemets_);
00168       return std::pair<size_type,size_type>(begin,end);
00169     }
00170 
00171     std::pair<size_type,size_type> calometSlice(size_type filter) const {
00172       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).calomets_);
00173       const size_type end(filterObjects_.at(filter).calomets_);
00174       return std::pair<size_type,size_type>(begin,end);
00175     }
00176 
00177     std::pair<size_type,size_type> pixtrackSlice(size_type filter) const {
00178       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pixtracks_);
00179       const size_type end(filterObjects_.at(filter).pixtracks_);
00180       return std::pair<size_type,size_type>(begin,end);
00181     }
00182 
00183     std::pair<size_type,size_type> l1emSlice(size_type filter) const {
00184       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1em_);
00185       const size_type end(filterObjects_.at(filter).l1em_);
00186       return std::pair<size_type,size_type>(begin,end);
00187     }
00188 
00189     std::pair<size_type,size_type> l1muonSlice(size_type filter) const {
00190       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1muon_);
00191       const size_type end(filterObjects_.at(filter).l1muon_);
00192       return std::pair<size_type,size_type>(begin,end);
00193     }
00194 
00195     std::pair<size_type,size_type> l1jetSlice(size_type filter) const {
00196       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1jet_);
00197       const size_type end(filterObjects_.at(filter).l1jet_);
00198       return std::pair<size_type,size_type>(begin,end);
00199     }
00200 
00201     std::pair<size_type,size_type> l1etmissSlice(size_type filter) const {
00202       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1etmiss_);
00203       const size_type end(filterObjects_.at(filter).l1etmiss_);
00204       return std::pair<size_type,size_type>(begin,end);
00205     }
00206 
00207     std::pair<size_type,size_type> l1hfringsSlice(size_type filter) const {
00208       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).l1hfrings_);
00209       const size_type end(filterObjects_.at(filter).l1hfrings_);
00210       return std::pair<size_type,size_type>(begin,end);
00211     }
00212 
00213     std::pair<size_type,size_type> pfjetSlice(size_type filter) const {
00214       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pfjets_);
00215       const size_type end(filterObjects_.at(filter).pfjets_);
00216       return std::pair<size_type,size_type>(begin,end);
00217     }
00218 
00219     std::pair<size_type,size_type> pftauSlice(size_type filter) const {
00220       const size_type begin(filter==0? 0 : filterObjects_.at(filter-1).pftaus_);
00221       const size_type end(filterObjects_.at(filter).pftaus_);
00222       return std::pair<size_type,size_type>(begin,end);
00223     }
00224 
00225 
00227 
00228     void getObjects(size_type filter, Vids& ids, VRphoton& photons) const {
00229       const size_type begin(photonSlice(filter).first);
00230       const size_type   end(photonSlice(filter).second);
00231       TriggerRefsCollections::getObjects(ids,photons,begin,end);
00232     }
00233     void getObjects(size_type filter, int id, VRphoton& photons) const {
00234       const size_type begin(photonSlice(filter).first);
00235       const size_type   end(photonSlice(filter).second);
00236       TriggerRefsCollections::getObjects(id,photons,begin,end);
00237     }
00238 
00239     void getObjects(size_type filter, Vids& ids, VRelectron& electrons) const {
00240       const size_type begin(electronSlice(filter).first);
00241       const size_type   end(electronSlice(filter).second);
00242       TriggerRefsCollections::getObjects(ids,electrons,begin,end);
00243     }
00244     void getObjects(size_type filter, int id, VRelectron& electrons) const {
00245       const size_type begin(electronSlice(filter).first);
00246       const size_type   end(electronSlice(filter).second);
00247       TriggerRefsCollections::getObjects(id,electrons,begin,end);
00248     }
00249 
00250     void getObjects(size_type filter, Vids& ids, VRmuon& muons) const {
00251       const size_type begin(muonSlice(filter).first);
00252       const size_type   end(muonSlice(filter).second);
00253       TriggerRefsCollections::getObjects(ids,muons,begin,end);
00254     }
00255     void getObjects(size_type filter, int id, VRmuon& muons) const {
00256       const size_type begin(muonSlice(filter).first);
00257       const size_type   end(muonSlice(filter).second);
00258       TriggerRefsCollections::getObjects(id,muons,begin,end);
00259     }
00260 
00261     void getObjects(size_type filter, Vids& ids, VRjet& jets) const {
00262       const size_type begin(jetSlice(filter).first);
00263       const size_type   end(jetSlice(filter).second);
00264       TriggerRefsCollections::getObjects(ids,jets,begin,end);
00265     }
00266     void getObjects(size_type filter, int id, VRjet& jets) const {
00267       const size_type begin(jetSlice(filter).first);
00268       const size_type   end(jetSlice(filter).second);
00269       TriggerRefsCollections::getObjects(id,jets,begin,end);
00270     }
00271 
00272     void getObjects(size_type filter, Vids& ids, VRcomposite& composites) const {
00273       const size_type begin(compositeSlice(filter).first);
00274       const size_type   end(compositeSlice(filter).second);
00275       TriggerRefsCollections::getObjects(ids,composites,begin,end);
00276     }
00277     void getObjects(size_type filter, int id, VRcomposite& composites) const {
00278       const size_type begin(compositeSlice(filter).first);
00279       const size_type   end(compositeSlice(filter).second);
00280       TriggerRefsCollections::getObjects(id,composites,begin,end);
00281     }
00282 
00283     void getObjects(size_type filter, Vids& ids, VRbasemet& basemets) const {
00284       const size_type begin(basemetSlice(filter).first);
00285       const size_type   end(basemetSlice(filter).second);
00286       TriggerRefsCollections::getObjects(ids,basemets,begin,end);
00287     }
00288     void getObjects(size_type filter, int id, VRbasemet& basemets) const {
00289       const size_type begin(basemetSlice(filter).first);
00290       const size_type   end(basemetSlice(filter).second);
00291       TriggerRefsCollections::getObjects(id,basemets,begin,end);
00292     }
00293 
00294     void getObjects(size_type filter, Vids& ids, VRcalomet& calomets) const {
00295       const size_type begin(calometSlice(filter).first);
00296       const size_type   end(calometSlice(filter).second);
00297       TriggerRefsCollections::getObjects(ids,calomets,begin,end);
00298     }
00299     void getObjects(size_type filter, int id, VRcalomet& calomets) const {
00300       const size_type begin(calometSlice(filter).first);
00301       const size_type   end(calometSlice(filter).second);
00302       TriggerRefsCollections::getObjects(id,calomets,begin,end);
00303     }
00304 
00305     void getObjects(size_type filter, Vids& ids, VRpixtrack& pixtracks) const {
00306       const size_type begin(pixtrackSlice(filter).first);
00307       const size_type   end(pixtrackSlice(filter).second);
00308       TriggerRefsCollections::getObjects(ids,pixtracks,begin,end);
00309     }
00310     void getObjects(size_type filter, int id, VRpixtrack& pixtracks) const {
00311       const size_type begin(pixtrackSlice(filter).first);
00312       const size_type   end(pixtrackSlice(filter).second);
00313       TriggerRefsCollections::getObjects(id,pixtracks,begin,end);
00314     }
00315 
00316     void getObjects(size_type filter, Vids& ids, VRl1em& l1em) const {
00317       const size_type begin(l1emSlice(filter).first);
00318       const size_type   end(l1emSlice(filter).second);
00319       TriggerRefsCollections::getObjects(ids,l1em,begin,end);
00320     }
00321     void getObjects(size_type filter, int id, VRl1em& l1em) const {
00322       const size_type begin(l1emSlice(filter).first);
00323       const size_type   end(l1emSlice(filter).second);
00324       TriggerRefsCollections::getObjects(id,l1em,begin,end);
00325     }
00326 
00327     void getObjects(size_type filter, Vids& ids, VRl1muon& l1muon) const {
00328       const size_type begin(l1muonSlice(filter).first);
00329       const size_type   end(l1muonSlice(filter).second);
00330       TriggerRefsCollections::getObjects(ids,l1muon,begin,end);
00331     }
00332     void getObjects(size_type filter, int id, VRl1muon& l1muon) const {
00333       const size_type begin(l1muonSlice(filter).first);
00334       const size_type   end(l1muonSlice(filter).second);
00335       TriggerRefsCollections::getObjects(id,l1muon,begin,end);
00336     }
00337 
00338     void getObjects(size_type filter, Vids& ids, VRl1jet& l1jet) const {
00339       const size_type begin(l1jetSlice(filter).first);
00340       const size_type   end(l1jetSlice(filter).second);
00341       TriggerRefsCollections::getObjects(ids,l1jet,begin,end);
00342     }
00343     void getObjects(size_type filter, int id, VRl1jet& l1jet) const {
00344       const size_type begin(l1jetSlice(filter).first);
00345       const size_type   end(l1jetSlice(filter).second);
00346       TriggerRefsCollections::getObjects(id,l1jet,begin,end);
00347     }
00348 
00349     void getObjects(size_type filter, Vids& ids, VRl1etmiss& l1etmiss) const {
00350       const size_type begin(l1etmissSlice(filter).first);
00351       const size_type   end(l1etmissSlice(filter).second);
00352       TriggerRefsCollections::getObjects(ids,l1etmiss,begin,end);
00353     }
00354     void getObjects(size_type filter, int id, VRl1etmiss& l1etmiss) const {
00355       const size_type begin(l1etmissSlice(filter).first);
00356       const size_type   end(l1etmissSlice(filter).second);
00357       TriggerRefsCollections::getObjects(id,l1etmiss,begin,end);
00358     }
00359 
00360     void getObjects(size_type filter, Vids& ids, VRl1hfrings& l1hfrings) const {
00361       const size_type begin(l1hfringsSlice(filter).first);
00362       const size_type   end(l1hfringsSlice(filter).second);
00363       TriggerRefsCollections::getObjects(ids,l1hfrings,begin,end);
00364     }
00365     void getObjects(size_type filter, int id, VRl1hfrings& l1hfrings) const {
00366       const size_type begin(l1hfringsSlice(filter).first);
00367       const size_type   end(l1hfringsSlice(filter).second);
00368       TriggerRefsCollections::getObjects(id,l1hfrings,begin,end);
00369     }
00370 
00371     void getObjects(size_type filter, Vids& ids, VRpfjet& pfjets) const {
00372       const size_type begin(pfjetSlice(filter).first);
00373       const size_type   end(pfjetSlice(filter).second);
00374       TriggerRefsCollections::getObjects(ids,pfjets,begin,end);
00375     }
00376     void getObjects(size_type filter, int id, VRpfjet& pfjets) const {
00377       const size_type begin(pfjetSlice(filter).first);
00378       const size_type   end(pfjetSlice(filter).second);
00379       TriggerRefsCollections::getObjects(id,pfjets,begin,end);
00380     }
00381 
00382     void getObjects(size_type filter, Vids& ids, VRpftau& pftaus) const {
00383       const size_type begin(pftauSlice(filter).first);
00384       const size_type   end(pftauSlice(filter).second);
00385       TriggerRefsCollections::getObjects(ids,pftaus,begin,end);
00386     }
00387     void getObjects(size_type filter, int id, VRpftau& pftaus) const {
00388       const size_type begin(pftauSlice(filter).first);
00389       const size_type   end(pftauSlice(filter).second);
00390       TriggerRefsCollections::getObjects(id,pftaus,begin,end);
00391     }
00392 
00393   };
00394 
00395 }
00396 
00397 #endif