CMS 3D CMS Logo

EVTColContainer.cc
Go to the documentation of this file.
1 #ifndef HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
2 #define HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
3 
14 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h" // TO BE DEPRECATED
35 
36 #include<vector>
37 #include<map>
38 
40 struct EVTColContainer
41 {
42  enum
43  {
44  MUON,
45  ELEC,
46  PHOTON,
47  CALOMET,
48  PFMET,
49  PFTAU,
50  PFJET,
51 // TRACK,
52  _nMAX
53  };
54 
55  int nOfCollections;
56  int nInitialized;
59  const std::vector<reco::Muon> * muons;
60  const std::vector<reco::GsfElectron> * electrons;
61  const std::vector<reco::Photon> * photons;
62  const std::vector<reco::CaloMET> * caloMETs;
63  const std::vector<reco::PFMET> * pfMETs;
64  const std::vector<reco::PFTau> * pfTaus;
65  const std::vector<reco::PFJet> * pfJets;
67  //const std::vector<reco::Track> * tracks;
71  nOfCollections(7),
72  nInitialized(0),
73  genParticles(nullptr),
74  genJets(nullptr),
75  muons(nullptr),
76  electrons(nullptr),
77  photons(nullptr),
78  caloMETs(nullptr),
79  pfMETs(nullptr),
80  pfTaus(nullptr),
81  pfJets(nullptr),
82  jetTags(nullptr),
83  //tracks(0),
84  rawTriggerEvent(nullptr),
85  triggerResults(nullptr)
86  {
87  }
89  bool isAllInit()
90  {
91  return (nInitialized == nOfCollections);
92  }
93 
94  bool isCommonInit()
95  {
96  return (rawTriggerEvent != nullptr);
97  }
99  void reset()
100  {
101  nInitialized = 0;
102  genParticles = nullptr;
103  genJets = nullptr;
104  muons = nullptr; electrons = nullptr; photons = nullptr; pfTaus=nullptr; caloMETs=nullptr; pfMETs= nullptr; pfJets=nullptr; //tracks=0;
105  jetTags = nullptr;
106  rawTriggerEvent = nullptr;
107  triggerResults = nullptr;
108  }
110  void set(const reco::MuonCollection * v)
111  {
112  muons = v;
113  ++nInitialized;
114  }
115  void set(const reco::GsfElectronCollection * v)
116  {
117  electrons = v;
118  ++nInitialized;
119  }
120  void set(const reco::PhotonCollection * v)
121  {
122  photons = v;
123  ++nInitialized;
124  }
125  void set(const reco::CaloMETCollection * v)
126  {
127  caloMETs = v;
128  ++nInitialized;
129  }
130  void set(const reco::PFMETCollection * v)
131  {
132  pfMETs = v;
133  ++nInitialized;
134  }
135  void set(const reco::PFTauCollection * v)
136  {
137  pfTaus = v;
138  ++nInitialized;
139  }
140  void set(const reco::PFJetCollection * v)
141  {
142  pfJets = v;
143  ++nInitialized;
144  }
145  void set(const reco::JetTagCollection * v)
146  {
147  jetTags = v;
148  }
149  /*void set(const reco::TrackCollection * v)
150  {
151  tracks = v;
152  ++nInitialized;
153  }*/
154  const unsigned int getSize(const unsigned int & objtype) const
155  {
156  unsigned int size = 0;
157  if( objtype == EVTColContainer::MUON && muons != nullptr )
158  {
159  size = muons->size();
160  }
161  else if( objtype == EVTColContainer::ELEC && electrons != nullptr )
162  {
163  size = electrons->size();
164  }
165  else if( objtype == EVTColContainer::PHOTON && photons != nullptr )
166  {
167  size = photons->size();
168  }
169  else if( objtype == EVTColContainer::CALOMET && caloMETs != nullptr )
170  {
171  size = caloMETs->size();
172  }
173  else if( objtype == EVTColContainer::PFMET && pfMETs != nullptr )
174  {
175  size = pfMETs->size();
176  }
177  else if( objtype == EVTColContainer::PFTAU && pfTaus != nullptr )
178  {
179  size = pfTaus->size();
180  }
181  else if( objtype == EVTColContainer::PFJET && pfJets != nullptr )
182  {
183  size = pfJets->size();
184  }
185  /*else if( objtype == EVTColContainer::TRACK && tracks != 0 )
186  {
187  size = tracks->size();
188  }*/
189 
190  return size;
191  }
192 
193  static std::string getTypeString(const unsigned int & objtype)
194  {
195  std::string objTypestr;
196 
197  if( objtype == EVTColContainer::MUON )
198  {
199  objTypestr = "Mu";
200  }
201  else if( objtype == EVTColContainer::ELEC )
202  {
203  objTypestr = "Ele";
204  }
205  else if( objtype == EVTColContainer::PHOTON )
206  {
207  objTypestr = "Photon";
208  }
209  else if( objtype == EVTColContainer::CALOMET )
210  {
211  objTypestr = "MET";
212  }
213  else if( objtype == EVTColContainer::PFMET )
214  {
215  objTypestr = "PFMET";
216  }
217  else if( objtype == EVTColContainer::PFTAU )
218  {
219  objTypestr = "PFTau";
220  }
221  else if( objtype == EVTColContainer::PFJET )
222  {
223  objTypestr = "Jet";
224  }
225  /*else if( objtype == EVTColContainer::TRACK )
226  {
227  // FIXME: decide what to do! Just a patch
228  objTypestr = "TkMu";
229  }*/
230  else
231  {
232  edm::LogError("HiggsValidations") << "EVTColContainer::getTypeString, "
233  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;;
234  }
235 
236  return objTypestr;
237  }
238 };
239 #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
static std::string getTypeString(const unsigned int &objtype)
const trigger::TriggerEventWithRefs * rawTriggerEvent
const std::vector< reco::CaloMET > * caloMETs
std::vector< GenJet > GenJetCollection
collection of GenJet objects
#define nullptr
const reco::GenParticleCollection * genParticles
container with all the objects needed
const unsigned int getSize(const unsigned int &objtype) const
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
const reco::GenJetCollection * genJets
const reco::JetTagCollection * jetTags
const std::vector< reco::PFJet > * pfJets
const std::vector< reco::Photon > * photons
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::PFMET > * pfMETs
const edm::TriggerResults * triggerResults