ATLAS Offline Software
Loading...
Searching...
No Matches
CaloScaleCluster.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
10
11
12#include "CaloScaleCluster.h"
14#include <cmath>
15
16
19
20
42 CaloCluster* cluster,
43 const CaloDetDescrElement* /*elt*/,
44 float /*eta*/,
45 float adj_eta,
46 float /*phi*/,
47 float /*adj_phi*/,
49 const
50{
51 const CxxUtils::Array<2> correction = m_correction (myctx);
52 if (correction.size() == 0) {
53 ATH_MSG_ERROR("Empty correction array");
54 return;
55 }
56
57 float adj_aeta = std::abs (adj_eta);
58 float fac;
59 if (std::abs (adj_eta) > m_etamax (myctx)) {
60 fac = correction[correction.size()-1][1];
61 }
62 else {
63 // The rfac-v5 tables contain a couple spurious zeros
64 // (from empty bins)? If we don't do anything, this correction will blow
65 // up in the immediate vicinity of those points. Work around by replacing
66 // the zeros with an average of the adjacent points, by setting
67 // fixZero=true in the interpolate call.
68 fac = interpolate (correction, adj_aeta, m_degree (myctx),
69 1, CaloRec::Array<1>(), -1,
70 /*fixZero=*/ true);
71 }
72 cluster->setE (cluster->e() / fac);
73}
#define ATH_MSG_ERROR(x)
Scale cluster energy by an eta-dependent factor.
Principal data class for CaloCell clusters.
virtual double e() const
Retrieve energy independent of signal state.
virtual void setE(double e)
Set energy.
This class groups all DetDescr information related to a CaloCell.
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Constant< float > m_etamax
Calibration constant: maximum eta for which this correction is defined.
Constant< int > m_degree
Calibration constant: degree of the polynomial interpolation.
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.
Read-only multidimensional array.
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.