CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
EleEnergyRetriever Class Reference

#include <EleEnergyRetriever.h>

Public Types

enum  EnergyType { EnergyType::EcalTrk, EnergyType::Ecal, EnergyType::SuperCluster, EnergyType::SuperClusterRaw }
 

Public Member Functions

 EleEnergyRetriever (const std::string &typeStr)
 
float operator() (const reco::GsfElectron &ele) const
 

Static Public Member Functions

static EnergyType convertFromStr (const std::string &typeStr)
 

Private Attributes

EnergyType type_
 

Detailed Description

Definition at line 7 of file EleEnergyRetriever.h.

Member Enumeration Documentation

Enumerator
EcalTrk 
Ecal 
SuperCluster 
SuperClusterRaw 

Definition at line 9 of file EleEnergyRetriever.h.

9 {EcalTrk,Ecal,SuperCluster,SuperClusterRaw};

Constructor & Destructor Documentation

EleEnergyRetriever::EleEnergyRetriever ( const std::string &  typeStr)
inline

Definition at line 11 of file EleEnergyRetriever.h.

11  :
12  type_(convertFromStr(typeStr)){}
static EnergyType convertFromStr(const std::string &typeStr)

Member Function Documentation

static EnergyType EleEnergyRetriever::convertFromStr ( const std::string &  typeStr)
inlinestatic

Definition at line 14 of file EleEnergyRetriever.h.

References Ecal, EcalTrk, Exception, SuperCluster, and SuperClusterRaw.

14  {
15  if(typeStr=="EcalTrk") return EnergyType::EcalTrk;
16  else if(typeStr=="Ecal") return EnergyType::Ecal;
17  else if(typeStr=="SuperCluster") return EnergyType::SuperCluster;
18  else if(typeStr=="SuperClusterRaw") return EnergyType::SuperClusterRaw;
19  else {
20  throw cms::Exception("ConfigError") <<" type \""<<typeStr<<"\" not recognised, must be of type EcalTrk,Ecal,SuperCluster,SuperClusterRaw";
21  }
22  }
float EleEnergyRetriever::operator() ( const reco::GsfElectron ele) const
inline

Definition at line 24 of file EleEnergyRetriever.h.

References Ecal, reco::GsfElectron::ecalEnergy(), EcalTrk, reco::LeafCandidate::energy(), SuperCluster, reco::GsfElectron::superCluster(), SuperClusterRaw, and type_.

24  {
25  switch(type_){
26  case EnergyType::EcalTrk: return ele.energy();
27  case EnergyType::Ecal: return ele.ecalEnergy();
28  case EnergyType::SuperCluster: return ele.superCluster()->energy();
29  case EnergyType::SuperClusterRaw: return ele.superCluster()->rawEnergy();
30  }
31  return 0.;
32  }
double energy() const final
energy
float ecalEnergy() const
Definition: GsfElectron.h:860
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185

Member Data Documentation

EnergyType EleEnergyRetriever::type_
private