decoder.cc File Reference

#include "Decoder-TypeDef.hh"
#include "Algorithm-TypeDef.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 5 of file decoder.cc.

References decoder_manager::add_input_filename(), FORMAT::BINARY, decoder_manager::debug_mode(), MSG::NORMAL, decoder_manager::reset(), decoder_manager::run(), algo_base::set_backtrace_mode(), decoder_manager::set_data_to_write(), decoder_manager::set_decoder(), decoder_manager::set_format(), decoder_manager::set_output_filename(), and decoder_base::set_verbosity().

Referenced by main().

00005                                {
00006 
00007   //
00008   // Example decoder routine
00009   //
00010   
00011   if(argc<2){
00012     std::cerr << "    Usage: decoder $INPUT_FILE" << std::endl << std::endl;
00013     return 1;
00014   }
00015 
00016 
00017   // Use a simple "out.root" for an output file name
00018 
00019   // Create the decoder instance
00020   decoder_manager decoder;
00021 
00022   // Choose your decoder algorithm
00023   algo_base* myalgo = new algo_xmit_decoder();
00024   //algo_base* myalgo = new algo_slow_readout_decoder();
00025   //algo_base* myalgo = new algo_trig_decoder();
00026 
00027   // If needed, set # words for backtrace.
00028   // In case of an error, decoder will print out this number of words being processed
00029   // prior to encountering the error word.
00030   myalgo->set_backtrace_mode(200);
00031 
00032   // Attach a decoder algorithm ... currently xmit, slow, or trigger
00033   decoder.set_decoder(myalgo);
00034 
00035   // Set data type to be written in the output
00036   decoder.set_data_to_write(DATA_STRUCT::WF_COLLECTION);
00037   //decoder.set_data_to_write(DATA_STRUCT::TRIG_INFO);
00038 
00039   // Set input file format ... ASCII or BINARY
00040   //decoder.set_format(FORMAT::ASCII);
00041   decoder.set_format(FORMAT::BINARY);
00042 
00043   // Set input file path
00044   decoder.add_input_filename(argv[1]);
00045 
00046   // Set output file path ... simple out.root here
00047   decoder.set_output_filename("out.root");
00048 
00049   // Set message level
00050   //    - DEBUG   ... for debugging purpose. Very verbose.
00051   //    - INFO    ... for validation purpose. Spits out summary info of channel/event
00052   //    - NORMAL  ... default mode. Only spits out run-relevant information
00053   //    - WARNING ... suppress NORMAL information
00054   //    - ERROR   ... suppress WARNING information
00055   // For the given info level, all lower level information will be suppressed.
00056   //decoder.set_verbosity(MSG::DEBUG);
00057   decoder.set_verbosity(MSG::NORMAL);
00058 
00059   // Set debug mode True if you wish to continue in the decoding event
00060   // loop with exception handling. This avoids saving an event with
00061   // missing event words or conflicting encoding algorithm, and continue
00062   // in the decoding event loop. When turned off, the program exits as
00063   // soon as it encounters any issue.
00064   //decoder.debug_mode(false);
00065   decoder.debug_mode(true);
00066 
00067   // Finish configuration. Now run it.
00068   decoder.run();
00069     
00070   // Reset properly before exits.
00071   decoder.reset();
00072 
00073   return 0;
00074 }


Generated on Mon Apr 7 15:35:12 2014 for MyProject by  doxygen 1.4.7