Main Page
Namespaces
Classes
Package Documentation
CalibCalorimetry
HcalAlgos
src
HcalSiPMnonlinearity.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <gsl/gsl_poly.h>
3
#include <gsl/gsl_complex.h>
4
#include "
CalibCalorimetry/HcalAlgos/interface/HcalSiPMnonlinearity.h
"
5
6
// Assume parameters come to us from the reco side; i.e.,
7
// true pes = corfun(pixelsfired). But we want to invert that.
8
//
9
int
HcalSiPMnonlinearity::getPixelsFired
(
int
inpes)
const
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
}
HcalSiPMnonlinearity.h
mps_fire.i
i
Definition:
mps_fire.py:156
w
const double w
Definition:
UKUtility.cc:23
HcalSiPMnonlinearity::b1
double b1
Definition:
HcalSiPMnonlinearity.h:24
HcalSiPMnonlinearity::c0
double c0
Definition:
HcalSiPMnonlinearity.h:24
EnergyCorrector.c
c
Definition:
EnergyCorrector.py:43
createfilelist.int
int
Definition:
createfilelist.py:10
HcalSiPMnonlinearity::getPixelsFired
int getPixelsFired(int inpes) const
Definition:
HcalSiPMnonlinearity.cc:9
b
double b
Definition:
hdecay.h:120
a
double a
Definition:
hdecay.h:121
DDAxes::z
HcalSiPMnonlinearity::a2
double a2
Definition:
HcalSiPMnonlinearity.h:24
Generated for CMSSW Reference Manual by
1.8.11