src
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
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
}
HcalSiPMnonlinearity.h
mps_fire.i
i
Definition:
mps_fire.py:429
HcalSiPMnonlinearity::b1
double b1
Definition:
HcalSiPMnonlinearity.h:27
HcalSiPMnonlinearity::c0
double c0
Definition:
HcalSiPMnonlinearity.h:27
w
T w() const
Definition:
extBasic3DVector.h:225
cms::cuda::assert
assert(be >=bs)
HltBtagPostValidation_cff.c
c
Definition:
HltBtagPostValidation_cff.py:31
createfilelist.int
int
Definition:
createfilelist.py:10
HcalSiPMnonlinearity::getPixelsFired
int getPixelsFired(int inpes) const
Definition:
HcalSiPMnonlinearity.cc:9
b
double b
Definition:
hdecay.h:118
a
double a
Definition:
hdecay.h:119
DDAxes::z
HcalSiPMnonlinearity::a2
double a2
Definition:
HcalSiPMnonlinearity.h:27
Generated for CMSSW Reference Manual by
1.8.14