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_EXOTICA_EVTCOLCONTAINER_CC
2 #define HLTRIGGEROFFLINE_EXOTICA_EVTCOLCONTAINER_CC
3 
27 
28 #include<vector>
29 #include<map>
30 
35  enum {
36  ELEC = 11,
37  MUON = 13,
38  PFTAU = 15,
39  PHOTON = 22,
40  PFMET = 39,
41  JET = 211,
43  };
44 
48  const std::vector<reco::Muon> * muons;
49  const std::vector<reco::GsfElectron> * electrons;
50  const std::vector<reco::Photon> * photons;
51  const std::vector<reco::PFMET> * pfMETs;
52  const std::vector<reco::PFTau> * pfTaus;
53  const std::vector<reco::PFJet> * jets;
56  nOfCollections(6),
57  nInitialized(0),
58  genParticles(0),
59  muons(0),
60  electrons(0),
61  photons(0),
62  pfMETs(0),
63  pfTaus(0),
64  jets(0),
66  {
67  }
69  bool isAllInit()
70  {
71  return (nInitialized == nOfCollections);
72  }
73 
74  bool isCommonInit()
75  {
76  return false;
77  }
78 
80  void reset()
81  {
82  nInitialized = 0;
83  genParticles = 0;
84  muons = 0;
85  electrons = 0;
86  photons = 0;
87  pfMETs = 0;
88  pfTaus = 0;
89  jets = 0;
90  triggerResults = 0;
91  }
92 
94  void set(const reco::MuonCollection * v)
95  {
96  muons = v;
97  ++nInitialized;
98  }
100  {
101  electrons = v;
102  ++nInitialized;
103  }
105  {
106  photons = v;
107  ++nInitialized;
108  }
110  {
111  pfMETs = v;
112  ++nInitialized;
113  }
115  {
116  pfTaus = v;
117  ++nInitialized;
118  }
120  {
121  jets = v;
122  ++nInitialized;
123  }
124 
126  const unsigned int getSize(const unsigned int & objtype) const
127  {
128  unsigned int size = 0;
129  if (objtype == EVTColContainer::MUON && muons != 0) {
130  size = muons->size();
131  } else if (objtype == EVTColContainer::ELEC && electrons != 0) {
132  size = electrons->size();
133  } else if (objtype == EVTColContainer::PHOTON && photons != 0) {
134  size = photons->size();
135  } else if (objtype == EVTColContainer::PFMET && pfMETs != 0) {
136  size = pfMETs->size();
137  } else if (objtype == EVTColContainer::PFTAU && pfTaus != 0) {
138  size = pfTaus->size();
139  } else if (objtype == EVTColContainer::JET && jets != 0) {
140  size = jets->size();
141  }
142 
143  return size;
144  }
145 
147  const static std::string getTypeString(const unsigned int & objtype)
148  {
149  std::string objTypestr;
150 
151  if (objtype == EVTColContainer::MUON) {
152  objTypestr = "Mu";
153  } else if (objtype == EVTColContainer::ELEC) {
154  objTypestr = "Ele";
155  } else if (objtype == EVTColContainer::PHOTON) {
156  objTypestr = "Photon";
157  } else if (objtype == EVTColContainer::PFMET) {
158  objTypestr = "MET";
159  } else if (objtype == EVTColContainer::PFTAU) {
160  objTypestr = "PFTau";
161  } else if (objtype == EVTColContainer::JET) {
162  objTypestr = "Jet";
163  } else {
164  edm::LogError("ExoticaValidations") << "EVTColContainer::getTypeString, "
165  << "NOT Implemented error (object type id='" << objtype << "')" << std::endl;;
166  }
167 
168  return objTypestr;
169  }
170 };
171 #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
const std::vector< reco::PFJet > * jets
void set(const reco::GsfElectronCollection *v)
const reco::GenParticleCollection * genParticles
container with all the objects needed
const unsigned int getSize(const unsigned int &objtype) const
Get size of collections.
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
void reset()
Reset: clear all collections.
void set(const reco::PFMETCollection *v)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
const std::vector< reco::GsfElectron > * electrons
void set(const reco::PFJetCollection *v)
void set(const reco::PhotonCollection *v)
std::vector< PFJet > PFJetCollection
collection of PFJet objects
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
const std::vector< reco::PFMET > * pfMETs
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
tuple size
Write out results.
Computes the MET from a collection of PFCandidates. HF missing!
Definition: PFMET.h:30