DataFormats
L1THGCal
src
ClusterShapes.cc
Go to the documentation of this file.
1
#include "
DataFormats/L1THGCal/interface/ClusterShapes.h
"
2
#include <cmath>
3
4
using namespace
l1t
;
5
6
ClusterShapes
ClusterShapes::operator+
(
const
ClusterShapes
& x) {
7
ClusterShapes
cs
(*
this
);
// copy constructor
8
cs
+= x;
9
return
cs
;
10
}
11
12
void
ClusterShapes::operator+=
(
const
ClusterShapes
& x) {
13
sum_e_
+= x.sum_e_;
14
sum_e2_
+= x.sum_e2_;
15
sum_logE_
+= x.sum_logE_;
16
n_
+= x.n_;
17
18
sum_w_
+= x.sum_w_;
19
20
emax_
= (
emax_
> x.emax_) ?
emax_
: x.emax_;
21
22
// mid-point
23
sum_eta_
+= x.sum_eta_;
24
sum_phi_0_
+= x.sum_phi_0_;
//
25
sum_phi_1_
+= x.sum_phi_1_;
//
26
sum_r_
+= x.sum_r_;
27
28
// square
29
sum_eta2_
+= x.sum_eta2_;
30
sum_phi2_0_
+= x.sum_phi2_0_;
31
sum_phi2_1_
+= x.sum_phi2_1_;
32
sum_r2_
+= x.sum_r2_;
33
34
// off diagonal
35
sum_eta_r_
+= x.sum_eta_r_;
36
sum_r_phi_0_
+= x.sum_r_phi_0_;
37
sum_r_phi_1_
+= x.sum_r_phi_1_;
38
sum_eta_phi_0_
+= x.sum_eta_phi_0_;
39
sum_eta_phi_1_
+= x.sum_eta_phi_1_;
40
}
41
42
// -------------- CLUSTER SHAPES ---------------
43
void
ClusterShapes::Init
(
float
e
,
float
eta
,
float
phi,
float
r
) {
44
if
(
e
<= 0)
45
return
;
46
sum_e_
=
e
;
47
sum_e2_
=
e
*
e
;
48
sum_logE_
=
std::log
(
e
);
49
50
float
w
=
e
;
51
52
n_
= 1;
53
54
sum_w_
=
w
;
55
56
sum_phi_0_
=
w
* (phi);
57
sum_phi_1_
=
w
* (phi +
M_PI
);
58
sum_r_
=
w
*
r
;
59
sum_eta_
=
w
*
eta
;
60
61
//--
62
sum_r2_
+=
w
* (
r
*
r
);
63
sum_eta2_
+=
w
* (
eta
*
eta
);
64
sum_phi2_0_
+=
w
* (phi * phi);
65
sum_phi2_1_
+=
w
* (phi +
M_PI
) * (phi +
M_PI
);
66
67
// -- off diagonal
68
sum_eta_r_
+=
w
* (
r
*
eta
);
69
sum_r_phi_0_
+=
w
* (
r
* phi);
70
sum_r_phi_1_
+=
w
*
r
* (phi +
M_PI
);
71
sum_eta_phi_0_
+=
w
* (
eta
* phi);
72
sum_eta_phi_1_
+=
w
*
eta
* (phi +
M_PI
);
73
}
74
// ------
75
float
ClusterShapes::Eta
()
const
{
return
sum_eta_
/
sum_w_
; }
76
float
ClusterShapes::R
()
const
{
return
sum_r_
/
sum_w_
; }
77
78
float
ClusterShapes::SigmaEtaEta
()
const
{
return
sum_eta2_
/
sum_w_
-
Eta
() *
Eta
(); }
79
80
float
ClusterShapes::SigmaRR
()
const
{
return
sum_r2_
/
sum_w_
-
R
() *
R
(); }
81
82
float
ClusterShapes::SigmaPhiPhi
()
const
{
83
float
phi_0 = (
sum_phi_0_
/
sum_w_
);
84
float
phi_1 = (
sum_phi_1_
/
sum_w_
);
85
float
spp_0 =
sum_phi2_0_
/
sum_w_
- phi_0 * phi_0;
86
float
spp_1 =
sum_phi2_1_
/
sum_w_
- phi_1 * phi_1;
87
88
if
(spp_0 < spp_1) {
89
isPhi0_
=
true
;
90
return
spp_0;
91
}
else
{
92
isPhi0_
=
false
;
93
return
spp_1;
94
}
95
}
96
97
float
ClusterShapes::Phi
()
const
{
98
SigmaPhiPhi
();
//update phi
99
if
(
isPhi0_
)
100
return
(
sum_phi_0_
/
sum_w_
);
101
else
102
return
(
sum_phi_1_
/
sum_w_
);
103
}
104
105
// off - diagonal
106
float
ClusterShapes::SigmaEtaR
()
const
{
return
-(
sum_eta_r_
/
sum_w_
-
Eta
() *
R
()); }
107
108
float
ClusterShapes::SigmaEtaPhi
()
const
{
109
SigmaPhiPhi
();
// decide which phi use, update phi
110
111
if
(
isPhi0_
)
112
return
-(
sum_eta_phi_0_
/
sum_w_
-
Eta
() * (
sum_phi_0_
/
sum_w_
));
113
else
114
return
-(
sum_eta_phi_1_
/
sum_w_
-
Eta
() * (
sum_phi_1_
/
sum_w_
));
115
}
116
117
float
ClusterShapes::SigmaRPhi
()
const
{
118
SigmaPhiPhi
();
// decide which phi use, update phi
119
if
(
isPhi0_
)
120
return
-(
sum_r_phi_0_
/
sum_w_
-
R
() * (
sum_phi_0_
/
sum_w_
));
121
else
122
return
-(
sum_r_phi_1_
/
sum_w_
-
R
() * (
sum_phi_1_
/
sum_w_
));
123
}
l1t::ClusterShapes::R
float R() const
Definition:
ClusterShapes.cc:76
l1t::ClusterShapes::sum_eta_phi_0_
float sum_eta_phi_0_
Definition:
ClusterShapes.h:34
l1t::ClusterShapes::n_
int n_
Definition:
ClusterShapes.h:14
l1t::ClusterShapes::Eta
float Eta() const
Definition:
ClusterShapes.cc:75
l1t::ClusterShapes::sum_r_phi_1_
float sum_r_phi_1_
Definition:
ClusterShapes.h:33
l1t::ClusterShapes::sum_e2_
float sum_e2_
Definition:
ClusterShapes.h:12
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition:
fastjetfortran_madfks.cc:47
l1t::ClusterShapes::SigmaPhiPhi
float SigmaPhiPhi() const
Definition:
ClusterShapes.cc:82
l1t::ClusterShapes::isPhi0_
bool isPhi0_
Definition:
ClusterShapes.h:38
l1t::ClusterShapes::SigmaEtaR
float SigmaEtaR() const
Definition:
ClusterShapes.cc:106
l1t::ClusterShapes::sum_eta2_
float sum_eta2_
Definition:
ClusterShapes.h:25
l1t::ClusterShapes::Phi
float Phi() const
Definition:
ClusterShapes.cc:97
l1t::ClusterShapes::sum_phi2_1_
float sum_phi2_1_
Definition:
ClusterShapes.h:28
PVValHelper::eta
Definition:
PVValidationHelpers.h:69
w
const double w
Definition:
UKUtility.cc:23
l1t::ClusterShapes::sum_eta_phi_1_
float sum_eta_phi_1_
Definition:
ClusterShapes.h:35
l1t::ClusterShapes::Init
void Init(float e, float eta, float phi, float r=0.)
Definition:
ClusterShapes.cc:43
l1t::ClusterShapes::sum_phi2_0_
float sum_phi2_0_
Definition:
ClusterShapes.h:27
l1t::ClusterShapes::SigmaRPhi
float SigmaRPhi() const
Definition:
ClusterShapes.cc:117
l1t::ClusterShapes::sum_r_phi_0_
float sum_r_phi_0_
Definition:
ClusterShapes.h:32
l1t::ClusterShapes::sum_e_
float sum_e_
Definition:
ClusterShapes.h:11
l1t::ClusterShapes::SigmaEtaEta
float SigmaEtaEta() const
Definition:
ClusterShapes.cc:78
l1t
delete x;
Definition:
CaloConfig.h:22
l1t::ClusterShapes::sum_eta_
float sum_eta_
Definition:
ClusterShapes.h:19
l1t::ClusterShapes::operator+
ClusterShapes operator+(const ClusterShapes &)
Definition:
ClusterShapes.cc:6
M_PI
#define M_PI
Definition:
BXVectorInputProducer.cc:49
l1t::ClusterShapes::sum_logE_
float sum_logE_
Definition:
ClusterShapes.h:13
l1t::ClusterShapes::sum_eta_r_
float sum_eta_r_
Definition:
ClusterShapes.h:31
l1t::ClusterShapes::operator+=
void operator+=(const ClusterShapes &)
Definition:
ClusterShapes.cc:12
l1t::ClusterShapes::sum_r2_
float sum_r2_
Definition:
ClusterShapes.h:26
l1t::ClusterShapes::sum_phi_0_
float sum_phi_0_
Definition:
ClusterShapes.h:22
alignCSCRings.r
r
Definition:
alignCSCRings.py:93
l1t::ClusterShapes::sum_phi_1_
float sum_phi_1_
Definition:
ClusterShapes.h:23
l1t::ClusterShapes::SigmaRR
float SigmaRR() const
Definition:
ClusterShapes.cc:80
l1t::ClusterShapes::sum_r_
float sum_r_
Definition:
ClusterShapes.h:20
ClusterShapes.h
dqm-mbProfile.log
log
Definition:
dqm-mbProfile.py:17
l1t::ClusterShapes::emax_
float emax_
Definition:
ClusterShapes.h:16
l1t::ClusterShapes
Definition:
ClusterShapes.h:9
l1t::ClusterShapes::SigmaEtaPhi
float SigmaEtaPhi() const
Definition:
ClusterShapes.cc:108
l1t::ClusterShapes::sum_w_
float sum_w_
Definition:
ClusterShapes.h:18
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16