CMS 3D CMS Logo

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,
62  CALOMHT = 400002,
64  };
65 
68 
70  const std::vector<reco::Muon> * muons;
71  const std::vector<reco::Track> * tracks;
72  const std::vector<reco::GsfElectron> * electrons;
73  const std::vector<reco::Photon> * photons;
74  const std::vector<reco::MET> * METs;
75  const std::vector<reco::PFMET> * pfMETs;
76  const std::vector<reco::PFMET> * pfMHTs;
77  const std::vector<reco::GenMET> * genMETs;
78  const std::vector<reco::CaloMET> * caloMETs;
79  const std::vector<reco::CaloMET> * caloMHTs;
80  const std::vector<l1extra::L1EtMissParticle> * l1METs;
81  const std::vector<reco::PFTau> * pfTaus;
82  const std::vector<reco::PFJet> * pfJets;
83  const std::vector<reco::CaloJet> * caloJets;
85  const reco::BeamSpot * bs;
86 
88  nOfCollections(6),
89  nInitialized(0),
90  genParticles(nullptr),
91  muons(nullptr),
92  tracks(nullptr),
93  electrons(nullptr),
94  photons(nullptr),
95  METs(nullptr),
96  pfMETs(nullptr),
97  pfMHTs(nullptr),
98  genMETs(nullptr),
99  caloMETs(nullptr),
100  caloMHTs(nullptr),
101  l1METs(nullptr),
102  pfTaus(nullptr),
103  pfJets(nullptr),
104  caloJets(nullptr),
105  triggerResults(nullptr),
106  bs(nullptr)
107  {
108  }
110  bool isAllInit()
111  {
112  return (nInitialized == nOfCollections);
113  }
114 
116  {
117  return false;
118  }
119 
121  void reset()
122  {
123  nInitialized = 0;
124  genParticles = nullptr;
125  muons = nullptr;
126  tracks = nullptr;
127  electrons = nullptr;
128  photons = nullptr;
129  METs = nullptr;
130  pfMETs = nullptr;
131  pfMHTs = nullptr;
132  genMETs = nullptr;
133  caloMETs = nullptr;
134  caloMHTs = nullptr;
135  l1METs = nullptr;
136  pfTaus = nullptr;
137  pfJets = nullptr;
138  caloJets = nullptr;
139  triggerResults = nullptr;
140  bs = nullptr;
141  }
142 
144  void set(const reco::MuonCollection * v)
145  {
146  muons = v;
147  ++nInitialized;
148  }
149  void set(const reco::TrackCollection * v)
150  {
151  tracks = v;
152  ++nInitialized;
153  }
154  void set(const reco::GsfElectronCollection * v)
155  {
156  electrons = v;
157  ++nInitialized;
158  }
159  void set(const reco::PhotonCollection * v)
160  {
161  photons = v;
162  ++nInitialized;
163  }
164  void set(const reco::METCollection * v)
165  {
166  METs = v;
167  ++nInitialized;
168  }
169  void set(const reco::PFMETCollection * v)
170  {
171  pfMETs = v;
172  ++nInitialized;
173  }
175  {
176  pfMHTs = v;
177  ++nInitialized;
178  }
179  void set(const reco::GenMETCollection * v)
180  {
181  genMETs = v;
182  ++nInitialized;
183  }
184  void set(const reco::CaloMETCollection * v)
185  {
186  caloMETs = v;
187  ++nInitialized;
188  }
190  {
191  caloMHTs = v;
192  ++nInitialized;
193  }
195  {
196  l1METs = v;
197  ++nInitialized;
198  }
199  void set(const reco::PFTauCollection * v)
200  {
201  pfTaus = v;
202  ++nInitialized;
203  }
204  void set(const reco::PFJetCollection * v)
205  {
206  pfJets = v;
207  ++nInitialized;
208  }
209  void set(const reco::CaloJetCollection * v)
210  {
211  caloJets = v;
212  ++nInitialized;
213  }
214 
216  const unsigned int getSize(const unsigned int & objtype) const
217  {
218  unsigned int size = 0;
219  if (objtype == EVTColContainer::MUON && muons != nullptr) {
220  size = muons->size();
221  } else if (objtype == EVTColContainer::MUTRK && tracks != nullptr) {
222  size = tracks->size();
223  } else if (objtype == EVTColContainer::TRACK && tracks != nullptr) {
224  size = tracks->size();
225  } else if (objtype == EVTColContainer::ELEC && electrons != nullptr) {
226  size = electrons->size();
227  } else if (objtype == EVTColContainer::PHOTON && photons != nullptr) {
228  size = photons->size();
229  } else if (objtype == EVTColContainer::MET && METs != nullptr) {
230  size = METs->size();
231  } else if (objtype == EVTColContainer::PFMET && pfMETs != nullptr) {
232  size = pfMETs->size();
233  } else if (objtype == EVTColContainer::PFMHT && pfMHTs != nullptr) {
234  size = pfMHTs->size();
235  } else if (objtype == EVTColContainer::GENMET && genMETs != nullptr) {
236  size = genMETs->size();
237  } else if (objtype == EVTColContainer::CALOMET && caloMETs != nullptr) {
238  size = caloMETs->size();
239  } else if (objtype == EVTColContainer::CALOMHT && caloMHTs != nullptr) {
240  size = caloMHTs->size();
241  } else if (objtype == EVTColContainer::L1MET && l1METs != nullptr) {
242  size = l1METs->size();
243  } else if (objtype == EVTColContainer::PFTAU && pfTaus != nullptr) {
244  size = pfTaus->size();
245  } else if (objtype == EVTColContainer::PFJET && pfJets != nullptr) {
246  size = pfJets->size();
247  } else if (objtype == EVTColContainer::CALOJET && caloJets != nullptr) {
248  size = caloJets->size();
249  }
250 
251  return size;
252  }
253 
255  const static std::string getTypeString(const unsigned int & objtype)
256  {
257  std::string objTypestr;
258 
259  if (objtype == EVTColContainer::MUON) {
260  objTypestr = "Mu";
261  } else if (objtype == EVTColContainer::MUTRK) {
262  objTypestr = "refittedStandAloneMuons";
263  } else if (objtype == EVTColContainer::TRACK) {
264  objTypestr = "Track";
265  } else if (objtype == EVTColContainer::ELEC) {
266  objTypestr = "Ele";
267  } else if (objtype == EVTColContainer::PHOTON) {
268  objTypestr = "Photon";
269  } else if (objtype == EVTColContainer::MET) {
270  objTypestr = "MET";
271  } else if (objtype == EVTColContainer::PFMET) {
272  objTypestr = "PFMET";
273  } else if (objtype == EVTColContainer::PFMHT) {
274  objTypestr = "PFMHT";
275  } else if (objtype == EVTColContainer::GENMET) {
276  objTypestr = "GenMET";
277  } else if (objtype == EVTColContainer::CALOMET) {
278  objTypestr = "CaloMET";
279  } else if (objtype == EVTColContainer::CALOMHT) {
280  objTypestr = "CaloMHT";
281  } else if (objtype == EVTColContainer::L1MET) {
282  objTypestr = "l1MET";
283  } else if (objtype == EVTColContainer::PFTAU) {
284  objTypestr = "PFTau";
285  } else if (objtype == EVTColContainer::PFJET) {
286  objTypestr = "PFJet";
287  } else if (objtype == EVTColContainer::CALOJET) {
288  objTypestr = "CaloJet";
289  } else {
290  edm::LogError("ExoticaValidations") << "EVTColContainer::getTypeString, "
291  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;;
292  }
293 
294  return objTypestr;
295  }
296 };
297 #endif
size
Write out results.
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
const std::vector< reco::CaloMET > * caloMETs
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
const std::vector< reco::MET > * METs
const std::vector< reco::CaloJet > * caloJets
const reco::GenParticleCollection * genParticles
container with all the objects needed
#define nullptr
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 setPFMHT(const reco::PFMETCollection *v)
const std::vector< reco::PFMET > * pfMHTs
const std::vector< reco::GenMET > * genMETs
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.
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
std::vector< PFJet > PFJetCollection
collection of PFJet objects
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
const std::vector< reco::CaloMET > * caloMHTs
std::vector< L1EtMissParticle > L1EtMissParticleCollection
const std::vector< reco::PFMET > * pfMETs
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
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.h:30