ATLAS Offline Software
CaloSwApplyWgts_g3.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: CaloSwApplyWgts_g3.cxx
8 PACKAGE: offline/Calorimeter/CaloClusterCorrection
9 
10 AUTHORS: J. McDonald
11 CREATED: Feb. 3, 2003
12 
13 PURPOSE: Optimization correction for the weights in the
14  different layers. The weights are tuned on
15  photons @ E = 100 GeV with fixed vertex
16  base class: CaloClusterCorrection
17  Tuned on DC1 data.
18 
19 Updated: May 5, 2004 (Sven Menke)
20  base class changed from algo to tool
21 
22 
23 
24 ********************************************************************/
25 #include "CaloSwApplyWgts_g3.h"
26 
27 
28 // correction constants Leonardo Carminati
29 // For eta < 1.35 and eta > 1.6, the weights are
30 // presampler, strips, middle section and back
31 // his global calibration should be applied to CaloSWApplyWgts
32 // 1.35 < n < 1.6 w_presampler (EC+barrel), Weight for the
33 // strips + middle + back barrel, Weight for the scintillator,
34 // W_ec (strips + middle + back) endcap
35 
36 /* This is the table for the different weights....
37 there are four different bins in the eta region...
38 ----------------------------------------------
39 Bin# | Eta < 1.35 | 1.35<eta<1.6 | eta > 1.6
40 ----------------------------------------------
41  0 | Presampler | Presampler | Presampler
42 ----------------------------------------------
43  1 | Strip | Strips/Middle| Strips
44  | | Back Barrel |
45 ----------------------------------------------
46  2 | Middle | Scintillator | Middle
47 ----------------------------------------------
48  3 | Back | Strips/Middle| Back
49  | | Back Endcap |
50 ----------------------------------------------
51 */
52 
53 using xAOD::CaloCluster;
54 const float CaloSwApplyWgts_g3::m_table_eta[s_numEtaBins+1]
55 = {0.000000, 0.025000, 0.050000, 0.075000, 0.100000, 0.125000,
56  0.150000, 0.175000, 0.200000, 0.225000, 0.250000, 0.275000,
57  0.300000, 0.325000, 0.350000, 0.375000, 0.400000, 0.425000,
58  0.450000, 0.475000, 0.500000, 0.525000, 0.550000, 0.575000,
59  0.600000, 0.625000, 0.650000, 0.675000, 0.700000, 0.725000,
60  0.750000, 0.775000, 0.800000, 0.825000, 0.850000, 0.875000,
61  0.900000, 0.925000, 0.950000, 0.975000, 1.000000, 1.025000,
62  1.050000, 1.075000, 1.100000, 1.125000, 1.150000, 1.175000,
63  1.200000, 1.225000, 1.250000, 1.275000, 1.300000, 1.325000,
64  1.350000, 1.375000, 1.400000, 1.425000, 1.450000, 1.475000,
65  1.500000, 1.525000, 1.550000, 1.575000, 1.600000, 1.625000,
66  1.650000, 1.675000, 1.700000, 1.725000, 1.750000, 1.775000,
67  1.800000, 1.825000, 1.850000, 1.875000, 1.900000, 1.925000,
68  1.950000, 1.975000, 2.000000, 2.025000, 2.050000, 2.075000,
69  2.100000, 2.125000, 2.150000, 2.175000, 2.200000, 2.225000,
70  2.250000, 2.275000, 2.300000, 2.325000, 2.350000, 2.375000,
71  2.400000, 2.425000, 2.450000, 2.475000, 2.500000};
72 const float CaloSwApplyWgts_g3::m_table_p[4][s_numEtaBins] = {
73  {
74  2.159336, 2.159365, 2.159426, 2.159524, 2.185450, 1.784150,
75  1.468300, 1.577280, 2.357230, 2.143870, 2.429050, 2.128170,
76  1.711000, 2.063040, 2.188510, 2.285910, 2.375140, 2.358500,
77  1.631560, 2.199280, 1.992240, 2.426500, 2.317250, 2.492310,
78  2.537180, 2.754830, 2.606900, 2.742630, 2.821300, 2.660760,
79  3.231350, 4.261270, 4.440460, 4.739960, 3.802220, 3.971200,
80  3.873020, 3.780380, 3.719170, 3.674910, 3.645370, 3.638160,
81  3.656870, 3.648160, 3.543830, 3.654490, 3.692520, 3.761490,
82  3.697630, 3.649310, 3.771020, 3.640650, 3.558510, 3.404140,
83  3.773840, 3.981200, 3.855140, 3.960490, 3.914110, 3.698370,
84  1.955760, 1.784920, 1.980230, 2.489000, 6.006220, 6.913410,
85  6.518250, 6.634570, 6.406190, 5.479100, 4.903650, 4.953980,
86  0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
87  0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
88  0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
89  0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
90  0.000000, 0.000000, 0.000000, 0.000000
91  },
92  {
93  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
94  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
95  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
96  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
97  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
98  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
99  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
100  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
101  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
102  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
103  0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000,
104  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
105  1.088920, 1.090670, 1.080880, 1.058810, 1.041350, 1.040150,
106  1.024850, 1.027870, 1.008870, 1.013690, 1.010470, 0.997779,
107  1.011620, 1.010720, 1.018570, 0.995325, 0.998770, 0.991472,
108  1.012050, 1.022670, 1.047580, 1.033470, 1.009190, 1.030510,
109  1.036582, 1.040966, 1.045282, 1.049457
110  },
111  {
112 
113  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
114  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
115  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
116  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
117  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
118  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
119  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
120  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
121  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
122  0.300938, 0.295500, 0.257021, 0.285664, 0.279562, 0.243856,
123  0.119355, 0.116621, 0.113299, 0.079486, 1.000000, 1.000000,
124  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
125  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
126  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
127  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
128  1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
129  1.000000, 1.000000, 1.000000, 1.000000
130  },
131  {
132  3.293558, 3.287675, 3.281793, 3.275910, 3.122819, 2.996900,
133  2.985870, 2.954540, 3.194080, 3.272640, 3.433830, 3.002840,
134  3.228300, 3.456140, 3.335890, 3.152420, 3.574670, 2.849230,
135  2.002860, 2.182840, 1.954540, 1.986730, 1.908350, 1.657820,
136  1.623290, 1.662690, 1.510320, 1.375820, 1.419890, 1.220120,
137  0.662087, 0.782405, 0.755827, 2.191330, 1.790190, 1.771680,
138  1.814130, 1.391820, 1.303030, 1.242170, 1.168910, 1.255750,
139  1.038260, 1.120300, 1.074110, 0.993337, 1.040780, 0.977912,
140  0.984398, 0.982676, 0.931838, 1.082950, 1.049780, 0.225949,
141  5.383710, 3.584280, 3.070560, 2.479340, 2.305020, 2.148400,
142  1.000000, 1.000000, 1.000000, 1.000000, 1.310010, 1.264220,
143  1.388090, 1.183090, 1.415110, 1.267950, 1.224720, 1.299080,
144  1.433390, 1.361880, 1.460400, 1.464050, 1.275200, 1.449930,
145  1.321960, 1.281420, 1.228370, 1.230360, 1.147990, 1.136030,
146  1.144620, 1.159600, 1.285750, 1.118030, 1.120420, 1.119130,
147  1.091780, 1.247480, 1.327550, 1.106430, 1.099030, 1.150530,
148  1.085429, 1.069589, 1.053206, 1.036276
149  }
150 };
151 
152 // make correction to one cluster
154  CaloCluster* cluster) const
155 {
156 
157 
158 
159  float eta2 = cluster->etaBE(2); // use second sampling
160 
161  float aeta2 = fabs(eta2);
162 
163  // samplings 0-3 are for the barrel, 4-7 are the endcap
164 
165  for (int sampling=0; sampling<8; ++sampling){
166 
169 
170  if (cluster->hasSampling (sam)) {
171 
172  // double myene = cluster->energy(sampling);
173  // FIXME: Why doesn't passing sam to eSample work here?
174  double e = cluster->eSample(sam)*GetWgt(sampling,aeta2);
175  cluster->setEnergy(sam,e);
176  }
177  }
178 
179 }
180 
181 float CaloSwApplyWgts_g3::GetWgt(int layer, float aeta)
182 {
183  if (aeta < m_table_eta[0] || aeta > m_table_eta[s_numEtaBins])
184  return m_table_p[layer%4][0];
185  else {
186  for (int i = 0; i < s_numEtaBins; ++i)
187  {
188  // Check Eta range and do interpolation
189 
190  if (aeta >= m_table_eta[i] && aeta < m_table_eta[i+1])
191  {
192  if ( aeta < 1.35 || aeta > 1.6 ) {
193  return m_table_p[layer%4][i] ;
194  }
195  else {
196  if ( layer%4 ==0 ) {
197  return m_table_p[0][i]; // presampler EC + Barrel
198  }
199  else {
200  if ( layer>0 && layer < 4) {
201  return m_table_p[1][i]; // Weights strips+mid+back barrel
202  }
203  else
204  return m_table_p[3][i]; // Weights endcap strips + back +barrel
205  }
206  }
207  }
208  }
209  }
210 
211  return m_table_p[0][0] ;
212 }
213 
214 
215 
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
CaloSwApplyWgts_g3.h
CaloCluster::eSample
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:975
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
CaloCluster::hasSampling
bool hasSampling(const sampling_type &theSampling) const
Checks if certain sampling contributes to cluster.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:954
CaloSwApplyWgts_g3::m_table_eta
static const float m_table_eta[s_numEtaBins+1]
Definition: CaloSwApplyWgts_g3.h:58
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
CaloSwApplyWgts_g3::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition: CaloSwApplyWgts_g3.cxx:153
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloSwApplyWgts_g3::s_numEtaBins
static const int s_numEtaBins
Definition: CaloSwApplyWgts_g3.h:56
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloCluster::etaBE
double etaBE(int sampling) const
EMB/EMEC combined barycenter .
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:1199
CaloSwApplyWgts_g3::m_table_p
static const float m_table_p[4][s_numEtaBins]
Definition: CaloSwApplyWgts_g3.h:59
CaloSwApplyWgts_g3::GetWgt
static float GetWgt(int table, float eta)
Definition: CaloSwApplyWgts_g3.cxx:181
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61