#include "Evt.hh" #include "Det.hh" #include "EventFile.hh" #include "TH2.h" #include "TCanvas.h" #include "TRint.h" /* This program plots nanobeacon data from DU-2. We use the known period of the pulser to plot the hit-time modulo the period for each dom. The resulting plot shows a peak in the dom which had the nano-beacon flashing and a (smaller) peak is the adjacent and next-to-adjacent doms. compile with make.py in the same dir. */ int main() { TRint* app = new TRint("app",0,0,0,0,true); // the usual root business Det det("/sps/km3net/users/heijboer/example_files/KM3NeT_00000007_02122015_zest_DR_PMT.detx"); EventFile::read_timeslices = true; EventFile f("/sps/km3net/users/heijboer/example_files/KM3NeT_00000007_00000490.root"); double period = 50000; // 50 microsec map hist_map; // histgrams for each dom-id // normally, we would run over the eventfile by doing // foreach( evt, f ) { use_evt_here; } // // In this case, we want to skip the first 1000 events, so we // take control over the index looping ourselves. for (int idx = 1000; idx<1100; idx++) { f.set_index( idx ); // loads the event print (f.evt); det.apply( f.evt ); foreach ( h, f.evt.hits ) { TH1D*& hist = hist_map[ h.dom_id ]; if ( !hist ) hist = new TH1D(("hist"+str(h.dom_id)).c_str(),"", 200,0,3000 ); hist -> Fill( fmod( h.t, period ) ); } } // plot the histograms. We have to put in some effort to // get the y-axis range correct... int cntr=0; double max=0; TH1D* first; foreach_map( dom_id, hist , hist_map ) { hist->SetLineColor( cntr ); hist->Draw( cntr? "same" : "" ); if (cntr==0) first = hist; max = std::max( max, hist->GetMaximum() ); cntr++; } first -> SetMaximum( max * 2 ); gPad->SetLogy(); gPad->Update(); app->Run(); }