ATLAS Offline Software
Loading...
Searching...
No Matches
CaloSwEta1b_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: CaloSwEta1b_g3.cxx
8PACKAGE: offline/Calorimeter/CaloClusterCorrection
9
10AUTHORS: H. Ma, S. Rajagopalan
11CREATED: Dec. 15, 1999
12
13PURPOSE: S-shape corrections in sampling 1 as a function of eta
14 (Tuned using 50 GeV Et photons)
15 base class: CaloClusterCorrection
16 Correction tuned on G3 samples.
17
18Atrecon Orig: emreco/qeta1b.age
19
20Updated: May 10, 2000 (SR, HM)
21 Migrated to Athena Framework from PASO
22
23Updated: Jan 5, 2001 (HM)
24 QA.
25
26Updated: Feb 28, 2003 (MW)
27 barrel goes only up to eta=1.475, not 1.5
28
29Updated: May 5, 2004 (Sven Menke)
30 base class changed from algo to tool
31
32Updated: June, 2004 (sss)
33 Use ToolWithConstants to get correction constants.
34********************************************************************/
35#include "CaloSwEta1b_g3.h"
37#include <cmath>
38
41
42const float CaloSwEta1b_g3::s_strip_granularity = 0.003125; // 0.025/8
43
44// make correction to one cluster.
46 CaloCluster* lar_cluster) const
47{
48 // Only for barrel
49 if (!lar_cluster->inBarrel())
50 return;
51
52 const CxxUtils::Array<2> correction = m_correction(myctx);
53 const CxxUtils::Array<1> correction_bins = m_correction_bins(myctx);
54 const int correction_degree = m_correction_degree(myctx);
55 assert (correction.size(1)-1 == correction_bins.size());
56
57 float eta = lar_cluster->etaSample(CaloSampling::EMB1);
58 if (eta == -999.) return;
59 float aeta = fabs(eta);
60 float u1 = fmod(aeta,s_strip_granularity);
61
62 // we evaluate the s-shape in each eta range
63
64 unsigned int shape[] = {correction_bins.size(), 2};
66
67 for (unsigned int i=0; i<correction_bins.size(); i++) {
68 w[i][0] = correction_bins[i];
69 w[i][1] = interpolate (correction, u1, correction_degree, i+1);
70 };
71
72 // finally we interpolate for the actual eta2
73 float deta = m_correction_coef(myctx) * interpolate (w, aeta, m_interp_degree(myctx));
74 if (eta < 0)
75 deta = -deta;
76
77 // Make the correction
78 lar_cluster->setEta( CaloSampling::EMB1, eta - deta);
79}
80
81
82const std::string& CaloSwEta1b_g3::toolType() const
83{
84 static const std::string typeName = "CaloSwEta_g3";
85 return typeName;
86}
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< CxxUtils::Array< 1 > > m_correction_bins
static const float s_strip_granularity
virtual const std::string & toolType() const override
Return the name of the type of this tool.
Constant< int > m_correction_degree
Constant< int > m_interp_degree
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Constant< float > m_correction_coef
Constant< CxxUtils::Array< 2 > > m_correction
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.