Main Page
Namespaces
Classes
Package Documentation
RecoEgamma
EgammaTools
interface
EleEnergyRetriever.h
Go to the documentation of this file.
1
#ifndef RecoEgamma_EgammaTools_EleEnergyRetriever_h
2
#define RecoEgamma_EgammaTools_EleEnergyRetriever_h
3
4
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
5
#include "
FWCore/Utilities/interface/Exception.h
"
6
7
class
EleEnergyRetriever
{
8
public
:
9
enum class
EnergyType
{
EcalTrk
,
Ecal
,
SuperCluster
,
SuperClusterRaw
};
10
11
EleEnergyRetriever
(
const
std::string
& typeStr):
12
type_
(
convertFromStr
(typeStr)){}
13
14
static
EnergyType
convertFromStr
(
const
std::string
& typeStr){
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
}
23
24
float
operator()
(
const
reco::GsfElectron
& ele)
const
{
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
}
33
34
private
:
35
EnergyType
type_
;
36
37
};
38
39
#endif
Exception
Definition:
hltDiff.cc:292
EleEnergyRetriever::convertFromStr
static EnergyType convertFromStr(const std::string &typeStr)
Definition:
EleEnergyRetriever.h:14
reco::GsfElectron
Definition:
GsfElectron.h:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
EleEnergyRetriever::EnergyType::EcalTrk
EleEnergyRetriever::operator()
float operator()(const reco::GsfElectron &ele) const
Definition:
EleEnergyRetriever.h:24
reco::LeafCandidate::energy
double energy() const final
energy
Definition:
LeafCandidate.h:110
EleEnergyRetriever
Definition:
EleEnergyRetriever.h:7
GsfElectron.h
Exception.h
EleEnergyRetriever::EnergyType::SuperCluster
EleEnergyRetriever::type_
EnergyType type_
Definition:
EleEnergyRetriever.h:35
EleEnergyRetriever::EnergyType
EnergyType
Definition:
EleEnergyRetriever.h:9
reco::GsfElectron::ecalEnergy
float ecalEnergy() const
Definition:
GsfElectron.h:860
EleEnergyRetriever::EnergyType::SuperClusterRaw
EleEnergyRetriever::EnergyType::Ecal
EleEnergyRetriever::EleEnergyRetriever
EleEnergyRetriever(const std::string &typeStr)
Definition:
EleEnergyRetriever.h:11
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition:
GsfElectron.h:185
Generated for CMSSW Reference Manual by
1.8.11