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_HIGGS_EVTCOLCONTAINER
2 #define HLTRIGGEROFFLINE_HIGGS_EVTCOLCONTAINER
3 
16 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h" // TO BE DEPRECATED
30 
31 #include<vector>
32 #include<map>
33 
36 {
37  enum
38  {
44 // TRACK,
46  };
47 
51  const std::vector<reco::Muon> * muons;
52  const std::vector<reco::GsfElectron> * electrons;
53  const std::vector<reco::Photon> * photons;
54  const std::vector<reco::CaloMET> * caloMETs;
55  const std::vector<reco::PFTau> * pfTaus;
56  //const std::vector<reco::Track> * tracks;
60 // nOfCollections(6),
61  nOfCollections(5),
62  nInitialized(0),
63  genParticles(0),
64  muons(0),
65  electrons(0),
66  photons(0),
67  pfTaus(0),
68  //tracks(0),
69  rawTriggerEvent(0),
71  {
72  }
74  bool isAllInit()
75  {
76  return (nInitialized == nOfCollections);
77  }
78 
79  bool isCommonInit()
80  {
81  return (rawTriggerEvent != 0);
82  }
84  void reset()
85  {
86  nInitialized = 0;
87  genParticles = 0;
88  muons = 0; electrons = 0; photons = 0; pfTaus=0; caloMETs=0; //tracks=0;
89  rawTriggerEvent = 0;
90  triggerResults = 0;
91  }
93  void set(const reco::MuonCollection * v)
94  {
95  muons = v;
96  ++nInitialized;
97  }
99  {
100  electrons = v;
101  ++nInitialized;
102  }
104  {
105  photons = v;
106  ++nInitialized;
107  }
109  {
110  caloMETs = v;
111  ++nInitialized;
112  }
114  {
115  pfTaus = v;
116  ++nInitialized;
117  }
118  /*void set(const reco::TrackCollection * v)
119  {
120  tracks = v;
121  ++nInitialized;
122  }*/
123  const unsigned int getSize(const unsigned int & objtype) const
124  {
125  unsigned int size = 0;
126  if( objtype == EVTColContainer::MUON && muons != 0 )
127  {
128  size = muons->size();
129  }
130  else if( objtype == EVTColContainer::ELEC && electrons != 0 )
131  {
132  size = electrons->size();
133  }
134  else if( objtype == EVTColContainer::PHOTON && photons != 0 )
135  {
136  size = photons->size();
137  }
138  else if( objtype == EVTColContainer::CALOMET && caloMETs != 0 )
139  {
140  size = caloMETs->size();
141  }
142  else if( objtype == EVTColContainer::PFTAU && pfTaus != 0 )
143  {
144  size = pfTaus->size();
145  }
146  /*else if( objtype == EVTColContainer::TRACK && tracks != 0 )
147  {
148  size = tracks->size();
149  }*/
150 
151  return size;
152  }
153 
154  static std::string getTypeString(const unsigned int & objtype)
155  {
156  std::string objTypestr;
157 
158  if( objtype == EVTColContainer::MUON )
159  {
160  objTypestr = "Mu";
161  }
162  else if( objtype == EVTColContainer::ELEC )
163  {
164  objTypestr = "Ele";
165  }
166  else if( objtype == EVTColContainer::PHOTON )
167  {
168  objTypestr = "Photon";
169  }
170  else if( objtype == EVTColContainer::CALOMET )
171  {
172  objTypestr = "MET";
173  }
174  else if( objtype == EVTColContainer::PFTAU )
175  {
176  objTypestr = "PFTau";
177  }
178  /*else if( objtype == EVTColContainer::TRACK )
179  {
180  // FIXME: decide what to do! Just a patch
181  objTypestr = "TkMu";
182  }*/
183  else
184  {
185  edm::LogError("HiggsValidations") << "EVTColContainer::getTypeString, "
186  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;;
187  }
188 
189  return objTypestr;
190  }
191 };
192 #endif
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
void set(const reco::GsfElectronCollection *v)
const std::vector< reco::Photon > * photons
const std::vector< reco::CaloMET > * caloMETs
const edm::TriggerResults * triggerResults
container with all the objects needed
void set(const reco::CaloMETCollection *v)
const unsigned int getSize(const unsigned int &objtype) const
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
void set(const reco::PFTauCollection *v)
const std::vector< reco::GsfElectron > * electrons
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
const reco::GenParticleCollection * genParticles
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
void set(const reco::PhotonCollection *v)
const std::vector< reco::PFTau > * pfTaus
tuple size
Write out results.
const std::vector< reco::Muon > * muons