ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloClusterUpdate.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/********************************************************************
6
7
NAME: CaloClusterUpdate.cxx
8
PACKAGE: offline/LArCalorimeter/LArClusterRec
9
10
AUTHORS: H. Ma, S. Rajagopalan
11
CREATED: Nov, 2000
12
13
PURPOSE: Recalculate the total energy, eta,phi of a cluster.
14
This should be called after all corrections to individual
15
samplings are done.
16
17
energy = Sum of energy in all sampling
18
eta = average of eta1 and eta2, weighted by energy and
19
relative resolution.
20
This needs to be tuned.
21
phi = phi of second sampling.
22
23
Base class: LArClusterCorrection (Algorithm)
24
25
Atrecon Orig: emreco/qetamod.F
26
27
Updated: May 10, 2000 (SR, HM)
28
Migrated to Athena Framework from PASO
29
30
Updated: Jan 5, 2001 (HM)
31
QA.
32
33
Updated: Feb 28, 2003, Mar 4, 2003 (MW)
34
protect against unphysical clusters
35
36
Updated: May 5, 2004 (Sven Menke)
37
base class changed from algo to tool
38
39
********************************************************************/
40
// include header files
41
#include "
CaloClusterUpdate.h
"
42
43
#include "GaudiKernel/MsgStream.h"
44
#include "
CaloGeoHelpers/proxim.h
"
45
#include "
CaloGeoHelpers/CaloPhiRange.h
"
46
47
using
xAOD::CaloCluster
;
48
void
CaloClusterUpdate::makeCorrection
(
const
Context& myctx,
49
CaloCluster
* cluster)
const
50
{
51
float
energy=0;
52
float
eta
=0;
53
float
weta=0;
54
55
// set eta to be weighted average of eta1 and eta2
56
ATH_MSG_DEBUG
(
" inBarrel "
<<cluster->
inBarrel
()
57
<<
" inEndcap "
<<cluster->
inEndcap
()) ;
58
59
for
(
int
i=0; i<5; i=i+4 )
60
{
61
62
if
(i==0 && !cluster->
inBarrel
())
continue
;
63
if
(i==4 && !cluster->
inEndcap
())
continue
;
64
65
CaloSampling::CaloSample
sam0 = (
CaloSampling::CaloSample
)(CaloSampling::PreSamplerB+i);
66
CaloSampling::CaloSample
sam1 = (
CaloSampling::CaloSample
)(CaloSampling::PreSamplerB+i+1);
67
CaloSampling::CaloSample
sam2 = (
CaloSampling::CaloSample
)(CaloSampling::PreSamplerB+i+2);
68
CaloSampling::CaloSample
sam3 = (
CaloSampling::CaloSample
)(CaloSampling::PreSamplerB+i+3);
69
70
float
e0 = cluster->
eSample
(sam0);
71
float
e1 = cluster->
eSample
(sam1);
72
float
e2 = cluster->
eSample
(sam2);
73
float
e3 = cluster->
eSample
(sam3);
74
75
// total energy is the sum of each sampling, which had all corrections
76
energy += (e0 + e1 + e2 + e3);
77
78
// do not consider including in the average if both energies are negative
79
if
(e1 <= 0 && e2 <= 0)
continue
;
80
81
// reject weird clusters. Not even sure it can ever happen
82
float
eta2 = cluster->
etaSample
(sam2);
83
if
(cluster->
hasSampling
(sam2) && eta2 == -999.)
continue
;
84
85
float
eta1 = cluster->
etaSample
(sam1);
86
if
(cluster->
hasSampling
(sam1) && eta1 == -999.)
continue
;
87
88
// eta1 has better resolution, so weight it differently
89
float
w1 = e1*
m_w1
;
90
float
w2 = e2;
91
92
// do not include layer if energy is negative
93
if
(e1 <= 0) {
94
w1 = 0;
95
}
96
else
if
(e2 <= 0) {
97
w2 = 0;
98
}
99
100
eta
+= (eta1*w1+eta2*w2) ;
101
weta += w1+w2;
102
}
103
104
//
105
// set them in the cluster.
106
//
107
if
(
eta
!= -999. && weta != 0)
108
eta
=
eta
/weta;
109
else
{
110
ATH_MSG_DEBUG
(
"Weird cluster "
111
" EB1 = "
<< cluster->
eSample
(CaloSampling::EMB1)
112
<<
" etaB1 = "
<< cluster->
etaSample
(CaloSampling::EMB1)
113
<<
" EE1 = "
<< cluster->
eSample
(CaloSampling::EME1)
114
<<
" etaE1 = "
<< cluster->
etaSample
(CaloSampling::EME1)
115
<<
" EB2 = "
<< cluster->
eSample
(CaloSampling::EMB2)
116
<<
" etaB2 = "
<< cluster->
etaSample
(CaloSampling::EMB2)
117
<<
" EE2 = "
<< cluster->
eSample
(CaloSampling::EME2)
118
<<
" etaE2 = "
<< cluster->
etaSample
(CaloSampling::EME2));
119
if
(cluster->
inBarrel
() && !cluster->
inEndcap
())
120
eta
= cluster->
etaSample
(CaloSampling::EMB2);
121
else
if
(cluster->
inEndcap
() && !cluster->
inBarrel
())
122
eta
= cluster->
etaSample
(CaloSampling::EME2);
123
else
{
124
if
(cluster->
eSample
(CaloSampling::EMB2) >
125
cluster->
eSample
(CaloSampling::EME2))
126
eta
= cluster->
etaSample
(CaloSampling::EMB2);
127
else
128
eta
= cluster->
etaSample
(CaloSampling::EME2);
129
}
130
}
131
132
cluster->
setEta
(
eta
);
133
cluster->
setPhi
(cluster->
phiBE
(2));
134
135
if
(
m_update_energy
(myctx))
136
cluster->
setE
(energy);
137
}
138
139
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloClusterUpdate.h
CaloPhiRange.h
CaloPhiRange class declaration.
CaloClusterUpdate::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition
CaloClusterUpdate.cxx:48
CaloClusterUpdate::m_w1
Gaudi::Property< float > m_w1
Definition
CaloClusterUpdate.h:61
CaloClusterUpdate::m_update_energy
Constant< bool > m_update_energy
Definition
CaloClusterUpdate.h:65
CaloCluster
Principal data class for CaloCell clusters.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloCluster::eSample
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:975
CaloCluster::phiBE
double phiBE(int sampling) const
EMB/EMEC combined barycenter .
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:1209
CaloCluster::setEta
virtual void setEta(double eta)
Set eta.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:769
CaloCluster::etaSample
double etaSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:991
CaloCluster::inEndcap
bool inEndcap() const
Returns true if at least one clustered cell in EMEC.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:931
CaloCluster::hasSampling
bool hasSampling(const sampling_type &theSampling) const
Checks if certain sampling contributes to cluster.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:954
CaloCluster::setPhi
virtual void setPhi(double phi)
Set phi.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:771
CaloCluster::inBarrel
bool inBarrel() const
Returns true if at least one clustered cell in EMB.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:926
CaloCluster::setE
virtual void setE(double e)
Set energy.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:767
CaloSampling::CaloSample
CaloSample
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
proxim.h
Generated on
for ATLAS Offline Software by
1.17.0