ATLAS Offline Software
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 
7 NAME: CaloSwEta2b_g3.cxx
8 PACKAGE: offline/Calorimeter/CaloClusterCorrection
9 
10 AUTHORS: H. Ma, S. Rajagopalan
11 CREATED: Dec. 15, 1999
12 
13 PURPOSE: 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 
19 Atrecon Orig: emreco/qeta2b.age
20 
21 Updated: May 10, 2000 (SR, HM)
22  Migrated to Athena Framework from PASO
23 
24 Updated: Jan 5, 2001 (HM)
25  QA.
26 
27 Updated: Feb 28, 2003 (MW)
28  barrel goes only up to eta=1.475, not 1.5
29 
30 Updated: May 5, 2004 (Sven Menke)
31  base class changed from algo to tool
32 
33 Updated: June, 2004 (sss)
34  Use ToolWithConstants to get correction constants.
35 ********************************************************************/
36 
37 #include "CaloSwEta2b_g3.h"
39 #include <cmath>
40 
41 using xAOD::CaloCluster;
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 
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 
109 const std::string& CaloSwEta2b_g3::toolType() const
110 {
111  static const std::string typeName = "CaloSwEta_g3";
112  return typeName;
113 }
CaloSwEta2b_g3.h
CaloSwEta2b_g3::m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Definition: CaloSwEta2b_g3.h:88
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
CaloCluster::inBarrel
bool inBarrel() const
Returns true if at least one clustered cell in EMB.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:926
CxxUtils::Array::size
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
CaloSwEta2b_g3::s_middle_layer_granularity
static const float s_middle_layer_granularity
Definition: CaloSwEta2b_g3.h:98
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
CaloSwEta2b_g3::m_residual_coef
Constant< float > m_residual_coef
Definition: CaloSwEta2b_g3.h:95
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloCluster::etaSample
double etaSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:991
CxxUtils::Array< 2 >
CxxUtils::WritableArrayData
Definition: Control/CxxUtils/CxxUtils/Array.h:778
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloSwEta2b_g3::m_correction_coef
Constant< float > m_correction_coef
Definition: CaloSwEta2b_g3.h:94
CaloCluster::setEta
virtual void setEta(double eta)
Set eta.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:769
CaloSwEta2b_g3::toolType
virtual const std::string & toolType() const override
Definition: CaloSwEta2b_g3.cxx:109
CaloSwEta2b_g3::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition: CaloSwEta2b_g3.cxx:49
CaloSwEta2b_g3::m_residual_bins
Constant< CxxUtils::Array< 1 > > m_residual_bins
Definition: CaloSwEta2b_g3.h:90
CaloSwEta2b_g3::m_residual_eval_degree
Constant< int > m_residual_eval_degree
Definition: CaloSwEta2b_g3.h:92
CaloClusterCorr::interpolate
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.
Definition: interpolate.cxx:75
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
CaloSwEta2b_g3::m_correction_degree
Constant< int > m_correction_degree
Definition: CaloSwEta2b_g3.h:91
CaloSwEta2b_g3::m_residuals
Constant< CxxUtils::Array< 2 > > m_residuals
Definition: CaloSwEta2b_g3.h:89
interpolate.h
Polynomial interpolation in a table.
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
CaloSwEta2b_g3::m_residual_degree
Constant< int > m_residual_degree
Definition: CaloSwEta2b_g3.h:93