00001 #include <TSystem.h>
00002 #include <storage_manager.hh>
00003 #include <constants.hh>
00004
00005 int main(){
00006
00007
00008
00009
00010
00011
00012
00013 storage_manager kazu;
00014
00015
00016
00017 kazu.set_verbosity(MSG::DEBUG);
00018
00019
00020
00021 kazu.set_io_mode(storage_manager::READ);
00022
00023
00024 kazu.add_in_filename(Form("%s/dat/sample.root",gSystem->Getenv("ANA_PROC_DIR")));
00025
00026
00027 kazu.open();
00028
00029
00030 if(!kazu.is_open()) {
00031 std::cerr << "File open failed!" << std::endl;
00032 return 0;
00033 }
00034
00035
00036 if(!kazu.is_ready_io()) {
00037 std::cerr << "I/O preparation failed!" << std::endl;
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 int ctr=0;
00057 int highest_adc=-1;
00058 int highest_adc_pmt=-1;
00059 while(kazu.next_event()){
00060
00061 ctr++;
00062 pmt_wf_collection *data=(pmt_wf_collection*)(kazu.get_data(DATA_STRUCT::PMT_WF_COLLECTION));
00063
00064
00065
00066
00067 for(pmt_wf_collection::const_iterator pmt_iter(data->begin());
00068 pmt_iter!=data->end();
00069 ++pmt_iter) {
00070
00071
00072
00073 for(pmt_waveform::const_iterator adc_iter((*pmt_iter).begin());
00074 adc_iter!=(*pmt_iter).end();
00075 ++adc_iter){
00076 if((*adc_iter) > highest_adc){
00077 std::cout
00078 << Form("Found a new highest adc count: %d (Ch=%-3d)",
00079 (*adc_iter),(*pmt_iter).channel_number())
00080 << std::endl;
00081 highest_adc=(*adc_iter);
00082 highest_adc_pmt=(*pmt_iter).channel_number();
00083 }
00084 }
00085 }
00086 }
00087
00088 std::cout
00089 << std::endl
00090 << ctr << " events retrieved!" << std::endl
00091 << "Ch. " << highest_adc_pmt << " had the highest adc count: " << highest_adc
00092 << std::endl << std::endl;
00093
00094 kazu.close();
00095 return 1;
00096 }
00097
00098