CMS 3D CMS Logo

EleEnergyRetriever.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_EgammaTools_EleEnergyRetriever_h
2 #define RecoEgamma_EgammaTools_EleEnergyRetriever_h
3 
6 
8 public:
10 
11  EleEnergyRetriever(const std::string& typeStr) : type_(convertFromStr(typeStr)) {}
12 
13  static EnergyType convertFromStr(const std::string& typeStr) {
14  if (typeStr == "EcalTrk")
15  return EnergyType::EcalTrk;
16  else if (typeStr == "Ecal")
17  return EnergyType::Ecal;
18  else if (typeStr == "SuperCluster")
20  else if (typeStr == "SuperClusterRaw")
22  else {
23  throw cms::Exception("ConfigError")
24  << " type \"" << typeStr << "\" not recognised, must be of type EcalTrk,Ecal,SuperCluster,SuperClusterRaw";
25  }
26  }
27 
28  float operator()(const reco::GsfElectron& ele) const {
29  switch (type_) {
31  return ele.energy();
32  case EnergyType::Ecal:
33  return ele.ecalEnergy();
35  return ele.superCluster()->energy();
37  return ele.superCluster()->rawEnergy();
38  }
39  return 0.;
40  }
41 
42 private:
44 };
45 
46 #endif
EleEnergyRetriever::EnergyType::SuperCluster
EleEnergyRetriever::convertFromStr
static EnergyType convertFromStr(const std::string &typeStr)
Definition: EleEnergyRetriever.h:13
EleEnergyRetriever
Definition: EleEnergyRetriever.h:7
EleEnergyRetriever::EleEnergyRetriever
EleEnergyRetriever(const std::string &typeStr)
Definition: EleEnergyRetriever.h:11
EleEnergyRetriever::EnergyType::Ecal
reco::GsfElectron
Definition: GsfElectron.h:35
GsfElectron.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EleEnergyRetriever::EnergyType::EcalTrk
EleEnergyRetriever::EnergyType
EnergyType
Definition: EleEnergyRetriever.h:9
Exception
Definition: hltDiff.cc:246
Exception.h
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:163
EleEnergyRetriever::type_
EnergyType type_
Definition: EleEnergyRetriever.h:43
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
EleEnergyRetriever::operator()
float operator()(const reco::GsfElectron &ele) const
Definition: EleEnergyRetriever.h:28
EleEnergyRetriever::EnergyType::SuperClusterRaw
reco::GsfElectron::ecalEnergy
float ecalEnergy() const
Definition: GsfElectron.h:820