ATLAS Offline Software
Loading...
Searching...
No Matches
CaloTopoEMLongWeights.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: CaloTopoEMLongWeights.cxx
8PACKAGE: offline/Calorimter/CaloSwLongWeights
9
10AUTHORS: N. Kerschen
11CREATED: Nov 8, 2006
12
13PURPOSE: Longitudinal weights for topoEM cluster (thresholds:633)
14
15********************************************************************/
18
19
22
23
45 (const Context& myctx,
46 CaloCluster* cluster,
47 const CaloDetDescrElement* /*elt*/,
48 float eta,
49 float adj_eta,
50 float /*phi*/,
51 float /*adj_phi*/,
52 CaloSampling::CaloSample /*samp*/) const
53{
54 // ??? In principle, we should use adj_eta for the interpolation
55 // and range checks. However, the v2 corrections were derived
56 // using regular eta instead.
57 float the_aeta;
58 if (m_use_raw_eta(myctx))
59 the_aeta = std::abs (adj_eta);
60 else
61 the_aeta = std::abs (eta);
62
63 const float etamax = m_etamax (myctx);
64 if (the_aeta >= etamax) return;
65
66 const float eta_start_crack = m_eta_start_crack (myctx);
67 const float eta_end_crack = m_eta_end_crack (myctx);
68
69 int si;
70 if (the_aeta < eta_start_crack)
71 si = 0;
72 else if (the_aeta > eta_end_crack)
73 si = 1;
74 else {
75 // No corrections are applied for the crack region.
76 return;
77 }
78
79 const CxxUtils::Array<2> correction = m_correction (myctx);
80
81 unsigned int shape[] = {2};
82 CaloRec::WritableArrayData<1> interp_barriers (shape);
83 interp_barriers[0] = eta_start_crack;
84 interp_barriers[1] = eta_end_crack;
85
86 float pars[6];
87 int ibin = static_cast<int> (the_aeta / etamax * correction.size());
88 pars[0] = correction[ibin][1];
89 pars[1] = correction[ibin][2];
90 pars[2] = correction[ibin][3];
91 pars[3] = correction[ibin][4];
92 pars[4] = correction[ibin][5];
93 pars[5] = correction[ibin][6];
94
95 // for (int i=0; i<6; i++)
96 // pars[i] = interpolate (correction,
97 // the_aeta,
98 // degree,
99 // i+1,
100 // interp_barriers);
101
102 static const
103 CaloSampling::CaloSample samps[2][4] = {
104 { CaloSampling::PreSamplerB,
105 CaloSampling::EMB1,
106 CaloSampling::EMB2,
107 CaloSampling::EMB3 },
108 { CaloSampling::PreSamplerE,
109 CaloSampling::EME1,
110 CaloSampling::EME2,
111 CaloSampling::EME3 }
112 };
113
114 float b = 0;
115 if (pars[0] != 0) {
116 float a = cluster->e()*exp(-pars[4])/pars[0];
117 if (a>1) b = pars[0]*log(a) + pars[0];
118 }
119
120 cluster->setEnergy (samps[si][0], cluster->eSample (samps[si][0]) * pars[1]);
121 cluster->setEnergy (samps[si][3], cluster->eSample (samps[si][3]) * pars[2]);
122
123 double total = 0;
124 for (int sampling=0; sampling<4; ++sampling)
125 total += cluster->eSample (samps[si][sampling]);
126
127 cluster->setE (pars[3] * (b + pars[5] + total));
128}
129
130
Scalar eta() const
pseudorapidity method
static Double_t a
Principal data class for CaloCell clusters.
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
virtual double e() const
Retrieve energy independent of signal state.
virtual void setE(double e)
Set energy.
This class groups all DetDescr information related to a CaloCell.
Constant< float > m_eta_start_crack
Constant< CxxUtils::Array< 2 > > m_correction
Constant< float > m_eta_end_crack
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.
Read-only multidimensional array.
Polynomial interpolation in a table.
float interpolate(const CaloRec::Array< 2 > &a, float x, unsigned int degree, unsigned int ycol=1, const CaloRec::Array< 1 > &regions=CaloRec::Array< 1 >(), int n_points=-1, bool fixZero=false)
Polynomial interpolation in a table.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.