ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
EgammaSshapeCalibration::Builder Class Reference
Inheritance diagram for EgammaSshapeCalibration::Builder:
Collaboration diagram for EgammaSshapeCalibration::Builder:

Public Member Functions

 Builder (const EgammaSshapeCalibration &, double, double, int)
 Constructor. More...
 
virtual float calculate (int energy_ndx, bool &good) const
 Calculate the correction for tabulated energy ENERGY_NDX. More...
 

Private Member Functions

float calc0 (float, float, const CaloRec::Array< 2 > &) const
 
float calc3 (float, float, const CaloRec::Array< 2 > &) const
 
float calc4 (float, float, const CaloRec::Array< 2 > &) const
 
float calc5 (float, float, const CaloRec::Array< 2 > &) const
 
float calc10 (float, float, const CaloRec::Array< 2 > &) const
 
float calc11 (float, float, const CaloRec::Array< 2 > &) const
 

Private Attributes

const EgammaSshapeCalibrationm_corr
 
double m_aeta
 
double m_u
 
int m_region_ndx
 
int m_form
 

Detailed Description

Definition at line 50 of file EgammaSshapeCalibration.h.

Constructor & Destructor Documentation

◆ Builder()

EgammaSshapeCalibration::Builder::Builder ( const EgammaSshapeCalibration corr,
double  aeta,
double  u,
int  region_ndx 
)

Constructor.

Gets the parent correction object, the abs(eta) at which the correction is being evaluated (in cal-local coordinates), the fractional cell offset u, and the index of the region for this correction.

Definition at line 234 of file EgammaSshapeCalibration.cxx.

238  : m_corr(corr),
239  m_aeta(aeta),
240  m_u(u),
241  m_region_ndx(region_ndx),
242  m_form (m_corr.m_regions()[region_ndx][REG_FORM])
243 { }

Member Function Documentation

◆ calc0()

float EgammaSshapeCalibration::Builder::calc0 ( float  aeta,
float  u,
const CaloRec::Array< 2 > &  coef 
) const
private

Definition at line 301 of file EgammaSshapeCalibration.cxx.

304 {
305  const unsigned int NPAR = 5;
306  double pars[NPAR];
307 
308  unsigned int degree = coef.size(1);
309  for (unsigned int i=0; i < NPAR; i++) {
310  CaloRec::Array<1> xcoef = coef[i];
311  double out = xcoef[0];
312  for (unsigned int j=1; j<degree; j++)
313  out = out * aeta + xcoef[j];
314  pars[i] = out;
315  }
316 
317  double c = (u>=0) ? pars[2] : pars[3];
318  return pars[0] * (std::atan (pars[1] * u) + c*u + pars[4]);
319 }

◆ calc10()

float EgammaSshapeCalibration::Builder::calc10 ( float  aeta,
float  u,
const CaloRec::Array< 2 > &  coef 
) const
private

Definition at line 399 of file EgammaSshapeCalibration.cxx.

402 {
403  const unsigned int NPAR = 7;
404  double pars[NPAR];
405 
406  unsigned int degree = coef.size(1);
407  for (unsigned int i=0; i < NPAR; i++) {
408  CaloRec::Array<1> xcoef = coef[i];
409  double out = xcoef[0];
410  for (unsigned int j=1; j<degree; j++)
411  out = out * aeta + xcoef[j];
412  pars[i] = out;
413  }
414 
415  double c = pars[2];
416  if (u < 0)
417  c = -c - 2*std::atan(pars[1]);
418 
419  double offs = pars[0] * (atan (pars[1] * u) + c*u + pars[3]) +
420  pars[4] * std::cos (u * pars[5] * M_PI + pars[6]);
421  if (u > 0.9 || u < -0.9) {
422  double xdiff = pars[4] * (std::cos (pars[5] * M_PI + pars[6]) -
423  std::cos (- pars[5] * M_PI + pars[6]));
424  if (u > 0.9)
425  offs -= (u-0.9)/0.1 * xdiff/2;
426  else
427  offs += (-0.9-u)/0.1 * xdiff/2;
428  }
429  return offs;
430 }

◆ calc11()

float EgammaSshapeCalibration::Builder::calc11 ( float  aeta,
float  u,
const CaloRec::Array< 2 > &  coef 
) const
private

Definition at line 435 of file EgammaSshapeCalibration.cxx.

438 {
439  const unsigned int NPAR = 8;
440  double pars[NPAR];
441 
442  unsigned int degree = coef.size(1);
443  for (unsigned int i=0; i < NPAR; i++) {
444  CaloRec::Array<1> xcoef = coef[i];
445  double out = xcoef[0];
446  for (unsigned int j=1; j<degree; j++)
447  out = out * aeta + xcoef[j];
448  pars[i] = out;
449  }
450 
451  double c = (u>=0) ? pars[2] : pars[3];
452  return pars[0] * (std::atan (pars[1] * u) + c*u + pars[4])
453  + pars[5] * std::cos (u * pars[6] * M_PI + pars[7]);
454 }

◆ calc3()

float EgammaSshapeCalibration::Builder::calc3 ( float  aeta,
float  u,
const CaloRec::Array< 2 > &  coef 
) const
private

Definition at line 324 of file EgammaSshapeCalibration.cxx.

327 {
328  const unsigned int NPAR = 4;
329  double pars[NPAR];
330 
331  unsigned int degree = coef.size(1);
332  for (unsigned int i=0; i < NPAR; i++) {
333  CaloRec::Array<1> xcoef = coef[i];
334  double out = xcoef[0];
335  for (unsigned int j=1; j<degree; j++)
336  out = out * aeta + xcoef[j];
337  pars[i] = out;
338  }
339 
340  double c = pars[2];
341  if (u < 0)
342  c = -c - 2*std::atan(pars[1]);
343  return pars[0] * (std::atan (pars[1] * u) + c*u + pars[3]);
344 }

◆ calc4()

float EgammaSshapeCalibration::Builder::calc4 ( float  aeta,
float  u,
const CaloRec::Array< 2 > &  coef 
) const
private

Definition at line 349 of file EgammaSshapeCalibration.cxx.

352 {
353  const unsigned int NPAR = 3;
354  double pars[NPAR];
355 
356  unsigned int degree = coef.size(1);
357  for (unsigned int i=0; i < NPAR; i++) {
358  CaloRec::Array<1> xcoef = coef[i];
359  double out = xcoef[0];
360  for (unsigned int j=1; j<degree; j++)
361  out = out * aeta + xcoef[j];
362  pars[i] = out;
363  }
364 
365  double b = std::max ((double)pars[1], 1e-5);
366  double atanb = std::atan(b);
367  double sq = std::sqrt (b/atanb - 1);
368  double den = (sq/b*atanb - std::atan(sq));
369  return pars[0]* ((- std::atan (b*u) + u*atanb) / den +
370  pars[2]*(1-std::abs(u)));
371 }

◆ calc5()

float EgammaSshapeCalibration::Builder::calc5 ( float  aeta,
float  ,
const CaloRec::Array< 2 > &  coef 
) const
private

Definition at line 376 of file EgammaSshapeCalibration.cxx.

379 {
380  const unsigned int NPAR = 1;
381  double pars[NPAR];
382 
383  // poly_eval (aeta, coef, NPAR, pars);
384  unsigned int degree = coef.size(1);
385  for (unsigned int i=0; i < NPAR; i++) {
386  CaloRec::Array<1> xcoef = coef[i];
387  double out = xcoef[0];
388  for (unsigned int j=1; j<degree; j++)
389  out = out * aeta + xcoef[j];
390  pars[i] = out;
391  }
392 
393  return pars[0];
394 }

◆ calculate()

float EgammaSshapeCalibration::Builder::calculate ( int  energy_ndx,
bool &  good 
) const
virtual

Calculate the correction for tabulated energy ENERGY_NDX.

Implements CaloClusterCorrectionCommon::TableBuilder.

Definition at line 248 of file EgammaSshapeCalibration.cxx.

249  {
250 
251  // Find the proper array of coefficients.
253 
254  // If we don't have coefficients for this energy/region, skip it.
255  if(coef[0].end()[-1]==0) {
256  good = false;
257  return 0;
258  }
259 
260  // Which functional form to use?
261  int form;
263  if (forms.size(0) != 0 && forms.size(1) != 0)
264  form = forms[m_region_ndx][energy_ndx];
265  else
266  form = m_form;
267 
268 
269  // Evaluate the correction!
270  good = true;
271  float ret = 0;
272  switch (form) {
273  case 0:
274  ret = calc0 (m_aeta, m_u, coef);
275  break;
276  case 3:
277  ret = calc3 (m_aeta, m_u, coef);
278  break;
279  case 4:
280  ret = calc4 (m_aeta, m_u, coef);
281  break;
282  case 5:
283  ret = calc5 (m_aeta, m_u, coef);
284  break;
285  case 10:
286  ret = calc10 (m_aeta, m_u, coef);
287  break;
288  case 11:
289  ret = calc11 (m_aeta, m_u, coef);
290  break;
291  default:
292  abort();
293  }
294 
295  return ret;
296 }

Member Data Documentation

◆ m_aeta

double EgammaSshapeCalibration::Builder::m_aeta
private

Definition at line 72 of file EgammaSshapeCalibration.h.

◆ m_corr

const EgammaSshapeCalibration& EgammaSshapeCalibration::Builder::m_corr
private

Definition at line 71 of file EgammaSshapeCalibration.h.

◆ m_form

int EgammaSshapeCalibration::Builder::m_form
private

Definition at line 75 of file EgammaSshapeCalibration.h.

◆ m_region_ndx

int EgammaSshapeCalibration::Builder::m_region_ndx
private

Definition at line 74 of file EgammaSshapeCalibration.h.

◆ m_u

double EgammaSshapeCalibration::Builder::m_u
private

Definition at line 73 of file EgammaSshapeCalibration.h.


The documentation for this class was generated from the following files:
EgammaSshapeCalibration::Builder::calc0
float calc0(float, float, const CaloRec::Array< 2 > &) const
Definition: EgammaSshapeCalibration.cxx:301
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
EgammaSshapeCalibration::Builder::calc11
float calc11(float, float, const CaloRec::Array< 2 > &) const
Definition: EgammaSshapeCalibration.cxx:435
max
#define max(a, b)
Definition: cfImp.cxx:41
EgammaSshapeCalibration::Builder::m_corr
const EgammaSshapeCalibration & m_corr
Definition: EgammaSshapeCalibration.h:71
CxxUtils::Array::size
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
EgammaSshapeCalibration::Builder::calc3
float calc3(float, float, const CaloRec::Array< 2 > &) const
Definition: EgammaSshapeCalibration.cxx:324
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
M_PI
#define M_PI
Definition: ActiveFraction.h:11
EgammaSshapeCalibration::Builder::calc5
float calc5(float, float, const CaloRec::Array< 2 > &) const
Definition: EgammaSshapeCalibration.cxx:376
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
EgammaSshapeCalibration::Builder::calc10
float calc10(float, float, const CaloRec::Array< 2 > &) const
Definition: EgammaSshapeCalibration.cxx:399
EgammaSshapeCalibration::m_correction
Constant< CxxUtils::Array< 4 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Definition: EgammaSshapeCalibration.h:90
lumiFormat.i
int i
Definition: lumiFormat.py:92
ret
T ret(T t)
Definition: rootspy.cxx:260
EgammaSshapeCalibration::m_forms
Constant< CxxUtils::Array< 2 > > m_forms
Calibration constant: Functional form to use per region per energy.
Definition: EgammaSshapeCalibration.h:122
sq
#define sq(x)
Definition: CurvedSegmentFinder.cxx:6
CxxUtils::Array
Read-only multidimensional array.
Definition: Control/CxxUtils/CxxUtils/Array.h:138
EgammaSshapeCalibration::Builder::m_u
double m_u
Definition: EgammaSshapeCalibration.h:73
EgammaSshapeCalibration::m_regions
Constant< CxxUtils::Array< 2 > > m_regions
Calibration constant: table of regions.
Definition: EgammaSshapeCalibration.h:102
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
ReadBchFromCool.good
good
Definition: ReadBchFromCool.py:433
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
EgammaSshapeCalibration::Builder::m_region_ndx
int m_region_ndx
Definition: EgammaSshapeCalibration.h:74
EgammaSshapeCalibration::Builder::m_form
int m_form
Definition: EgammaSshapeCalibration.h:75
EgammaSshapeCalibration::REG_FORM
@ REG_FORM
Definition: EgammaSshapeCalibration.h:106
EgammaSshapeCalibration::Builder::m_aeta
double m_aeta
Definition: EgammaSshapeCalibration.h:72
python.compressB64.c
def c
Definition: compressB64.py:93
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106
WriteCalibToCool.coef
coef
Definition: WriteCalibToCool.py:582
EgammaSshapeCalibration::Builder::calc4
float calc4(float, float, const CaloRec::Array< 2 > &) const
Definition: EgammaSshapeCalibration.cxx:349