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