00001
00002 #include "DataFormat-TypeDef.hh"
00003 #include <TF1.h>
00004 #include <TMath.h>
00005
00006 int main(){
00007
00008
00009
00010
00011
00012
00013 TF1* f1 = new TF1("f1","100*(TMath::Poisson(x,[0]))",-1,21);
00014 f1->SetParameter(0,3);
00015
00016
00017 larlight::storage_manager my_storage;
00018
00019 my_storage.set_io_mode(larlight::storage_manager::WRITE);
00020
00021 my_storage.set_out_filename("sample_pmt_waveform.root");
00022
00023 my_storage.open();
00024
00025 if(!my_storage.is_ready_io()) {
00026 std::cerr << "I/O preparation failed!" << std::endl;
00027 }
00028
00029
00030 larlight::event_pmtfifo* my_event_fifo = (larlight::event_pmtfifo*)(my_storage.get_data(larlight::DATA::PMTFIFO));
00031 int run_id = 1;
00032 int subrun_id = 1;
00033
00034 for( int i=0; i<100; i++){
00035
00036 int event_id = i;
00037 my_event_fifo->set_run(run_id);
00038 my_event_fifo->set_subrun(subrun_id);
00039 my_event_fifo->set_event_id(event_id);
00040
00041
00042 int n_channels=30;
00043 my_event_fifo->reserve(n_channels);
00044 for( int ch=0; ch<n_channels; ++ch) {
00045
00046 larlight::pmtfifo wf;
00047
00048 wf.set_channel_number(ch);
00049
00050 wf.reserve(20);
00051 for(size_t wf_index=0; wf_index<20; ++wf_index)
00052
00053 wf.push_back(f1->Eval((double)(wf_index - i%6)));
00054
00055
00056 my_event_fifo->push_back(wf);
00057 }
00058
00059
00060 my_storage.next_event();
00061
00062 }
00063
00064
00065 my_storage.close();
00066 return 1;
00067 }
00068
00069