50 float u = (
eta - elt->
eta()) / elt->
deta() * 2;
65 float adj_aeta = std::abs (adj_eta);
77 u = fmod (adj_aeta, cellsize) / cellsize * 2 - 1;
109 unsigned int nreg =
regions.size();
110 for (
unsigned int i=0; i < nreg; i++) {
158 if (coef[0].end()[-1] == 0) {
200 for (
unsigned int i=0; i < reg_n; i++) {
216 if (fabs(ret) > 0.025) {
235void poly_eval (
float aeta,
240 assert (npar <= coef.size(0));
243 unsigned int degree = coef.size(1);
246 for (
unsigned int i=0; i < npar; i++) {
251 double out = xcoef[0];
252 for (
unsigned int j = 1; j < degree; j++)
253 out = out * aeta + xcoef[j];
272 const unsigned int NPAR = 5;
274 poly_eval (aeta, coef, NPAR, pars);
275 double c = (u>=0) ? pars[2] : pars[3];
276 return pars[0] * (std::atan (pars[1] * u) + c*u + pars[4]);
290 const unsigned int NPAR = 4;
292 poly_eval (aeta, coef, NPAR, pars);
295 c = -c - 2*std::atan(pars[1]);
296 return pars[0] * (std::atan (pars[1] * u) + c*u + pars[3]);
310 const unsigned int NPAR = 3;
312 poly_eval (aeta, coef, NPAR, pars);
313 double b = std::max ((
double)pars[1], 1e-5);
314 double atanb = std::atan(b);
315 double sq = std::sqrt (b/atanb - 1);
316 double den = (
sq/b*atanb - std::atan(
sq));
317 return pars[0]* ((- std::atan (b*u) + u*atanb) / den +
318 pars[2]*(1-std::abs(u)));
332 const unsigned int NPAR = 1;
334 poly_eval (aeta, coef, NPAR, pars);
349 const unsigned int NPAR = 7;
351 poly_eval (aeta, coef, NPAR, pars);
354 c = -c - 2*std::atan(pars[1]);
356 double offs = pars[0] * (atan (pars[1] * u) + c*u + pars[3]) +
357 pars[4] * std::cos (u * pars[5] *
M_PI + pars[6]);
358 if (u > 0.9 || u < -0.9) {
359 double xdiff = pars[4] * (std::cos (pars[5] *
M_PI + pars[6]) -
360 std::cos (- pars[5] *
M_PI + pars[6]));
362 offs -= (u-0.9)*(1./0.1) * xdiff/2;
364 offs += (-0.9-u)*(1./0.1) * xdiff/2;
380 const unsigned int NPAR = 8;
382 poly_eval (aeta, coef, NPAR, pars);
383 double c = (u>=0) ? pars[2] : pars[3];
384 return pars[0] * (std::atan (pars[1] * u) + c*u + pars[4])
385 + pars[5] * std::cos (u * pars[6] *
M_PI + pars[7]);
401 const unsigned int NPAR = 1;
403 float x = (aeta - xlo) / (xhi - xlo) ;
404 poly_eval (
x, coef, NPAR, pars);
Scalar eta() const
pseudorapidity method
Definition of CaloDetDescrManager.
EM calorimeter eta offset (S-shape) corrections, version 3.
static const std::vector< std::string > regions
static float energy_interpolation(float energy, const TableBuilder &builder, const CaloRec::Array< 1 > &energies, int energy_degree)
Many of the corrections use the same method for doing the final interpolation in energy.
This class groups all DetDescr information related to a CaloCell.
float eta_raw() const
cell eta_raw
float eta() const
cell eta
float deta() const
cell deta
int m_form
The index of the functional form we're evaluating.
const CxxUtils::Array< 2 > & m_forms
Functional form per region.
static float calc10(float aeta, float u, const CaloRec::Array< 2 > &coef)
Evaluate the function Form 10.
static float calc0(float aeta, float u, const CaloRec::Array< 2 > &coef)
Evaluate the function Form 0.
float m_u
The fractional offset in the cell of this cluster.
Builder(const CxxUtils::Array< 4 > &correction, const CxxUtils::Array< 2 > ®ions, const CxxUtils::Array< 2 > &forms, float aeta, float u, int region_ndx)
Constructor.
const CxxUtils::Array< 2 > & m_regions
Table of regions.
static float calc4(float aeta, float u, const CaloRec::Array< 2 > &coef)
Evaluate the function Form 4.
float m_aeta
The abs(eta) at which the correction is being evaluated (in cal-local coordinates).
static float calc11(float aeta, float u, const CaloRec::Array< 2 > &coef)
Evaluate the function Form 11.
static float calc3(float aeta, float u, const CaloRec::Array< 2 > &coef)
Evaluate the function Form 3.
int m_region_ndx
The index of the region in which we're evaluating the correction.
const CxxUtils::Array< 4 > & m_correction
virtual float calculate(int energy_ndx, bool &good) const
Calculate the correction for tabulated energy ENERGY_NDX.
static float calc13(float aeta, float u, const CaloRec::Array< 2 > &coef, float xlo, float xhi)
Evaluate the function Form 13.
static float calc5(float aeta, float u, const CaloRec::Array< 2 > &coef)
Evaluate the function Form 5.
static int find_region(const CxxUtils::Array< 2 > ®ions, float aeta)
Find the index of the region containing a given value.
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.
Constant< CxxUtils::Array< 4 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Constant< CxxUtils::Array< 2 > > m_forms
Calibration constant: Functional form to use per region per energy.
Constant< CxxUtils::Array< 2 > > m_regions
Calibration constant: table of regions.
Constant< CxxUtils::Array< 1 > > m_energies
Calibration constant: table of energies at which the correction was tabulated.
Constant< int > m_energy_degree
Calibration constant: degree of the polynomial interpolation in energy.
Read-only multidimensional array.
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.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.