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

Public Member Functions | |
| pulse_analyzer () | |
| Default constructor. | |
| virtual | ~pulse_analyzer () |
| Default destructor. | |
| virtual bool | initialize () |
| Initialization method to be called before the analysis event loop. | |
| virtual bool | analyze (storage_manager *storage) |
| Analyze a data event-by-event. | |
| virtual bool | finalize () |
| Finalize method to be called after all events processed. | |
| void | set_pulse_type (DATA_STRUCT::DATA_TYPE type) |
| void | set_output_file (TFile *fout) |
| A setter for analysis output file poitner. | |
| 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 Attributes | |
| TFile * | _fout |
| Analysis output file pointer. | |
| 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 | |
Private Attributes | |
| PMT::word_t | _event_id |
| event id holder | |
| PMT::word_t | _ch_frame_id |
| PMT::word_t | _ch_sample_id |
| PMT::word_t | _disc_id |
| DATA_STRUCT::DATA_TYPE | _pulse_type |
| TTree * | _ch_tree |
| int | _ch |
| int | _nsample |
| double | _wf_charge |
| double | _wf_peak |
| double | _wf_ts |
| double | _wf_tm |
| double | _wf_te |
| double | _ped_mean |
| double | _ped_rms |
This helps to debug/understand pulse reconstruction algorithm output. It is meant to be used interactively and not in a batch mode as it does not store any objects in an output. It allows a user to specify a range for various pulse-wise and event-wise parameters so that one can filter out irrelevant pulses from visualization routine (which can take time). See Analysis/mac/pulse_analyzer.py for an example usage.
Definition at line 45 of file pulse_analyzer.hh.
| pulse_analyzer::pulse_analyzer | ( | ) |
Default constructor.
Definition at line 6 of file pulse_analyzer.cc.
References decoder_base::_name, _pulse_type, and DATA_STRUCT::THRES_WIN_PULSE_COLLECTION.
00006 { 00007 _name="pulse_analyzer"; 00008 _pulse_type=DATA_STRUCT::THRES_WIN_PULSE_COLLECTION; 00009 }
| virtual pulse_analyzer::~pulse_analyzer | ( | ) | [inline, virtual] |
| bool pulse_analyzer::analyze | ( | storage_manager * | storage | ) | [virtual] |
Analyze a data event-by-event.
Implements ana_base.
Definition at line 37 of file pulse_analyzer.cc.
References _ch, _ch_frame_id, _ch_sample_id, _ch_tree, _disc_id, _ped_mean, _ped_rms, _pulse_type, _wf_charge, _wf_peak, _wf_te, _wf_tm, _wf_ts, MSG::ERROR, storage_manager::get_data(), DATA_STRUCT::PMT_WF_COLLECTION, and Message::send().
00037 { 00038 00039 pulse_collection *pulses = (pulse_collection*)(storage->get_data(_pulse_type)); 00040 pmt_wf_collection *wfs = (pmt_wf_collection*)(storage->get_data(DATA_STRUCT::PMT_WF_COLLECTION)); 00041 00042 if(pulses->size()==0) { 00043 Message::send(MSG::ERROR,__FUNCTION__,"No Pulse Found!"); 00044 return false; 00045 } 00046 if(wfs->size()==0) { 00047 Message::send(MSG::ERROR,__FUNCTION__,"No Waveforms Found!"); 00048 return false; 00049 } 00050 00051 // Fill map for this event 00052 for(pulse_collection::const_iterator iter(pulses->begin()); 00053 iter!=pulses->end(); 00054 ++iter){ 00055 _ch = (*iter).channel_number(); 00056 _ch_frame_id = (*iter).frame_id(); 00057 _ch_sample_id = (*iter).timeslice(); 00058 _disc_id = (int)((*iter).disc_id()); 00059 _wf_charge = (*iter).charge(); 00060 _wf_peak = (*iter).pulse_peak(); 00061 _wf_ts = (*iter).start_time(); 00062 _wf_tm = (*iter).max_time(); 00063 _wf_te = (*iter).end_time(); 00064 _ped_mean = (*iter).ped_mean(); 00065 _ped_rms = (*iter).ped_rms(); 00066 _ch_tree->Fill(); 00067 00068 } 00069 00070 return true; 00071 }
| 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 pulse_analyzer::finalize | ( | ) | [virtual] |
Finalize method to be called after all events processed.
Implements ana_base.
Definition at line 73 of file pulse_analyzer.cc.
References _ch_tree, and ana_base::_fout.
00073 { 00074 00075 // This function is called at the end of event loop. 00076 // Do all variable finalization you wish to do here. 00077 // If you need, you can store your ROOT class instance in the output 00078 // file. You have an access to the output file through "_fout" pointer. 00079 //amplitude->Write(); 00080 _fout->cd(); 00081 _ch_tree->Write(); 00082 return true; 00083 }
| 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 pulse_analyzer::initialize | ( | ) | [virtual] |
Initialization method to be called before the analysis event loop.
Implements ana_base.
Definition at line 11 of file pulse_analyzer.cc.
References _ch, _ch_frame_id, _ch_sample_id, _ch_tree, _disc_id, _event_id, ana_base::_fout, _nsample, _ped_mean, _ped_rms, _pulse_type, _wf_charge, _wf_peak, _wf_te, _wf_tm, _wf_ts, and DATA_STRUCT::DATA_TREE_NAME.
00011 { 00012 00013 TString tree_name(Form("%s_tree",DATA_STRUCT::DATA_TREE_NAME[_pulse_type].c_str())); 00014 tree_name.ReplaceAll("pulse_",""); 00015 tree_name.ReplaceAll("_window",""); 00016 00017 _fout->cd(); 00018 00019 _ch_tree = new TTree(tree_name.Data(),""); 00020 _ch_tree->Branch("event_id",&_event_id,"event_id/I"); 00021 _ch_tree->Branch("frame_id",&_ch_frame_id,"frame_id/I"); 00022 _ch_tree->Branch("sample_id",&_ch_sample_id,"sample_id/I"); 00023 _ch_tree->Branch("disc_id",&_disc_id,"disc_id/I"); 00024 _ch_tree->Branch("ch",&_ch,"ch/I"); 00025 _ch_tree->Branch("charge",&_wf_charge,"charge/D"); 00026 _ch_tree->Branch("peak",&_wf_peak,"peak/D"); 00027 _ch_tree->Branch("t_start",&_wf_ts,"t_start/D"); 00028 _ch_tree->Branch("t_max",&_wf_tm,"t_max/D"); 00029 _ch_tree->Branch("t_end",&_wf_te,"t_end/D"); 00030 _ch_tree->Branch("ped_mean",&_ped_mean,"ped_mean/D"); 00031 _ch_tree->Branch("ped_rms",&_ped_rms,"ped_rms/D"); 00032 _ch_tree->Branch("nsample",&_nsample,"nsample/I"); 00033 00034 return true; 00035 }
| void ana_base::set_output_file | ( | TFile * | fout | ) | [inline, inherited] |
A setter for analysis output file poitner.
Definition at line 46 of file ana_base.hh.
References ana_base::_fout.
00046 {_fout=fout;};
| void pulse_analyzer::set_pulse_type | ( | DATA_STRUCT::DATA_TYPE | type | ) | [inline] |
| 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 }
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().
int pulse_analyzer::_ch [private] |
PMT::word_t pulse_analyzer::_ch_frame_id [private] |
PMT::word_t pulse_analyzer::_ch_sample_id [private] |
TTree* pulse_analyzer::_ch_tree [private] |
Definition at line 75 of file pulse_analyzer.hh.
Referenced by analyze(), finalize(), and initialize().
PMT::word_t pulse_analyzer::_disc_id [private] |
PMT::word_t pulse_analyzer::_event_id [private] |
TFile* ana_base::_fout [protected, inherited] |
Analysis output file pointer.
Definition at line 46 of file ana_base.hh.
Referenced by ana_base::ana_base(), waveform_sampler::finalize(), pulse_reco::finalize(), finalize(), pmtbaseline_ana::finalize(), pmtbaseline::finalize(), led_pulse_analyzer::finalize(), beamgate_debugger::finalize(), initialize(), pmt_slow_encoder::pmt_slow_encoder(), pmtbaseline::pmtbaseline(), pmtbaseline_ana::pmtbaseline_ana(), pulse_selector_base::pulse_selector_base(), pulse_selector_simple::pulse_selector_simple(), waveform_sampler::sample_waveform(), ana_base::set_output_file(), and waveform_sampler::waveform_sampler().
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::preco_algo_base(), 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().
int pulse_analyzer::_nsample [private] |
double pulse_analyzer::_ped_mean [private] |
double pulse_analyzer::_ped_rms [private] |
Definition at line 73 of file pulse_analyzer.hh.
Referenced by analyze(), initialize(), pulse_analyzer(), and set_pulse_type().
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().
double pulse_analyzer::_wf_charge [private] |
double pulse_analyzer::_wf_peak [private] |
double pulse_analyzer::_wf_te [private] |
double pulse_analyzer::_wf_tm [private] |
double pulse_analyzer::_wf_ts [private] |
1.4.7