#include <algo_threshold.hh>
Inheritance diagram for algo_threshold:

Public Member Functions | |
| algo_threshold () | |
| Default constructor. | |
| virtual | ~algo_threshold () |
| Default destructor. | |
| virtual DATA_STRUCT::DATA_TYPE | storage_type () |
| A method to return the storage pulse_collection type enum. | |
| virtual bool | reco (const std::vector< UShort_t > *wf) |
| Implementation of preco_algo_base::reco method. | |
| virtual void | reset () |
| Implementation of preco_algo_base::reset method. | |
| void | set_adc_threshold (double v) |
| A method to set user-defined ADC threshold value. | |
| void | set_nsigma (double v) |
| A method to set a multiplication factor to the pedestal standard deviation which is used as one of two input values to define a threshold. | |
| const pulse_param * | get_pulse (size_t index=0) const |
| A getter for the pulse_param struct object. | |
| size_t | get_npulse () const |
| A getter for the number of reconstructed pulses from the input waveform. | |
| void | set_ped_mean (double v) |
| A setter for the pedestal mean value. | |
| void | set_ped_rms (double v) |
| A setter for the pedestal standard deviation. | |
| double | ped_mean () const |
| A getter for the set pedestal mean value. | |
| double | ped_rms () const |
| A getter for the set pedestal standard deviation. | |
| void | set_verbosity (MSG::Level level) |
| Setter for the verbosity level. | |
| MSG::Level | get_verbosity () const |
| Getter for the verbosity level. | |
| const std::string | class_name () const |
| Getter for the class name. | |
Protected Member Functions | |
| bool | integral (const std::vector< UShort_t > *wf, double &result, size_t begin=0, size_t end=0) const |
| A method to integrate an waveform from index "begin" to the "end". | |
| bool | derivative (const std::vector< UShort_t > *wf, std::vector< Int_t > &diff, size_t begin=0, size_t end=0) const |
| A method to compute derivative, which is a simple subtraction of previous ADC sample from each sample. | |
| size_t | max (const std::vector< UShort_t > *wf, double &result, size_t begin=0, size_t end=0) const |
| A method to return the maximum value of ADC sample within the index from "begin" to "end". | |
| size_t | min (const std::vector< UShort_t > *wf, double &result, size_t begin=0, size_t end=0) const |
| A method to return the minimum value of ADC sample within the index from "begin" to "end". | |
Protected Attributes | |
| double | _adc_thres |
| A variable holder for a user-defined absolute ADC threshold value. | |
| double | _nsigma |
| A variable holder for a multiplicative factor for the pedestal standard deviation to defin the threshold. | |
| std::vector< pulse_param > | _pulse_v |
| A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s). | |
| pulse_param | _pulse |
| A subject pulse_param object to be filled with the last reconstructed pulse parameters. | |
| double | _ped_mean |
| Pedestal mean value. | |
| double | _ped_rms |
| Pedestal standard deviation. | |
| char | _buf [200] |
| char buffer for message manipulation | |
| bool | _verbosity [MSG::MSG_TYPE_MAX] |
| holder for enabled message levels | |
| MSG::Level | _verbosity_level |
| holder for specified verbosity level | |
| std::string | _name |
| class name holder | |
The algorithm defines a pulse start when it find an ADC count above a threshold. The threshold is defined from two values: value 1 = user defined ADC count, and value 2 = n * pedestal standard deviation where "n" is specified by a user. The algorithm takes a larger value among those two values, and use it as the minimum threshold to declaire a pulse firing. Once it finds the pulse start with the ADC value above the threshold, it scands consecutive ADC samples until it finds another ADC sample that goes below the threshold, which is considere to be the end of the pulse.
Definition at line 32 of file algo_threshold.hh.
| algo_threshold::algo_threshold | ( | ) |
Default constructor.
Definition at line 7 of file algo_threshold.cc.
References _adc_thres, decoder_base::_name, _nsigma, and reset().
00007 : preco_algo_base() { 00008 //*************************************************************** 00009 00010 _name = "algo_threshold"; 00011 00012 _adc_thres = 3; 00013 00014 _nsigma = 5; 00015 00016 reset(); 00017 00018 }
| virtual algo_threshold::~algo_threshold | ( | ) | [inline, virtual] |
| const std::string decoder_base::class_name | ( | ) | const [inline, inherited] |
Getter for the class name.
Definition at line 46 of file decoder_base.hh.
References decoder_base::_name.
00046 {return _name;};
| bool preco_algo_base::derivative | ( | const std::vector< UShort_t > * | wf, | |
| std::vector< Int_t > & | diff, | |||
| size_t | begin = 0, |
|||
| size_t | end = 0 | |||
| ) | const [protected, inherited] |
A method to compute derivative, which is a simple subtraction of previous ADC sample from each sample.
The result is stored in the input "diff" reference vector which is Int_t type as a derivative could be negative.
| size_t preco_algo_base::get_npulse | ( | ) | const [inline, inherited] |
A getter for the number of reconstructed pulses from the input waveform.
Definition at line 87 of file preco_algo_base.hh.
References preco_algo_base::_pulse_v.
00087 {return _pulse_v.size();};
| const pulse_param * preco_algo_base::get_pulse | ( | size_t | index = 0 |
) | const [inherited] |
A getter for the pulse_param struct object.
Reconstruction algorithm may have more than one pulse reconstructed from an input waveform. Note you must, accordingly, provide an index key to specify which pulse_param object to be retrieved.
Definition at line 48 of file preco_algo_base.cc.
00050 { 00051 00052 if(index >= _pulse_v.size()) return 0; 00053 00054 else return &(_pulse_v.at(index)); 00055 00056 }
| MSG::Level decoder_base::get_verbosity | ( | ) | const [inline, inherited] |
Getter for the verbosity level.
Definition at line 43 of file decoder_base.hh.
References decoder_base::_verbosity_level.
00043 {return _verbosity_level;};
| bool preco_algo_base::integral | ( | const std::vector< UShort_t > * | wf, | |
| double & | result, | |||
| size_t | begin = 0, |
|||
| size_t | end = 0 | |||
| ) | const [protected, inherited] |
A method to integrate an waveform from index "begin" to the "end".
The result is filled in "result" reference. If the "end" is default (=0), then "end" is set to the last index of the waveform.
Definition at line 59 of file preco_algo_base.cc.
References check_index().
Referenced by algo_fixed_window::reco().
00064 { 00065 00066 if(!check_index(wf,begin,end)) return false; 00067 00068 std::vector<UShort_t>::const_iterator begin_iter(wf->begin()); 00069 00070 std::vector<UShort_t>::const_iterator end_iter(wf->begin()); 00071 00072 begin_iter = begin_iter + begin; 00073 00074 end_iter = end_iter + end + 1; 00075 00076 result = (double)(std::accumulate(begin_iter, end_iter, 0)); 00077 00078 return true; 00079 }
| size_t preco_algo_base::max | ( | const std::vector< UShort_t > * | wf, | |
| double & | result, | |||
| size_t | begin = 0, |
|||
| size_t | end = 0 | |||
| ) | const [protected, inherited] |
A method to return the maximum value of ADC sample within the index from "begin" to "end".
If the "end" is default (=0), then "end" is set to the last index of the waveform.
Definition at line 106 of file preco_algo_base.cc.
References check_index().
Referenced by algo_fixed_window::reco().
00111 { 00112 00113 size_t target_index = wf->size() + 1; 00114 00115 result = 0; 00116 00117 if(check_index(wf,begin,end)) { 00118 00119 for(size_t index = begin; index <= end; ++index) 00120 00121 if( result < wf->at(index)) { target_index = index; result = (double)(wf->at(index)); } 00122 00123 } 00124 00125 return target_index; 00126 00127 }
| size_t preco_algo_base::min | ( | const std::vector< UShort_t > * | wf, | |
| double & | result, | |||
| size_t | begin = 0, |
|||
| size_t | end = 0 | |||
| ) | const [protected, inherited] |
A method to return the minimum value of ADC sample within the index from "begin" to "end".
If the "end" is default (=0), then "end" is set to the last index of the waveform.
Definition at line 130 of file preco_algo_base.cc.
References check_index().
00135 { 00136 00137 size_t target_index = wf->size() + 1; 00138 00139 result = 4096; 00140 00141 if(check_index(wf,begin,end)) { 00142 00143 for(size_t index = begin; index <= end; ++index) 00144 00145 if( result > wf->at(index)) { target_index = index; result = (double)(wf->at(index)); } 00146 00147 } 00148 00149 return target_index; 00150 00151 }
| double preco_algo_base::ped_mean | ( | ) | const [inline, inherited] |
A getter for the set pedestal mean value.
Definition at line 96 of file preco_algo_base.hh.
References preco_algo_base::_ped_mean.
00096 {return _ped_mean; };
| double preco_algo_base::ped_rms | ( | ) | const [inline, inherited] |
A getter for the set pedestal standard deviation.
Definition at line 99 of file preco_algo_base.hh.
References preco_algo_base::_ped_rms.
00099 {return _ped_rms; };
| bool algo_threshold::reco | ( | const std::vector< UShort_t > * | wf | ) | [virtual] |
Implementation of preco_algo_base::reco method.
Implements preco_algo_base.
Definition at line 27 of file algo_threshold.cc.
References _adc_thres, _nsigma, preco_algo_base::_ped_mean, preco_algo_base::_ped_rms, preco_algo_base::_pulse, preco_algo_base::_pulse_v, pulse_param::area, pulse_param::peak, reset(), pulse_param::reset_param(), pulse_param::t_end, pulse_param::t_max, and pulse_param::t_start.
00027 { 00028 //*************************************************************** 00029 00030 bool fire = false; 00031 00032 double counter=0; 00033 00034 double threshold = ( _adc_thres > (_nsigma * _ped_rms) ? _adc_thres : (_nsigma * _ped_rms) ); 00035 00036 threshold += _ped_mean; 00037 00038 reset(); 00039 00040 for(auto value : *wf){ 00041 00042 if( !fire && ((double)value) > threshold ){ 00043 00044 // Found a new pulse 00045 00046 fire = true; 00047 00048 _pulse.t_start = counter; 00049 00050 } 00051 00052 if( fire && ((double)value) < threshold ){ 00053 00054 // Found the end of a pulse 00055 00056 fire = false; 00057 00058 _pulse.t_end = counter - 1; 00059 00060 _pulse_v.push_back(_pulse); 00061 00062 _pulse.reset_param(); 00063 00064 } 00065 00066 if(fire){ 00067 00068 // Add this adc count to the integral 00069 00070 _pulse.area += ((double)value - (double)_ped_mean); 00071 00072 if(_pulse.peak < ((double)value - (double)_ped_mean)) { 00073 00074 // Found a new maximum 00075 00076 _pulse.peak = ((double)value - (double)_ped_mean); 00077 00078 _pulse.t_max = counter; 00079 00080 } 00081 00082 } 00083 00084 counter++; 00085 } 00086 00087 if(fire){ 00088 00089 // Take care of a pulse that did not finish within the readout window. 00090 00091 fire = false; 00092 00093 _pulse.t_end = counter - 1; 00094 00095 _pulse_v.push_back(_pulse); 00096 00097 _pulse.reset_param(); 00098 00099 } 00100 00101 return true; 00102 00103 }
| void algo_threshold::reset | ( | ) | [virtual] |
Implementation of preco_algo_base::reset method.
Reimplemented from preco_algo_base.
Definition at line 20 of file algo_threshold.cc.
References preco_algo_base::reset().
Referenced by algo_threshold(), and reco().
00020 { 00021 00022 preco_algo_base::reset(); 00023 00024 }
| void algo_threshold::set_adc_threshold | ( | double | v | ) | [inline] |
A method to set user-defined ADC threshold value.
Definition at line 55 of file algo_threshold.hh.
References _adc_thres.
00055 {_adc_thres = v;};
| void algo_threshold::set_nsigma | ( | double | v | ) | [inline] |
A method to set a multiplication factor to the pedestal standard deviation which is used as one of two input values to define a threshold.
Definition at line 61 of file algo_threshold.hh.
References _nsigma.
00061 {_nsigma = v;};
| void preco_algo_base::set_ped_mean | ( | double | v | ) | [inline, inherited] |
A setter for the pedestal mean value.
Definition at line 90 of file preco_algo_base.hh.
References preco_algo_base::_ped_mean.
00090 { _ped_mean = v; };
| void preco_algo_base::set_ped_rms | ( | double | v | ) | [inline, inherited] |
A setter for the pedestal standard deviation.
Definition at line 93 of file preco_algo_base.hh.
References preco_algo_base::_ped_rms.
00093 { _ped_rms = v; };
| void decoder_base::set_verbosity | ( | MSG::Level | level | ) | [inherited] |
Setter for the verbosity level.
Reimplemented in ana_processor.
Definition at line 11 of file decoder_base.cc.
References decoder_base::_verbosity, decoder_base::_verbosity_level, MSG::DEBUG, MSG::ERROR, MSG::INFO, MSG::MSG_TYPE_MAX, MSG::NORMAL, and MSG::WARNING.
Referenced by algo_slow_readout_decoder::algo_slow_readout_decoder(), compare_content(), decoder_base::decoder_base(), decoder_manager::decoder_manager(), decoder_manager::initialize(), main(), xmit_event_search::run(), bin_word_search::run(), and ana_processor::set_verbosity().
00011 { 00012 00013 _verbosity_level=level; 00014 00015 for(size_t i=(size_t)(MSG::DEBUG); i<(size_t)(MSG::MSG_TYPE_MAX); ++i) 00016 _verbosity[i]=false; 00017 00018 switch(level){ 00019 case MSG::DEBUG: 00020 _verbosity[MSG::DEBUG]=true; 00021 case MSG::INFO: 00022 _verbosity[MSG::INFO]=true; 00023 case MSG::NORMAL: 00024 _verbosity[MSG::NORMAL]=true; 00025 case MSG::WARNING: 00026 _verbosity[MSG::WARNING]=true; 00027 case MSG::ERROR: 00028 _verbosity[MSG::ERROR]=true; 00029 case MSG::MSG_TYPE_MAX: 00030 break; 00031 } 00032 00033 }
| virtual DATA_STRUCT::DATA_TYPE algo_threshold::storage_type | ( | ) | [inline, virtual] |
A method to return the storage pulse_collection type enum.
This one returns DATA_STRUCT::THRES_WIN_PULSE_COLLECTION
Reimplemented from preco_algo_base.
Definition at line 46 of file algo_threshold.hh.
References DATA_STRUCT::THRES_WIN_PULSE_COLLECTION.
00046 {return DATA_STRUCT::THRES_WIN_PULSE_COLLECTION;};
double algo_threshold::_adc_thres [protected] |
A variable holder for a user-defined absolute ADC threshold value.
Definition at line 61 of file algo_threshold.hh.
Referenced by algo_threshold(), reco(), and set_adc_threshold().
char decoder_base::_buf[200] [protected, inherited] |
char buffer for message manipulation
Definition at line 46 of file decoder_base.hh.
Referenced by reco_wf::analyze(), pulse_viewer::analyze(), algo_slow_readout_decoder::check_event_quality(), storage_manager::close(), bin_io_handler::close(), decoder_manager::decode(), algo_slow_readout_decoder::decode_ch_word(), algo_pmt_xmit::decode_ch_word(), algo_slow_readout_decoder::decode_event_header(), pulse_viewer::get_waveform(), ana_processor::initialize(), pulse_viewer::next_pulse(), storage_manager::open(), bin_io_handler::open(), storage_manager::prepare_tree(), pulse_viewer::previous_pulse(), algo_slow_readout_decoder::print_adc_values(), algo_tpc_xmit::process_ch_word(), algo_slow_readout_decoder::process_ch_word(), algo_pmt_xmit::process_ch_word(), algo_fem_decoder_base::process_fem_header(), algo_xmit_decoder::process_header(), algo_slow_readout_decoder::process_header(), algo_slow_readout_decoder::process_word(), bin_io_handler::read_multi_word(), bin_io_handler::read_word(), and ana_processor::run().
std::string decoder_base::_name [protected, inherited] |
class name holder
Definition at line 53 of file decoder_base.hh.
Referenced by algo_base::algo_base(), algo_fem_decoder_base::algo_fem_decoder_base(), algo_fixed_window::algo_fixed_window(), algo_slow_readout_decoder::algo_slow_readout_decoder(), algo_threshold(), algo_tpc_huffman::algo_tpc_huffman(), algo_trig_decoder::algo_trig_decoder(), ana_base::ana_base(), ana_processor::ana_processor(), beamgate_debugger::beamgate_debugger(), bin_io_handler::bin_io_handler(), decoder_base::class_name(), led_pulse_analyzer::led_pulse_analyzer(), led_pulse_selector::led_pulse_selector(), pmt_slow_encoder::pmt_slow_encoder(), pmtbaseline::pmtbaseline(), pmtbaseline_ana::pmtbaseline_ana(), preco_algo_base::preco_algo_base(), pulse_analyzer::pulse_analyzer(), pulse_reco::pulse_reco(), pulse_selector_base::pulse_selector_base(), pulse_selector_simple::pulse_selector_simple(), pulse_viewer::pulse_viewer(), reco_wf::reco_wf(), storage_manager::storage_manager(), and waveform_sampler::waveform_sampler().
double algo_threshold::_nsigma [protected] |
A variable holder for a multiplicative factor for the pedestal standard deviation to defin the threshold.
Definition at line 69 of file algo_threshold.hh.
Referenced by algo_threshold(), reco(), and set_nsigma().
double preco_algo_base::_ped_mean [protected, inherited] |
Pedestal mean value.
Definition at line 110 of file preco_algo_base.hh.
Referenced by preco_algo_base::ped_mean(), preco_algo_base::preco_algo_base(), reco(), algo_fixed_window::reco(), and preco_algo_base::set_ped_mean().
double preco_algo_base::_ped_rms [protected, inherited] |
Pedestal standard deviation.
Definition at line 113 of file preco_algo_base.hh.
Referenced by preco_algo_base::ped_rms(), preco_algo_base::preco_algo_base(), reco(), and preco_algo_base::set_ped_rms().
pulse_param preco_algo_base::_pulse [protected, inherited] |
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
Definition at line 107 of file preco_algo_base.hh.
Referenced by reco(), preco_algo_base::reset(), and algo_fixed_window::reset().
std::vector<pulse_param> preco_algo_base::_pulse_v [protected, inherited] |
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s).
Definition at line 99 of file preco_algo_base.hh.
Referenced by preco_algo_base::get_npulse(), reco(), algo_fixed_window::reco(), preco_algo_base::reset(), and algo_fixed_window::reset().
bool decoder_base::_verbosity[MSG::MSG_TYPE_MAX] [protected, inherited] |
holder for enabled message levels
Definition at line 51 of file decoder_base.hh.
Referenced by reco_wf::analyze(), algo_slow_readout_decoder::check_event_quality(), storage_manager::close(), decoder_manager::decode(), algo_slow_readout_decoder::decode_ch_word(), algo_pmt_xmit::decode_ch_word(), algo_slow_readout_decoder::decode_event_header(), algo_fem_decoder_base::decode_fem_header(), algo_trig_decoder::decode_trigger_words(), decoder_manager::finalize(), beamgate_debugger::finalize(), ana_processor::finalize(), decoder_manager::initialize(), beamgate_debugger::initialize(), ana_processor::initialize(), storage_manager::open(), beamgate_debugger::prepare_histo(), storage_manager::prepare_tree(), algo_tpc_xmit::process_ch_word(), algo_tpc_huffman::process_ch_word(), algo_slow_readout_decoder::process_ch_word(), algo_pmt_xmit::process_ch_word(), algo_tpc_xmit::process_event_last_word(), algo_pmt_xmit::process_event_last_word(), algo_fem_decoder_base::process_fem_header(), algo_pmt_xmit::process_fem_last_word(), algo_xmit_decoder::process_header(), algo_slow_readout_decoder::process_header(), algo_fem_decoder_base::process_word(), bin_io_handler::read_multi_word(), storage_manager::reset(), beamgate_debugger::reset(), ana_processor::reset(), decoder_manager::run(), ana_processor::run(), decoder_base::set_verbosity(), algo_tpc_xmit::store_event(), and algo_pmt_xmit::store_event().
MSG::Level decoder_base::_verbosity_level [protected, inherited] |
holder for specified verbosity level
Definition at line 52 of file decoder_base.hh.
Referenced by pulse_viewer::analyze(), decoder_base::get_verbosity(), pulse_viewer::initialize(), decoder_manager::initialize(), ana_processor::initialize(), bin_io_handler::read_multi_word(), bin_io_handler::read_word(), and decoder_base::set_verbosity().
1.4.7