PedAlgoRmsSlider.h
Go to the documentation of this file.
1 /**
2  * \file PedAlgoRmsSlider.h
3  *
4  * \ingroup PulseReco
5  *
6  * \brief Class definition file of PedAlgoRmsSlider
7  *
8  * @author Marco - Oxford 2017
9  */
10 
11 /** \addtogroup PulseReco
12 
13 @{*/
14 
15 #ifndef larana_OPTICALDETECTOR_PEDALGORMSSLIDER_H
16 #define larana_OPTICALDETECTOR_PEDALGORMSSLIDER_H
17 
19 
20 #include "PMTPedestalBase.h"
21 #include "fhiclcpp/fwd.h"
22 
23 #include <fstream>
24 
25 namespace pmtana
26 {
27 
28  /**
29  \class PedAlgoRmsSlider
30  A class that calculates pedestal mean & standard deviation (here and elsewhere called as "RMS").
31  */
33 
34  public:
35 
36  /// Default constructor
37  PedAlgoRmsSlider(const std::string name="PedRmsSlider");
38 
39  /// Alternative ctor
40  PedAlgoRmsSlider(const fhicl::ParameterSet &pset,const std::string name="PedRmsSlider");
41 
42  /// Print settings
43  void PrintInfo();
44 
45 
46  protected:
47 
48  /// Method to compute a pedestal of the input waveform using "nsample" ADC samples from "start" index.
49  bool ComputePedestal( const pmtana::Waveform_t& wf,
50  pmtana::PedestalMean_t& mean_v,
51  pmtana::PedestalSigma_t& sigma_v);
52 
53  private:
54 
55  size_t _sample_size; ///< How many samples are used to calculate local rms and mean
56  double _threshold; ///< Threshold applied to local rms to claim a pulse
57 
58  float _max_sigma; ///< Max sigma to consider adc as 'sane'
59  float _ped_range_max; ///< Max value of adc to consider adc as 'sane'
60  float _ped_range_min; ///< Min value of adc to consider adc as 'sane'
61 
62  bool _verbose; ///< For debugging
63  int _n_wf_to_csvfile; ///< If greater than zero saves firsts waveforms with pedestal to csv file
64  int _wf_saved = 0;
65  int _num_presample; ///< number of ADCs to sample before the gap
66  int _num_postsample; ///< number of ADCs to sample after the gap
67  std::ofstream _csvfile;
68 
69  /// Returns the mean of the elements of the vector from start to start+nsample
70  double CalcMean(const std::vector<double>& wf, size_t start, size_t nsample);
71 
72  /// Returns the std of the elements of the vector from start to start+nsample
73  double CalcStd(const std::vector<double>& wf, const double ped_mean, size_t start, size_t nsample);
74 
75  /// Checks the sanity of the estimated pedestal, returns false if not sane
77  };
78 }
79 #endif
80 
81 /** @} */ // end of doxygen group
static QCString name
Definition: declinfo.cpp:673
void PrintInfo()
Print settings.
bool CheckSanity(pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v)
Checks the sanity of the estimated pedestal, returns false if not sane.
std::vector< double > PedestalSigma_t
float _ped_range_min
Min value of adc to consider adc as &#39;sane&#39;.
std::string string
Definition: nybbler.cc:12
int _num_postsample
number of ADCs to sample after the gap
float _max_sigma
Max sigma to consider adc as &#39;sane&#39;.
PedAlgoRmsSlider(const std::string name="PedRmsSlider")
Default constructor.
Class definition file of PMTPedestalBase.
int _num_presample
number of ADCs to sample before the gap
double CalcStd(const std::vector< double > &wf, const double ped_mean, size_t start, size_t nsample)
Returns the std of the elements of the vector from start to start+nsample.
bool ComputePedestal(const pmtana::Waveform_t &wf, pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v)
Method to compute a pedestal of the input waveform using "nsample" ADC samples from "start" index...
double _threshold
Threshold applied to local rms to claim a pulse.
float _ped_range_max
Max value of adc to consider adc as &#39;sane&#39;.
std::vector< short > Waveform_t
int _n_wf_to_csvfile
If greater than zero saves firsts waveforms with pedestal to csv file.
size_t _sample_size
How many samples are used to calculate local rms and mean.
double CalcMean(const std::vector< double > &wf, size_t start, size_t nsample)
Returns the mean of the elements of the vector from start to start+nsample.
std::vector< double > PedestalMean_t
bool _verbose
For debugging.