EgammaAnalysis
ElectronTools
src
ElectronEPcombinator.cc
Go to the documentation of this file.
1
#include "
EgammaAnalysis/ElectronTools/interface/ElectronEPcombinator.h
"
2
#include <iostream>
3
4
//Accessor to the combination results
5
void
ElectronEPcombinator::combine
(
SimpleElectron
&
electron
) {
6
electron_
=
electron
;
7
computeEPcombination
();
8
electron
.setCombinedMomentum(
combinedMomentum_
);
9
electron
.setCombinedMomentumError(
combinedMomentumError_
);
10
}
11
12
//Core code to compute the EP combination
13
void
ElectronEPcombinator::computeEPcombination
() {
14
if
(
mode_
== 1) {
15
scEnergy_
=
electron_
.
getNewEnergy
();
16
scEnergyError_
=
electron_
.
getNewEnergyError
();
17
}
18
if
(
mode_
== 2) {
19
scEnergy_
=
electron_
.
getRegEnergy
();
20
scEnergyError_
=
electron_
.
getRegEnergyError
();
21
}
22
trackerMomentum_
=
electron_
.
getTrackerMomentum
();
23
trackerMomentumError_
=
electron_
.
getTrackerMomentumError
();
24
elClass_
=
electron_
.
getElClass
();
25
26
combinedMomentum_
=
scEnergy_
;
// initial
27
combinedMomentumError_
= 999.;
28
29
// first check for large errors
30
31
if
(
trackerMomentumError_
/
trackerMomentum_
> 0.5 &&
scEnergyError_
/
scEnergy_
<= 0.5) {
32
combinedMomentum_
=
scEnergy_
;
33
combinedMomentumError_
=
scEnergyError_
;
34
}
else
if
(
trackerMomentumError_
/ trackerMomentum_ <= 0.5 && scEnergyError_ / scEnergy_ > 0.5) {
35
combinedMomentum_
=
trackerMomentum_
;
36
combinedMomentumError_
=
trackerMomentumError_
;
37
}
else
if
(
trackerMomentumError_
/
trackerMomentum_
> 0.5 &&
scEnergyError_
/
scEnergy_
> 0.5) {
38
if
(
trackerMomentumError_
/
trackerMomentum_
<
scEnergyError_
/
scEnergy_
) {
39
combinedMomentum_
=
trackerMomentum_
;
40
combinedMomentumError_
=
trackerMomentumError_
;
41
}
else
{
42
combinedMomentum_
=
scEnergy_
;
43
combinedMomentumError_
=
scEnergyError_
;
44
}
45
}
46
47
// then apply the combination algorithm
48
else
{
49
// calculate E/p and corresponding error
50
float
eOverP
=
scEnergy_
/
trackerMomentum_
;
51
float
errorEOverP =
sqrt
((
scEnergyError_
/
trackerMomentum_
) * (
scEnergyError_
/
trackerMomentum_
) +
52
(
scEnergy_
*
trackerMomentumError_
/
trackerMomentum_
/
trackerMomentum_
) *
53
(
scEnergy_
*
trackerMomentumError_
/
trackerMomentum_
/
trackerMomentum_
));
54
55
bool
eleIsNotInCombination =
false
;
56
if
((
eOverP
> 1 + 2.5 * errorEOverP) || (
eOverP
< 1 - 2.5 * errorEOverP) || (
eOverP
< 0.8) || (
eOverP
> 1.3)) {
57
eleIsNotInCombination =
true
;
58
}
59
60
if
(eleIsNotInCombination) {
61
if
(
eOverP
> 1) {
62
combinedMomentum_
=
scEnergy_
;
63
combinedMomentumError_
=
scEnergyError_
;
64
}
else
{
65
if
(
elClass_
== 0)
// == reco::GsfElectron::GOLDEN)
66
{
67
combinedMomentum_
=
scEnergy_
;
68
combinedMomentumError_
=
scEnergyError_
;
69
}
70
if
(
elClass_
== 1)
//reco::GsfElectron::BIGBREM)
71
{
72
if
(
scEnergy_
< 36) {
73
combinedMomentum_
=
trackerMomentum_
;
74
combinedMomentumError_
=
trackerMomentumError_
;
75
}
else
{
76
combinedMomentum_
=
scEnergy_
;
77
combinedMomentumError_
=
scEnergyError_
;
78
}
79
}
80
if
(
elClass_
== 2)
// == reco::GsfElectron::BADTRACK)
81
{
82
combinedMomentum_
=
scEnergy_
;
83
combinedMomentumError_
=
scEnergyError_
;
84
}
85
if
(
elClass_
== 3)
//reco::GsfElectron::SHOWERING)
86
{
87
if
(
scEnergy_
< 30) {
88
combinedMomentum_
=
trackerMomentum_
;
89
combinedMomentumError_
=
trackerMomentumError_
;
90
}
else
{
91
combinedMomentum_
=
scEnergy_
;
92
combinedMomentumError_
=
scEnergyError_
;
93
}
94
}
95
if
(
elClass_
== 4)
//reco::GsfElectron::GAP)
96
{
97
if
(
scEnergy_
< 60) {
98
combinedMomentum_
=
trackerMomentum_
;
99
combinedMomentumError_
=
trackerMomentumError_
;
100
}
else
{
101
combinedMomentum_
=
scEnergy_
;
102
combinedMomentumError_
=
scEnergyError_
;
103
}
104
}
105
}
106
}
else
{
107
// combination
108
combinedMomentum_
= (
scEnergy_
/
scEnergyError_
/
scEnergyError_
+
109
trackerMomentum_
/
trackerMomentumError_
/
trackerMomentumError_
) /
110
(1 /
scEnergyError_
/
scEnergyError_
+ 1 /
trackerMomentumError_
/
trackerMomentumError_
);
111
float
combinedMomentum_Variance =
112
1 / (1 /
scEnergyError_
/
scEnergyError_
+ 1 /
trackerMomentumError_
/
trackerMomentumError_
);
113
combinedMomentumError_
=
sqrt
(combinedMomentum_Variance);
114
}
115
}
116
}
EgHLTOffHistBins_cfi.eOverP
eOverP
Definition:
EgHLTOffHistBins_cfi.py:37
SimpleElectron::getTrackerMomentumError
double getTrackerMomentumError() const
Definition:
SimpleElectron.h:66
SimpleElectron::getTrackerMomentum
double getTrackerMomentum() const
Definition:
SimpleElectron.h:65
ElectronEPcombinator::mode_
int mode_
Definition:
ElectronEPcombinator.h:24
ElectronEPcombinator::trackerMomentum_
double trackerMomentum_
Definition:
ElectronEPcombinator.h:21
ElectronEPcombinator::scEnergyError_
double scEnergyError_
Definition:
ElectronEPcombinator.h:20
SimpleElectron
Definition:
SimpleElectron.h:8
SimpleElectron::getRegEnergyError
double getRegEnergyError() const
Definition:
SimpleElectron.h:64
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:19
metsig::electron
Definition:
SignAlgoResolutions.h:48
ElectronEPcombinator::combinedMomentum_
double combinedMomentum_
Definition:
ElectronEPcombinator.h:17
ElectronEPcombinator::scEnergy_
double scEnergy_
Definition:
ElectronEPcombinator.h:19
ElectronEPcombinator::trackerMomentumError_
double trackerMomentumError_
Definition:
ElectronEPcombinator.h:22
SimpleElectron::getRegEnergy
double getRegEnergy() const
Definition:
SimpleElectron.h:63
SimpleElectron::getNewEnergyError
double getNewEnergyError() const
Definition:
SimpleElectron.h:56
ElectronEPcombinator.h
ElectronEPcombinator::electron_
SimpleElectron electron_
Definition:
ElectronEPcombinator.h:15
SimpleElectron::getNewEnergy
double getNewEnergy() const
Definition:
SimpleElectron.h:55
ElectronEPcombinator::computeEPcombination
void computeEPcombination()
Definition:
ElectronEPcombinator.cc:13
SimpleElectron::getElClass
int getElClass() const
Definition:
SimpleElectron.h:69
ElectronEPcombinator::combine
void combine(SimpleElectron &electron)
Definition:
ElectronEPcombinator.cc:5
ElectronEPcombinator::combinedMomentumError_
double combinedMomentumError_
Definition:
ElectronEPcombinator.h:18
ElectronEPcombinator::elClass_
int elClass_
Definition:
ElectronEPcombinator.h:23
Generated for CMSSW Reference Manual by
1.8.16