ATLAS Offline Software
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 
7 NAME: CaloSwEta1b_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 1 as a function of eta
14  (Tuned using 50 GeV Et photons)
15  base class: CaloClusterCorrection
16  Correction tuned on G3 samples.
17 
18 Atrecon Orig: emreco/qeta1b.age
19 
20 Updated: May 10, 2000 (SR, HM)
21  Migrated to Athena Framework from PASO
22 
23 Updated: Jan 5, 2001 (HM)
24  QA.
25 
26 Updated: Feb 28, 2003 (MW)
27  barrel goes only up to eta=1.475, not 1.5
28 
29 Updated: May 5, 2004 (Sven Menke)
30  base class changed from algo to tool
31 
32 Updated: June, 2004 (sss)
33  Use ToolWithConstants to get correction constants.
34 ********************************************************************/
35 #include "CaloSwEta1b_g3.h"
37 #include <cmath>
38 
39 using xAOD::CaloCluster;
41 
42 const 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 
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 
82 const std::string& CaloSwEta1b_g3::toolType() const
83 {
84  static const std::string typeName = "CaloSwEta_g3";
85  return typeName;
86 }
CaloSwEta1b_g3::m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Definition: CaloSwEta1b_g3.h:86
CaloSwEta1b_g3.h
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
CaloSwEta1b_g3::m_interp_degree
Constant< int > m_interp_degree
Definition: CaloSwEta1b_g3.h:89
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
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.
CaloSwEta1b_g3::toolType
virtual const std::string & toolType() const override
Definition: CaloSwEta1b_g3.cxx:82
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloCluster::etaSample
double etaSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:991
CxxUtils::Array< 2 >
CaloSwEta1b_g3::s_strip_granularity
static const float s_strip_granularity
Definition: CaloSwEta1b_g3.h:93
CxxUtils::WritableArrayData
Definition: Control/CxxUtils/CxxUtils/Array.h:778
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloCluster::setEta
virtual void setEta(double eta)
Set eta.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:769
CaloSwEta1b_g3::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition: CaloSwEta1b_g3.cxx:45
CaloSwEta1b_g3::m_correction_bins
Constant< CxxUtils::Array< 1 > > m_correction_bins
Definition: CaloSwEta1b_g3.h:87
CaloSwEta1b_g3::m_correction_coef
Constant< float > m_correction_coef
Definition: CaloSwEta1b_g3.h:90
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
interpolate.h
Polynomial interpolation in a table.
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
CaloSwEta1b_g3::m_correction_degree
Constant< int > m_correction_degree
Definition: CaloSwEta1b_g3.h:88