ATLAS Offline Software
Loading...
Searching...
No Matches
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
7NAME: CaloTopoEMphioff.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 "CaloTopoEMphioff.h"
21#include "CLHEP/Units/SystemOfUnits.h"
24#include <cmath>
25
26using 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}
Scalar phi() const
phi method
#define endmsg
#define ATH_MSG_DEBUG(x)
Definition of CaloDetDescrManager.
CaloPhiRange class declaration.
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
static double fix(double phi)
Constant< CxxUtils::Array< 1 > > m_EdepA
Constant< float > m_EndcapOffset
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
Constant< CxxUtils::Array< 1 > > m_EdepB
Constant< CxxUtils::Array< 1 > > m_EtaFrontier
Constant< int > m_FlipPhi
Constant< float > m_Granularity
Read-only multidimensional array.
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
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.