CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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, assert(), b1, and c0.

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

Member Function Documentation

int HcalSiPMnonlinearity::getPixelsFired ( int  inpes) const

Definition at line 9 of file HcalSiPMnonlinearity.cc.

References a, a2, assert(), b, b1, EnergyCorrector::c, c0, i, w, and z.

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

Definition at line 15 of file HcalSiPMnonlinearity.h.

References a2, b1, c0, and x.

15  {
16  double x=inpixelsfired; return (a2*x*x + b1*x + c0);
17  }

Member Data Documentation

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