ATLAS Offline Software
CaloTopoEMphimod.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: CaloTopoEMphimod.cxx
8 PACKAGE: offline/Calorimeter/CaloClusterCorrection
9 
10 AUTHORS: M.Boonekamp & N.Kerschen
11 CREATED: March 2005
12 
13 PURPOSE: correction for the phi offset due to accordion structure
14  base class: CaloClusterCorrection (Algorithm)
15 
16 Updated: 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 
26 using CLHEP::pi;
27 
28 
29 // make correction to one cluster
31  xAOD::CaloCluster* cluster,
32  const CaloDetDescrElement* elt,
33  float /*eta*/,
34  float adj_eta,
35  float phi,
36  float /*adj_phi*/,
37  CaloSampling::CaloSample /*samp*/) const
38 {
39  float qphimod = 0.;
40  float aeta = fabs(adj_eta);
41  int iEtaBin;
42  // u is the normalized coordinate along phi (within a cell)
43  // 0 < u < 1
44  float u = (phi - elt->phi()) / elt->dphi() + 0.5;
45 
46  ATH_MSG_DEBUG( " ... phi-mod BEGIN" << endmsg);
47  ATH_MSG_DEBUG( " ... e, eta, phi " << cluster->e() << " " << cluster->eta() << " " << cluster->phi() << " " << endmsg);
48 
49  const CxxUtils::Array<1> EtaFrontier = m_EtaFrontier (myctx);
50 
51  // Compute the correction
52  if (aeta < EtaFrontier[0])
53  {
54  iEtaBin = (int)(aeta / m_BarrelGranularity(myctx));
55  qphimod = 1 - m_P1b(myctx)[iEtaBin]*std::cos(8*pi*u)
56  - m_P2b(myctx)[iEtaBin]*std::cos(16*pi*u)
57  - m_P3b(myctx)[iEtaBin]*std::sin(8*pi*u)
58  - m_P4b(myctx)[iEtaBin]*std::sin(16*pi*u);
59  }
60  else if (aeta > EtaFrontier[1] && aeta < EtaFrontier[2])
61  {
62  iEtaBin = (int)((aeta - EtaFrontier[1]) / m_EndcapGranularity(myctx));
63  qphimod = 1 - m_P1e(myctx)[iEtaBin]*std::cos(6*pi*u)
64  - m_P2e(myctx)[iEtaBin]*std::cos(12*pi*u)
65  - m_P3e(myctx)[iEtaBin]*std::sin(6*pi*u)
66  - m_P4e(myctx)[iEtaBin]*std::sin(12*pi*u);
67  }
68  else // wrong eta value
69  {
70  return;
71  }
72 
73  // Print out the function for debugging
74  ATH_MSG_DEBUG( " ... Phi mod " << qphimod << " " << u << " " << phi << " " << elt->phi()
75  << " " << adj_eta << " " << aeta << " " << iEtaBin << endmsg);
76 
77  // Apply the correction
78  setenergy (cluster, cluster->e() * qphimod);
79 
80  ATH_MSG_DEBUG( " ... phi-mod END" << endmsg);
81  ATH_MSG_DEBUG( " ... e, eta, phi " << cluster->e() << " " << cluster->eta() << " " << cluster->phi() << " " << endmsg);
82 }
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
CaloTopoEMphimod::m_EndcapGranularity
Constant< float > m_EndcapGranularity
Definition: CaloTopoEMphimod.h:60
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloTopoEMphimod::m_P3e
Constant< CxxUtils::Array< 1 > > m_P3e
Definition: CaloTopoEMphimod.h:56
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
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
CaloTopoEMphimod::m_P3b
Constant< CxxUtils::Array< 1 > > m_P3b
Definition: CaloTopoEMphimod.h:52
CaloTopoEMphimod::m_P2b
Constant< CxxUtils::Array< 1 > > m_P2b
Definition: CaloTopoEMphimod.h:51
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
CaloTopoEMphimod::m_P2e
Constant< CxxUtils::Array< 1 > > m_P2e
Definition: CaloTopoEMphimod.h:55
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
pi
#define pi
Definition: TileMuonFitter.cxx:65
CaloTopoEMphimod::m_P1b
Constant< CxxUtils::Array< 1 > > m_P1b
Definition: CaloTopoEMphimod.h:50
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloTopoEMphimod::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
Virtual function for the correction-specific code.
Definition: CaloTopoEMphimod.cxx:30
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CxxUtils::Array< 1 >
CaloTopoEMphimod::m_BarrelGranularity
Constant< float > m_BarrelGranularity
Definition: CaloTopoEMphimod.h:59
CaloPhiRange.h
CaloPhiRange class declaration.
CaloTopoEMphimod::m_P1e
Constant< CxxUtils::Array< 1 > > m_P1e
Definition: CaloTopoEMphimod.h:54
CaloDetDescrElement::dphi
float dphi() const
cell dphi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:358
CaloTopoEMphimod.h
CaloTopoEMphimod::m_EtaFrontier
Constant< CxxUtils::Array< 1 > > m_EtaFrontier
Definition: CaloTopoEMphimod.h:58
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
CaloTopoEMphimod::m_P4b
Constant< CxxUtils::Array< 1 > > m_P4b
Definition: CaloTopoEMphimod.h:53
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
CaloTopoEMphimod::m_P4e
Constant< CxxUtils::Array< 1 > > m_P4e
Definition: CaloTopoEMphimod.h:57