ATLAS Offline Software
CaloTopoEMphioff.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: CaloTopoEMphioff.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 "CaloTopoEMphioff.h"
21 #include "CLHEP/Units/SystemOfUnits.h"
24 #include <cmath>
25 
26 using CLHEP::GeV;
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 qphioff = 0.;
40  float aeta = fabs(adj_eta);
41  float eclus = cluster->e() * (1./GeV);
42  int iEtaBin = (int)(aeta/m_Granularity(myctx));
43  // compute CaloSampling
45 
46  if (eclus <= 0)
47  return;
48 
49  ATH_MSG_DEBUG( " ... phi-off BEGIN" << endmsg);
50  ATH_MSG_DEBUG( " ... e, eta, phi " << cluster->e() << " " << cluster->eta() << " " << cluster->phi() << " " << samp << endmsg);
51 
52  const CxxUtils::Array<1> EtaFrontier = m_EtaFrontier (myctx);
53 
54  // Compute the correction
55  if (aeta < EtaFrontier[0])
56  {
57  qphioff = m_EdepA(myctx)[iEtaBin]/sqrt(eclus) + m_EdepB(myctx)[iEtaBin];
58  }
59  else if (aeta < EtaFrontier[2])
60  {
61  qphioff = m_EdepA(myctx)[iEtaBin]/eclus + m_EdepB(myctx)[iEtaBin];
62  qphioff = -qphioff;
63  if (aeta > EtaFrontier[1]) qphioff -= m_EndcapOffset(myctx);
64  }
65  else if (aeta < EtaFrontier[3])
66  {
67  qphioff = m_EdepA(myctx)[iEtaBin]*eclus + m_EdepB(myctx)[iEtaBin];
68  qphioff -= m_EndcapOffset(myctx);
69  }
70  else // wrong eta value
71  {
72  return;
73  }
74 
75  // Flip the sign, if needed.
76  if (m_FlipPhi(myctx) && elt->eta_raw() < 0)
77  qphioff = -qphioff;
78 
79  // Print out the function for debugging
80  ATH_MSG_DEBUG( " ... Phi off " << qphioff << " " << adj_eta << " " << eclus << " " << iEtaBin << endmsg);
81 
82  // Apply the correction
83  phi = CaloPhiRange::fix(phi + qphioff);
84  cluster->setPhi(samp,phi);
85 
86  ATH_MSG_DEBUG( " ... phi-off END" << endmsg);
87  ATH_MSG_DEBUG( " ... e, eta, phi " << cluster->e() << " " << cluster->eta() << " " << cluster->phi() << " " << samp << endmsg);
88 }
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloTopoEMphioff::m_Granularity
Constant< float > m_Granularity
Definition: CaloTopoEMphioff.h:60
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloTopoEMphioff.h
CaloTopoEMphioff::m_EtaFrontier
Constant< CxxUtils::Array< 1 > > m_EtaFrontier
Definition: CaloTopoEMphioff.h:58
CaloTopoEMphioff::m_FlipPhi
Constant< int > m_FlipPhi
Definition: CaloTopoEMphioff.h:61
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
CaloTopoEMphioff::m_EdepB
Constant< CxxUtils::Array< 1 > > m_EdepB
Definition: CaloTopoEMphioff.h:57
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
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CxxUtils::Array< 1 >
CaloTopoEMphioff::m_EdepA
Constant< CxxUtils::Array< 1 > > m_EdepA
Definition: CaloTopoEMphioff.h:56
CaloPhiRange.h
CaloPhiRange class declaration.
CaloPhiRange::fix
static double fix(double phi)
Definition: CaloPhiRange.cxx:14
CaloTopoEMphioff::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: CaloTopoEMphioff.cxx:30
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
xAOD::CaloCluster_v1::setPhi
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
Definition: CaloCluster_v1.cxx:556
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
CaloTopoEMphioff::m_EndcapOffset
Constant< float > m_EndcapOffset
Definition: CaloTopoEMphioff.h:62