algo_fixed_window Class Reference
[PulseRecoPulseReco]

This class implements fixed_window algorithm to preco_algo_base class. More...

#include <algo_fixed_window.hh>

Inheritance diagram for algo_fixed_window:

preco_algo_base decoder_base List of all members.

Public Member Functions

 algo_fixed_window ()
 Default constructor.
virtual ~algo_fixed_window ()
 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_start_index (size_t index)
 Specify the beginning of fixed pulse time window.
void set_end_index (size_t index)
 Specify the end of fixed pulse time window.
const pulse_paramget_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

size_t _index_start
 index marker for the beginning of the pulse time window
size_t _index_end
 index marker for the end of pulse time window
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

Detailed Description

This class implements fixed_window algorithm to preco_algo_base class.

The algorithm defines a pulse in user-specified time window. A typical usage is to set the beginning of the window to be 0 (= start of the waveform) and integrate over the time of interest. By default, the ending is set to index=0, in which case it uses the ending index of the input waveform (i.e. full integration).

Definition at line 28 of file algo_fixed_window.hh.


Constructor & Destructor Documentation

algo_fixed_window::algo_fixed_window (  ) 

Default constructor.

Definition at line 7 of file algo_fixed_window.cc.

References _index_end, _index_start, decoder_base::_name, and reset().

00007                                      : preco_algo_base() {
00008 //***************************************************************
00009 
00010   _name = "algo_fixed_window";
00011   
00012   reset();
00013 
00014   _index_start = 0;
00015 
00016   _index_end = 0;
00017 
00018 }

virtual algo_fixed_window::~algo_fixed_window (  )  [inline, virtual]

Default destructor.

Definition at line 36 of file algo_fixed_window.hh.

00036 {};


Member Function Documentation

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 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 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_fixed_window::reco ( const std::vector< UShort_t > *  wf  )  [virtual]

Implementation of preco_algo_base::reco() method.

Implements preco_algo_base.

Definition at line 31 of file algo_fixed_window.cc.

References _index_end, _index_start, preco_algo_base::_ped_mean, preco_algo_base::_pulse_v, preco_algo_base::integral(), preco_algo_base::max(), and reset().

00031                                                           {
00032 //***************************************************************
00033 
00034   this->reset();
00035 
00036   _pulse_v[0].t_start = (double)(_index_start);
00037 
00038   if(!_index_end)
00039 
00040     _pulse_v[0].t_end = (double)(wf->size() - 1);
00041 
00042   else
00043 
00044     _pulse_v[0].t_end = (double)_index_end;
00045 
00046   _pulse_v[0].t_max = preco_algo_base::max(wf, _pulse_v[0].peak, _index_start, _index_end);
00047 
00048   _pulse_v[0].peak -= _ped_mean;
00049 
00050   preco_algo_base::integral(wf, _pulse_v[0].area, _index_start, _index_end);
00051 
00052   _pulse_v[0].area = _pulse_v[0].area - ( _pulse_v[0].t_end - _pulse_v[0].t_start + 1) * _ped_mean;
00053 
00054   return true;
00055 
00056 }

void algo_fixed_window::reset (  )  [virtual]

Implementation of preco_algo_base::reset() method.

Reimplemented from preco_algo_base.

Definition at line 20 of file algo_fixed_window.cc.

References preco_algo_base::_pulse, and preco_algo_base::_pulse_v.

Referenced by algo_fixed_window(), and reco().

00020                              {
00021 
00022   if(!(_pulse_v.size()))
00023 
00024     _pulse_v.push_back(_pulse);
00025 
00026   _pulse_v[0].reset_param();
00027 
00028 }

void algo_fixed_window::set_end_index ( size_t  index  )  [inline]

Specify the end of fixed pulse time window.

Definition at line 54 of file algo_fixed_window.hh.

References _index_end.

00054 {_index_end   = index;};

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 algo_fixed_window::set_start_index ( size_t  index  )  [inline]

Specify the beginning of fixed pulse time window.

Definition at line 51 of file algo_fixed_window.hh.

References _index_start.

00051 {_index_start = index;};

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_fixed_window::storage_type (  )  [inline, virtual]

A method to return the storage pulse_collection type enum.

This one returns DATA_STRUCT::FIXED_WIN_PULSE_COLLECTION

Reimplemented from preco_algo_base.

Definition at line 42 of file algo_fixed_window.hh.

References DATA_STRUCT::FIXED_WIN_PULSE_COLLECTION.


Member Data Documentation

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().

size_t algo_fixed_window::_index_end [protected]

index marker for the end of pulse time window

Definition at line 59 of file algo_fixed_window.hh.

Referenced by algo_fixed_window(), reco(), and set_end_index().

size_t algo_fixed_window::_index_start [protected]

index marker for the beginning of the pulse time window

Definition at line 54 of file algo_fixed_window.hh.

Referenced by algo_fixed_window(), reco(), and set_start_index().

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_slow_readout_decoder::algo_slow_readout_decoder(), algo_threshold::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 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(), algo_threshold::reco(), 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(), algo_threshold::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 algo_threshold::reco(), preco_algo_base::reset(), and 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(), algo_threshold::reco(), reco(), preco_algo_base::reset(), and 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().


The documentation for this class was generated from the following files:
Generated on Mon Apr 7 15:35:12 2014 for MyProject by  doxygen 1.4.7