Go to the documentation of this file.00001 #ifndef HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
00002 #define HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
00003
00015 #include "DataFormats/Common/interface/TriggerResults.h"
00016 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
00017 #include "DataFormats/MuonReco/interface/Muon.h"
00018 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00019 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00020 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00021 #include "DataFormats/METReco/interface/CaloMET.h"
00022 #include "DataFormats/METReco/interface/CaloMETFwd.h"
00023 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00024 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00025 #include "DataFormats/TrackReco/interface/Track.h"
00026 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00027 #include "DataFormats/TauReco/interface/PFTau.h"
00028 #include "DataFormats/TauReco/interface/PFTauFwd.h"
00029 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00030
00031 #include<vector>
00032 #include<map>
00033
00035 struct EVTColContainer
00036 {
00037 enum
00038 {
00039 MUON,
00040 ELEC,
00041 PHOTON,
00042 CALOMET,
00043 PFTAU,
00044
00045 _nMAX
00046 };
00047
00048 int nOfCollections;
00049 int nInitialized;
00050 const reco::GenParticleCollection * genParticles;
00051 const std::vector<reco::Muon> * muons;
00052 const std::vector<reco::GsfElectron> * electrons;
00053 const std::vector<reco::Photon> * photons;
00054 const std::vector<reco::CaloMET> * caloMETs;
00055 const std::vector<reco::PFTau> * pfTaus;
00056
00057 const trigger::TriggerEventWithRefs * rawTriggerEvent;
00058 const edm::TriggerResults * triggerResults ;
00059 EVTColContainer():
00060
00061 nOfCollections(5),
00062 nInitialized(0),
00063 genParticles(0),
00064 muons(0),
00065 electrons(0),
00066 photons(0),
00067 pfTaus(0),
00068
00069 rawTriggerEvent(0),
00070 triggerResults(0)
00071 {
00072 }
00074 bool isAllInit()
00075 {
00076 return (nInitialized == nOfCollections);
00077 }
00078
00079 bool isCommonInit()
00080 {
00081 return (rawTriggerEvent != 0);
00082 }
00084 void reset()
00085 {
00086 nInitialized = 0;
00087 genParticles = 0;
00088 muons = 0; electrons = 0; photons = 0; pfTaus=0; caloMETs=0;
00089 rawTriggerEvent = 0;
00090 triggerResults = 0;
00091 }
00093 void set(const reco::MuonCollection * v)
00094 {
00095 muons = v;
00096 ++nInitialized;
00097 }
00098 void set(const reco::GsfElectronCollection * v)
00099 {
00100 electrons = v;
00101 ++nInitialized;
00102 }
00103 void set(const reco::PhotonCollection * v)
00104 {
00105 photons = v;
00106 ++nInitialized;
00107 }
00108 void set(const reco::CaloMETCollection * v)
00109 {
00110 caloMETs = v;
00111 ++nInitialized;
00112 }
00113 void set(const reco::PFTauCollection * v)
00114 {
00115 pfTaus = v;
00116 ++nInitialized;
00117 }
00118
00119
00120
00121
00122
00123 const unsigned int getSize(const unsigned int & objtype) const
00124 {
00125 unsigned int size = 0;
00126 if( objtype == EVTColContainer::MUON && muons != 0 )
00127 {
00128 size = muons->size();
00129 }
00130 else if( objtype == EVTColContainer::ELEC && electrons != 0 )
00131 {
00132 size = electrons->size();
00133 }
00134 else if( objtype == EVTColContainer::PHOTON && photons != 0 )
00135 {
00136 size = photons->size();
00137 }
00138 else if( objtype == EVTColContainer::CALOMET && caloMETs != 0 )
00139 {
00140 size = caloMETs->size();
00141 }
00142 else if( objtype == EVTColContainer::PFTAU && pfTaus != 0 )
00143 {
00144 size = pfTaus->size();
00145 }
00146
00147
00148
00149
00150
00151 return size;
00152 }
00153
00154 static std::string getTypeString(const unsigned int & objtype)
00155 {
00156 std::string objTypestr;
00157
00158 if( objtype == EVTColContainer::MUON )
00159 {
00160 objTypestr = "Mu";
00161 }
00162 else if( objtype == EVTColContainer::ELEC )
00163 {
00164 objTypestr = "Ele";
00165 }
00166 else if( objtype == EVTColContainer::PHOTON )
00167 {
00168 objTypestr = "Photon";
00169 }
00170 else if( objtype == EVTColContainer::CALOMET )
00171 {
00172 objTypestr = "MET";
00173 }
00174 else if( objtype == EVTColContainer::PFTAU )
00175 {
00176 objTypestr = "PFTau";
00177 }
00178
00179
00180
00181
00182
00183 else
00184 {
00185 edm::LogError("HiggsValidations") << "EVTColContainer::getTypeString, "
00186 << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;;
00187 }
00188
00189 return objTypestr;
00190 }
00191 };
00192 #endif