ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTopoEMphimod.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: CaloTopoEMphimod.cxx
8PACKAGE: offline/Calorimeter/CaloClusterCorrection
9
10AUTHORS: M.Boonekamp & N.Kerschen
11CREATED: March 2005
12
13PURPOSE: correction for the phi offset due to accordion structure
14 base class: CaloClusterCorrection (Algorithm)
15
16Updated: March 12, 2005 (MB)
17 corrections for the TopoCluster
18********************************************************************/
19
20#include "CaloTopoEMphimod.h"
21#include "CLHEP/Units/PhysicalConstants.h"
24#include <cmath>
25#include <numbers>
26
27using std::numbers::pi;
28
29
30// make correction to one cluster
31void CaloTopoEMphimod::makeTheCorrection(const Context& myctx,
32 xAOD::CaloCluster* cluster,
33 const CaloDetDescrElement* elt,
34 float /*eta*/,
35 float adj_eta,
36 float phi,
37 float /*adj_phi*/,
38 CaloSampling::CaloSample /*samp*/) const
39{
40 float qphimod = 0.;
41 float aeta = fabs(adj_eta);
42 int iEtaBin;
43 // u is the normalized coordinate along phi (within a cell)
44 // 0 < u < 1
45 float u = (phi - elt->phi()) / elt->dphi() + 0.5;
46
47 ATH_MSG_DEBUG( " ... phi-mod BEGIN" << endmsg);
48 ATH_MSG_DEBUG( " ... e, eta, phi " << cluster->e() << " " << cluster->eta() << " " << cluster->phi() << " " << endmsg);
49
50 const CxxUtils::Array<1> EtaFrontier = m_EtaFrontier (myctx);
51
52 // Compute the correction
53 if (aeta < EtaFrontier[0])
54 {
55 iEtaBin = (int)(aeta / m_BarrelGranularity(myctx));
56 qphimod = 1 - m_P1b(myctx)[iEtaBin]*std::cos(8*pi*u)
57 - m_P2b(myctx)[iEtaBin]*std::cos(16*pi*u)
58 - m_P3b(myctx)[iEtaBin]*std::sin(8*pi*u)
59 - m_P4b(myctx)[iEtaBin]*std::sin(16*pi*u);
60 }
61 else if (aeta > EtaFrontier[1] && aeta < EtaFrontier[2])
62 {
63 iEtaBin = (int)((aeta - EtaFrontier[1]) / m_EndcapGranularity(myctx));
64 qphimod = 1 - m_P1e(myctx)[iEtaBin]*std::cos(6*pi*u)
65 - m_P2e(myctx)[iEtaBin]*std::cos(12*pi*u)
66 - m_P3e(myctx)[iEtaBin]*std::sin(6*pi*u)
67 - m_P4e(myctx)[iEtaBin]*std::sin(12*pi*u);
68 }
69 else // wrong eta value
70 {
71 return;
72 }
73
74 // Print out the function for debugging
75 ATH_MSG_DEBUG( " ... Phi mod " << qphimod << " " << u << " " << phi << " " << elt->phi()
76 << " " << adj_eta << " " << aeta << " " << iEtaBin << endmsg);
77
78 // Apply the correction
79 setenergy (cluster, cluster->e() * qphimod);
80
81 ATH_MSG_DEBUG( " ... phi-mod END" << endmsg);
82 ATH_MSG_DEBUG( " ... e, eta, phi " << cluster->e() << " " << cluster->eta() << " " << cluster->phi() << " " << endmsg);
83}
Scalar phi() const
phi method
#define endmsg
#define ATH_MSG_DEBUG(x)
Definition of CaloDetDescrManager.
CaloPhiRange class declaration.
#define pi
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
This class groups all DetDescr information related to a CaloCell.
Constant< CxxUtils::Array< 1 > > m_P3b
Constant< CxxUtils::Array< 1 > > m_P2e
Constant< CxxUtils::Array< 1 > > m_P1e
Constant< CxxUtils::Array< 1 > > m_P2b
Constant< CxxUtils::Array< 1 > > m_P4b
Constant< float > m_EndcapGranularity
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
Virtual function for the correction-specific code.
Constant< CxxUtils::Array< 1 > > m_P4e
Constant< CxxUtils::Array< 1 > > m_P3e
Constant< float > m_BarrelGranularity
Constant< CxxUtils::Array< 1 > > m_P1b
Constant< CxxUtils::Array< 1 > > m_EtaFrontier
Read-only multidimensional array.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.