ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSwEta2b_g3.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: CaloSwEta2b_g3.cxx
8PACKAGE: offline/Calorimeter/CaloClusterCorrection
9
10AUTHORS: H. Ma, S. Rajagopalan
11CREATED: Dec. 15, 1999
12
13PURPOSE: S-shape corrections in sampling 2 as a function of eta
14 for barrel EM calorimeter.
15 (Tuned using 50 GeV Et photons)
16 base class: CaloClusterCorrection
17 Correction tuned on G3 samples.
18
19Atrecon Orig: emreco/qeta2b.age
20
21Updated: May 10, 2000 (SR, HM)
22 Migrated to Athena Framework from PASO
23
24Updated: Jan 5, 2001 (HM)
25 QA.
26
27Updated: Feb 28, 2003 (MW)
28 barrel goes only up to eta=1.475, not 1.5
29
30Updated: May 5, 2004 (Sven Menke)
31 base class changed from algo to tool
32
33Updated: June, 2004 (sss)
34 Use ToolWithConstants to get correction constants.
35********************************************************************/
36
37#include "CaloSwEta2b_g3.h"
39#include <cmath>
40
43
44// granularity of middle EM barrel layer
45
47
48
50 CaloCluster* cluster) const
51{
52 // Only for barrel
53 if (!cluster->inBarrel())
54 return;
55
56 const CxxUtils::Array<2> correction = m_correction (myctx);
57 const CxxUtils::Array<2> residuals = m_residuals (myctx);
58 const CxxUtils::Array<1> residual_bins = m_residual_bins (myctx);
59 const int correction_degree = m_correction_degree(myctx);
60 const int residual_eval_degree = m_residual_eval_degree(myctx);
61 const int residual_degree = m_residual_degree(myctx);
62 const float correction_coef = m_correction_coef(myctx);
63 const float residual_coef = m_residual_coef(myctx);
64
65 assert (residuals.size(1)-1 == residual_bins.size());
66
67 // eta of second sampling
68 float eta = cluster->etaSample(CaloSampling::EMB2);
69 if (eta == -999.) return;
70 float aeta = fabs(eta);
71
72 // u2 is the distance to the inner edge of the cell (granularity 0.025)
73 float u2 = fmod(aeta,s_middle_layer_granularity) ;
74
75 // First order (average) S-shape correction
76 float deta = correction_coef * interpolate (correction,
77 u2,
78 correction_degree);
79
80 // Residual S-shape correction: six ranges in eta from 0 to 1.2
81 // Evaluated by 2nd order interpolation between 10 tabulated values
82
83 // first we evaluate our residual in each eta range, given u2
84
85 unsigned int shape[] = {residual_bins.size(), 2};
87
88 for (unsigned int i=0; i < residual_bins.size(); i++) {
89 w[i][0] = residual_bins[i];
90 w[i][1] = interpolate (residuals,
91 u2,
92 residual_eval_degree,
93 i+1);
94 }
95
96 // finally we interpolate (2nd order) for the actual eta
97
98 deta += residual_coef * interpolate (w,
99 aeta,
100 residual_degree);
101 if (eta < 0)
102 deta = -deta;
103
104 // make correction to second sampling
105 cluster->setEta(CaloSampling::EMB2, eta - deta);
106}
107
108
109const std::string& CaloSwEta2b_g3::toolType() const
110{
111 static const std::string typeName = "CaloSwEta_g3";
112 return typeName;
113}
Scalar eta() const
pseudorapidity method
Principal data class for CaloCell clusters.
virtual void setEta(double eta)
Set eta.
double etaSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
bool inBarrel() const
Returns true if at least one clustered cell in EMB.
Constant< float > m_residual_coef
Constant< int > m_residual_eval_degree
Constant< CxxUtils::Array< 2 > > m_correction
Constant< int > m_residual_degree
Constant< CxxUtils::Array< 1 > > m_residual_bins
virtual const std::string & toolType() const override
Return the name of the type of this tool.
static const float s_middle_layer_granularity
Constant< int > m_correction_degree
Constant< float > m_correction_coef
Constant< CxxUtils::Array< 2 > > m_residuals
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Read-only multidimensional array.
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
Polynomial interpolation in a table.
float interpolate(const CaloRec::Array< 2 > &a, float x, unsigned int degree, unsigned int ycol=1, const CaloRec::Array< 1 > &regions=CaloRec::Array< 1 >(), int n_points=-1, bool fixZero=false)
Polynomial interpolation in a table.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.