File indexing completed on 2024-04-06 12:18:53
0001 #ifndef HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
0002 #define HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "DataFormats/Common/interface/TriggerResults.h"
0014 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h" // TO BE DEPRECATED
0015 #include "DataFormats/MuonReco/interface/Muon.h"
0016 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0017 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0018 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0019 #include "DataFormats/METReco/interface/CaloMET.h"
0020 #include "DataFormats/METReco/interface/CaloMETFwd.h"
0021 #include "DataFormats/METReco/interface/PFMET.h"
0022 #include "DataFormats/METReco/interface/PFMETFwd.h"
0023 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0024 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
0025 #include "DataFormats/TrackReco/interface/Track.h"
0026 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0027 #include "DataFormats/TauReco/interface/PFTau.h"
0028 #include "DataFormats/TauReco/interface/PFTauFwd.h"
0029 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0030 #include "DataFormats/JetReco/interface/GenJet.h"
0031 #include "DataFormats/JetReco/interface/GenJetCollection.h"
0032 #include "DataFormats/JetReco/interface/PFJet.h"
0033 #include "DataFormats/JetReco/interface/PFJetCollection.h"
0034 #include "DataFormats/BTauReco/interface/JetTag.h"
0035 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0036
0037 #include <vector>
0038 #include <map>
0039
0040
0041 struct EVTColContainer {
0042 enum {
0043 MUON,
0044 ELEC,
0045 PHOTON,
0046 CALOMET,
0047 PFMET,
0048 PFTAU,
0049 PFJET,
0050
0051 _nMAX
0052 };
0053
0054 int nOfCollections;
0055 int nInitialized;
0056 const reco::GenParticleCollection* genParticles;
0057 const reco::GenJetCollection* genJets;
0058 const std::vector<reco::Muon>* muons;
0059 const std::vector<reco::GsfElectron>* electrons;
0060 const std::vector<reco::Photon>* photons;
0061 const std::vector<reco::CaloMET>* caloMETs;
0062 const std::vector<reco::PFMET>* pfMETs;
0063 const std::vector<reco::PFTau>* pfTaus;
0064 const std::vector<reco::PFJet>* pfJets;
0065 const reco::JetTagCollection* jetTags;
0066
0067 const trigger::TriggerEventWithRefs* rawTriggerEvent;
0068 const edm::TriggerResults* triggerResults;
0069 EVTColContainer()
0070 : nOfCollections(7),
0071 nInitialized(0),
0072 genParticles(nullptr),
0073 genJets(nullptr),
0074 muons(nullptr),
0075 electrons(nullptr),
0076 photons(nullptr),
0077 caloMETs(nullptr),
0078 pfMETs(nullptr),
0079 pfTaus(nullptr),
0080 pfJets(nullptr),
0081 jetTags(nullptr),
0082
0083 rawTriggerEvent(nullptr),
0084 triggerResults(nullptr) {}
0085
0086 bool isAllInit() { return (nInitialized == nOfCollections); }
0087
0088 bool isCommonInit() { return (rawTriggerEvent != nullptr); }
0089
0090 void reset() {
0091 nInitialized = 0;
0092 genParticles = nullptr;
0093 genJets = nullptr;
0094 muons = nullptr;
0095 electrons = nullptr;
0096 photons = nullptr;
0097 pfTaus = nullptr;
0098 caloMETs = nullptr;
0099 pfMETs = nullptr;
0100 pfJets = nullptr;
0101 jetTags = nullptr;
0102 rawTriggerEvent = nullptr;
0103 triggerResults = nullptr;
0104 }
0105
0106 void set(const reco::MuonCollection* v) {
0107 muons = v;
0108 ++nInitialized;
0109 }
0110 void set(const reco::GsfElectronCollection* v) {
0111 electrons = v;
0112 ++nInitialized;
0113 }
0114 void set(const reco::PhotonCollection* v) {
0115 photons = v;
0116 ++nInitialized;
0117 }
0118 void set(const reco::CaloMETCollection* v) {
0119 caloMETs = v;
0120 ++nInitialized;
0121 }
0122 void set(const reco::PFMETCollection* v) {
0123 pfMETs = v;
0124 ++nInitialized;
0125 }
0126 void set(const reco::PFTauCollection* v) {
0127 pfTaus = v;
0128 ++nInitialized;
0129 }
0130 void set(const reco::PFJetCollection* v) {
0131 pfJets = v;
0132 ++nInitialized;
0133 }
0134 void set(const reco::JetTagCollection* v) { jetTags = v; }
0135
0136
0137
0138
0139
0140 const unsigned int getSize(const unsigned int& objtype) const {
0141 unsigned int size = 0;
0142 if (objtype == EVTColContainer::MUON && muons != nullptr) {
0143 size = muons->size();
0144 } else if (objtype == EVTColContainer::ELEC && electrons != nullptr) {
0145 size = electrons->size();
0146 } else if (objtype == EVTColContainer::PHOTON && photons != nullptr) {
0147 size = photons->size();
0148 } else if (objtype == EVTColContainer::CALOMET && caloMETs != nullptr) {
0149 size = caloMETs->size();
0150 } else if (objtype == EVTColContainer::PFMET && pfMETs != nullptr) {
0151 size = pfMETs->size();
0152 } else if (objtype == EVTColContainer::PFTAU && pfTaus != nullptr) {
0153 size = pfTaus->size();
0154 } else if (objtype == EVTColContainer::PFJET && pfJets != nullptr) {
0155 size = pfJets->size();
0156 }
0157
0158
0159
0160
0161
0162 return size;
0163 }
0164
0165 static std::string getTypeString(const unsigned int& objtype) {
0166 std::string objTypestr;
0167
0168 if (objtype == EVTColContainer::MUON) {
0169 objTypestr = "Mu";
0170 } else if (objtype == EVTColContainer::ELEC) {
0171 objTypestr = "Ele";
0172 } else if (objtype == EVTColContainer::PHOTON) {
0173 objTypestr = "Photon";
0174 } else if (objtype == EVTColContainer::CALOMET) {
0175 objTypestr = "MET";
0176 } else if (objtype == EVTColContainer::PFMET) {
0177 objTypestr = "PFMET";
0178 } else if (objtype == EVTColContainer::PFTAU) {
0179 objTypestr = "PFTau";
0180 } else if (objtype == EVTColContainer::PFJET) {
0181 objTypestr = "Jet";
0182 }
0183
0184
0185
0186
0187
0188 else {
0189 edm::LogError("HiggsValidations") << "EVTColContainer::getTypeString, "
0190 << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;
0191 ;
0192 }
0193
0194 return objTypestr;
0195 }
0196 };
0197 #endif