ATLAS Offline Software
CaloSwPhioff_v2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
41 #include "CaloSwPhioff_v2.h"
45 #include <cmath>
46 
47 
48 using xAOD::CaloCluster;
50 
51 
73  CaloCluster* cluster,
74  const CaloDetDescrElement* elt,
75  float /*eta*/,
76  float adj_eta,
77  float phi,
78  float /*adj_phi*/,
79  CaloSampling::CaloSample samp) const
80 {
81  // Calculate the correction.
82  float offs = m_correction_coef(myctx) * energy_interpolation
83  (cluster->e(),
84  Builder (m_correction (myctx),
85  m_interp_barriers (myctx),
86  m_degree (myctx),
87  std::abs (adj_eta)),
88  m_energies(myctx),
89  m_energy_degree(myctx));
90 
91  // Flip the sign, if needed.
92  if (m_flip_phi(myctx) && elt->eta_raw() < 0)
93  offs = -offs;
94 
95  // Apply the correction.
96  cluster->setPhi (samp, CaloPhiRange::fix (phi + offs));
97 }
98 
99 
109  const CxxUtils::Array<1>& interp_barriers,
110  int degree,
111  float aeta)
112  : m_correction (correction),
113  m_interp_barriers (interp_barriers),
114  m_degree (degree),
115  m_aeta (aeta)
116 {
117 }
118 
119 
126 float CaloSwPhioff_v2::Builder::calculate (int energy_ndx, bool& good) const
127 {
128  good = true;
129  return interpolate (m_correction[energy_ndx],
130  m_aeta,
131  m_degree,
132  1,
134 }
CaloSwPhioff_v2::makeTheCorrection
virtual void makeTheCorrection(const Context &myctx, xAOD::CaloCluster *cluster, const CaloDetDescrElement *elt, float eta, float adj_eta, float phi, float adj_phi, CaloSampling::CaloSample samp) const override
Virtual function for the correction-specific code.
Definition: CaloSwPhioff_v2.cxx:72
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloSwPhioff_v2::Builder::calculate
virtual float calculate(int energy_ndx, bool &good) const
Calculate the correction for tabulated energy ENERGY_NDX.
Definition: CaloSwPhioff_v2.cxx:126
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloSwPhioff_v2::m_energies
Constant< CxxUtils::Array< 1 > > m_energies
Calibration constant: table of energies at which the correction was tabulated.
Definition: CaloSwPhioff_v2.h:153
CaloSwPhioff_v2::m_energy_degree
Constant< int > m_energy_degree
Calibration constant: degree of the polynomial interpolation in energy.
Definition: CaloSwPhioff_v2.h:157
CaloSwPhioff_v2.h
EM calorimeter phi offset corrections.
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
CaloSwPhioff_v2::Builder
Helper class for calculating the energy interpolation table.
Definition: CaloSwPhioff_v2.h:99
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CxxUtils::Array< 3 >
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloPhiRange.h
CaloPhiRange class declaration.
CaloPhiRange::fix
static double fix(double phi)
Definition: CaloPhiRange.cxx:14
CaloSwPhioff_v2::m_degree
Constant< int > m_degree
Calibration constant: degree of the polynomial interpolation.
Definition: CaloSwPhioff_v2.h:138
CaloSwPhioff_v2::m_correction_coef
Constant< float > m_correction_coef
Calibration constant: coefficient by which to scale the entire correction.
Definition: CaloSwPhioff_v2.h:143
CaloSwPhioff_v2::m_correction
Constant< CaloRec::Array< 3 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Definition: CaloSwPhioff_v2.h:129
ReadBchFromCool.good
good
Definition: ReadBchFromCool.py:433
CaloClusterCorrectionCommon::energy_interpolation
static float energy_interpolation(float energy, const TableBuilder &builder, const CaloRec::Array< 1 > &energies, int energy_degree)
Many of the corrections use the same method for doing the final interpolation in energy.
Definition: CaloClusterCorrectionCommon.cxx:575
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
CaloCluster::e
virtual double e() const
Retrieve energy independent of signal state.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:753
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
CaloSwPhioff_v2::m_flip_phi
Constant< bool > m_flip_phi
Calibration constant: if true, the correction gets an opposite sign if eta < 0.
Definition: CaloSwPhioff_v2.h:148
interpolate.h
Polynomial interpolation in a table.
CaloCluster::setPhi
virtual void setPhi(double phi)
Set phi.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:771
CaloSwPhioff_v2::Builder::Builder
Builder(const CxxUtils::Array< 3 > &correction, const CxxUtils::Array< 1 > &interp_barriers, int degree, float aeta)
Constructor.
Definition: CaloSwPhioff_v2.cxx:108
CaloSwPhioff_v2::m_interp_barriers
Constant< CxxUtils::Array< 1 > > m_interp_barriers
Calibration constant: allow breaking up the interpolation into independent regions.
Definition: CaloSwPhioff_v2.h:134
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106