algo_base Class Reference
[AlgorithmAlgorithm]

Decoder algorithm base class. More...

#include <algo_base.hh>

Inheritance diagram for algo_base:

decoder_base algo_fem_decoder_base algo_slow_readout_decoder algo_trig_decoder algo_pmt_xmit algo_tpc_xmit algo_xmit_decoder algo_tpc_huffman List of all members.

Public Member Functions

 algo_base ()
 Default constructor.
virtual ~algo_base ()
 Default destructor.
virtual bool process_word (const PMT::word_t word)=0
 A parent process to run this decoder should pass a stream of words to this method.
virtual void finalize ()
 Function called just after processing word.
virtual PMT::PMT_WORD get_word_class (const PMT::word_t word) const
 Virtual member: this should return word type defined in PMT::PMT_WORD.
void set_debug_mode (bool doit)
 Run utility: set debug mode. Children class defines what-to-do in debug mode.
void set_storage_ptr (storage_manager *storage)
 Expects a storage pointer to be provided from a parent class.
virtual void set_backtrace_mode (size_t nwords=0)
 Run utility: set back-trace mode. One should provide number of words to be stored.
size_t backtrace_mode () const
 Getter for backtrace mode (returns # words specified to store. 0=no backtrace).
virtual bool check_event_quality ()
 A method to check event quality upon saving in the output file.
virtual void reset ()
 Function to reset variables for new usage.
void backtrace () const
 Function to print out stored words in buffer for back-trace purpose.
virtual bool is_event_empty ()=0
 A function to inquire if the local event data holder is empty or not.
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

virtual void init_checker_info ()
 Function to initialize checker information.

Protected Attributes

bool _debug_mode
 Debug mode boolean holder.
bool _bt_mode
 Back-trace mode boolean holder.
storage_manager_storage
 Data storage pointer to be provided by a parent process.
PMT::word_t _checksum
 data checksum
PMT::word_t _nwords
 number of data word counts processed
std::deque< PMT::word_t_bt_words
 processed words to be stored event-wise for back-trace purpose
size_t _bt_nwords
 user defined # of words to be temporarily stored in the buffer
bool _bt_nwords_filled
 run utility boolean to keep a recored of filled buffer
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

Static Protected Attributes

static const size_t BEAM_REF_CHANNEL = 39
 Defines a reference channel for beamgate.
static const size_t BEAM_NWORDS = 21
 Defines # of minimum words to identify beamgate event.
static const size_t FRAME_WIDTH = 8192
 Defines # of ADC samples per readout frame.

Detailed Description

Decoder algorithm base class.

May need a little make up to be a base for encdoer algorithms.

Definition at line 26 of file algo_base.hh.


Constructor & Destructor Documentation

algo_base::algo_base (  )  [inline]

Default constructor.

Definition at line 31 of file algo_base.hh.

References _bt_mode, _bt_nwords, _bt_nwords_filled, _debug_mode, decoder_base::_name, and _storage.

00031               { 
00032     _name="algo_base"; 
00033     _storage=0; 
00034     _debug_mode=false; 
00035     _bt_mode=false;
00036     _bt_nwords=0;
00037     _bt_nwords_filled=false;
00038   };

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

Default destructor.

Definition at line 41 of file algo_base.hh.

00041 {}; 


Member Function Documentation

void algo_base::backtrace (  )  const [inline]

Function to print out stored words in buffer for back-trace purpose.

Definition at line 82 of file algo_base.hh.

References _bt_words, Message::send(), and MSG::WARNING.

Referenced by algo_tpc_huffman::process_word(), and algo_fem_decoder_base::process_word().

00083   {
00084     Message::send(MSG::WARNING,__FUNCTION__,"Dumping a backtrace...");
00085     int ctr=1;
00086     for(std::deque<PMT::word_t>::const_iterator iter(_bt_words.begin());
00087     iter!=_bt_words.end();
00088     ++iter) {
00089       printf("%08x ",(*iter));
00090       if(ctr%8==0 && ctr) std::cout<<std::endl;
00091       ctr++;
00092     }
00093     std::cout<<std::endl<<std::endl;
00094   };

size_t algo_base::backtrace_mode (  )  const [inline]

Getter for backtrace mode (returns # words specified to store. 0=no backtrace).

Definition at line 71 of file algo_base.hh.

References _bt_nwords.

00071 {return _bt_nwords;};

virtual bool algo_base::check_event_quality (  )  [inline, virtual]

A method to check event quality upon saving in the output file.

Children should implement.

Reimplemented in algo_fem_decoder_base, algo_pmt_xmit, algo_slow_readout_decoder, algo_tpc_xmit, and algo_trig_decoder.

Definition at line 76 of file algo_base.hh.

Referenced by decoder_manager::decode().

00076 {return false;};

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;};

virtual void algo_base::finalize (  )  [inline, virtual]

Function called just after processing word.

Definition at line 52 of file algo_base.hh.

00052 {};

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;};

virtual PMT::PMT_WORD algo_base::get_word_class ( const PMT::word_t  word  )  const [inline, virtual]

Virtual member: this should return word type defined in PMT::PMT_WORD.

Reimplemented in algo_fem_decoder_base, algo_pmt_xmit, algo_slow_readout_decoder, algo_tpc_huffman, algo_tpc_xmit, and algo_xmit_decoder.

Definition at line 55 of file algo_base.hh.

References PMT::UNDEFINED_WORD.

Referenced by xmit_event_search::print_word().

00056   {if(word) return PMT::UNDEFINED_WORD; else return PMT::UNDEFINED_WORD;};

void algo_base::init_checker_info (  )  [protected, virtual]

Function to initialize checker information.

Definition at line 6 of file algo_base.cc.

References _checksum, and _nwords.

Referenced by algo_slow_readout_decoder::init_event_info(), algo_trig_decoder::reset(), and reset().

00007 {
00008   _checksum=0x0;
00009   _nwords=0;
00010 }

virtual bool algo_base::is_event_empty (  )  [pure virtual]

A function to inquire if the local event data holder is empty or not.

Implemented in algo_fem_decoder_base, algo_slow_readout_decoder, and algo_trig_decoder.

Referenced by decoder_manager::decode().

virtual bool algo_base::process_word ( const PMT::word_t  word  )  [pure virtual]

A parent process to run this decoder should pass a stream of words to this method.

In this framework, a parent class should be decoder_manager for decoding, for instance. Children should implement to perform (1) decoding and (2) storing event data upon this function call.

Implemented in algo_fem_decoder_base, algo_slow_readout_decoder, algo_tpc_huffman, and algo_trig_decoder.

Referenced by decoder_manager::decode().

virtual void algo_base::reset (  )  [inline, virtual]

Function to reset variables for new usage.

Reimplemented in algo_fem_decoder_base, algo_pmt_xmit, algo_slow_readout_decoder, algo_tpc_huffman, algo_tpc_xmit, and algo_trig_decoder.

Definition at line 79 of file algo_base.hh.

References _storage, and init_checker_info().

Referenced by decoder_manager::finalize(), algo_trig_decoder::reset(), and algo_fem_decoder_base::reset().

00079 { init_checker_info(); _storage=0;};

virtual void algo_base::set_backtrace_mode ( size_t  nwords = 0  )  [inline, virtual]

Run utility: set back-trace mode. One should provide number of words to be stored.

Definition at line 65 of file algo_base.hh.

References _bt_mode, and _bt_nwords.

Referenced by main().

00065                                                   {
00066     _bt_nwords=nwords;
00067     _bt_mode=(bool)(nwords);
00068   };

void algo_base::set_debug_mode ( bool  doit  )  [inline]

Run utility: set debug mode. Children class defines what-to-do in debug mode.

Definition at line 59 of file algo_base.hh.

References _debug_mode.

Referenced by decoder_manager::initialize().

00059 {_debug_mode=doit;};

void algo_base::set_storage_ptr ( storage_manager storage  )  [inline]

Expects a storage pointer to be provided from a parent class.

Definition at line 62 of file algo_base.hh.

References _storage.

Referenced by decoder_manager::initialize().

00062 {_storage=storage;};

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 }


Member Data Documentation

bool algo_base::_bt_mode [protected]

Back-trace mode boolean holder.

Definition at line 109 of file algo_base.hh.

Referenced by algo_base(), algo_trig_decoder::process_word(), algo_tpc_huffman::process_word(), algo_slow_readout_decoder::process_word(), algo_fem_decoder_base::process_word(), and set_backtrace_mode().

size_t algo_base::_bt_nwords [protected]

user defined # of words to be temporarily stored in the buffer

Definition at line 133 of file algo_base.hh.

Referenced by algo_base(), backtrace_mode(), algo_trig_decoder::process_word(), algo_tpc_huffman::process_word(), algo_slow_readout_decoder::process_word(), algo_fem_decoder_base::process_word(), and set_backtrace_mode().

bool algo_base::_bt_nwords_filled [protected]

run utility boolean to keep a recored of filled buffer

Definition at line 134 of file algo_base.hh.

Referenced by algo_base(), algo_trig_decoder::process_word(), algo_tpc_huffman::process_word(), algo_slow_readout_decoder::process_word(), and algo_fem_decoder_base::process_word().

std::deque<PMT::word_t> algo_base::_bt_words [protected]

processed words to be stored event-wise for back-trace purpose

Definition at line 132 of file algo_base.hh.

Referenced by backtrace(), algo_trig_decoder::process_word(), algo_tpc_huffman::process_word(), algo_slow_readout_decoder::process_word(), and algo_fem_decoder_base::process_word().

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

PMT::word_t algo_base::_checksum [protected]

data checksum

Definition at line 126 of file algo_base.hh.

Referenced by algo_tpc_xmit::check_event_quality(), algo_slow_readout_decoder::check_event_quality(), algo_pmt_xmit::check_event_quality(), algo_slow_readout_decoder::decode_event_header(), algo_fem_decoder_base::decode_fem_header(), init_checker_info(), 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(), and algo_trig_decoder::process_word().

bool algo_base::_debug_mode [protected]

Debug mode boolean holder.

Definition at line 108 of file algo_base.hh.

Referenced by algo_base(), algo_slow_readout_decoder::process_ch_word(), algo_fem_decoder_base::process_fem_header(), algo_slow_readout_decoder::process_header(), algo_trig_decoder::process_word(), algo_tpc_huffman::process_word(), algo_slow_readout_decoder::process_word(), algo_fem_decoder_base::process_word(), and set_debug_mode().

std::string decoder_base::_name [protected, inherited]

class name holder

Definition at line 53 of file decoder_base.hh.

Referenced by 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::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().

PMT::word_t algo_base::_nwords [protected]

number of data word counts processed

Definition at line 127 of file algo_base.hh.

Referenced by algo_tpc_xmit::check_event_quality(), algo_slow_readout_decoder::check_event_quality(), algo_pmt_xmit::check_event_quality(), algo_slow_readout_decoder::decode_event_header(), algo_fem_decoder_base::decode_fem_header(), init_checker_info(), 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_pmt_xmit::process_fem_last_word(), algo_trig_decoder::process_word(), and algo_tpc_huffman::process_word().

storage_manager* algo_base::_storage [protected]

Data storage pointer to be provided by a parent process.

Definition at line 121 of file algo_base.hh.

Referenced by algo_base(), algo_slow_readout_decoder::process_ch_word(), algo_tpc_xmit::process_event_header(), algo_tpc_huffman::process_event_header(), algo_pmt_xmit::process_event_header(), algo_trig_decoder::process_word(), algo_slow_readout_decoder::process_word(), reset(), set_storage_ptr(), algo_tpc_xmit::store_event(), and algo_pmt_xmit::store_event().

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

const size_t algo_base::BEAM_NWORDS = 21 [static, protected]

Defines # of minimum words to identify beamgate event.

Definition at line 115 of file algo_base.hh.

Referenced by algo_slow_readout_decoder::apply_beamgate_correction(), and algo_slow_readout_decoder::store_ch_data().

const size_t algo_base::BEAM_REF_CHANNEL = 39 [static, protected]

Defines a reference channel for beamgate.

Definition at line 114 of file algo_base.hh.

Referenced by algo_slow_readout_decoder::store_ch_data().

const size_t algo_base::FRAME_WIDTH = 8192 [static, protected]

Defines # of ADC samples per readout frame.

Definition at line 116 of file algo_base.hh.

Referenced by algo_slow_readout_decoder::apply_beamgate_correction().


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