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

Member Function Documentation

◆ convertFromStr()

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

Definition at line 13 of file EleEnergyRetriever.h.

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  }

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

◆ operator()()

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

Definition at line 28 of file EleEnergyRetriever.h.

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  }

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

Member Data Documentation

◆ type_

EnergyType EleEnergyRetriever::type_
private
EleEnergyRetriever::EnergyType::SuperCluster
EleEnergyRetriever::convertFromStr
static EnergyType convertFromStr(const std::string &typeStr)
Definition: EleEnergyRetriever.h:13
EleEnergyRetriever::EnergyType::Ecal
EleEnergyRetriever::EnergyType::EcalTrk
Exception
Definition: hltDiff.cc:246
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::EnergyType::SuperClusterRaw
reco::GsfElectron::ecalEnergy
float ecalEnergy() const
Definition: GsfElectron.h:820