ATLAS Offline Software
egammaqweta2c.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include <cmath>
9 
10 namespace {
11 constexpr float P0A[3] = {0.0045, 0.005375, -0.0562};
12 constexpr float P1A[3] = {-0.0016, -0.0215, 0.114};
13 constexpr float P2A[3] = {-0.0866, 0.0215, -0.053};
14 
15 constexpr float P0B[3] = {0.0039, 0.005075, -0.0324};
16 constexpr float P1B[3] = {0.00816, -0.0203, 0.0653};
17 constexpr float P2B[3] = {-0.145, 0.0203, -0.0286};
18 
19 constexpr float P0C[3] = {0.0047, 0.0035, 0.0};
20 constexpr float P1C[3] = {-0.0184, -0.0139, 0.0};
21 constexpr float P2C[3] = {0.0180, 0.0137, 0.0};
22 } // namespace
23 
24 float egammaqweta2c::Correct(const float eta, const float etacell, const float weta2) {
25 
26  const float aeta = fabs(eta);
27  const float etarel = RelPosition(eta, etacell);
28 
29  if (aeta < 0.8) {
30  if (etarel < 0.1) {
31  return (weta2 - (P0A[0] + P1A[0] * etarel + P2A[0] * etarel * etarel));
32  }
33  if (etarel < 0.9) {
34  return (weta2 - (P0A[1] + P1A[1] * etarel + P2A[1] * etarel * etarel));
35  }
36  return (weta2 - (P0A[2] + P1A[2] * etarel + P2A[2] * etarel * etarel));
37  }
38 
39  if (aeta < 1.5) {
40  if (etarel < 0.1) {
41  return (weta2 - (P0B[0] + P1B[0] * etarel + P2B[0] * etarel * etarel));
42  }
43  if (etarel < 0.9) {
44  return (weta2 - (P0B[1] + P1B[1] * etarel + P2B[1] * etarel * etarel));
45  }
46  return (weta2 - (P0B[2] + P1B[2] * etarel + P2B[2] * etarel * etarel));
47  }
48 
49  if (aeta < 1.8) {
50  if (etarel < 0.1) {
51  return (weta2 - (P0B[0] + P1B[0] * etarel + P2B[0] * etarel * etarel));
52  }
53  if (etarel < 0.9) {
54  return (weta2 - (P0B[1] + P1B[1] * etarel + P2B[1] * etarel * etarel));
55  }
56  return (weta2 - (P0B[2] + P1B[2] * etarel + P2B[2] * etarel * etarel));
57  }
58 
59  if (aeta < 2.0) {
60  return (weta2 - (P0C[0] + P1C[0] * etarel + P2C[0] * etarel * etarel));
61  }
62 
63  if (aeta < 2.5) {
64  return (weta2 - (P0C[1] + P1C[1] * etarel + P2C[1] * etarel * etarel));
65  }
66  return weta2;
67 }
68 
69 double egammaqweta2c::RelPosition(float eta, float etacell) {
70 
71  if (eta == -999.)
72  return -999;
73  // position within cell (-cellsize/2 - cellsize/2)
74  const double x = fabs(eta - etacell - 0.025 / 2.);
75  const double g = 0.025;
76  return fmod(x, g) / (double)0.025;
77 }
78 
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
egammaqweta2c.h
x
#define x
CaloCluster.h
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
egammaqweta2c::RelPosition
double RelPosition(const float eta, const float etacell)
returns method within the cell
xAOD::EgammaParameters::weta2
@ weta2
the lateral width is calculated with a window of 3x5 cells using the energy weighted sum over all cel...
Definition: EgammaEnums.h:103
egammaqweta2c::Correct
float Correct(float eta, float etacell, float width)
returns corrected width at eta.