ATLAS Offline Software
CaloPhiParabola.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 NAME: CaloPhiParabola.cxx
8 PACKAGE: offline/Calorimter/CaloClusterCorrection
9 
10 AUTHORS: Mohamed Aharrouche
11 CREATED: Jan 25, 2006
12 
13 PURPOSE: 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 
23 using xAOD::CaloCluster;
25 
27  CaloCluster* cluster,
28  const CaloDetDescrElement* /*elt*/,
29  float /*eta*/,
30  float /*adj_eta*/,
31  float /*phi*/,
32  float /*adj_phi*/,
33  CaloSampling::CaloSample /*samp*/)
34  const
35 {
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 
45  unsigned int shape[] = {n_samples, 4};
46  CaloRec::WritableArrayData<2> pol2Parm (shape);
47 
48 
49  for(unsigned int i=0;i<n_samples;i++)
50  {
51  pol2Parm[i][0] = energies[i];
52  for(unsigned int j=0;j<3;j++)
53  {
54  pol2Parm[i][j+1] = correction[i][j];
55  }
56  }
57 
58 
59  float energy = cluster->e();
60  for(unsigned int k=0; k<3;k++)
61  {
62  if(energy < energies[0])
63  coefs[k] = pol2Parm[0][k+1];
64  else if(energy > energies[n_samples-1])
65  coefs[k] = pol2Parm[n_samples-1][k+1];
66  else
67  coefs[k] = interpolate (pol2Parm, energy, degree, k+1);
68  }
69 
70  //
71  float phi2 = cluster->phiBE(2);
72 
73  float mod = coefs[0]+coefs[1]*phi2+coefs[2]*phi2*phi2;
74 
75  //
76  setenergy (cluster, cluster->e() / mod);
77 }
78 
79 
CaloCluster::phiBE
double phiBE(int sampling) const
EMB/EMEC combined barycenter .
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:1209
CxxUtils::Array::size
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloClusterCorrection::setenergy
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Definition: CaloClusterCorrection.cxx:94
CaloPhiParabola::m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Definition: CaloPhiParabola.h:50
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.
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
CaloPhiParabola.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloPhiParabola::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: CaloPhiParabola.cxx:26
CxxUtils::Array< 2 >
CxxUtils::WritableArrayData
Definition: Control/CxxUtils/CxxUtils/Array.h:778
CaloCluster
Principal data class for CaloCell clusters.
Definition: Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloPhiParabola::m_degree
Constant< int > m_degree
Definition: CaloPhiParabola.h:52
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
interpolate.h
Polynomial interpolation in a table.
CaloPhiParabola::m_energies
Constant< CxxUtils::Array< 1 > > m_energies
Definition: CaloPhiParabola.h:51
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106
fitman.k
k
Definition: fitman.py:528