ATLAS Offline Software
Loading...
Searching...
No Matches
CaloPhiParabola.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: CaloPhiParabola.cxx
8PACKAGE: offline/Calorimter/CaloClusterCorrection
9
10AUTHORS: Mohamed Aharrouche
11CREATED: Jan 25, 2006
12
13PURPOSE: corrects for the parabolic behavior in the E vs Phi curve
14
15********************************************************************/
16#include "CaloPhiParabola.h"
19#include "CLHEP/Units/PhysicalConstants.h"
20#include <cmath>
21
22
25
27 CaloCluster* cluster,
28 const CaloDetDescrElement* /*elt*/,
29 float /*eta*/,
30 float /*adj_eta*/,
31 float /*phi*/,
32 float /*adj_phi*/,
34 const
35{
36 const CxxUtils::Array<2> correction = m_correction (myctx);
37 const CxxUtils::Array<1> energies = m_energies (myctx);
38 const int degree = m_degree (myctx);
39
40 //
41 float coefs[3];
42
43 unsigned int n_samples = energies.size();
44 if (n_samples == 0) {
45 ATH_MSG_ERROR("Empty energies vector");
46 return;
47 }
48
49 unsigned int shape[] = {n_samples, 4};
50 CaloRec::WritableArrayData<2> pol2Parm (shape);
51
52
53 for(unsigned int i=0;i<n_samples;i++)
54 {
55 pol2Parm[i][0] = energies[i];
56 for(unsigned int j=0;j<3;j++)
57 {
58 pol2Parm[i][j+1] = correction[i][j];
59 }
60 }
61
62
63 float energy = cluster->e();
64 for(unsigned int k=0; k<3;k++)
65 {
66 if(energy < energies[0])
67 coefs[k] = pol2Parm[0][k+1];
68 else if(energy > energies[n_samples-1])
69 coefs[k] = pol2Parm[n_samples-1][k+1];
70 else
71 coefs[k] = interpolate (pol2Parm, energy, degree, k+1);
72 }
73
74 //
75 float phi2 = cluster->phiBE(2);
76
77 float mod = coefs[0]+coefs[1]*phi2+coefs[2]*phi2*phi2;
78
79 //
80 setenergy (cluster, cluster->e() / mod);
81}
82
83
#define ATH_MSG_ERROR(x)
Definition of CaloDetDescrManager.
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Principal data class for CaloCell clusters.
virtual double e() const
Retrieve energy independent of signal state.
double phiBE(int sampling) const
EMB/EMEC combined barycenter .
This class groups all DetDescr information related to a CaloCell.
Constant< CxxUtils::Array< 2 > > m_correction
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
Constant< int > m_degree
Constant< CxxUtils::Array< 1 > > m_energies
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.