ATLAS Offline Software
CaloSwEta2e_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: CaloSwEta2e_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 endcap EM calorimeter.
15  (Tuned using 100 GeV E photons)
16  base class: CaloClusterCorrection
17  Correction tuned on G3 samples.
18 
19 Updated: Feb 11, 2003 (MW)
20  new correction for DC1 data
21 Updated: Feb 28, 2003 (MW)
22  protect against unphysical clusters
23 
24 Updated: May 5, 2004 (Sven Menke)
25  base class changed from algo to tool
26 
27 Updated: June, 2004 (sss)
28  Use ToolWithConstants to get correction constants.
29 ********************************************************************/
30 
31 #include "CaloSwEta2e_g3.h"
33 #include <cmath>
34 
35 using xAOD::CaloCluster;
37 
38 // granularity of middle EM barrel layer
39 
41 
42 
43 // make correction to one cluster
45  CaloCluster* cluster) const
46 {
47  // Only for endcap
48  if (!cluster->inEndcap())
49  return;
50 
51  float eta = cluster->etaSample(CaloSampling::EME2);
52  if (eta == -999.) return;
53  float etamax = cluster->etamax(CaloSampling::EME2);
54  float aeta = fabs(eta);
55 
56  // peak around center of cell (+=0.0125)
57  float u2 = fmod(eta-etamax,s_middle_layer_granularity/2.);
59  // be careful with negative eta values, position correction is not symmetric.
60  if (eta < 0.) u2 = s_middle_layer_granularity-u2;
61 
62  // First order (average) S-shape correction
63  float etc2 = aeta - interpolate (m_correction(myctx),
64  u2,
65  m_correction_degree(myctx));
66 
67  if (eta < 0.)
68  etc2 = -etc2;
69 
70  // make correction to second sampling
71  cluster->setEta( CaloSampling::EME2, etc2);
72 }
73 
74 
75 const std::string& CaloSwEta2e_g3::toolType() const
76 {
77  static const std::string typeName = "CaloSwEta_g3";
78  return typeName;
79 }
CaloSwEta2e_g3::m_correction_degree
Constant< int > m_correction_degree
Definition: CaloSwEta2e_g3.h:79
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
CaloCluster::inEndcap
bool inEndcap() const
Returns true if at least one clustered cell in EMEC.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:931
CaloSwEta2e_g3::m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Definition: CaloSwEta2e_g3.h:78
CaloCluster::etaSample
double etaSample(sampling_type sampling) const
Retrieve barycenter in a given sample.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:991
CaloSwEta2e_g3::s_middle_layer_granularity
static const float s_middle_layer_granularity
Definition: CaloSwEta2e_g3.h:82
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
CaloSwEta2e_g3::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition: CaloSwEta2e_g3.cxx:44
CaloSwEta2e_g3::toolType
virtual const std::string & toolType() const override
Definition: CaloSwEta2e_g3.cxx:75
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
CaloCluster::etamax
double etamax(sampling_type sampling) const
Retrieve of cell with maximum energy in given sampling.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:1112
interpolate.h
Polynomial interpolation in a table.
CaloSwEta2e_g3.h
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56