CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EVTColContainer.h
Go to the documentation of this file.
1 #ifndef HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
2 #define HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
3 
14 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h" // TO BE DEPRECATED
36 
37 #include <vector>
38 #include <map>
39 
41 struct EVTColContainer {
42  enum {
43  MUON,
44  ELEC,
45  PHOTON,
46  CALOMET,
47  PFMET,
48  PFTAU,
49  PFJET,
50  // TRACK,
51  _nMAX
52  };
53 
54  int nOfCollections;
55  int nInitialized;
58  const std::vector<reco::Muon>* muons;
59  const std::vector<reco::GsfElectron>* electrons;
60  const std::vector<reco::Photon>* photons;
61  const std::vector<reco::CaloMET>* caloMETs;
62  const std::vector<reco::PFMET>* pfMETs;
63  const std::vector<reco::PFTau>* pfTaus;
64  const std::vector<reco::PFJet>* pfJets;
66  //const std::vector<reco::Track> * tracks;
70  : nOfCollections(7),
71  nInitialized(0),
72  genParticles(nullptr),
73  genJets(nullptr),
74  muons(nullptr),
75  electrons(nullptr),
76  photons(nullptr),
77  caloMETs(nullptr),
78  pfMETs(nullptr),
79  pfTaus(nullptr),
80  pfJets(nullptr),
81  jetTags(nullptr),
82  //tracks(0),
83  rawTriggerEvent(nullptr),
84  triggerResults(nullptr) {}
86  bool isAllInit() { return (nInitialized == nOfCollections); }
87 
88  bool isCommonInit() { return (rawTriggerEvent != nullptr); }
90  void reset() {
91  nInitialized = 0;
92  genParticles = nullptr;
93  genJets = nullptr;
94  muons = nullptr;
95  electrons = nullptr;
96  photons = nullptr;
97  pfTaus = nullptr;
98  caloMETs = nullptr;
99  pfMETs = nullptr;
100  pfJets = nullptr; //tracks=0;
101  jetTags = nullptr;
102  rawTriggerEvent = nullptr;
103  triggerResults = nullptr;
104  }
106  void set(const reco::MuonCollection* v) {
107  muons = v;
108  ++nInitialized;
109  }
111  electrons = v;
112  ++nInitialized;
113  }
114  void set(const reco::PhotonCollection* v) {
115  photons = v;
116  ++nInitialized;
117  }
119  caloMETs = v;
120  ++nInitialized;
121  }
122  void set(const reco::PFMETCollection* v) {
123  pfMETs = v;
124  ++nInitialized;
125  }
126  void set(const reco::PFTauCollection* v) {
127  pfTaus = v;
128  ++nInitialized;
129  }
130  void set(const reco::PFJetCollection* v) {
131  pfJets = v;
132  ++nInitialized;
133  }
134  void set(const reco::JetTagCollection* v) { jetTags = v; }
135  /*void set(const reco::TrackCollection * v)
136  {
137  tracks = v;
138  ++nInitialized;
139  }*/
140  const unsigned int getSize(const unsigned int& objtype) const {
141  unsigned int size = 0;
142  if (objtype == EVTColContainer::MUON && muons != nullptr) {
143  size = muons->size();
144  } else if (objtype == EVTColContainer::ELEC && electrons != nullptr) {
145  size = electrons->size();
146  } else if (objtype == EVTColContainer::PHOTON && photons != nullptr) {
147  size = photons->size();
148  } else if (objtype == EVTColContainer::CALOMET && caloMETs != nullptr) {
149  size = caloMETs->size();
150  } else if (objtype == EVTColContainer::PFMET && pfMETs != nullptr) {
151  size = pfMETs->size();
152  } else if (objtype == EVTColContainer::PFTAU && pfTaus != nullptr) {
153  size = pfTaus->size();
154  } else if (objtype == EVTColContainer::PFJET && pfJets != nullptr) {
155  size = pfJets->size();
156  }
157  /*else if( objtype == EVTColContainer::TRACK && tracks != 0 )
158  {
159  size = tracks->size();
160  }*/
161 
162  return size;
163  }
164 
165  static std::string getTypeString(const unsigned int& objtype) {
166  std::string objTypestr;
167 
168  if (objtype == EVTColContainer::MUON) {
169  objTypestr = "Mu";
170  } else if (objtype == EVTColContainer::ELEC) {
171  objTypestr = "Ele";
172  } else if (objtype == EVTColContainer::PHOTON) {
173  objTypestr = "Photon";
174  } else if (objtype == EVTColContainer::CALOMET) {
175  objTypestr = "MET";
176  } else if (objtype == EVTColContainer::PFMET) {
177  objTypestr = "PFMET";
178  } else if (objtype == EVTColContainer::PFTAU) {
179  objTypestr = "PFTau";
180  } else if (objtype == EVTColContainer::PFJET) {
181  objTypestr = "Jet";
182  }
183  /*else if( objtype == EVTColContainer::TRACK )
184  {
185  // FIXME: decide what to do! Just a patch
186  objTypestr = "TkMu";
187  }*/
188  else {
189  edm::LogError("HiggsValidations") << "EVTColContainer::getTypeString, "
190  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;
191  ;
192  }
193 
194  return objTypestr;
195  }
196 };
197 #endif
const std::vector< reco::Muon > * muons
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
static std::string getTypeString(const unsigned int &objtype)
const trigger::TriggerEventWithRefs * rawTriggerEvent
const std::vector< reco::CaloMET > * caloMETs
std::vector< GenJet > GenJetCollection
collection of GenJet objects
void set(const reco::GsfElectronCollection *v)
const reco::GenParticleCollection * genParticles
container with all the objects needed
void set(const reco::CaloMETCollection *v)
Log< level::Error, false > LogError
const unsigned int getSize(const unsigned int &objtype) const
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
const std::vector< reco::PFTau > * pfTaus
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
void set(const reco::PFTauCollection *v)
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
void set(const reco::JetTagCollection *v)
const reco::GenJetCollection * genJets
const reco::JetTagCollection * jetTags
const std::vector< reco::PFJet > * pfJets
const std::vector< reco::Photon > * photons
void set(const reco::PFMETCollection *v)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
const std::vector< reco::GsfElectron > * electrons
void set(const reco::PFJetCollection *v)
void set(const reco::PhotonCollection *v)
std::vector< PFJet > PFJetCollection
collection of PFJet objects
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
const std::vector< reco::PFMET > * pfMETs
const edm::TriggerResults * triggerResults
tuple size
Write out results.