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

◆ EnergyType

Enumerator
EcalTrk 
Ecal 
SuperCluster 
SuperClusterRaw 

Definition at line 9 of file EleEnergyRetriever.h.

9 { EcalTrk, Ecal, SuperCluster, SuperClusterRaw };

Constructor & Destructor Documentation

◆ EleEnergyRetriever()

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

Definition at line 11 of file EleEnergyRetriever.h.

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

Member Function Documentation

◆ convertFromStr()

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

Definition at line 13 of file EleEnergyRetriever.h.

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

13  {
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  }

◆ operator()()

float EleEnergyRetriever::operator() ( const reco::GsfElectron ele) const
inline

Definition at line 28 of file EleEnergyRetriever.h.

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

28  {
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  }
float ecalEnergy() const
Definition: GsfElectron.h:896
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
double energy() const final
energy

Member Data Documentation

◆ type_

EnergyType EleEnergyRetriever::type_
private