Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
17
// Default Constructor...
18
TPNPulse::TPNPulse
()
19
{
20
init
(50,6);
21
}
22
23
// Constructor...
24
TPNPulse::TPNPulse
(
int
nsamples,
int
presample )
25
{
26
init
( nsamples, presample);
27
}
28
29
// Destructor
30
TPNPulse::~TPNPulse
()
31
{
32
}
33
34
void
TPNPulse::init
(
int
nsamples,
int
presample )
35
{
36
_nsamples=50;
37
assert
(nsamples==_nsamples);
38
assert
(presample!=0);
39
adc_ =
new
double
[50];
40
41
_presample=presample;
42
43
for
(
int
i
=0;
i
<_nsamples;
i
++){
44
adc_[
i
]=0.0;
45
}
46
47
adcMax_=0;
48
iadcMax_=0;
49
pedestal_=0;
50
51
isMaxFound_=
false
;
52
isPedCalc_=
false
;
53
}
54
55
bool
TPNPulse::setPulse
(
double
*
adc
){
56
57
bool
done
=
false
;
58
adc_=
adc
;
59
done=
true
;
60
isMaxFound_=
false
;
61
isPedCalc_=
false
;
62
return
done
;
63
}
64
double
TPNPulse::getMax
(){
65
66
if
(isMaxFound_)
return
adcMax_;
67
68
int
iadcmax=0;
69
double
adcmax=0.0;
70
for
(
int
i
=0;
i
<_nsamples;
i
++){
71
if
(adc_[
i
]>adcmax){
72
iadcmax=
i
;
73
adcmax=adc_[
i
];
74
}
75
}
76
iadcMax_=iadcmax;
77
adcMax_=adcmax;
78
return
adcMax_;
79
}
80
81
int
TPNPulse::getMaxSample
(){
82
if
(!isMaxFound_) getMax();
83
return
iadcMax_;
84
85
}
86
87
double
TPNPulse::getPedestal
(){
88
if
(isPedCalc_)
return
pedestal_;
89
double
ped=0;
90
for
(
int
i
=0;
i
<_presample;
i
++){
91
ped+=adc_[
i
];
92
}
93
ped/=double(_presample);
94
pedestal_=ped;
95
isPedCalc_=
true
;
96
return
pedestal_;
97
}
98
99
double
*
TPNPulse::getAdcWithoutPedestal
(){
100
101
double
ped;
102
if
(!isPedCalc_) ped=getPedestal();
103
else
ped=pedestal_;
104
105
double
*adcNoPed=
new
double
[50];
106
for
(
int
i
=0;
i
<_nsamples;
i
++){
107
adcNoPed[
i
]=adc_[
i
]-ped;
108
}
109
return
adcNoPed;
110
}
111
112
void
TPNPulse::setPresamples
(
int
presample){
113
isPedCalc_=
false
;
114
_presample=presample;
115
}
ecalMGPA::adc
int adc(sample_type sample)
get the ADC sample (12 bits)
Definition:
EcalMGPASample.h:11
run_regression.done
done
Definition:
run_regression.py:387
i
int i
Definition:
DBlmapReader.cc:9
TPNPulse::getPedestal
double getPedestal()
Definition:
TPNPulse.cc:87
TPNPulse.h
TPNPulse::init
void init(int, int)
Definition:
TPNPulse.cc:34
TPNPulse::getMax
double getMax()
Definition:
TPNPulse.cc:64
assert
assert(m_qm.get())
init
int init
Definition:
HydjetWrapper.h:67
TPNPulse::~TPNPulse
virtual ~TPNPulse()
Definition:
TPNPulse.cc:30
TPNPulse::getAdcWithoutPedestal
double * getAdcWithoutPedestal()
Definition:
TPNPulse.cc:99
TPNPulse::setPulse
bool setPulse(double *)
Definition:
TPNPulse.cc:55
TPNPulse::TPNPulse
TPNPulse()
Definition:
TPNPulse.cc:18
TPNPulse::setPresamples
void setPresamples(int)
Definition:
TPNPulse.cc:112
TPNPulse::getMaxSample
int getMaxSample()
Definition:
TPNPulse.cc:81
Generated for CMSSW Reference Manual by
1.8.5