CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( 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

int HcalSiPMnonlinearity::getPixelsFired ( int  inpes) const

Definition at line 9 of file HcalSiPMnonlinearity.cc.

References a, a2, cms::cuda::assert(), b, b1, c, c0, dat, mps_fire::i, 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 }
const edm::EventSetup & c
assert(be >=bs)
double b
Definition: hdecay.h:118
static std::vector< std::string > checklist dat
double a
Definition: hdecay.h:119
T w() const
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

double HcalSiPMnonlinearity::a2
private
double HcalSiPMnonlinearity::b1
private
double HcalSiPMnonlinearity::c0
private