Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
duneopdet
duneopdet
OpticalDetector
AlgoSSPLeadingEdge.cc
Go to the documentation of this file.
1
//=========================================================
2
// AlgoSSPLeadingEdge.cc
3
// This class provides the digital output for the
4
// Leading Edge Discrimintator, used in SSP module.
5
//
6
// Vitor Luzio, UFABC, 2017
7
// Based on AlgoSiPM.cxx
8
//=========================================================
9
10
11
12
#include "
duneopdet/OpticalDetector/AlgoSSPLeadingEdge.h
"
13
14
namespace
pmtana
{
15
16
//---------------------------------------------------------------------------
17
AlgoSSPLeadingEdge::AlgoSSPLeadingEdge
(
const
fhicl::ParameterSet
&pset,
const
std::string
name
)
18
:
PMTPulseRecoBase
(name)
19
{
20
21
_adc_thres
= pset.
get
<
float
>(
"ADCThreshold"
);
22
// _min_width = pset.get< float >("MinWidth" );
23
// _2nd_thres = pset.get< float >("SecondThreshold");
24
_pedestal
= pset.
get
<
float
>(
"Pedestal"
);
25
_dwindow
= pset.
get
<
int
>(
"DWindow"
);
26
_rdwindow
= pset.
get
<
size_t
>(
"ReadoutWd"
);
27
_pretrg
= pset.
get
<
size_t
>(
"PreTrg"
);
28
29
// std::cout << "VITOR DEBUG" << std::endl;
30
// std::cout << "ADCThreshold = " << _adc_thres << std::endl;
31
// std::cout << "DWindow = " << _dwindow << std::endl;
32
// std::cout << "Readout Window = " << _rdwindow << std::endl;
33
// std::cout << "Pre Trigger = " << _pretrg << std::endl;
34
// std::cout << "VITOR DEBUG" << std::endl;
35
36
37
38
39
// _nsigma = 5;
40
41
Reset
();
42
43
}
44
45
//---------------------------------------------------------------------------
46
AlgoSSPLeadingEdge::~AlgoSSPLeadingEdge
()
47
{}
48
49
//---------------------------------------------------------------------------
50
void
AlgoSSPLeadingEdge::Reset
()
51
{
52
53
PMTPulseRecoBase::Reset
();
54
55
}
56
57
//---------------------------------------------------------------------------
58
bool
AlgoSSPLeadingEdge::RecoPulse
(
const
pmtana::Waveform_t
& wf,
59
const
pmtana::PedestalMean_t
& ped_mean,
60
const
pmtana::PedestalSigma_t
& ped_rms )
61
{
62
63
bool
fire =
false
;
64
int
counter
= 0;
65
double
pedestal =
_pedestal
;
66
double
threshold =
_adc_thres
;
67
double
threshold2 =
_adc_thres
;
68
threshold += pedestal;
69
// double pre_threshold = _2nd_thres;
70
// pre_threshold += pedestal;
71
72
int
d_window =
_dwindow
;
73
int
timer = 0;
//time to delay the wf and compare amplitudes
74
int
readout_window =
_rdwindow
;
//from 0 to 2046 in SSP
75
int
readout_pretrigger =
_pretrg
;
//(from 0 to 2047 in SSP)
76
double
threshold_cmp;
77
int
tamanho, cnt2;
78
79
Reset
();
80
tamanho = wf.size();
81
82
83
for
(
short
const
&
value
: wf) {
84
85
cnt2 =
value
;
86
if
(cnt2 !=
value
){std::cout <<
"teste VITOR"
<<
std::endl
; }
87
88
if
(counter < (tamanho - d_window )) {
89
90
threshold_cmp = wf[counter+d_window]-wf[
counter
];
91
92
93
if
(threshold_cmp >= threshold2){
94
95
if
(timer==0){
trg_wvf
.emplace_back(counter+d_window);}
96
97
if
(!fire && timer==0){
98
fire =
true
;
99
if
(readout_pretrigger < (counter + d_window)){
100
_pulse
.
t_start
= counter + d_window - readout_pretrigger;
101
}
else
{
102
_pulse
.
t_start
= 1;
103
}
104
timer++;
105
}
else
if
(timer>0 && timer < d_window){
106
timer++;
107
}
else
if
(timer == d_window){
108
timer=0;
109
}
110
111
}
else
{
112
if
(timer>0 && timer < d_window){timer++;}
113
else
if
(timer==d_window || timer==0 ){timer=0;}
114
115
}
116
if
(fire==
true
&& counter == (
_pulse
.
t_start
+ readout_window)){
//we need to configure the _min_widht to be 700 bins
117
fire =
false
;
118
_pulse
.
t_end
= counter - 1;
119
_pulse_v
.push_back(
_pulse
);
120
_pulse
.
reset_param
();
121
122
}
123
}
124
125
counter++;
126
127
}
128
129
if
(fire) {
//It's not mine, but is a good strategy to handle the pulses at the end of waveform
130
131
// Take care of a pulse that did not finish within the readout window
132
133
fire =
false
;
134
_pulse
.
t_end
= tamanho;
135
_pulse_v
.push_back(
_pulse
);
136
_pulse
.
reset_param
();
137
138
}
139
140
return
true
;
141
142
}
143
144
}
pmtana::AlgoSSPLeadingEdge::RecoPulse
bool RecoPulse(const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)
Definition:
AlgoSSPLeadingEdge.cc:58
name
static QCString name
Definition:
declinfo.cpp:673
pmtana::AlgoSSPLeadingEdge::_rdwindow
size_t _rdwindow
Definition:
AlgoSSPLeadingEdge.h:51
pmtana::AlgoSSPLeadingEdge::_pretrg
size_t _pretrg
Definition:
AlgoSSPLeadingEdge.h:52
pmtana::PedestalSigma_t
std::vector< double > PedestalSigma_t
Definition:
OpticalRecoTypes.h:10
pmtana::PMTPulseRecoBase::Reset
virtual void Reset()
A method to be called event-wise to reset parameters.
Definition:
PMTPulseRecoBase.cxx:57
pmtana::AlgoSSPLeadingEdge::~AlgoSSPLeadingEdge
~AlgoSSPLeadingEdge()
Definition:
AlgoSSPLeadingEdge.cc:46
string
std::string string
Definition:
nybbler.cc:12
pmtana::AlgoSSPLeadingEdge::Reset
void Reset()
A method to be called event-wise to reset parameters.
Definition:
AlgoSSPLeadingEdge.cc:50
pmtana::pulse_param::t_end
double t_end
Definition:
PMTPulseRecoBase.h:30
pmtana::pulse_param::reset_param
void reset_param()
Definition:
PMTPulseRecoBase.h:39
pmtana::PMTPulseRecoBase::_pulse
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
Definition:
PMTPulseRecoBase.h:122
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
pmtana::AlgoSSPLeadingEdge::_dwindow
int _dwindow
Definition:
AlgoSSPLeadingEdge.h:48
pmtana::Waveform_t
std::vector< short > Waveform_t
Definition:
OpticalRecoTypes.h:8
make_THn_beam_input.counter
int counter
Definition:
make_THn_beam_input.py:56
AlgoSSPLeadingEdge.h
pmtana::AlgoSSPLeadingEdge::_adc_thres
double _adc_thres
Definition:
AlgoSSPLeadingEdge.h:42
pmtana::AlgoSSPLeadingEdge::trg_wvf
std::vector< int > trg_wvf
Definition:
AlgoSSPLeadingEdge.h:25
pmtana::AlgoSSPLeadingEdge::_pedestal
double _pedestal
Definition:
AlgoSSPLeadingEdge.h:45
pmtana
Definition:
AlgoSSPLeadingEdge.cc:14
pmtana::pulse_param::t_start
double t_start
Definition:
PMTPulseRecoBase.h:30
pmtana::PedestalMean_t
std::vector< double > PedestalMean_t
Definition:
OpticalRecoTypes.h:9
pmtana::PMTPulseRecoBase
Definition:
PMTPulseRecoBase.h:66
submit_mcc.value
value
Definition:
submit_mcc.py:159
pmtana::AlgoSSPLeadingEdge::AlgoSSPLeadingEdge
AlgoSSPLeadingEdge(const fhicl::ParameterSet &pset, const std::string name="AlgoSSPLeadingEdge")
Definition:
AlgoSSPLeadingEdge.cc:17
pmtana::PMTPulseRecoBase::_pulse_v
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
Definition:
PMTPulseRecoBase.h:119
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11