CalibCalorimetry
EcalLaserAnalyzer
src
TPNPulse.cc
Go to the documentation of this file.
1
/*
2
* \class TPNPulse
3
*
4
* \author: Julie Malcles - CEA/Saclay
5
*/
6
7
#include <
CalibCalorimetry/EcalLaserAnalyzer/interface/TPNPulse.h
>
8
9
#include <TMath.h>
10
#include <iostream>
11
#include <cassert>
12
using namespace
std
;
13
14
//ClassImp(TPNPulse)
15
16
// Default Constructor...
17
TPNPulse::TPNPulse
() {
init
(50, 6); }
18
19
// Constructor...
20
TPNPulse::TPNPulse
(
int
nsamples,
int
presample) {
init
(nsamples, presample); }
21
22
// Destructor
23
TPNPulse::~TPNPulse
() {}
24
25
void
TPNPulse::init
(
int
nsamples,
int
presample) {
26
_nsamples = 50;
27
assert
(nsamples == _nsamples);
28
assert
(presample != 0);
29
adc_ =
new
double
[50];
30
31
_presample = presample;
32
33
for
(
int
i
= 0;
i
< _nsamples;
i
++) {
34
adc_[
i
] = 0.0;
35
}
36
37
adcMax_ = 0;
38
iadcMax_ = 0;
39
pedestal_ = 0;
40
41
isMaxFound_ =
false
;
42
isPedCalc_ =
false
;
43
}
44
45
bool
TPNPulse::setPulse
(
double
*
adc
) {
46
bool
done
=
false
;
47
adc_ =
adc
;
48
done
=
true
;
49
isMaxFound_ =
false
;
50
isPedCalc_ =
false
;
51
return
done
;
52
}
53
double
TPNPulse::getMax
() {
54
if
(isMaxFound_)
55
return
adcMax_;
56
57
int
iadcmax = 0;
58
double
adcmax = 0.0;
59
for
(
int
i
= 0;
i
< _nsamples;
i
++) {
60
if
(adc_[
i
] > adcmax) {
61
iadcmax =
i
;
62
adcmax = adc_[
i
];
63
}
64
}
65
iadcMax_ = iadcmax;
66
adcMax_ = adcmax;
67
return
adcMax_;
68
}
69
70
int
TPNPulse::getMaxSample
() {
71
if
(!isMaxFound_)
72
getMax();
73
return
iadcMax_;
74
}
75
76
double
TPNPulse::getPedestal
() {
77
if
(isPedCalc_)
78
return
pedestal_;
79
double
ped = 0;
80
for
(
int
i
= 0;
i
< _presample;
i
++) {
81
ped += adc_[
i
];
82
}
83
ped /= double(_presample);
84
pedestal_ = ped;
85
isPedCalc_ =
true
;
86
return
pedestal_;
87
}
88
89
double
*
TPNPulse::getAdcWithoutPedestal
() {
90
double
ped;
91
if
(!isPedCalc_)
92
ped = getPedestal();
93
else
94
ped = pedestal_;
95
96
double
*adcNoPed =
new
double
[50];
97
for
(
int
i
= 0;
i
< _nsamples;
i
++) {
98
adcNoPed[
i
] = adc_[
i
] - ped;
99
}
100
return
adcNoPed;
101
}
102
103
void
TPNPulse::setPresamples
(
int
presample) {
104
isPedCalc_ =
false
;
105
_presample = presample;
106
}
TPNPulse::getMax
double getMax()
Definition:
TPNPulse.cc:53
init
int init
Definition:
HydjetWrapper.h:64
TPNPulse::TPNPulse
TPNPulse()
Definition:
TPNPulse.cc:17
mps_fire.i
i
Definition:
mps_fire.py:428
TPNPulse.h
TPNPulse::setPulse
bool setPulse(double *)
Definition:
TPNPulse.cc:45
cms::cuda::assert
assert(be >=bs)
TPNPulse::~TPNPulse
~TPNPulse() override
Definition:
TPNPulse.cc:23
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition:
EcalLiteDTUSample.h:12
TPNPulse::getAdcWithoutPedestal
double * getAdcWithoutPedestal()
Definition:
TPNPulse.cc:89
fileCollector.done
done
Definition:
fileCollector.py:123
TPNPulse::getPedestal
double getPedestal()
Definition:
TPNPulse.cc:76
TPNPulse::setPresamples
void setPresamples(int)
Definition:
TPNPulse.cc:103
std
Definition:
JetResolutionObject.h:76
TPNPulse::init
void init(int, int)
Definition:
TPNPulse.cc:25
TPNPulse::getMaxSample
int getMaxSample()
Definition:
TPNPulse.cc:70
Generated for CMSSW Reference Manual by
1.8.16