1 #ifndef __JRUNHISTOGRAMS__ 
    2 #define __JRUNHISTOGRAMS__ 
   23 #include "TProfile2D.h" 
   26 #include "TPaveText.h" 
   31 #include "TDirectory.h" 
   33 #include "TObjArray.h" 
   34 #include "TObjString.h" 
   37 using namespace KM3NETDAQ ;
 
   38 using namespace JLANG ;   
 
   40 using namespace JSUPPORT ;
 
   50   TAxis *axis = h->GetXaxis();
 
   52   int bins = axis->GetNbins();
 
   54   Axis_t from = axis->GetXmin();
 
   56   Axis_t to = axis->GetXmax();
 
   58   Axis_t width = (to - from) / bins;
 
   60   Axis_t *new_bins = 
new Axis_t[bins + 1];
 
   62   for (
int i = 0; i <= bins; i++) {
 
   64     new_bins[i] = TMath::Power(10, from + i * width);
 
   68   axis->Set(bins, new_bins);
 
   83   h -> Scale(n / h -> Integral()) ;
 
  135     h_fifo_per_dom = NULL ;
 
  137     h_daq_status_per_dom = NULL ;
 
  139     h_hrv_per_dom = NULL ;
 
  141     h_rate_summary = NULL ;
 
  143     h_pmt_rate_distribution = NULL ;
 
  145     m_mean_summary_rate = NULL ;
 
  147     m_summary_rate_vs_time = NULL ;
 
  149     m_summary_rate_distribution = NULL ;
 
  155     m_module_rates_vs_time = NULL ;
 
  165     int first_frame = frame_index_range.
first ;
 
  167     int last_frame = frame_index_range.
second ;
 
  169     int n_frames = last_frame - first_frame + 1 ;
 
  173     double min_time = -0.5 * frame_time_s ;
 
  175     double max_time = (frame_index_range.
second - frame_index_range.
first + 0.5 ) * frame_time_s ;
 
  177     init_h_fifo (n_frames , first_frame , last_frame) ;
 
  179     init_h_daq_status (n_frames , first_frame , last_frame) ;
 
  181     init_h_hrv (n_frames , first_frame , last_frame) ;
 
  183     init_h_fifo_per_dom (du_ids , modules_per_string) ;
 
  185     init_h_daq_status_per_dom (du_ids , modules_per_string) ;
 
  187     init_h_hrv_per_dom (du_ids , modules_per_string) ;
 
  189     init_h_rate_summary (du_ids , modules_per_string) ;
 
  191     init_h_pmt_rate_distribution() ;
 
  193     init_m_mean_summary_rate (modules_per_string) ;
 
  195     init_m_summary_rate_vs_time (n_frames , min_time , max_time) ;
 
  197     init_m_summary_rate_distribution () ;
 
  199     init_m_fifo_full (n_frames , min_time , max_time) ;
 
  201     init_m_hrv (n_frames , min_time , max_time) ;
 
  203     init_m_module_rates_vs_time (n_frames , min_time , max_time) ;     
 
  205     init_h_rate (n_frames , first_frame , last_frame) ;
 
  216   void init_h_fifo (
int n_frames , 
int first_frame , 
int last_frame){
 
  220     string title = 
MAKE_STRING (
"FIFO status ; slice number ; Average number of PMTs per module with FIFO almost full") ;
 
  222     h_fifo = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  237     string title = 
MAKE_STRING (
"DAQ status ; slice number ; Number of DOMS with wrong DAQ status of packets") ;
 
  239     h_daq_status = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  250   void init_h_hrv (
int n_frames , 
int first_frame , 
int last_frame){
 
  254     string title = 
MAKE_STRING (
"High Rate Veto ; slice number ; Average number of PMTs per module in HRV regime") ;
 
  256     h_hrv = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  270     string title = 
MAKE_STRING (
" FIFO ; String ; Floor ; Number of slices with FIFO almost full ") ;
 
  272     h_fifo_per_dom = 
new TH2D (name.c_str() , title.c_str() , *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
  284     string name = 
MAKE_STRING (
"h_daq_status_per_dom") ;
 
  286     string title = 
MAKE_STRING (
" DAQ Status ; String ; Floor ; Number of slices with wrong DAQ status of packets ") ;
 
  288     h_daq_status_per_dom = 
new TH2D (name.c_str() , title.c_str() , *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
  302     string title = 
MAKE_STRING (
" HRV ; String ; Floor ; Number of slices with at least 1 PMT in HRV ") ;
 
  304     h_hrv_per_dom = 
new TH2D (name.c_str() , title.c_str() , *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
  318     string title = 
MAKE_STRING (
" Summary slices ; String ; Floor ; Mean rate over all summary slices [kHz] ") ;
 
  320     h_rate_summary = 
new TH2D (name.c_str() , title.c_str() , *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
  329     string name = 
MAKE_STRING (
"h_pmt_rate_distribution") ;
 
  331     string title = 
MAKE_STRING (
" PMT rate distribution from summary slices ; rate [kHz] ; Counts ") ;    
 
  333     h_pmt_rate_distribution = 
new TH1D (name.c_str() , title.c_str() , 40 , 0 , log10(1000)) ;
 
  335     BinLogX (h_pmt_rate_distribution) ;
 
  337     h_pmt_rate_distribution -> SetMinimum(1) ;
 
  348     string name = 
MAKE_STRING (
"%/h_mean_summary_rate") ;
 
  350     string title = 
MAKE_STRING (
" ; PMT ; Floor ; rate [kHz] ") ;
 
  367     string name = 
MAKE_STRING ( 
"%/h_rate_vs_time_Summaryslice" ) ;
 
  369     string title = 
MAKE_STRING (
"Summary slices ; frame index ; TDC channel ; rate [Hz]") ;
 
  381       string name = 
MAKE_STRING (
"%/h_pmt_rate_distributions_Summaryslice") ;
 
  383       string title = 
MAKE_STRING (
"Summaryslice ; rate [kHz] ; TDC channel ; counts ") ;    
 
  385       TH2D* h_summary_rate_distribution = 
new TH2D (name.c_str() , title.c_str() ,
 
  386                                            40 , 0 , log10(1000),
 
  389       BinLogX (h_summary_rate_distribution) ;
 
  406     string name = 
MAKE_STRING ( 
"%/h_fifo_almost_full" ) ;
 
  408     string title = 
MAKE_STRING (
" ; frame index ; TDC channel ; FIFO almost full") ;
 
  423   void init_m_hrv(
int n_frames , 
double first_frame , 
double last_frame){
 
  427     string title = 
MAKE_STRING (
" ; frame index ; TDC channel ; HRV ") ;
 
  444     string name = 
MAKE_STRING ( 
"%/h_module_rate_vs_time_Summaryslice") ;
 
  446     string title = 
MAKE_STRING (
"Summaryslice ; time since run start [s] ; rate [Hz]" ) ;
 
  448     m_module_rates_vs_time = 
new JManager < string , TProfile > (
new TProfile (name.c_str() , title.c_str() , int(n_frames/1) , min_time , max_time)) ;
 
  461   void init_h_rate (
int n_frames , 
int first_frame , 
int last_frame){
 
  463     string name = 
MAKE_STRING (
"h_rate_Summaryslice") ;
 
  465     string title = 
MAKE_STRING (
"Average module rate (Summaryslice) ; slice number ; rate [Hz]") ;
 
  467     h_rate = 
new TProfile ( name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  549     h_slice_start_time.resize (number_of_timeslice_types , NULL) ;
 
  551     h_rate.resize (number_of_timeslice_types , NULL) ;
 
  553     h_active_modules.resize (number_of_timeslice_types , NULL) ;
 
  555     h_du_active_modules.resize (number_of_timeslice_types , NULL) ;
 
  557     h_dom_mean_rates.resize (number_of_timeslice_types , NULL) ;
 
  559     h_ToT_255_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  561     h_ToT_255_Floor_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  563     h_ToT_255_Floor_vs_time_2.resize (number_of_timeslice_types , NULL) ;
 
  565     m_mean_ToT.resize (number_of_timeslice_types , NULL) ;
 
  567     m_ToT_255.resize (number_of_timeslice_types , NULL) ;
 
  569     m_module_rates_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  571     m_pmt_tot_distributions.resize (number_of_timeslice_types , NULL) ;
 
  573     m_pmt_rate_distributions.resize (number_of_timeslice_types , NULL) ;
 
  575     m_pmt_rates_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  577     m_pmt_tot_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  579     m_pmt_dt_consecutive_hits.resize (number_of_timeslice_types , NULL) ;
 
  594     int first_frame = frame_index_range.
first ;
 
  596     int last_frame = frame_index_range.
second ;
 
  598     int n_frames = last_frame - first_frame + 1 ;
 
  602     double min_time = -0.5 * frame_time_s ;
 
  604     double max_time = (frame_index_range.
second - frame_index_range.
first + 0.5 ) * frame_time_s ;
 
  606     init_h_slice_starting_time (ts_type , n_frames , first_frame , last_frame , ts_name) ;
 
  608     init_h_rate (ts_type , n_frames , first_frame , last_frame , ts_name) ;
 
  610     init_h_active_modules (ts_type , n_frames , first_frame , last_frame , ts_name) ;
 
  612     init_h_du_active_modules (ts_type , du_ids , n_frames , first_frame , last_frame , ts_name) ;
 
  614     init_h_dom_mean_rates (ts_type , du_ids , modules_per_string , ts_name) ;
 
  616     init_h_ToT_255_vs_time (ts_type , ts_name) ;
 
  618     init_h_ToT_255_Floor_vs_time (ts_type , modules_per_string , ts_name) ;
 
  620     init_h_ToT_255_Floor_vs_time_2 (ts_type , modules_per_string , ts_name) ;
 
  622     init_m_mean_ToT (ts_type , modules_per_string , ts_name) ;
 
  624     init_m_ToT_255 (ts_type , modules_per_string , ts_name) ;
 
  626     init_m_module_rates_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ;
 
  628     init_m_pmt_tot_distributions (ts_type , ts_name) ;
 
  630     init_m_pmt_rate_distributions (ts_type , ts_name) ;
 
  632     init_m_pmt_tot_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ; 
 
  634     init_m_pmt_rates_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ;
 
  636     init_m_pmt_dt_consecutive_hits(ts_type , ts_name) ;
 
  651     for (
typename vector < 
JManager < string , TH2D >* >::const_iterator it = m_pmt_tot_distributions.begin() ; it != m_pmt_tot_distributions.end() ; ++it , ++i){
 
  659           TPRegexp r (
"(\\w+)/(\\DU)(\\d+)/(F)(\\d+)") ;
 
  661           TObjArray* o = r.MatchS(s) ;
 
  663           int String = ((TObjString *)o->At(3))->GetString().Atoi();
 
  665           int Floor = ((TObjString *)o->At(5))->GetString().Atoi();
 
  667           for (
int pmt = 1 ; pmt <= (j -> second) -> GetYaxis() -> GetNbins() ; pmt++){
 
  669             (*m_mean_ToT[i])[
MAKE_STRING(
"Detector/DU" + 
to_string(String))] -> Fill(Floor , (j->second) -> GetYaxis() -> GetBinCenter(pmt) , (j -> second) -> ProjectionX (
"" , pmt , pmt) -> GetMean () ) ;
 
  692     string name = 
MAKE_STRING (
"h_slice_starting_time_" + ts_name ) ;
 
  694     string title = 
MAKE_STRING (
"Slice Starting Time (" + ts_name + 
"); slice number ; time since first slice [s]") ;
 
  696     h_slice_start_time[ts_type] = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  709   void init_h_rate (
int ts_type , 
int n_frames , 
int first_frame , 
int last_frame , std::string ts_name){
 
  713     string title = 
MAKE_STRING (
"Average module rate ("+ts_name+
") ; slice number ; rate [Hz]") ;
 
  715     h_rate[ts_type] = 
new TProfile ( name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  730     string name = 
MAKE_STRING (
"h_active_DOMS_" + ts_name) ;
 
  732     string title = 
MAKE_STRING (
" Active modules (" + ts_name + 
"); slice number ; fraction of active modules") ;
 
  734     h_active_modules[ts_type] = 
new TProfile ( name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  750     string name = 
MAKE_STRING (
"h_du_active_DOMS_" + ts_name) ;
 
  752     string title = 
MAKE_STRING (
"Active modules in DU (" + ts_name + 
"); slice number ; DU number ; number of active modules") ;
 
  754     h_du_active_modules[ts_type] = 
new TProfile2D (name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 , *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 ) ;
 
  767     string name = 
MAKE_STRING (
"h_mean_dom_rates_" + ts_name) ;
 
  769     string title = 
MAKE_STRING (ts_name + 
" ; Floor number ; DU number ; time slice averaged rate [Hz]") ;
 
  771     h_dom_mean_rates[ts_type] = 
new TH2D (name.c_str() , title.c_str() , *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , 0.5 + modules_per_string) ;
 
  783     string name = 
MAKE_STRING (
"h_ToT_255_vs_time_" + ts_name) ;
 
  785     string title = 
MAKE_STRING (
" (" + ts_name + 
") Hits with ToT = 255 ns. All PMTs, all timeslices ; Time since beginning of slice [ns] ; counts ") ;
 
  787     h_ToT_255_vs_time[ts_type] = 
new TH1D (name.c_str() , title.c_str() , 100 , 0 , log10(
getFrameTime())) ;
 
  789     BinLogX (h_ToT_255_vs_time[ts_type]) ;
 
  802     string name = 
MAKE_STRING (
"h_ToT_255_Floor_vs_time_" + ts_name) ;
 
  804     string title = 
MAKE_STRING (
" (" + ts_name + 
") Hits with ToT = 255 ns. All DUs , all timeslices ; Time since beginning of slice [ns] ; Floor number ; counts ") ;
 
  806     h_ToT_255_Floor_vs_time[ts_type] = 
new TH2D (name.c_str() , title.c_str() , 100 , 0 , log10(
getFrameTime()) , modules_per_string , 0.5 , 0.5 + modules_per_string) ;
 
  808     BinLogX(h_ToT_255_Floor_vs_time[ts_type]) ;
 
  821     string name = 
MAKE_STRING (
"h_ToT_255_Floor_vs_time_2_" + ts_name) ;
 
  823     string title = 
MAKE_STRING (
" (" + ts_name + 
") Hits with ToT = 255 ns. All DUs , all timeslices ; Time since beginning of slice [ns] ; Floor number ; counts ") ;
 
  825     h_ToT_255_Floor_vs_time_2[ts_type] = 
new TH2D (name.c_str() , title.c_str() , 100 , 0 , 
getFrameTime() , modules_per_string , 0.5 , 0.5 + modules_per_string) ;
 
  838     string name = 
MAKE_STRING (
"%/h_mean_ToT_" + ts_name) ;
 
  840     string title = 
MAKE_STRING (ts_name + 
" ; Floor number ; TDC channel ; mean ToT over all timeslices [ns] ") ;
 
  842     m_mean_ToT[ts_type] = 
new JManager < string , TH2D > (
new TH2D (name.c_str() , title.c_str() , modules_per_string , 0.5 , 0.5 + modules_per_string , 
NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5)) ;
 
  855     string name = 
MAKE_STRING (
"%/h_ToT_255_" + ts_name) ;
 
  857     string title = 
MAKE_STRING (ts_name + 
" ; Floor number ; TDC channel ; number of hits with ToT = 255 ns ") ;
 
  859     m_ToT_255[ts_type] = 
new JManager < string , TH2D > (
new TH2D (name.c_str() , title.c_str() , modules_per_string , 0.5 , 0.5 + modules_per_string , 
NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5)) ;
 
  873     string name = 
MAKE_STRING ( 
"%/h_module_rate_vs_time_" + ts_name ) ;
 
  875     string title = 
MAKE_STRING (ts_name + 
" ; time since run start [s] ; rate [Hz]" ) ;
 
  877     m_module_rates_vs_time[ts_type] = 
new JManager < string , TProfile > (
new TProfile (name.c_str() , title.c_str() , int(n_frames/600) , min_time , max_time)) ;
 
  889     string name = 
MAKE_STRING (
"%_" + ts_name + 
"_2SToT") ;
 
  891     string title = 
MAKE_STRING (ts_name + 
" ; TDC channel ; ToT [ns] ; counts") ;
 
  895                                                                                  max_ToT - min_ToT + 1 , min_ToT - 0.5 , max_ToT + 0.5)) ;
 
  907       string name = 
MAKE_STRING (
"%/h_pmt_rate_distributions_" + ts_name) ;
 
  909       string title = 
MAKE_STRING (ts_name + 
" ; rate [kHz] ; TDC channel ; counts ") ;    
 
  911       TH2D* h_pmt_rate_distributions = 
new TH2D (name.c_str() , title.c_str() ,
 
  915       BinLogX (h_pmt_rate_distributions) ;
 
  932       string name = 
MAKE_STRING (
"%/ToT_vs_time_" + ts_name) ;
 
  934       string title = 
MAKE_STRING (ts_name + 
" ; time [s] ; TDC channel ; ToT [ns]") ;
 
  951     string name = 
MAKE_STRING ( 
"%/h_rate_vs_time_" + ts_name ) ;
 
  953     string title = 
MAKE_STRING (ts_name + 
" ; time since run start [s] ; TDC channel ; rate [Hz]") ;
 
  967     string name = 
MAKE_STRING (
"%/h_dt_consecutive_hits_" + ts_name) ;
 
  969     string title = 
MAKE_STRING (ts_name + 
" ; log(dt [ns]) ; TDC channel ; counts") ;
 
 1021     h_Trigger_bit_event = NULL ;
 
 1023     h_Trigger_bit_hit = NULL ;
 
 1025     h_Snapshot_hits = NULL ;
 
 1027     h_Triggered_hits = NULL ;
 
 1029     h_Snapshot_hits_per_module = NULL ;
 
 1031     h_Triggered_hits_per_module = NULL ;
 
 1033     h_Trigger_map = NULL ;
 
 1035     m_trigger_rates = NULL ;
 
 1037     m_Snapshot_hits_per_pmt = NULL ;
 
 1039     m_Trigger_map = NULL ;
 
 1041     h_pmt_distribution_triggered_hits = NULL ;
 
 1043     h_tot_distribution_triggered_hits = NULL ;
 
 1045     h_pmt_distribution_snapshot_hits = NULL ;
 
 1047     h_tot_distribution_snapshot_hits = NULL ;
 
 1049     h_n_triggered_hits_distribution = NULL ;
 
 1061     int first_frame = frame_index_range.
first ;
 
 1063     int last_frame = frame_index_range.
second ;
 
 1065     int n_frames = last_frame - first_frame + 1 ;
 
 1067     int n_pmts = du_ids.size() * modules_per_string * 
NUMBER_OF_PMTS ;
 
 1069     init_h_Trigger_bit_event () ;
 
 1071     init_h_Trigger_bit_hit () ;
 
 1073     init_h_Snapshot_hits () ;
 
 1075     init_h_Triggered_hits () ;
 
 1077     init_h_Snapshot_hits_per_module (modules_per_string , du_ids) ;
 
 1079     init_h_Triggered_hits_per_module (modules_per_string , du_ids) ;
 
 1081     init_m_trigger_rates(first_frame , last_frame) ;
 
 1083     init_m_Snapshot_hits_per_pmt (modules_per_string) ;
 
 1085     init_m_Trigger_map (modules_per_string , n_frames , first_frame , last_frame) ;
 
 1087     init_h_Trigger_map (modules_per_string ,  n_frames , first_frame , last_frame) ;
 
 1089     init_h_pmt_distribution_triggered_hits() ;
 
 1091     init_h_tot_distribution_triggered_hits() ;
 
 1093     init_h_pmt_distribution_snapshot_hits() ;
 
 1095     init_h_tot_distribution_snapshot_hits() ;
 
 1097     init_h_n_triggered_hits_distribution (n_pmts) ;
 
 1106     string name = 
MAKE_STRING (
"h_Trigger_bit_event") ;
 
 1108     string title = 
MAKE_STRING (
"Number of events as a function of trigger bit in event ; Trigger Bit ; Counts ") ;
 
 1116         h_Trigger_bit_event -> GetXaxis() -> SetBinLabel(i+1 , 
getTriggerName(i) ) ;
 
 1120         h_Trigger_bit_event -> GetXaxis() -> SetBinLabel(i+1 , 
"" ) ;
 
 1126      h_Trigger_bit_event -> GetXaxis() -> LabelsOption(
"v") ; 
 
 1137     string title = 
MAKE_STRING (
"Number of hits per event as a function of trigger bit in hit ; Trigger Bit ; #Events ") ;
 
 1145         h_Trigger_bit_hit -> GetXaxis() -> SetBinLabel(i+1 , 
getTriggerName(i) ) ;
 
 1149         h_Trigger_bit_hit -> GetXaxis() -> SetBinLabel(i+1 , 
"" ) ;
 
 1155      h_Trigger_bit_hit -> GetXaxis() -> LabelsOption(
"v") ; 
 
 1166     string title = 
MAKE_STRING (
" Snapshot hits ; Number of hits ; Counts/#Events ") ;
 
 1168     h_Snapshot_hits = 
new TH1D (name.c_str() , title.c_str() , 50, 0, 4 ) ;
 
 1181     string title = 
MAKE_STRING (
" Triggered hits ; Number of hits ; Counts/#Events ") ;
 
 1183     h_Triggered_hits = 
new TH1D (name.c_str() , title.c_str() , 50 , 0, 4 ) ;
 
 1196     string name = 
MAKE_STRING (
"h_Snapshot_hits_per_module") ;
 
 1198     string title = 
MAKE_STRING (
" ; String ; Floor ; Number of snapshot hits ") ;
 
 1200     h_Snapshot_hits_per_module = 
new TH2D (name.c_str() , title.c_str() ,
 
 1201                                            *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 ,
 
 1202                                            modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
 1213     string name = 
MAKE_STRING (
"h_Triggered_hits_per_module") ;
 
 1215     string title = 
MAKE_STRING (
" ; String ; Floor ; Number of triggered hits ") ;
 
 1217     h_Triggered_hits_per_module = 
new TH2D (name.c_str() , title.c_str() ,
 
 1218                                            *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 ,
 
 1219                                            modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
 1234     string title = 
MAKE_STRING (
" ; Frame index ; DOM ; Number of triggered hits ") ;
 
 1236     h_Trigger_map = 
new TH2D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ,
 
 1237                               modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
 1250     int frames_per_bin = seconds_per_bin / 
getFrameTime() / 1e-9 ;
 
 1252     int n_bins = (last_frame - first_frame) / frames_per_bin ;
 
 1254     string title = 
MAKE_STRING (
" ; Frame Index ; rate [Hz] ") ;
 
 1256     m_trigger_rates = 
new JManager <string , TH1D> (
new TH1D(
"h_rate_%" , title.c_str() , n_bins , -0.5 , last_frame - first_frame + 0.5)) ;
 
 1267     string name = 
MAKE_STRING (
"%/h_Snapshot_hits_per_pmt") ;
 
 1269     string title = 
MAKE_STRING (
" ; PMT ; Floor ; Number of snapshot hits ") ;
 
 1272                                                                          modules_per_string , 0.5 , modules_per_string + 0.5 ) ) ;
 
 1287     string title = 
MAKE_STRING (
" ; Frame index ; DOM ; Mean number of triggered hits per event") ;
 
 1289     m_Trigger_map = 
new JManager < string , TH2D > ( 
new TH2D (name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 ,
 
 1290                                                                modules_per_string , 0.5 , modules_per_string + 0.5)) ;
 
 1301     string name = 
MAKE_STRING (
"h_pmt_distribution_triggered_hits") ;
 
 1303     string title = 
MAKE_STRING (
" ; PMT number ; Counts [a.u.]") ;
 
 1314     string name = 
MAKE_STRING (
"h_tot_distribution_triggered_hits") ;
 
 1316     string title = 
MAKE_STRING (
" ; ToT [ns] ; Counts [a.u.]") ;
 
 1318     h_tot_distribution_triggered_hits = 
new TH1D (name.c_str() , title.c_str() , 255 , 0.5 , 255.5 ) ;
 
 1327     string name = 
MAKE_STRING (
"h_pmt_distribution_snapshot_hits") ;
 
 1329     string title = 
MAKE_STRING (
" ; PMT number ; Counts [a.u.]") ;
 
 1340     string name = 
MAKE_STRING (
"h_tot_distribution_snapshot_hits") ;
 
 1342     string title = 
MAKE_STRING (
" ; ToT [ns] ; Counts [a.u.]") ;
 
 1344     h_tot_distribution_snapshot_hits = 
new TH1D (name.c_str() , title.c_str() , 255 , 0.5 , 255.5 ) ;
 
 1355     string name = 
MAKE_STRING (
"h_n_triggered_hits_distribution") ;
 
 1357     string title = 
MAKE_STRING (
" ; Number of hits ; Counts") ;
 
 1359     h_n_triggered_hits_distribution = 
new TH1D (name.c_str() , title.c_str() , n_pmts , 0.5 , n_pmts + 0.5 ) ;
 
 1409     h_summary.initialize(du_ids , modules_per_string , range) ;
 
 1423     const string prefix = 
"KM3NETDAQ::JDAQ" ;
 
 1425     string ts_name = T::Class_Name() ;
 
 1427     string::size_type pos = ts_name.find(prefix);
 
 1429     if (pos != string::npos) ts_name.replace(ts_name.find(prefix) , prefix.length() , 
"") ;
 
 1431     h_timeslice.initialize(du_ids , modules_per_string , range , index , ts_name) ;
 
 1440     h_trigger.initialize (du_ids , range , modules_per_string) ;
 
 1454     if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
 
 1456     f.cd (dirname.c_str()) ;
 
 1458     for (
int i=0 ; i < (int)table.size() ; i++){
 
 1460       for (
int j=0 ; j< (int)table[i].size() ; j++){
 
 1462         if (table[i][j]) table [i][j] -> Write() ;
 
 1480     if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
 
 1482     f.cd (dirname.c_str()) ;
 
 1484     for (
int i=0 ; i < (int)table.size() ; i++){
 
 1486       if (table[i]) table[i] -> Write() ;
 
 1499   template <
class T , 
class V>
 
 1502     if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
 
 1504     f.cd (dirname.c_str()) ;
 
 1508       i -> second -> Write() ;
 
 1519   template <
class T , 
class V>
 
 1524       if (i -> second -> GetTitle()){
 
 1526         std::string buffer = i -> second -> GetTitle() ;
 
 1528         string::size_type ipos = buffer.find(wc) ;
 
 1530         if (ipos!=std::string::npos){
 
 1536           buffer.replace(ipos, 1, os.str());
 
 1538           i -> second -> SetTitle(buffer.c_str()) ;
 
 1553   template < 
class T , 
class V >
 
 1558       std::string fullpath = 
MAKE_STRING(i-> second -> GetName()) ;
 
 1560       int pos = fullpath.rfind (
'/');
 
 1562       std::string name = fullpath.substr (pos + 1) ;
 
 1564       std::string path = fullpath.substr (0 , pos) ;
 
 1566       if (f.GetDirectory(path.c_str()) == 0) f.mkdir (path.c_str()) ;
 
 1568       f.cd(path.c_str()) ;
 
 1570       i -> second -> SetName(name.c_str()) ;
 
 1572       i -> second -> Write() ;
 
 1583   template < 
class T , 
class V >
 
 1592           std::string fullpath = 
MAKE_STRING(j-> second -> GetName()) ;
 
 1594           int pos = fullpath.rfind (
'/');
 
 1596           std::string name = fullpath.substr (pos + 1) ;
 
 1598           std::string path = fullpath.substr (0 , pos) ;
 
 1600           if (f.GetDirectory(path.c_str()) == 0) f.mkdir (path.c_str()) ;
 
 1602           f.cd(path.c_str()) ;
 
 1604           j -> second -> SetName(name.c_str()) ;
 
 1606           j -> second -> Write() ;
 
 1622     f.mkdir(
"Detector") ;
 
 1626     if (h_summary.h_fifo) h_summary.h_fifo -> Write() ; 
 
 1628     if (h_summary.h_daq_status) h_summary.h_daq_status -> Write() ;
 
 1630     if (h_summary.h_hrv) h_summary.h_hrv -> Write() ;
 
 1632     if (h_summary.h_fifo_per_dom) h_summary.h_fifo_per_dom -> Write() ;
 
 1634     if (h_summary.h_daq_status_per_dom) h_summary.h_daq_status_per_dom -> Write() ;
 
 1636     if (h_summary.h_hrv_per_dom) h_summary.h_hrv_per_dom -> Write() ;
 
 1638     if (h_summary.h_rate_summary) h_summary.h_rate_summary -> Write() ;
 
 1640     if (h_summary.h_pmt_rate_distribution) h_summary.h_pmt_rate_distribution -> Write() ; 
 
 1642     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/ToT_255_vs_time") , h_timeslice.h_ToT_255_vs_time) ;
 
 1644     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/ToT_255_Floor_vs_time") , h_timeslice.h_ToT_255_Floor_vs_time) ;
 
 1646     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/ToT_255_Floor_vs_time") , h_timeslice.h_ToT_255_Floor_vs_time_2) ;
 
 1648     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/slice_start_time") , h_timeslice.h_slice_start_time) ;
 
 1650     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/Rate") , h_timeslice.h_rate) ;
 
 1652     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/Active_modules_detector") , h_timeslice.h_active_modules) ;
 
 1654     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/Active_modules_du") , h_timeslice.h_du_active_modules) ;
 
 1656     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/DOM_mean_rates") , h_timeslice.h_dom_mean_rates) ;
 
 1658     Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_tot_distributions) ;
 
 1660     Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_rate_distributions) ;
 
 1662     Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_tot_vs_time) ;
 
 1664     Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_rates_vs_time) ;
 
 1666     Write_manager_in_key_dir (f , h_summary.m_summary_rate_vs_time) ;
 
 1668     Write_manager_in_key_dir (f , h_summary.m_summary_rate_distribution) ;
 
 1670     Write_manager_in_key_dir (f , h_summary.m_fifo_full) ;
 
 1672     Write_manager_in_key_dir (f , h_summary.m_hrv) ;
 
 1674     Write_manager_in_key_dir (f , h_summary.m_module_rates_vs_time) ;
 
 1676     Write_manager_in_key_dir (f , h_trigger.m_Trigger_map) ;
 
 1678     Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_dt_consecutive_hits) ;
 
 1680     Write_manager_table_in_key_dir (f , h_timeslice.m_ToT_255) ;
 
 1682     Write_manager_table_in_key_dir (f , h_timeslice.m_module_rates_vs_time) ;
 
 1684     if (h_summary.m_mean_summary_rate) Write_manager_in_key_dir( f , h_summary.m_mean_summary_rate) ;
 
 1686     h_timeslice.Fill_mean_ToT_histograms() ;
 
 1688     Write_manager_table_in_key_dir (f , h_timeslice.m_mean_ToT) ;
 
 1692     f.cd (
"JDAQEvent") ;
 
 1694     if (h_trigger.h_Trigger_bit_event) h_trigger.h_Trigger_bit_event -> Write() ; 
 
 1696     if (h_trigger.h_Trigger_bit_hit) h_trigger.h_Trigger_bit_hit -> Write() ; 
 
 1698     f.mkdir ( 
MAKE_STRING (
"JDAQEvent/hits_per_event").c_str() ) ;
 
 1700     f.cd (
"JDAQEvent/hits_per_event") ;
 
 1702     if (h_trigger.h_Triggered_hits) h_trigger.h_Triggered_hits -> Write() ; 
 
 1704     if (h_trigger.h_Snapshot_hits) h_trigger.h_Snapshot_hits -> Write() ;
 
 1706     f.mkdir ( 
MAKE_STRING (
"JDAQEvent/hits_pmt_distributions").c_str() ) ;
 
 1708     f.cd (
"JDAQEvent/hits_pmt_distributions") ;
 
 1710     if (h_trigger.h_pmt_distribution_triggered_hits) { 
normalize (h_trigger.h_pmt_distribution_triggered_hits) ; h_trigger.h_pmt_distribution_triggered_hits -> Write() ; }
 
 1712     if (h_trigger.h_pmt_distribution_snapshot_hits) {
normalize (h_trigger.h_pmt_distribution_snapshot_hits) ; h_trigger.h_pmt_distribution_snapshot_hits -> Write() ; }
 
 1714     f.mkdir ( 
MAKE_STRING (
"JDAQEvent/hits_tot_distributions").c_str() ) ;
 
 1716     f.cd (
"JDAQEvent/hits_tot_distributions") ;
 
 1718     if (h_trigger.h_tot_distribution_triggered_hits) { 
normalize (h_trigger.h_tot_distribution_triggered_hits) ; h_trigger.h_tot_distribution_triggered_hits -> Write() ; }
 
 1720     if (h_trigger.h_tot_distribution_snapshot_hits) { 
normalize (h_trigger.h_tot_distribution_snapshot_hits) ; h_trigger.h_tot_distribution_snapshot_hits -> Write() ; }
 
 1722     f.mkdir ( 
MAKE_STRING (
"JDAQEvent/trigger_rates").c_str() ) ;
 
 1724     f.cd (
"JDAQEvent/trigger_rates") ;
 
 1726     if (h_trigger.m_trigger_rates){ 
 
 1730         i -> second -> Scale (1./(i->second->GetBinWidth(1) * 
getFrameTime() * 1e-9) ) ; 
 
 1732         i -> second -> Write() ;
 
 1738     f.cd (
"JDAQEvent") ;
 
 1742     if (h_trigger.h_Triggered_hits_per_module) { h_trigger.h_Triggered_hits_per_module -> Write() ; }
 
 1744     if (h_trigger.h_Snapshot_hits_per_module) { h_trigger.h_Snapshot_hits_per_module -> Write() ; }
 
 1746     if (h_trigger.h_n_triggered_hits_distribution) { h_trigger.h_n_triggered_hits_distribution -> Write() ; }
 
 1748     if (h_trigger.m_Snapshot_hits_per_pmt) Write_manager_in_key_dir( f , h_trigger.m_Snapshot_hits_per_pmt) ;
 
TH1D * h_pmt_distribution_snapshot_hits
 
TH1D * h_n_triggered_hits_distribution
 
void init_h_dom_mean_rates(int ts_type, std::set< int > du_ids, int modules_per_string, std::string ts_name)
 
void initialize_trigger_histograms(JFrameIndexRange &range)
 
vector< JManager< string, TH2D > * > m_ToT_255
 
void init_h_Trigger_map(int modules_per_string, int n_frames, int first_frame, int last_frame)
 
void initialize_summary_histograms(JFrameIndexRange &range)
 
TH2D * h_Snapshot_hits_per_module
 
void init_h_rate_summary(set< int > &du_ids, int modules_per_string)
 
void init_h_fifo_per_dom(std::set< int > &du_ids, int modules_per_string)
 
static const unsigned int NUMBER_OF_TRIGGER_BITS
Number of trigger bits. 
 
void init_h_ToT_255_vs_time(int ts_type, string ts_name)
 
JManager< string, TProfile2D > * m_hrv
 
TH1D * h_pmt_distribution_triggered_hits
 
vector< JManager< string, TH2D > * > m_pmt_tot_distributions
 
void initialize(std::set< int > &du_ids, JFrameIndexRange &frame_index_range, int modules_per_string)
 
void init_h_rate(int n_frames, int first_frame, int last_frame)
 
int getNumberOfStrings(const JDetector &detector)
Get number of strings. 
 
void Write_histogram_table_to_file(TFile &f, string dirname, vector< T * > table)
 
void init_h_n_triggered_hits_distribution(int n_pmts)
 
vector< TH2D * > h_dom_mean_rates
 
JManager< string, TProfile2D > * m_summary_rate_vs_time
 
void init_h_Trigger_bit_event()
 
void init_h_Triggered_hits_per_module(int modules_per_string, std::set< int > &du_ids)
 
TH2D * h_Triggered_hits_per_module
 
void init_h_daq_status(int n_frames, int first_frame, int last_frame)
 
void init_m_module_rates_vs_time(int n_frames, double min_time, double max_time)
 
void init_h_Snapshot_hits_per_module(int modules_per_string, std::set< int > &du_ids)
 
void init_m_pmt_dt_consecutive_hits(int ts_type, string ts_name)
 
JManager< string, TH1D > * m_trigger_rates
 
std::set< int > getStringIDs(const JDetector &detector)
Get list of strings IDs. 
 
void init_h_active_modules(int ts_type, int n_frames, int first_frame, int last_frame, std::string ts_name)
 
void init_m_pmt_tot_vs_time(int ts_type, int n_frames, double min_time, double max_time, string ts_name)
 
void init_m_pmt_rates_vs_time(int ts_type, int n_frames, double min_time, double max_time, string ts_name)
 
void init_h_slice_starting_time(int ts_type, int n_frames, int first_frame, int last_frame, std::string ts_name)
 
TH2D * h_daq_status_per_dom
 
JManager< string, TProfile > * m_module_rates_vs_time
 
Dynamic ROOT object management. 
 
vector< TH2D * > h_ToT_255_Floor_vs_time_2
 
JManager< string, TH2D > * m_mean_summary_rate
 
void init_h_ToT_255_Floor_vs_time_2(int ts_type, int modules_per_string, string ts_name)
 
#define MAKE_STRING(A)
Make string. 
 
void Fill_mean_ToT_histograms()
 
void init_h_pmt_distribution_snapshot_hits()
 
void init_m_module_rates_vs_time(int ts_type, int n_frames, double min_time, double max_time, string ts_name)
 
Auxiliary class to manage set of compatible ROOT objects (e.g. 
 
void Write_to_file(TFile &f)
 
void init_m_summary_rate_distribution()
 
void init_h_tot_distribution_triggered_hits()
 
void initialize(std::set< int > &du_ids, int modules_per_string, JFrameIndexRange &frame_index_range)
 
TimesliceHistograms h_timeslice
 
void init_m_trigger_rates(int first_frame, int last_frame, int seconds_per_bin=30)
 
void init_m_mean_summary_rate(int modules_per_string)
 
void initialize_timeslice_histograms(JFrameIndexRange &range)
 
TH1D * h_tot_distribution_snapshot_hits
 
vector< JManager< string, TProfile2D > * > m_pmt_rates_vs_time
 
void init_m_ToT_255(int ts_type, int modules_per_string, string ts_name)
 
void init_m_hrv(int n_frames, double first_frame, double last_frame)
 
TriggerHistograms h_trigger
 
void init_m_summary_rate_vs_time(int n_frames, double first_frame, double last_frame)
 
vector< TProfile2D * > h_du_active_modules
 
double getFrameTime()
Get frame time duration. 
 
void Replace_wildcard_in_name(JManager< T, V > *manager, char wc= '%')
 
void Write_manager_table_in_key_dir(TFile &f, vector< JManager< T, V > * > table)
 
void init_h_ToT_255_Floor_vs_time(int ts_type, int modules_per_string, string ts_name)
 
void init_m_pmt_rate_distributions(int ts_type, string ts_name)
 
TH1D * h_pmt_rate_distribution
 
void init_h_du_active_modules(int ts_type, std::set< int > du_ids, int n_frames, int first_frame, int last_frame, std::string ts_name)
 
void init_h_rate(int ts_type, int n_frames, int first_frame, int last_frame, std::string ts_name)
 
void Write_histogram_table_to_file(TFile &f, string dirname, vector< vector< T * > > table)
 
TH1D * h_Trigger_bit_event
 
void init_h_Snapshot_hits()
 
void init_m_Snapshot_hits_per_pmt(int modules_per_string)
 
vector< JManager< string, TProfile2D > * > m_pmt_tot_vs_time
 
void normalize(T *h, double n=1.0)
 
void init_m_fifo_full(int n_frames, double first_frame, double last_frame)
 
void init_h_Triggered_hits()
 
SummaryHistograms h_summary
 
Direct access to module in detector data structure. 
 
void init_m_mean_ToT(int ts_type, int modules_per_string, string ts_name)
 
vector< TH2D * > h_ToT_255_Floor_vs_time
 
vector< TProfile * > h_active_modules
 
JManager< string, TH2D > * m_summary_rate_distribution
 
const char * getTriggerName(JTriggerbit_t bit)
Get trigger name. 
 
void Write_manager_in_key_dir(TFile &f, JManager< T, V > *manager)
 
General purpose string class. 
 
ROOT TTree parameter settings. 
 
std::string to_string(const T &value)
Convert value to string. 
 
void init_h_fifo(int n_frames, int first_frame, int last_frame)
 
vector< JManager< string, TH2D > * > m_mean_ToT
 
vector< JManager< string, TH2D > * > m_pmt_rate_distributions
 
vector< JManager< string, TH2D > * > m_pmt_dt_consecutive_hits
 
void init_h_tot_distribution_snapshot_hits()
 
TH1D * h_tot_distribution_triggered_hits
 
void init_h_pmt_distribution_triggered_hits()
 
vector< TH1D * > h_slice_start_time
 
void init_h_hrv(int n_frames, int first_frame, int last_frame)
 
vector< JManager< string, TProfile > * > m_module_rates_vs_time
 
Indexing of data type in type list. 
 
KM3NeT DAQ constants, bit handling, etc. 
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
JRA_Histograms(JDetector &det)
 
void init_h_daq_status_per_dom(std::set< int > &du_ids, int modules_per_string)
 
vector< TH1D * > h_ToT_255_vs_time
 
int getNumberOfModules(const JDetector &detector)
Get number of modules. 
 
void init_h_Trigger_bit_hit()
 
JManager< string, TH2D > * m_Trigger_map
 
vector< TProfile * > h_rate
 
void init_h_hrv_per_dom(set< int > &du_ids, int modules_per_string)
 
JManager< string, TProfile2D > * m_fifo_full
 
JManager< string, TH2D > * m_Snapshot_hits_per_pmt
 
void Write_manager_to_file(TFile &f, string dirname, JManager< T, V > *table)
 
void init_m_Trigger_map(int modules_per_string, int n_frames, int first_frame, int last_frame)
 
void initialize(std::set< int > du_ids, int modules_per_string, JFrameIndexRange &frame_index_range, int ts_type, std::string ts_name)
 
void init_h_pmt_rate_distribution()
 
void init_m_pmt_tot_distributions(int ts_type, string ts_name)