ATLAS Offline Software
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 
7 NAME: CaloTopoEsshape.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 "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 }
CaloDetDescrElement::deta
float deta() const
cell deta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:356
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
CaloTopoEMsshape::m_P3
Constant< CxxUtils::Array< 1 > > m_P3
Definition: CaloTopoEMsshape.h:50
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloTopoEMsshape::m_P4
Constant< CxxUtils::Array< 1 > > m_P4
Definition: CaloTopoEMsshape.h:51
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloTopoEMsshape::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: CaloTopoEMsshape.cxx:27
CaloTopoEMsshape::m_P0
Constant< CxxUtils::Array< 1 > > m_P0
Definition: CaloTopoEMsshape.h:47
CaloTopoEMsshape::m_EtaFrontier
Constant< CxxUtils::Array< 1 > > m_EtaFrontier
Definition: CaloTopoEMsshape.h:52
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
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 >
CaloPhiRange.h
CaloPhiRange class declaration.
CaloTopoEMsshape::m_Granularity
Constant< float > m_Granularity
Definition: CaloTopoEMsshape.h:53
CaloTopoEMsshape::m_P2
Constant< CxxUtils::Array< 1 > > m_P2
Definition: CaloTopoEMsshape.h:49
CaloTopoEMsshape::m_P1
Constant< CxxUtils::Array< 1 > > m_P1
Definition: CaloTopoEMsshape.h:48
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
xAOD::CaloCluster_v1::setEta
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
Definition: CaloCluster_v1.cxx:541
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
CaloTopoEMsshape.h
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56