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  const reco::BeamSpot * bs;
84 
86  nOfCollections(6),
87  nInitialized(0),
88  genParticles(0),
89  muons(0),
90  tracks(0),
91  electrons(0),
92  photons(0),
93  METs(0),
94  pfMETs(0),
95  pfMHTs(0),
96  genMETs(0),
97  caloMETs(0),
98  l1METs(0),
99  pfTaus(0),
100  pfJets(0),
101  caloJets(0),
102  triggerResults(0),
103  bs(0)
104  {
105  }
107  bool isAllInit()
108  {
109  return (nInitialized == nOfCollections);
110  }
111 
113  {
114  return false;
115  }
116 
118  void reset()
119  {
120  nInitialized = 0;
121  genParticles = 0;
122  muons = 0;
123  tracks = 0;
124  electrons = 0;
125  photons = 0;
126  METs = 0;
127  pfMETs = 0;
128  pfMHTs = 0;
129  genMETs = 0;
130  caloMETs = 0;
131  l1METs = 0;
132  pfTaus = 0;
133  pfJets = 0;
134  caloJets = 0;
135  triggerResults = 0;
136  bs = 0;
137  }
138 
140  void set(const reco::MuonCollection * v)
141  {
142  muons = v;
143  ++nInitialized;
144  }
146  {
147  tracks = v;
148  ++nInitialized;
149  }
151  {
152  electrons = v;
153  ++nInitialized;
154  }
156  {
157  photons = v;
158  ++nInitialized;
159  }
160  void set(const reco::METCollection * v)
161  {
162  METs = v;
163  ++nInitialized;
164  }
166  {
167  pfMETs = v;
168  ++nInitialized;
169  }
171  {
172  pfMHTs = v;
173  ++nInitialized;
174  }
176  {
177  genMETs = v;
178  ++nInitialized;
179  }
181  {
182  caloMETs = v;
183  ++nInitialized;
184  }
186  {
187  l1METs = v;
188  ++nInitialized;
189  }
191  {
192  pfTaus = v;
193  ++nInitialized;
194  }
196  {
197  pfJets = v;
198  ++nInitialized;
199  }
201  {
202  caloJets = v;
203  ++nInitialized;
204  }
205 
207  const unsigned int getSize(const unsigned int & objtype) const
208  {
209  unsigned int size = 0;
210  if (objtype == EVTColContainer::MUON && muons != 0) {
211  size = muons->size();
212  } else if (objtype == EVTColContainer::MUTRK && tracks != 0) {
213  size = tracks->size();
214  } else if (objtype == EVTColContainer::TRACK && tracks != 0) {
215  size = tracks->size();
216  } else if (objtype == EVTColContainer::ELEC && electrons != 0) {
217  size = electrons->size();
218  } else if (objtype == EVTColContainer::PHOTON && photons != 0) {
219  size = photons->size();
220  } else if (objtype == EVTColContainer::MET && METs != 0) {
221  size = METs->size();
222  } else if (objtype == EVTColContainer::PFMET && pfMETs != 0) {
223  size = pfMETs->size();
224  } else if (objtype == EVTColContainer::PFMHT && pfMHTs != 0) {
225  size = pfMHTs->size();
226  } else if (objtype == EVTColContainer::GENMET && genMETs != 0) {
227  size = genMETs->size();
228  } else if (objtype == EVTColContainer::CALOMET && caloMETs != 0) {
229  size = caloMETs->size();
230  } else if (objtype == EVTColContainer::L1MET && l1METs != 0) {
231  size = l1METs->size();
232  } else if (objtype == EVTColContainer::PFTAU && pfTaus != 0) {
233  size = pfTaus->size();
234  } else if (objtype == EVTColContainer::PFJET && pfJets != 0) {
235  size = pfJets->size();
236  } else if (objtype == EVTColContainer::CALOJET && caloJets != 0) {
237  size = caloJets->size();
238  }
239 
240  return size;
241  }
242 
244  const static std::string getTypeString(const unsigned int & objtype)
245  {
246  std::string objTypestr;
247 
248  if (objtype == EVTColContainer::MUON) {
249  objTypestr = "Mu";
250  } else if (objtype == EVTColContainer::MUTRK) {
251  objTypestr = "refittedStandAloneMuons";
252  } else if (objtype == EVTColContainer::TRACK) {
253  objTypestr = "Track";
254  } else if (objtype == EVTColContainer::ELEC) {
255  objTypestr = "Ele";
256  } else if (objtype == EVTColContainer::PHOTON) {
257  objTypestr = "Photon";
258  } else if (objtype == EVTColContainer::MET) {
259  objTypestr = "MET";
260  } else if (objtype == EVTColContainer::PFMET) {
261  objTypestr = "PFMET";
262  } else if (objtype == EVTColContainer::PFMHT) {
263  objTypestr = "PFMHT";
264  } else if (objtype == EVTColContainer::GENMET) {
265  objTypestr = "GenMET";
266  } else if (objtype == EVTColContainer::CALOMET) {
267  objTypestr = "CaloMET";
268  } else if (objtype == EVTColContainer::L1MET) {
269  objTypestr = "l1MET";
270  } else if (objtype == EVTColContainer::PFTAU) {
271  objTypestr = "PFTau";
272  } else if (objtype == EVTColContainer::PFJET) {
273  objTypestr = "PFJet";
274  } else if (objtype == EVTColContainer::CALOJET) {
275  objTypestr = "CaloJet";
276  } else {
277  edm::LogError("ExoticaValidations") << "EVTColContainer::getTypeString, "
278  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;;
279  }
280 
281  return objTypestr;
282  }
283 };
284 #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 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< 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