CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EVTColContainer.cc
Go to the documentation of this file.
1 #ifndef HLTRIGGEROFFLINE_EXOTICA_EVTCOLCONTAINER_CC
2 #define HLTRIGGEROFFLINE_EXOTICA_EVTCOLCONTAINER_CC
3 
38 
39 #include <map>
40 #include <vector>
41 
45 
47  enum {
48  PHOTON = 22,
49  ELEC = 11,
50  MUON = 13,
51  MUTRK = 130,
52  PFTAU = 15,
53  TRACK = 0,
54  PFMET = 39,
55  PFMHT = 40,
56  MET = 390000,
57  GENMET = 390001,
58  CALOMET = 390002,
59  HLTMET = 390003,
60  L1MET = 390004,
61  PFJET = 211,
62  CALOJET = 111,
63  CALOMHT = 400002,
65  };
66 
69 
71  const std::vector<reco::Muon> *muons;
72  const std::vector<reco::Track> *tracks;
73  const std::vector<reco::GsfElectron> *electrons;
74  const std::vector<reco::Photon> *photons;
75  const std::vector<reco::MET> *METs;
76  const std::vector<reco::PFMET> *pfMETs;
77  const std::vector<reco::PFMET> *pfMHTs;
78  const std::vector<reco::GenMET> *genMETs;
79  const std::vector<reco::CaloMET> *caloMETs;
80  const std::vector<reco::CaloMET> *caloMHTs;
81  const std::vector<l1extra::L1EtMissParticle> *l1METs;
82  const std::vector<reco::PFTau> *pfTaus;
83  const std::vector<reco::PFJet> *pfJets;
84  const std::vector<reco::CaloJet> *caloJets;
87 
89  : nOfCollections(6),
90  nInitialized(0),
91  genParticles(nullptr),
92  muons(nullptr),
93  tracks(nullptr),
94  electrons(nullptr),
95  photons(nullptr),
96  METs(nullptr),
97  pfMETs(nullptr),
98  pfMHTs(nullptr),
99  genMETs(nullptr),
100  caloMETs(nullptr),
101  caloMHTs(nullptr),
102  l1METs(nullptr),
103  pfTaus(nullptr),
104  pfJets(nullptr),
105  caloJets(nullptr),
106  triggerResults(nullptr),
107  bs(nullptr) {}
109  bool isAllInit() { return (nInitialized == nOfCollections); }
110 
111  bool isCommonInit() { return false; }
112 
114  void reset() {
115  nInitialized = 0;
116  genParticles = nullptr;
117  muons = nullptr;
118  tracks = nullptr;
119  electrons = nullptr;
120  photons = nullptr;
121  METs = nullptr;
122  pfMETs = nullptr;
123  pfMHTs = nullptr;
124  genMETs = nullptr;
125  caloMETs = nullptr;
126  caloMHTs = nullptr;
127  l1METs = nullptr;
128  pfTaus = nullptr;
129  pfJets = nullptr;
130  caloJets = nullptr;
131  triggerResults = nullptr;
132  bs = nullptr;
133  }
134 
136  void set(const reco::MuonCollection *v) {
137  muons = v;
138  ++nInitialized;
139  }
140  void set(const reco::TrackCollection *v) {
141  tracks = v;
142  ++nInitialized;
143  }
145  electrons = v;
146  ++nInitialized;
147  }
148  void set(const reco::PhotonCollection *v) {
149  photons = v;
150  ++nInitialized;
151  }
152  void set(const reco::METCollection *v) {
153  METs = v;
154  ++nInitialized;
155  }
156  void set(const reco::PFMETCollection *v) {
157  pfMETs = v;
158  ++nInitialized;
159  }
161  pfMHTs = v;
162  ++nInitialized;
163  }
164  void set(const reco::GenMETCollection *v) {
165  genMETs = v;
166  ++nInitialized;
167  }
169  caloMETs = v;
170  ++nInitialized;
171  }
173  caloMHTs = v;
174  ++nInitialized;
175  }
177  l1METs = v;
178  ++nInitialized;
179  }
180  void set(const reco::PFTauCollection *v) {
181  pfTaus = v;
182  ++nInitialized;
183  }
184  void set(const reco::PFJetCollection *v) {
185  pfJets = v;
186  ++nInitialized;
187  }
189  caloJets = v;
190  ++nInitialized;
191  }
192 
194  const unsigned int getSize(const unsigned int &objtype) const {
195  unsigned int size = 0;
196  if (objtype == EVTColContainer::MUON && muons != nullptr) {
197  size = muons->size();
198  } else if (objtype == EVTColContainer::MUTRK && tracks != nullptr) {
199  size = tracks->size();
200  } else if (objtype == EVTColContainer::TRACK && tracks != nullptr) {
201  size = tracks->size();
202  } else if (objtype == EVTColContainer::ELEC && electrons != nullptr) {
203  size = electrons->size();
204  } else if (objtype == EVTColContainer::PHOTON && photons != nullptr) {
205  size = photons->size();
206  } else if (objtype == EVTColContainer::MET && METs != nullptr) {
207  size = METs->size();
208  } else if (objtype == EVTColContainer::PFMET && pfMETs != nullptr) {
209  size = pfMETs->size();
210  } else if (objtype == EVTColContainer::PFMHT && pfMHTs != nullptr) {
211  size = pfMHTs->size();
212  } else if (objtype == EVTColContainer::GENMET && genMETs != nullptr) {
213  size = genMETs->size();
214  } else if (objtype == EVTColContainer::CALOMET && caloMETs != nullptr) {
215  size = caloMETs->size();
216  } else if (objtype == EVTColContainer::CALOMHT && caloMHTs != nullptr) {
217  size = caloMHTs->size();
218  } else if (objtype == EVTColContainer::L1MET && l1METs != nullptr) {
219  size = l1METs->size();
220  } else if (objtype == EVTColContainer::PFTAU && pfTaus != nullptr) {
221  size = pfTaus->size();
222  } else if (objtype == EVTColContainer::PFJET && pfJets != nullptr) {
223  size = pfJets->size();
224  } else if (objtype == EVTColContainer::CALOJET && caloJets != nullptr) {
225  size = caloJets->size();
226  }
227 
228  return size;
229  }
230 
232  const static std::string getTypeString(const unsigned int &objtype) {
233  std::string objTypestr;
234 
235  if (objtype == EVTColContainer::MUON) {
236  objTypestr = "Mu";
237  } else if (objtype == EVTColContainer::MUTRK) {
238  objTypestr = "refittedStandAloneMuons";
239  } else if (objtype == EVTColContainer::TRACK) {
240  objTypestr = "Track";
241  } else if (objtype == EVTColContainer::ELEC) {
242  objTypestr = "Ele";
243  } else if (objtype == EVTColContainer::PHOTON) {
244  objTypestr = "Photon";
245  } else if (objtype == EVTColContainer::MET) {
246  objTypestr = "MET";
247  } else if (objtype == EVTColContainer::PFMET) {
248  objTypestr = "PFMET";
249  } else if (objtype == EVTColContainer::PFMHT) {
250  objTypestr = "PFMHT";
251  } else if (objtype == EVTColContainer::GENMET) {
252  objTypestr = "GenMET";
253  } else if (objtype == EVTColContainer::CALOMET) {
254  objTypestr = "CaloMET";
255  } else if (objtype == EVTColContainer::CALOMHT) {
256  objTypestr = "CaloMHT";
257  } else if (objtype == EVTColContainer::L1MET) {
258  objTypestr = "l1MET";
259  } else if (objtype == EVTColContainer::PFTAU) {
260  objTypestr = "PFTau";
261  } else if (objtype == EVTColContainer::PFJET) {
262  objTypestr = "PFJet";
263  } else if (objtype == EVTColContainer::CALOJET) {
264  objTypestr = "CaloJet";
265  } else {
266  edm::LogError("ExoticaValidations") << "EVTColContainer::getTypeString, "
267  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;
268  ;
269  }
270 
271  return objTypestr;
272  }
273 };
274 #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
void set(const reco::TrackCollection *v)
const std::vector< reco::CaloMET > * caloMETs
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
void set(const reco::GsfElectronCollection *v)
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
const std::vector< reco::MET > * METs
const std::vector< reco::CaloJet > * caloJets
const reco::GenParticleCollection * genParticles
container with all the objects needed
void set(const reco::CaloMETCollection *v)
void set(const reco::GenMETCollection *v)
Log< level::Error, false > LogError
const unsigned int getSize(const unsigned int &objtype) const
Get size of collections.
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:22
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 setPFMHT(const reco::PFMETCollection *v)
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
const std::vector< reco::PFMET > * pfMHTs
const std::vector< reco::GenMET > * genMETs
void set(const l1extra::L1EtMissParticleCollection *v)
const reco::BeamSpot * bs
const std::vector< reco::PFJet > * pfJets
const std::vector< reco::Track > * tracks
const std::vector< reco::Photon > * photons
void reset()
Reset: clear all collections.
void set(const reco::PFMETCollection *v)
const std::vector< l1extra::L1EtMissParticle > * l1METs
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< L1EtMissParticle > L1EtMissParticleCollection
std::vector< PFJet > PFJetCollection
collection of PFJet objects
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
void set(const reco::CaloJetCollection *v)
const std::vector< reco::CaloMET > * caloMHTs
const std::vector< reco::PFMET > * pfMETs
void set(const reco::METCollection *v)
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
tuple size
Write out results.
void setCaloMHT(const reco::CaloMETCollection *v)
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Computes the MET from a collection of PFCandidates. HF missing!
Definition: PFMET.cc:26