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 
36 
37 #include <map>
38 #include <vector>
39 
43 
45  enum {
46  PHOTON = 22,
47  ELEC = 11,
48  MUON = 13,
49  MUTRK = 130,
50  PFTAU = 15,
51  TRACK = 0,
52  PFMET = 39,
53  PFMHT = 40,
54  MET = 390000,
55  GENMET = 390001,
56  CALOMET = 390002,
57  HLTMET = 390003,
58  PFJET = 211,
59  CALOJET = 111,
60  CALOMHT = 400002,
62  };
63 
66 
68  const std::vector<reco::Muon> *muons;
69  const std::vector<reco::Track> *tracks;
70  const std::vector<reco::GsfElectron> *electrons;
71  const std::vector<reco::Photon> *photons;
72  const std::vector<reco::MET> *METs;
73  const std::vector<reco::PFMET> *pfMETs;
74  const std::vector<reco::PFMET> *pfMHTs;
75  const std::vector<reco::GenMET> *genMETs;
76  const std::vector<reco::CaloMET> *caloMETs;
77  const std::vector<reco::CaloMET> *caloMHTs;
78  const std::vector<reco::PFTau> *pfTaus;
79  const std::vector<reco::PFJet> *pfJets;
80  const std::vector<reco::CaloJet> *caloJets;
83 
85  : nOfCollections(6),
86  nInitialized(0),
87  genParticles(nullptr),
88  muons(nullptr),
89  tracks(nullptr),
90  electrons(nullptr),
91  photons(nullptr),
92  METs(nullptr),
93  pfMETs(nullptr),
94  pfMHTs(nullptr),
95  genMETs(nullptr),
96  caloMETs(nullptr),
97  caloMHTs(nullptr),
98  pfTaus(nullptr),
99  pfJets(nullptr),
100  caloJets(nullptr),
101  triggerResults(nullptr),
102  bs(nullptr) {}
104  bool isAllInit() { return (nInitialized == nOfCollections); }
105 
106  bool isCommonInit() { return false; }
107 
109  void reset() {
110  nInitialized = 0;
111  genParticles = nullptr;
112  muons = nullptr;
113  tracks = nullptr;
114  electrons = nullptr;
115  photons = nullptr;
116  METs = nullptr;
117  pfMETs = nullptr;
118  pfMHTs = nullptr;
119  genMETs = nullptr;
120  caloMETs = nullptr;
121  caloMHTs = nullptr;
122  pfTaus = nullptr;
123  pfJets = nullptr;
124  caloJets = nullptr;
125  triggerResults = nullptr;
126  bs = nullptr;
127  }
128 
130  void set(const reco::MuonCollection *v) {
131  muons = v;
132  ++nInitialized;
133  }
134  void set(const reco::TrackCollection *v) {
135  tracks = v;
136  ++nInitialized;
137  }
138  void set(const reco::GsfElectronCollection *v) {
139  electrons = v;
140  ++nInitialized;
141  }
142  void set(const reco::PhotonCollection *v) {
143  photons = v;
144  ++nInitialized;
145  }
146  void set(const reco::METCollection *v) {
147  METs = v;
148  ++nInitialized;
149  }
150  void set(const reco::PFMETCollection *v) {
151  pfMETs = v;
152  ++nInitialized;
153  }
155  pfMHTs = v;
156  ++nInitialized;
157  }
158  void set(const reco::GenMETCollection *v) {
159  genMETs = v;
160  ++nInitialized;
161  }
162  void set(const reco::CaloMETCollection *v) {
163  caloMETs = v;
164  ++nInitialized;
165  }
167  caloMHTs = v;
168  ++nInitialized;
169  }
170  void set(const reco::PFTauCollection *v) {
171  pfTaus = v;
172  ++nInitialized;
173  }
174  void set(const reco::PFJetCollection *v) {
175  pfJets = v;
176  ++nInitialized;
177  }
178  void set(const reco::CaloJetCollection *v) {
179  caloJets = v;
180  ++nInitialized;
181  }
182 
184  const unsigned int getSize(const unsigned int &objtype) const {
185  unsigned int size = 0;
186  if (objtype == EVTColContainer::MUON && muons != nullptr) {
187  size = muons->size();
188  } else if (objtype == EVTColContainer::MUTRK && tracks != nullptr) {
189  size = tracks->size();
190  } else if (objtype == EVTColContainer::TRACK && tracks != nullptr) {
191  size = tracks->size();
192  } else if (objtype == EVTColContainer::ELEC && electrons != nullptr) {
193  size = electrons->size();
194  } else if (objtype == EVTColContainer::PHOTON && photons != nullptr) {
195  size = photons->size();
196  } else if (objtype == EVTColContainer::MET && METs != nullptr) {
197  size = METs->size();
198  } else if (objtype == EVTColContainer::PFMET && pfMETs != nullptr) {
199  size = pfMETs->size();
200  } else if (objtype == EVTColContainer::PFMHT && pfMHTs != nullptr) {
201  size = pfMHTs->size();
202  } else if (objtype == EVTColContainer::GENMET && genMETs != nullptr) {
203  size = genMETs->size();
204  } else if (objtype == EVTColContainer::CALOMET && caloMETs != nullptr) {
205  size = caloMETs->size();
206  } else if (objtype == EVTColContainer::CALOMHT && caloMHTs != nullptr) {
207  size = caloMHTs->size();
208  } else if (objtype == EVTColContainer::PFTAU && pfTaus != nullptr) {
209  size = pfTaus->size();
210  } else if (objtype == EVTColContainer::PFJET && pfJets != nullptr) {
211  size = pfJets->size();
212  } else if (objtype == EVTColContainer::CALOJET && caloJets != nullptr) {
213  size = caloJets->size();
214  }
215 
216  return size;
217  }
218 
220  const static std::string getTypeString(const unsigned int &objtype) {
221  std::string objTypestr;
222 
223  if (objtype == EVTColContainer::MUON) {
224  objTypestr = "Mu";
225  } else if (objtype == EVTColContainer::MUTRK) {
226  objTypestr = "refittedStandAloneMuons";
227  } else if (objtype == EVTColContainer::TRACK) {
228  objTypestr = "Track";
229  } else if (objtype == EVTColContainer::ELEC) {
230  objTypestr = "Ele";
231  } else if (objtype == EVTColContainer::PHOTON) {
232  objTypestr = "Photon";
233  } else if (objtype == EVTColContainer::MET) {
234  objTypestr = "MET";
235  } else if (objtype == EVTColContainer::PFMET) {
236  objTypestr = "PFMET";
237  } else if (objtype == EVTColContainer::PFMHT) {
238  objTypestr = "PFMHT";
239  } else if (objtype == EVTColContainer::GENMET) {
240  objTypestr = "GenMET";
241  } else if (objtype == EVTColContainer::CALOMET) {
242  objTypestr = "CaloMET";
243  } else if (objtype == EVTColContainer::CALOMHT) {
244  objTypestr = "CaloMHT";
245  } else if (objtype == EVTColContainer::PFTAU) {
246  objTypestr = "PFTau";
247  } else if (objtype == EVTColContainer::PFJET) {
248  objTypestr = "PFJet";
249  } else if (objtype == EVTColContainer::CALOJET) {
250  objTypestr = "CaloJet";
251  } else {
252  edm::LogError("ExoticaValidations") << "EVTColContainer::getTypeString, "
253  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;
254  ;
255  }
256 
257  return objTypestr;
258  }
259 };
260 #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:14
const std::vector< reco::MET > * METs
const std::vector< reco::CaloJet > * caloJets
const reco::GenParticleCollection * genParticles
container with all the objects needed
Log< level::Error, false > LogError
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 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.
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
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
const unsigned int getSize(const unsigned int &objtype) const
Get size of collections.
Computes the MET from a collection of PFCandidates. HF missing!
Definition: PFMET.cc:24