Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
pmtana::AlgoSSPLeadingEdge Class Reference

#include <AlgoSSPLeadingEdge.h>

Inheritance diagram for pmtana::AlgoSSPLeadingEdge:
pmtana::PMTPulseRecoBase

Public Member Functions

 AlgoSSPLeadingEdge (const fhicl::ParameterSet &pset, const std::string name="AlgoSSPLeadingEdge")
 
 ~AlgoSSPLeadingEdge ()
 
void Reset ()
 A method to be called event-wise to reset parameters. More...
 
- Public Member Functions inherited from pmtana::PMTPulseRecoBase
 PMTPulseRecoBase (const std::string name="noname")
 Default constructor with fhicl parameters. More...
 
virtual ~PMTPulseRecoBase ()=default
 Default destructor. More...
 
const std::stringName () const
 Name getter. More...
 
bool Status () const
 Status getter. More...
 
bool Reconstruct (const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)
 
const pulse_paramGetPulse (size_t index=0) const
 
const pulse_param_arrayGetPulses () const
 A getter for the whole array of pulse_param struct object. More...
 
size_t GetNPulse () const
 A getter for the number of reconstructed pulses from the input waveform. More...
 

Public Attributes

std::vector< int > trg_wvf
 

Protected Member Functions

bool RecoPulse (const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)
 
- Protected Member Functions inherited from pmtana::PMTPulseRecoBase
bool Integral (const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
 
bool Derivative (const std::vector< short > &wf, std::vector< int32_t > &diff, size_t begin=0, size_t end=0) const
 
size_t Max (const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
 
size_t Min (const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
 

Protected Attributes

double _adc_thres
 
double _pedestal
 
int _dwindow
 
size_t _rdwindow
 
size_t _pretrg
 
- Protected Attributes inherited from pmtana::PMTPulseRecoBase
pulse_param_array _pulse_v
 A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s). More...
 
pulse_param _pulse
 A subject pulse_param object to be filled with the last reconstructed pulse parameters. More...
 

Detailed Description

Definition at line 21 of file AlgoSSPLeadingEdge.h.

Constructor & Destructor Documentation

pmtana::AlgoSSPLeadingEdge::AlgoSSPLeadingEdge ( const fhicl::ParameterSet pset,
const std::string  name = "AlgoSSPLeadingEdge" 
)

Definition at line 17 of file AlgoSSPLeadingEdge.cc.

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  }
static QCString name
Definition: declinfo.cpp:673
void Reset()
A method to be called event-wise to reset parameters.
T get(std::string const &key) const
Definition: ParameterSet.h:271
PMTPulseRecoBase(const std::string name="noname")
Default constructor with fhicl parameters.
pmtana::AlgoSSPLeadingEdge::~AlgoSSPLeadingEdge ( )

Definition at line 46 of file AlgoSSPLeadingEdge.cc.

47  {}

Member Function Documentation

bool pmtana::AlgoSSPLeadingEdge::RecoPulse ( const pmtana::Waveform_t wf,
const pmtana::PedestalMean_t ped_mean,
const pmtana::PedestalSigma_t ped_rms 
)
protectedvirtual

Implements pmtana::PMTPulseRecoBase.

Definition at line 58 of file AlgoSSPLeadingEdge.cc.

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);
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);
137 
138  }
139 
140  return true;
141 
142  }
void Reset()
A method to be called event-wise to reset parameters.
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
QTextStream & endl(QTextStream &s)
void pmtana::AlgoSSPLeadingEdge::Reset ( )
virtual

A method to be called event-wise to reset parameters.

Reimplemented from pmtana::PMTPulseRecoBase.

Definition at line 50 of file AlgoSSPLeadingEdge.cc.

51  {
52 
54 
55  }
virtual void Reset()
A method to be called event-wise to reset parameters.

Member Data Documentation

double pmtana::AlgoSSPLeadingEdge::_adc_thres
protected

Definition at line 42 of file AlgoSSPLeadingEdge.h.

int pmtana::AlgoSSPLeadingEdge::_dwindow
protected

Definition at line 48 of file AlgoSSPLeadingEdge.h.

double pmtana::AlgoSSPLeadingEdge::_pedestal
protected

Definition at line 45 of file AlgoSSPLeadingEdge.h.

size_t pmtana::AlgoSSPLeadingEdge::_pretrg
protected

Definition at line 52 of file AlgoSSPLeadingEdge.h.

size_t pmtana::AlgoSSPLeadingEdge::_rdwindow
protected

Definition at line 51 of file AlgoSSPLeadingEdge.h.

std::vector<int> pmtana::AlgoSSPLeadingEdge::trg_wvf

Definition at line 25 of file AlgoSSPLeadingEdge.h.


The documentation for this class was generated from the following files: