preco_algo_base Class Reference
[PulseRecoPulseReco]

The base class of pulse reconstruction algorithms. More...

#include <preco_algo_base.hh>

Inheritance diagram for preco_algo_base:

decoder_base algo_fixed_window algo_threshold List of all members.

Public Member Functions

 preco_algo_base ()
 Default constructor.
virtual ~preco_algo_base ()
 Default destructor.
virtual DATA_STRUCT::DATA_TYPE storage_type ()
 A method to return the storage pulse_collection type enum.
virtual void reset ()
 A method to be called event-wise to reset parameters.
virtual bool reco (const std::vector< UShort_t > *wf)=0
 A core method: this executes the algorithm and stores reconstructed parameters in the pulse_param struct object.
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

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

The base class of pulse reconstruction algorithms.

All algorithms should inherit from this calss to be executed by a manager class, pulse_reco. Note that this class does not depend on the rest of the framework except for the use of constants. In order to reconstruct a pulse, all it requires is a std::vector<UShort_t> type object (i.e. raw waveform), waveform pedestal, and its standard deviation. All of these are to be provided by an executer. Reconstructed pulse parameters are stored in the pulse_param struct object.

All methods specified as "virtual" should be implemented by the inherit children class.

This class provides some basic std::vector calculation algorithms such as integral, derivative, max and min algorithms. Inherit children classes are encouraged to use these provided methods when possible.

Definition at line 55 of file preco_algo_base.hh.


Constructor & Destructor Documentation

preco_algo_base::preco_algo_base (  ) 

Default constructor.

Definition at line 25 of file preco_algo_base.cc.

References decoder_base::_name, _ped_mean, _ped_rms, and reset().

00025                                  : decoder_base(), _pulse()
00026 //***************************************************************
00027 {
00028 
00029   _name = "preco_algo_base";
00030   
00031   _ped_mean = _ped_rms = -1;
00032 
00033   reset();
00034 
00035 }

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

Default destructor.

Definition at line 63 of file preco_algo_base.hh.

00063 {};


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]

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]

A getter for the number of reconstructed pulses from the input waveform.

Definition at line 87 of file preco_algo_base.hh.

References _pulse_v.

00087 {return _pulse_v.size();};

const pulse_param * preco_algo_base::get_pulse ( size_t  index = 0  )  const

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]

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]

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]

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]

A getter for the set pedestal mean value.

Definition at line 96 of file preco_algo_base.hh.

References _ped_mean.

00096 {return _ped_mean; };

double preco_algo_base::ped_rms (  )  const [inline]

A getter for the set pedestal standard deviation.

Definition at line 99 of file preco_algo_base.hh.

References _ped_rms.

00099 {return _ped_rms;  };

virtual bool preco_algo_base::reco ( const std::vector< UShort_t > *  wf  )  [pure virtual]

A core method: this executes the algorithm and stores reconstructed parameters in the pulse_param struct object.

Implemented in algo_fixed_window, and algo_threshold.

void preco_algo_base::reset (  )  [virtual]

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

Reimplemented in algo_fixed_window, and algo_threshold.

Definition at line 37 of file preco_algo_base.cc.

References _pulse, _pulse_v, and pulse_param::reset_param().

Referenced by preco_algo_base(), and algo_threshold::reset().

00037                            {
00038 
00039   _pulse.reset_param();
00040 
00041   _pulse_v.clear();
00042 
00043   _pulse_v.reserve(3);
00044   
00045 }

void preco_algo_base::set_ped_mean ( double  v  )  [inline]

A setter for the pedestal mean value.

Definition at line 90 of file preco_algo_base.hh.

References _ped_mean.

00090 { _ped_mean = v; };

void preco_algo_base::set_ped_rms ( double  v  )  [inline]

A setter for the pedestal standard deviation.

Definition at line 93 of file preco_algo_base.hh.

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

A method to return the storage pulse_collection type enum.

A children reco algo class should implement the unique, relevant type to be returned. This base class use the basic one PULSE_COLLECTION.

Reimplemented in algo_fixed_window, and algo_threshold.

Definition at line 70 of file preco_algo_base.hh.

References DATA_STRUCT::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().

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_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(), 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]

Pedestal mean value.

Definition at line 110 of file preco_algo_base.hh.

Referenced by ped_mean(), preco_algo_base(), algo_threshold::reco(), algo_fixed_window::reco(), and set_ped_mean().

double preco_algo_base::_ped_rms [protected]

Pedestal standard deviation.

Definition at line 113 of file preco_algo_base.hh.

Referenced by ped_rms(), preco_algo_base(), algo_threshold::reco(), and set_ped_rms().

pulse_param preco_algo_base::_pulse [protected]

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(), reset(), and algo_fixed_window::reset().

std::vector<pulse_param> preco_algo_base::_pulse_v [protected]

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 get_npulse(), algo_threshold::reco(), algo_fixed_window::reco(), 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().


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