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.

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

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

Member Function Documentation

◆ getPixelsFired()

int HcalSiPMnonlinearity::getPixelsFired ( int  inpes) const

Definition at line 9 of file HcalSiPMnonlinearity.cc.

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 }

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

◆ getRecoCorrectionFactor()

double HcalSiPMnonlinearity::getRecoCorrectionFactor ( double  inpixelsfired) const
inline

Definition at line 17 of file HcalSiPMnonlinearity.h.

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

References a2, b1, c0, and x.

Member Data Documentation

◆ a2

double HcalSiPMnonlinearity::a2
private

◆ b1

double HcalSiPMnonlinearity::b1
private

◆ c0

double HcalSiPMnonlinearity::c0
private
mps_fire.i
i
Definition: mps_fire.py:428
HcalSiPMnonlinearity::a2
double a2
Definition: HcalSiPMnonlinearity.h:27
HcalSiPMnonlinearity::c0
double c0
Definition: HcalSiPMnonlinearity.h:27
cms::cuda::assert
assert(be >=bs)
DDAxes::x
w
const double w
Definition: UKUtility.cc:23
DDAxes::z
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
createfilelist.int
int
Definition: createfilelist.py:10
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
HcalSiPMnonlinearity::b1
double b1
Definition: HcalSiPMnonlinearity.h:27