32 float the_eta = std::abs (
eta);
33 if (the_eta >=
m_etamax (myctx))
return;
36 bool inBarrel =
false;
47 float energy = cluster->
e();
53 int etaIndex = (int) (the_eta * (1./0.025));
56 unsigned int n_samples = energies.
size();
62 unsigned int shape[] = {n_samples, 6};
66 for(
unsigned int i=0;i<n_samples;i++)
68 vectParm[i][0] = energies[i];
69 for(
unsigned int j=0;j<5;j++)
71 vectParm[i][j+1] = correction[i][etaIndex][j+1];
75 for(
unsigned int k=0; k<5;k++)
77 if(energy < energies[0])
78 coefs[k] = vectParm[0][k+1];
79 else if(energy > energies[n_samples-1])
80 coefs[k] = vectParm[n_samples-1][k+1];
82 coefs[k] = interpolate (vectParm, energy, degree, k+1);
88 static const Samplingmap LBarrel = { CaloSampling::PreSamplerB,
89 CaloSampling::EMB1, CaloSampling::EMB2, CaloSampling::EMB3 };
90 static const Samplingmap LEndcap = { CaloSampling::PreSamplerE,
91 CaloSampling::EME1, CaloSampling::EME2, CaloSampling::EME3 };
92 const Samplingmap& L = inBarrel ? LBarrel : LEndcap;
98 Egap=coefs[3]*std::sqrt(cluster->
eSample(L[0])*cluster->
eSample(L[1]));
101 cluster->setEnergy ( L[0],cluster->
eSample(L[0])*coefs[0]);
103 float Eleak = cluster->
eSample(L[3])*coefs[1];
107 for (
int iSample=1; iSample < 4 ; ++iSample)
109 Erec += cluster->
eSample (L[iSample]);
113 cluster->
setE (coefs[4]*Erec + cluster->
eSample (L[0]) + Eleak + coefs[2]+ Egap);
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 override
Virtual function for the correction-specific code.
float interpolate(const CaloRec::Array< 2 > &a, float x, unsigned int degree, unsigned int ycol=1, const CaloRec::Array< 1 > ®ions=CaloRec::Array< 1 >(), int n_points=-1, bool fixZero=false)
Polynomial interpolation in a table.