ATLAS Offline Software
CaloSwPhimod_g3.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: CaloSwPhimod_g3.cxx
8 PACKAGE: offline/Calorimeter/CaloClusterCorrection
9 
10 AUTHORS: H. Ma, S. Rajagopalan
11 CREATED: Dec. 15, 1999
12 
13 PURPOSE: correction for the modulations with the position in phi
14  (Tuned using 50 GeV Et photons)
15  base class: CaloClusterCorrection
16  Correction tuned on G3 samples.
17 
18 Atrecon Orig: emreco/qphimod.F
19 
20 Updated: May 10, 2000 (SR, HM)
21  Migrated to Athena Framework from PASO
22 
23 Updated: Jan 5, 2001 (HM)
24  QA.
25 
26 Updated: May 5, 2004 (Sven Menke)
27  base class changed from algo to tool
28 
29 Updated: June, 2004 (sss)
30  Use ToolWithConstants to get correction constants.
31 ********************************************************************/
32 #include "CaloSwPhimod_g3.h"
33 #include <cmath>
34 
35 
36 
37 // make correction to one cluster
39  xAOD::CaloCluster* cluster) const
40 {
41 
42  float eta2 = cluster->etaBE(2); // use second sampling
43  float phi2 = cluster->phiBE(2); // use the average over Bar and EC.
44  if (eta2 < -900 || phi2 < -900)
45  return;
46 
47  float aeta2 = fabs(eta2);
48  float nabs;
49  if (aeta2 < 1.5)
50  nabs = 1024;
51  else if (aeta2 < 2.5)
52  nabs = 768;
53  else
54  nabs = 256.;
55 
56  std::vector<float> tab = qphmop (myctx, aeta2);
57  assert (tab.size() == 5);
58  float qphimod =
59  tab[0] +
60  tab[1] * cos(nabs*phi2) +
61  tab[2] * cos(2.*nabs*phi2)+
62  tab[3] * cos(3.*nabs*phi2)+
63  tab[4] * sin(nabs*phi2);
64 
65  // set energy, and rescale each sampling
66  setenergy(cluster, qphimod * cluster->e());
67 
68 
69 }
70 
71 std::vector<float> CaloSwPhimod_g3::qphmop (const Context& myctx,
72  float aeta) const
73 {
75 
76  std::vector<float> coef (correction.size(1)-1);
77 
78  int i1 = 0;
79  int i2 = 0;
80  if (aeta < correction[0][0]) {
81  for (unsigned int j = 1; j < correction.size(1); j++)
82  coef[j-1] = correction[0][j];
83  return coef;
84  }
85 
86  else if (aeta >= correction[0][0]) {
87  for (unsigned int i = 0; i < correction.size()-1; i++) {
88  if (aeta >= correction[i][0] && aeta < correction[i+1][0]) {
89  i1 = i;
90  i2 = i+1;
91  break;
92  }
93  }
94  }
95  if (i1 == i2) {
96  i2 = correction.size()-1;
97  i1 = i2-1;
98  }
99 
100  float deta = correction[i2][0] - correction[i1][0];
101  if (deta == 0)
102  deta = 1;
103 
104  float m = (aeta - correction[i1][0]) / deta;
105  for (unsigned int j = 1; j < correction.size(1); j++) {
106  float dy = correction[i2][j] - correction[i1][j];
107  coef[j-1] = (correction[i1][j] + dy * m);
108  }
109 
110  return coef;
111 }
112 
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
CaloClusterCorrection::setenergy
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Definition: CaloClusterCorrection.cxx:94
xAOD::CaloCluster_v1::phiBE
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:680
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:644
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
lumiFormat.i
int i
Definition: lumiFormat.py:85
CxxUtils::Array< 2 >
CaloSwPhimod_g3::m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Definition: CaloSwPhimod_g3.h:83
CaloSwPhimod_g3::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition: CaloSwPhimod_g3.cxx:38
CaloSwPhimod_g3.h
CaloSwPhimod_g3::qphmop
std::vector< float > qphmop(const Context &myctx, float eta) const
Definition: CaloSwPhimod_g3.cxx:71
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
CaloUtils::ToolConstantsContext
Context object for retrieving ToolConstant values.
Definition: ToolWithConstants.h:61
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
WriteCalibToCool.coef
coef
Definition: WriteCalibToCool.py:582