ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTopoEMsshape.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: CaloTopoEsshape.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 "CaloTopoEMsshape.h"
22#include "GaudiKernel/MsgStream.h"
23#include <cmath>
24
25
26// make correction to one cluster
28 xAOD::CaloCluster* cluster,
29 const CaloDetDescrElement* elt,
30 float eta,
31 float adj_eta,
32 float /*phi*/,
33 float /*adj_phi*/,
34 CaloSampling::CaloSample /*samp*/) const
35{
36 float qsshape = 0.;
37 float aeta = fabs(adj_eta);
38 int iEtaBin = (int)(aeta/m_Granularity(myctx));
39 // u is the normalized coordinate along eta (within a cell)
40 // -0.5 < u < 0.5
41 float u = (eta - elt->eta()) / elt->deta();
42 if (elt->eta_raw() < 0) u = -u;
43 if (u > 0.5) u = 0.5;
44 else if (u < -0.5) u = -0.5;
45 // compute CaloSampling
47
48 ATH_MSG_DEBUG( " ... s-shapes BEGIN ; u = " << u << " " << eta << " " << adj_eta << " " << elt->eta() << " " << elt->deta() << endmsg);
49 ATH_MSG_DEBUG( " ... e, eta, phi " << cluster->e() << " " << cluster->eta() << " " << cluster->phi() << " " << samp << endmsg);
50
51 const CxxUtils::Array<1> EtaFrontier = m_EtaFrontier (myctx);
52
53 // Compute the correction
54 if (aeta < EtaFrontier[0] || (aeta > EtaFrontier[1] && aeta < EtaFrontier[2]))
55 {
56 if (samp == CaloSampling::EMB2 || samp == CaloSampling::EME2)
57 {
58 qsshape = m_P0(myctx)[iEtaBin]*0.01*std::atan(m_P1(myctx)[iEtaBin]*u)
59 + m_P2(myctx)[iEtaBin]*0.01*u + m_P3(myctx)[iEtaBin]*1e-3*fabs(u)
60 + m_P4(myctx)[iEtaBin]*1e-3;
61 }
62 else // wrong samp value
63 {
64 return;
65 }
66 }
67 else // wrong eta value
68 {
69 return;
70 }
71
72 // Print out the function for debugging
73 ATH_MSG_DEBUG( " ... S shape " << qsshape << " " << u << " " << eta << " " << elt->eta()
74 << " " << adj_eta << " " << aeta << " " << iEtaBin << " " << samp << endmsg);
75
76 // Apply the correction
77 // ... there was a sign mistake here
79 if (eta > 0) qsshape = -qsshape;
80 cluster->setEta(samp, eta + qsshape);
81
82 ATH_MSG_DEBUG( " ... s-shapes END" << endmsg);
83 ATH_MSG_DEBUG( " ... e, eta, phi " << cluster->e() << " " << cluster->eta() << " " << cluster->phi() << " " << samp << endmsg);
84}
Scalar eta() const
pseudorapidity method
#define endmsg
#define ATH_MSG_DEBUG(x)
CaloPhiRange class declaration.
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
Constant< CxxUtils::Array< 1 > > m_EtaFrontier
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< float > m_Granularity
Constant< CxxUtils::Array< 1 > > m_P4
Constant< CxxUtils::Array< 1 > > m_P2
Constant< CxxUtils::Array< 1 > > m_P3
Constant< CxxUtils::Array< 1 > > m_P0
Constant< CxxUtils::Array< 1 > > m_P1
Read-only multidimensional array.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
virtual double phi() const
The azimuthal angle ( ) of the particle.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.