CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EVTColContainer.cc
Go to the documentation of this file.
1 #ifndef HLTRIGGEROFFLINE_EXOTICA_EVTCOLCONTAINER_CC
2 #define HLTRIGGEROFFLINE_EXOTICA_EVTCOLCONTAINER_CC
3 
37 
38 #include<vector>
39 #include<map>
40 
44 
46  enum {
47  PHOTON = 22,
48  ELEC = 11,
49  MUON = 13,
50  MUTRK = 130,
51  PFTAU = 15,
52  TRACK = 0,
53  PFMET = 39,
54  PFMHT = 40,
55  MET = 390000,
56  GENMET = 390001,
57  CALOMET = 390002,
58  HLTMET = 390003,
59  L1MET = 390004,
60  PFJET = 211,
61  CALOJET = 111,
63  };
64 
67 
69  const std::vector<reco::Muon> * muons;
70  const std::vector<reco::Track> * tracks;
71  const std::vector<reco::GsfElectron> * electrons;
72  const std::vector<reco::Photon> * photons;
73  const std::vector<reco::MET> * METs;
74  const std::vector<reco::PFMET> * pfMETs;
75  const std::vector<reco::PFMET> * pfMHTs;
76  const std::vector<reco::GenMET> * genMETs;
77  const std::vector<reco::CaloMET> * caloMETs;
78  const std::vector<l1extra::L1EtMissParticle> * l1METs;
79  const std::vector<reco::PFTau> * pfTaus;
80  const std::vector<reco::PFJet> * pfJets;
81  const std::vector<reco::CaloJet> * caloJets;
83 
85  nOfCollections(6),
86  nInitialized(0),
87  genParticles(0),
88  muons(0),
89  tracks(0),
90  electrons(0),
91  photons(0),
92  METs(0),
93  pfMETs(0),
94  pfMHTs(0),
95  genMETs(0),
96  caloMETs(0),
97  l1METs(0),
98  pfTaus(0),
99  pfJets(0),
100  caloJets(0),
101  triggerResults(0)
102  {
103  }
105  bool isAllInit()
106  {
107  return (nInitialized == nOfCollections);
108  }
109 
111  {
112  return false;
113  }
114 
116  void reset()
117  {
118  nInitialized = 0;
119  genParticles = 0;
120  muons = 0;
121  tracks = 0;
122  electrons = 0;
123  photons = 0;
124  METs = 0;
125  pfMETs = 0;
126  pfMHTs = 0;
127  genMETs = 0;
128  caloMETs = 0;
129  l1METs = 0;
130  pfTaus = 0;
131  pfJets = 0;
132  caloJets = 0;
133  triggerResults = 0;
134  }
135 
137  void set(const reco::MuonCollection * v)
138  {
139  muons = v;
140  ++nInitialized;
141  }
143  {
144  tracks = v;
145  ++nInitialized;
146  }
148  {
149  electrons = v;
150  ++nInitialized;
151  }
153  {
154  photons = v;
155  ++nInitialized;
156  }
157  void set(const reco::METCollection * v)
158  {
159  METs = v;
160  ++nInitialized;
161  }
163  {
164  pfMETs = v;
165  ++nInitialized;
166  }
168  {
169  pfMHTs = v;
170  ++nInitialized;
171  }
173  {
174  genMETs = v;
175  ++nInitialized;
176  }
178  {
179  caloMETs = v;
180  ++nInitialized;
181  }
183  {
184  l1METs = v;
185  ++nInitialized;
186  }
188  {
189  pfTaus = v;
190  ++nInitialized;
191  }
193  {
194  pfJets = v;
195  ++nInitialized;
196  }
198  {
199  caloJets = v;
200  ++nInitialized;
201  }
202 
204  const unsigned int getSize(const unsigned int & objtype) const
205  {
206  unsigned int size = 0;
207  if (objtype == EVTColContainer::MUON && muons != 0) {
208  size = muons->size();
209  } else if (objtype == EVTColContainer::MUTRK && tracks != 0) {
210  size = tracks->size();
211  } else if (objtype == EVTColContainer::TRACK && tracks != 0) {
212  size = tracks->size();
213  } else if (objtype == EVTColContainer::ELEC && electrons != 0) {
214  size = electrons->size();
215  } else if (objtype == EVTColContainer::PHOTON && photons != 0) {
216  size = photons->size();
217  } else if (objtype == EVTColContainer::MET && METs != 0) {
218  size = METs->size();
219  } else if (objtype == EVTColContainer::PFMET && pfMETs != 0) {
220  size = pfMETs->size();
221  } else if (objtype == EVTColContainer::PFMHT && pfMHTs != 0) {
222  size = pfMHTs->size();
223  } else if (objtype == EVTColContainer::GENMET && genMETs != 0) {
224  size = genMETs->size();
225  } else if (objtype == EVTColContainer::CALOMET && caloMETs != 0) {
226  size = caloMETs->size();
227  } else if (objtype == EVTColContainer::L1MET && l1METs != 0) {
228  size = l1METs->size();
229  } else if (objtype == EVTColContainer::PFTAU && pfTaus != 0) {
230  size = pfTaus->size();
231  } else if (objtype == EVTColContainer::PFJET && pfJets != 0) {
232  size = pfJets->size();
233  } else if (objtype == EVTColContainer::CALOJET && caloJets != 0) {
234  size = caloJets->size();
235  }
236 
237  return size;
238  }
239 
241  const static std::string getTypeString(const unsigned int & objtype)
242  {
243  std::string objTypestr;
244 
245  if (objtype == EVTColContainer::MUON) {
246  objTypestr = "Mu";
247  } else if (objtype == EVTColContainer::MUTRK) {
248  objTypestr = "refittedStandAloneMuons";
249  } else if (objtype == EVTColContainer::TRACK) {
250  objTypestr = "Track";
251  } else if (objtype == EVTColContainer::ELEC) {
252  objTypestr = "Ele";
253  } else if (objtype == EVTColContainer::PHOTON) {
254  objTypestr = "Photon";
255  } else if (objtype == EVTColContainer::MET) {
256  objTypestr = "MET";
257  } else if (objtype == EVTColContainer::PFMET) {
258  objTypestr = "PFMET";
259  } else if (objtype == EVTColContainer::PFMHT) {
260  objTypestr = "PFMHT";
261  } else if (objtype == EVTColContainer::GENMET) {
262  objTypestr = "GenMET";
263  } else if (objtype == EVTColContainer::CALOMET) {
264  objTypestr = "CaloMET";
265  } else if (objtype == EVTColContainer::L1MET) {
266  objTypestr = "l1MET";
267  } else if (objtype == EVTColContainer::PFTAU) {
268  objTypestr = "PFTau";
269  } else if (objtype == EVTColContainer::PFJET) {
270  objTypestr = "PFJet";
271  } else if (objtype == EVTColContainer::CALOJET) {
272  objTypestr = "CaloJet";
273  } else {
274  edm::LogError("ExoticaValidations") << "EVTColContainer::getTypeString, "
275  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;;
276  }
277 
278  return objTypestr;
279  }
280 };
281 #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:13
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)
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:23
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 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< PFJet > PFJetCollection
collection of PFJet objects
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
void set(const reco::CaloJetCollection *v)
std::vector< L1EtMissParticle > L1EtMissParticleCollection
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.
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Computes the MET from a collection of PFCandidates. HF missing!
Definition: PFMET.h:30