ATLAS Offline Software
Loading...
Searching...
No Matches
EgammaSshapeCalibration::Builder Class Reference
Inheritance diagram for EgammaSshapeCalibration::Builder:
Collaboration diagram for EgammaSshapeCalibration::Builder:

Public Member Functions

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

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.

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}
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77

◆ 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}
#define M_PI

◆ 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}
#define sq(x)

◆ 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.
252 CaloRec::Array<2> coef = m_corr.m_correction()[energy_ndx][m_region_ndx];
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;
262 CxxUtils::Array<2> forms = m_corr.m_forms();
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}
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
float calc4(float, float, const CaloRec::Array< 2 > &) const
float calc0(float, float, const CaloRec::Array< 2 > &) const
float calc11(float, float, const CaloRec::Array< 2 > &) const
float calc10(float, float, const CaloRec::Array< 2 > &) const
float calc5(float, float, const CaloRec::Array< 2 > &) const
float calc3(float, float, const CaloRec::Array< 2 > &) const

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: