CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalSiPMnonlinearity Class Reference

#include <HcalSiPMnonlinearity.h>

Public Member Functions

int getPixelsFired (int inpes) const
 
double getRecoCorrectionFactor (double inpixelsfired) const
 
 HcalSiPMnonlinearity (const std::vector< float > &pars)
 

Private Attributes

double a2
 
double b1
 
double c0
 

Detailed Description

Definition at line 7 of file HcalSiPMnonlinearity.h.

Constructor & Destructor Documentation

◆ HcalSiPMnonlinearity()

HcalSiPMnonlinearity::HcalSiPMnonlinearity ( const std::vector< float > &  pars)
inline

Definition at line 9 of file HcalSiPMnonlinearity.h.

References a2, cms::cuda::assert(), b1, and c0.

9  {
10  assert(pars.size() == 3);
11  c0 = (double)pars[0];
12  b1 = (double)pars[1];
13  a2 = (double)pars[2];
14  }
assert(be >=bs)

Member Function Documentation

◆ getPixelsFired()

int HcalSiPMnonlinearity::getPixelsFired ( int  inpes) const

Definition at line 9 of file HcalSiPMnonlinearity.cc.

References a, a2, cms::cuda::assert(), b, b1, HltBtagPostValidation_cff::c, c0, mps_fire::i, createfilelist::int, w(), and z.

9  {
10  gsl_complex z[3];
11  double w = -inpes;
12  // normalize params
13  double a = a2 / w;
14  double b = b1 / w;
15  double c = c0 / w;
16  int nroots = gsl_poly_complex_solve_cubic(a, b, c, &z[1], &z[2], &z[3]);
17  assert(nroots);
18 
19  // all use cases tested over the full range of anticipated values;
20  // the first root is always the right one.
21  double realpix = 0;
22  // find real roots
23  for (int i = 0; i < 3; ++i) {
24  if (z[i].dat[1] == 0) {
25  realpix = z[i].dat[0];
26  break;
27  }
28  }
29 
30  return realpix > 0 ? (int)(realpix + 0.5) : 0;
31 }
T w() const
assert(be >=bs)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ getRecoCorrectionFactor()

double HcalSiPMnonlinearity::getRecoCorrectionFactor ( double  inpixelsfired) const
inline

Definition at line 17 of file HcalSiPMnonlinearity.h.

References a2, b1, c0, and x.

17  {
18  double x = inpixelsfired;
19  return (a2 * x * x + b1 * x + c0);
20  }

Member Data Documentation

◆ a2

double HcalSiPMnonlinearity::a2
private

◆ b1

double HcalSiPMnonlinearity::b1
private

◆ c0

double HcalSiPMnonlinearity::c0
private