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) :
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"
)
19
return
EnergyType::SuperCluster
;
20
else
if
(typeStr ==
"SuperClusterRaw"
)
21
return
EnergyType::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_
) {
30
case
EnergyType::EcalTrk
:
31
return
ele.
energy
();
32
case
EnergyType::Ecal
:
33
return
ele.
ecalEnergy
();
34
case
EnergyType::SuperCluster
:
35
return
ele.
superCluster
()->energy();
36
case
EnergyType::SuperClusterRaw
:
37
return
ele.
superCluster
()->rawEnergy();
38
}
39
return
0.;
40
}
41
42
private
:
43
EnergyType
type_
;
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:34
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:245
Exception.h
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition:
GsfElectron.h:162
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:818
Generated for CMSSW Reference Manual by
1.8.16