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" 
   38 using namespace JLANG ;   
 
   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()) ;
 
  141     h_frame_index_check = NULL;
 
  159     h_fifo_per_dom = NULL ;
 
  161     h_daq_status_per_dom = NULL ;
 
  163     h_hrv_per_dom = NULL ;
 
  165     h_rate_summary = NULL ;
 
  167     h_pmt_rate_distribution = NULL ;
 
  169     m_mean_summary_rate = NULL ;
 
  171     m_summary_rate_vs_time = NULL ;
 
  173     m_summary_rate_distribution = NULL ;
 
  179     m_module_rates_vs_time = NULL ;
 
  190     int first_frame = frame_index_range.
first ;
 
  192     int last_frame = frame_index_range.
second ;
 
  194     int n_frames = last_frame - first_frame + 1 ;
 
  198     double min_time = -0.5 * frame_time_s ;
 
  200     double max_time = (frame_index_range.
second - frame_index_range.
first + 0.5 ) * frame_time_s ;
 
  202     init_h_fifo (n_frames , first_frame , last_frame) ;
 
  206     init_h_daq_status (n_frames , first_frame , last_frame) ;
 
  210     init_h_hrv (n_frames , first_frame , last_frame) ;
 
  218     init_h_fifo_per_dom (du_ids , modules_per_string) ;
 
  220     init_h_daq_status_per_dom (du_ids , modules_per_string) ;
 
  222     init_h_hrv_per_dom (du_ids , modules_per_string) ;
 
  224     init_h_rate_summary (du_ids , modules_per_string) ;
 
  226     init_h_pmt_rate_distribution() ;
 
  228     init_m_mean_summary_rate (modules_per_string) ;
 
  230     init_m_summary_rate_vs_time (n_frames , min_time , max_time) ;
 
  232     init_m_summary_rate_distribution () ;
 
  234     init_m_fifo_full (n_frames , min_time , max_time) ;
 
  236     init_m_hrv (n_frames , min_time , max_time) ;
 
  238     init_m_module_rates_vs_time (n_frames , min_time , max_time) ;     
 
  240     init_h_rate (n_frames , first_frame , last_frame) ;
 
  253     string name = 
MAKE_STRING (
"h_frame_index_check") ;
 
  255     string title = 
MAKE_STRING (
" ; frame count ; frame index") ;
 
  257     h_frame_index_check = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , n_frames + 0.5 ) ;
 
  268   void init_h_fifo (
int n_frames , 
int first_frame , 
int last_frame){
 
  272     string title = 
MAKE_STRING (
"FIFO status ; slice number ; Average number of PMTs per module with FIFO almost full") ;
 
  274     h_fifo = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  302     string title = 
MAKE_STRING (
"DAQ status ; slice number ; Number of DOMS with wrong DAQ status of packets") ;
 
  304     h_daq_status = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  328   void init_h_hrv (
int n_frames , 
int first_frame , 
int last_frame){
 
  332     string title = 
MAKE_STRING (
"High Rate Veto ; slice number ; Average number of PMTs per module in HRV regime") ;
 
  334     h_hrv = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  387     string title = 
MAKE_STRING (
" FIFO ; String ; Floor ; Number of slices with FIFO almost full ") ;
 
  389     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 ) ;
 
  401     string name = 
MAKE_STRING (
"h_daq_status_per_dom") ;
 
  403     string title = 
MAKE_STRING (
" DAQ Status ; String ; Floor ; Number of slices with wrong DAQ status of packets ") ;
 
  405     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 ) ;
 
  419     string title = 
MAKE_STRING (
" HRV ; String ; Floor ; Number of slices with at least 1 PMT in HRV ") ;
 
  421     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 ) ;
 
  435     string title = 
MAKE_STRING (
" Summary slices ; String ; Floor ; Mean rate over all summary slices [kHz] ") ;
 
  437     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 ) ;
 
  446     string name = 
MAKE_STRING (
"h_pmt_rate_distribution") ;
 
  448     string title = 
MAKE_STRING (
" PMT rate distribution from summary slices ; rate [kHz] ; Counts ") ;    
 
  450     h_pmt_rate_distribution = 
new TH1D (name.c_str() , title.c_str() , 40 , 0 , log10(1000)) ;
 
  452     BinLogX (h_pmt_rate_distribution) ;
 
  454     h_pmt_rate_distribution -> SetMinimum(1) ;
 
  465     string name = 
MAKE_STRING (
"%/h_mean_summary_rate") ;
 
  467     string title = 
MAKE_STRING (
" ; PMT ; Floor ; rate [kHz] ") ;
 
  484     string name = 
MAKE_STRING ( 
"%/h_rate_vs_time_Summaryslice" ) ;
 
  486     string title = 
MAKE_STRING (
"Summary slices ; frame index ; TDC channel ; rate [Hz]") ;
 
  498       string name = 
MAKE_STRING (
"%/h_pmt_rate_distributions_Summaryslice") ;
 
  500       string title = 
MAKE_STRING (
"Summaryslice ; rate [kHz] ; TDC channel ; counts ") ;    
 
  502       TH2D* h_summary_rate_distribution = 
new TH2D (name.c_str() , title.c_str() ,
 
  503                                            40 , 0 , log10(1000),
 
  506       BinLogX (h_summary_rate_distribution) ;
 
  523     string name = 
MAKE_STRING ( 
"%/h_fifo_almost_full" ) ;
 
  525     string title = 
MAKE_STRING (
" ; frame index ; TDC channel ; FIFO almost full") ;
 
  540   void init_m_hrv(
int n_frames , 
double first_frame , 
double last_frame){
 
  544     string title = 
MAKE_STRING (
" ; frame index ; TDC channel ; HRV ") ;
 
  561     string name = 
MAKE_STRING ( 
"%/h_module_rate_vs_time_Summaryslice") ;
 
  563     string title = 
MAKE_STRING (
"Summaryslice ; time since run start [s] ; rate [Hz]" ) ;
 
  565     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)) ;
 
  578   void init_h_rate (
int n_frames , 
int first_frame , 
int last_frame){
 
  580     string name = 
MAKE_STRING (
"h_rate_Summaryslice") ;
 
  582     string title = 
MAKE_STRING (
"Average module rate (Summaryslice) ; slice number ; rate [Hz]") ;
 
  584     h_rate = 
new TProfile ( name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  666     h_slice_start_time.resize (number_of_timeslice_types , NULL) ;
 
  668     h_rate.resize (number_of_timeslice_types , NULL) ;
 
  670     h_active_modules.resize (number_of_timeslice_types , NULL) ;
 
  672     h_du_active_modules.resize (number_of_timeslice_types , NULL) ;
 
  674     h_dom_mean_rates.resize (number_of_timeslice_types , NULL) ;
 
  676     h_ToT_255_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  678     h_ToT_255_Floor_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  680     h_ToT_255_Floor_vs_time_2.resize (number_of_timeslice_types , NULL) ;
 
  682     m_mean_ToT.resize (number_of_timeslice_types , NULL) ;
 
  684     m_ToT_255.resize (number_of_timeslice_types , NULL) ;
 
  686     m_module_rates_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  688     m_pmt_tot_distributions.resize (number_of_timeslice_types , NULL) ;
 
  690     m_pmt_rate_distributions.resize (number_of_timeslice_types , NULL) ;
 
  692     m_pmt_rates_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  694     m_pmt_tot_vs_time.resize (number_of_timeslice_types , NULL) ;
 
  696     m_pmt_dt_consecutive_hits.resize (number_of_timeslice_types , NULL) ;
 
  711     int first_frame = frame_index_range.
first ;
 
  713     int last_frame = frame_index_range.
second ;
 
  715     int n_frames = last_frame - first_frame + 1 ;
 
  719     double min_time = -0.5 * frame_time_s ;
 
  721     double max_time = (frame_index_range.
second - frame_index_range.
first + 0.5 ) * frame_time_s ;
 
  723     init_h_slice_starting_time (ts_type , n_frames , first_frame , last_frame , ts_name) ;
 
  725     init_h_rate (ts_type , n_frames , first_frame , last_frame , ts_name) ;
 
  727     init_h_active_modules (ts_type , n_frames , first_frame , last_frame , ts_name) ;
 
  729     init_h_du_active_modules (ts_type , du_ids , n_frames , first_frame , last_frame , ts_name) ;
 
  731     init_h_dom_mean_rates (ts_type , du_ids , modules_per_string , ts_name) ;
 
  733     init_h_ToT_255_vs_time (ts_type , ts_name) ;
 
  735     init_h_ToT_255_Floor_vs_time (ts_type , modules_per_string , ts_name) ;
 
  737     init_h_ToT_255_Floor_vs_time_2 (ts_type , modules_per_string , ts_name) ;
 
  739     init_m_mean_ToT (ts_type , modules_per_string , ts_name) ;
 
  741     init_m_ToT_255 (ts_type , modules_per_string , ts_name) ;
 
  743     init_m_module_rates_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ;
 
  745     init_m_pmt_tot_distributions (ts_type , ts_name) ;
 
  747     init_m_pmt_rate_distributions (ts_type , ts_name) ;
 
  749     init_m_pmt_tot_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ; 
 
  751     init_m_pmt_rates_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ;
 
  753     init_m_pmt_dt_consecutive_hits(ts_type , ts_name) ;
 
  768     for (
typename vector < 
JManager < string , TH2D >* >::const_iterator it = m_pmt_tot_distributions.begin() ; it != m_pmt_tot_distributions.end() ; ++it , ++i){
 
  776           TPRegexp 
r (
"(\\w+)/(\\DU)(\\d+)/(F)(\\d+)") ;
 
  778           TObjArray* o = 
r.MatchS(s) ;
 
  780           int String = ((TObjString *)o->At(3))->GetString().Atoi();
 
  782           int Floor = ((TObjString *)o->At(5))->GetString().Atoi();
 
  784           for (
int pmt = 1 ; pmt <= (
j -> second) -> GetYaxis() -> GetNbins() ; pmt++){
 
  786             (*m_mean_ToT[i])[
MAKE_STRING(
"Detector/DU" + 
to_string(
String))] -> Fill(Floor , (
j->second) -> GetYaxis() -> GetBinCenter(pmt) , (
j -> second) -> ProjectionX (
"" , pmt , pmt) -> GetMean () ) ;
 
  809     string name = 
MAKE_STRING (
"h_slice_starting_time_" + ts_name ) ;
 
  811     string title = 
MAKE_STRING (
"Slice Starting Time (" + ts_name + 
"); slice number ; time since first slice [s]") ;
 
  813     h_slice_start_time[ts_type] = 
new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  826   void init_h_rate (
int ts_type , 
int n_frames , 
int first_frame , 
int last_frame , std::string ts_name){
 
  830     string title = 
MAKE_STRING (
"Average module rate ("+ts_name+
") ; slice number ; rate [Hz]") ;
 
  832     h_rate[ts_type] = 
new TProfile ( name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 ) ;
 
  847     string name = 
MAKE_STRING (
"h_active_DOMS_" + ts_name) ;
 
  849     string title = 
MAKE_STRING (
" Active modules (" + ts_name + 
"); slice number ; fraction of active modules") ;
 
  851     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 ) ;
 
  867     string name = 
MAKE_STRING (
"h_du_active_DOMS_" + ts_name) ;
 
  869     string title = 
MAKE_STRING (
"Active modules in DU (" + ts_name + 
"); slice number ; DU number ; number of active modules") ;
 
  871     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 ) ;
 
  884     string name = 
MAKE_STRING (
"h_mean_dom_rates_" + ts_name) ;
 
  886     string title = 
MAKE_STRING (ts_name + 
" ; Floor number ; DU number ; time slice averaged rate [Hz]") ;
 
  888     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) ;
 
  900     string name = 
MAKE_STRING (
"h_ToT_255_vs_time_" + ts_name) ;
 
  902     string title = 
MAKE_STRING (
" (" + ts_name + 
") Hits with ToT = 255 ns. All PMTs, all timeslices ; Time since beginning of slice [ns] ; counts ") ;
 
  904     h_ToT_255_vs_time[ts_type] = 
new TH1D (name.c_str() , title.c_str() , 100 , 0 , log10(
getFrameTime())) ;
 
  906     BinLogX (h_ToT_255_vs_time[ts_type]) ;
 
  919     string name = 
MAKE_STRING (
"h_ToT_255_Floor_vs_time_" + ts_name) ;
 
  921     string title = 
MAKE_STRING (
" (" + ts_name + 
") Hits with ToT = 255 ns. All DUs , all timeslices ; Time since beginning of slice [ns] ; Floor number ; counts ") ;
 
  923     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) ;
 
  925     BinLogX(h_ToT_255_Floor_vs_time[ts_type]) ;
 
  938     string name = 
MAKE_STRING (
"h_ToT_255_Floor_vs_time_2_" + ts_name) ;
 
  940     string title = 
MAKE_STRING (
" (" + ts_name + 
") Hits with ToT = 255 ns. All DUs , all timeslices ; Time since beginning of slice [ns] ; Floor number ; counts ") ;
 
  942     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) ;
 
  955     string name = 
MAKE_STRING (
"%/h_mean_ToT_" + ts_name) ;
 
  957     string title = 
MAKE_STRING (ts_name + 
" ; Floor number ; TDC channel ; mean ToT over all timeslices [ns] ") ;
 
  972     string name = 
MAKE_STRING (
"%/h_ToT_255_" + ts_name) ;
 
  974     string title = 
MAKE_STRING (ts_name + 
" ; Floor number ; TDC channel ; number of hits with ToT = 255 ns ") ;
 
  990     string name = 
MAKE_STRING ( 
"%/h_module_rate_vs_time_" + ts_name ) ;
 
  992     string title = 
MAKE_STRING (ts_name + 
" ; time since run start [s] ; rate [Hz]" ) ;
 
  994     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)) ;
 
 1006     string name = 
MAKE_STRING (
"%_" + ts_name + 
"_2SToT") ;
 
 1008     string title = 
MAKE_STRING (ts_name + 
" ; TDC channel ; ToT [ns] ; counts") ;
 
 1012                                                                                  max_ToT - min_ToT + 1 , min_ToT - 0.5 , max_ToT + 0.5)) ;
 
 1024       string name = 
MAKE_STRING (
"%/h_pmt_rate_distributions_" + ts_name) ;
 
 1026       string title = 
MAKE_STRING (ts_name + 
" ; rate [kHz] ; TDC channel ; counts ") ;    
 
 1028       TH2D* h_pmt_rate_distributions = 
new TH2D (name.c_str() , title.c_str() ,
 
 1029                                            60 , -6 , log10(20),
 
 1032       BinLogX (h_pmt_rate_distributions) ;
 
 1049       string name = 
MAKE_STRING (
"%/ToT_vs_time_" + ts_name) ;
 
 1051       string title = 
MAKE_STRING (ts_name + 
" ; time [s] ; TDC channel ; ToT [ns]") ;
 
 1068     string name = 
MAKE_STRING ( 
"%/h_rate_vs_time_" + ts_name ) ;
 
 1070     string title = 
MAKE_STRING (ts_name + 
" ; time since run start [s] ; TDC channel ; rate [Hz]") ;
 
 1084     string name = 
MAKE_STRING (
"%/h_dt_consecutive_hits_" + ts_name) ;
 
 1086     string title = 
MAKE_STRING (ts_name + 
" ; log(dt [ns]) ; TDC channel ; counts") ;
 
 1138     h_Trigger_bit_event = NULL ;
 
 1140     h_Trigger_bit_hit = NULL ;
 
 1142     h_Snapshot_hits = NULL ;
 
 1144     h_Triggered_hits = NULL ;
 
 1146     h_Snapshot_hits_per_module = NULL ;
 
 1148     h_Triggered_hits_per_module = NULL ;
 
 1150     h_Trigger_map = NULL ;
 
 1152     m_trigger_rates = NULL ;
 
 1154     m_Snapshot_hits_per_pmt = NULL ;
 
 1156     m_Trigger_map = NULL ;
 
 1158     h_pmt_distribution_triggered_hits = NULL ;
 
 1160     h_tot_distribution_triggered_hits = NULL ;
 
 1162     h_pmt_distribution_snapshot_hits = NULL ;
 
 1164     h_tot_distribution_snapshot_hits = NULL ;
 
 1166     h_n_triggered_hits_distribution = NULL ;
 
 1178     int first_frame = frame_index_range.
first ;
 
 1180     int last_frame = frame_index_range.
second ;
 
 1182     int n_frames = last_frame - first_frame + 1 ;
 
 1184     int n_pmts = du_ids.size() * modules_per_string * 
NUMBER_OF_PMTS ;
 
 1186     init_h_Trigger_bit_event () ;
 
 1188     init_h_Trigger_bit_hit () ;
 
 1190     init_h_Snapshot_hits () ;
 
 1192     init_h_Triggered_hits () ;
 
 1194     init_h_Snapshot_hits_per_module (modules_per_string , du_ids) ;
 
 1196     init_h_Triggered_hits_per_module (modules_per_string , du_ids) ;
 
 1198     init_m_trigger_rates(first_frame , last_frame) ;
 
 1200     init_m_Snapshot_hits_per_pmt (modules_per_string) ;
 
 1202     init_m_Trigger_map (modules_per_string , n_frames , first_frame , last_frame) ;
 
 1204     init_h_Trigger_map (modules_per_string ,  n_frames , first_frame , last_frame) ;
 
 1206     init_h_pmt_distribution_triggered_hits() ;
 
 1208     init_h_tot_distribution_triggered_hits() ;
 
 1210     init_h_pmt_distribution_snapshot_hits() ;
 
 1212     init_h_tot_distribution_snapshot_hits() ;
 
 1214     init_h_n_triggered_hits_distribution (n_pmts) ;
 
 1223     string name = 
MAKE_STRING (
"h_Trigger_bit_event") ;
 
 1225     string title = 
MAKE_STRING (
"Number of events as a function of trigger bit in event ; Trigger Bit ; Counts ") ;
 
 1233         h_Trigger_bit_event -> GetXaxis() -> SetBinLabel(i+1 , 
getTriggerName(i) ) ;
 
 1237         h_Trigger_bit_event -> GetXaxis() -> SetBinLabel(i+1 , 
"" ) ;
 
 1243      h_Trigger_bit_event -> GetXaxis() -> LabelsOption(
"v") ; 
 
 1254     string title = 
MAKE_STRING (
"Number of hits per event as a function of trigger bit in hit ; Trigger Bit ; #Events ") ;
 
 1262         h_Trigger_bit_hit -> GetXaxis() -> SetBinLabel(i+1 , 
getTriggerName(i) ) ;
 
 1266         h_Trigger_bit_hit -> GetXaxis() -> SetBinLabel(i+1 , 
"" ) ;
 
 1272      h_Trigger_bit_hit -> GetXaxis() -> LabelsOption(
"v") ; 
 
 1283     string title = 
MAKE_STRING (
" Snapshot hits ; Number of hits ; Counts/#Events ") ;
 
 1285     h_Snapshot_hits = 
new TH1D (name.c_str() , title.c_str() , 50, 0, 4 ) ;
 
 1298     string title = 
MAKE_STRING (
" Triggered hits ; Number of hits ; Counts/#Events ") ;
 
 1300     h_Triggered_hits = 
new TH1D (name.c_str() , title.c_str() , 50 , 0, 4 ) ;
 
 1313     string name = 
MAKE_STRING (
"h_Snapshot_hits_per_module") ;
 
 1315     string title = 
MAKE_STRING (
" ; String ; Floor ; Number of snapshot hits ") ;
 
 1317     h_Snapshot_hits_per_module = 
new TH2D (name.c_str() , title.c_str() ,
 
 1318                                            *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 ,
 
 1319                                            modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
 1330     string name = 
MAKE_STRING (
"h_Triggered_hits_per_module") ;
 
 1332     string title = 
MAKE_STRING (
" ; String ; Floor ; Number of triggered hits ") ;
 
 1334     h_Triggered_hits_per_module = 
new TH2D (name.c_str() , title.c_str() ,
 
 1335                                            *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 ,
 
 1336                                            modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
 1351     string title = 
MAKE_STRING (
" ; Frame index ; DOM ; Number of triggered hits ") ;
 
 1353     h_Trigger_map = 
new TH2D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ,
 
 1354                               modules_per_string , 0.5 , modules_per_string + 0.5 ) ;
 
 1367     int frames_per_bin = seconds_per_bin / 
getFrameTime() / 1e-9 ;
 
 1369     int n_bins = (last_frame - first_frame) / frames_per_bin ;
 
 1371     string title = 
MAKE_STRING (
" ; Frame Index ; rate [Hz] ") ;
 
 1373     m_trigger_rates = 
new JManager <string , TH1D> (
new TH1D(
"h_rate_%" , title.c_str() , n_bins , -0.5 , last_frame - first_frame + 0.5)) ;
 
 1384     string name = 
MAKE_STRING (
"%/h_Snapshot_hits_per_pmt") ;
 
 1386     string title = 
MAKE_STRING (
" ; PMT ; Floor ; Number of snapshot hits ") ;
 
 1389                                                                          modules_per_string , 0.5 , modules_per_string + 0.5 ) ) ;
 
 1404     string title = 
MAKE_STRING (
" ; Frame index ; DOM ; Mean number of triggered hits per event") ;
 
 1406     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 ,
 
 1407                                                                modules_per_string , 0.5 , modules_per_string + 0.5)) ;
 
 1418     string name = 
MAKE_STRING (
"h_pmt_distribution_triggered_hits") ;
 
 1420     string title = 
MAKE_STRING (
" ; PMT number ; Counts [a.u.]") ;
 
 1431     string name = 
MAKE_STRING (
"h_tot_distribution_triggered_hits") ;
 
 1433     string title = 
MAKE_STRING (
" ; ToT [ns] ; Counts [a.u.]") ;
 
 1435     h_tot_distribution_triggered_hits = 
new TH1D (name.c_str() , title.c_str() , 255 , 0.5 , 255.5 ) ;
 
 1444     string name = 
MAKE_STRING (
"h_pmt_distribution_snapshot_hits") ;
 
 1446     string title = 
MAKE_STRING (
" ; PMT number ; Counts [a.u.]") ;
 
 1457     string name = 
MAKE_STRING (
"h_tot_distribution_snapshot_hits") ;
 
 1459     string title = 
MAKE_STRING (
" ; ToT [ns] ; Counts [a.u.]") ;
 
 1461     h_tot_distribution_snapshot_hits = 
new TH1D (name.c_str() , title.c_str() , 255 , 0.5 , 255.5 ) ;
 
 1472     string name = 
MAKE_STRING (
"h_n_triggered_hits_distribution") ;
 
 1474     string title = 
MAKE_STRING (
" ; Number of hits ; Counts") ;
 
 1476     h_n_triggered_hits_distribution = 
new TH1D (name.c_str() , title.c_str() , n_pmts , 0.5 , n_pmts + 0.5 ) ;
 
 1526     h_summary.
initialize(du_ids , modules_per_string , range) ;
 
 1540     const string prefix = 
"KM3NETDAQ::JDAQ" ;
 
 1542     string ts_name = T::Class_Name() ;
 
 1544     string::size_type pos = ts_name.find(prefix);
 
 1546     if (pos != string::npos) ts_name.replace(ts_name.find(prefix) , prefix.length() , 
"") ;
 
 1548     h_timeslice.
initialize(du_ids , modules_per_string , range , index , ts_name) ;
 
 1557     h_trigger.
initialize (du_ids , range , modules_per_string) ;
 
 1571     if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
 
 1573     f.cd (dirname.c_str()) ;
 
 1575     for (
int i=0 ; i < (int)table.size() ; i++){
 
 1577       for (
int j=0 ; 
j< (int)table[i].size() ; 
j++){
 
 1579         if (table[i][
j]) table [i][
j] -> Write() ;
 
 1597     if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
 
 1599     f.cd (dirname.c_str()) ;
 
 1601     for (
int i=0 ; i < (int)table.size() ; i++){
 
 1603       if (table[i]) table[i] -> Write() ;
 
 1616   template <
class T , 
class V>
 
 1619     if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
 
 1621     f.cd (dirname.c_str()) ;
 
 1625       i -> second -> Write() ;
 
 1636   template <
class T , 
class V>
 
 1641       if (i -> second -> GetTitle()){
 
 1643         std::string buffer = i -> second -> GetTitle() ;
 
 1645         string::size_type ipos = buffer.find(wc) ;
 
 1647         if (ipos!=std::string::npos){
 
 1653           buffer.replace(ipos, 1, os.str());
 
 1655           i -> second -> SetTitle(buffer.c_str()) ;
 
 1670   template < 
class T , 
class V >
 
 1675       std::string fullpath = 
MAKE_STRING(i-> second -> GetName()) ;
 
 1677       int pos = fullpath.rfind (
'/');
 
 1679       std::string name = fullpath.substr (pos + 1) ;
 
 1681       std::string path = fullpath.substr (0 , pos) ;
 
 1683       if (f.GetDirectory(path.c_str()) == 0) f.mkdir (path.c_str()) ;
 
 1685       f.cd(path.c_str()) ;
 
 1687       i -> second -> SetName(name.c_str()) ;
 
 1689       i -> second -> Write() ;
 
 1700   template < 
class T , 
class V >
 
 1709           std::string fullpath = 
MAKE_STRING(
j-> second -> GetName()) ;
 
 1711           int pos = fullpath.rfind (
'/');
 
 1713           std::string name = fullpath.substr (pos + 1) ;
 
 1715           std::string path = fullpath.substr (0 , pos) ;
 
 1717           if (f.GetDirectory(path.c_str()) == 0) f.mkdir (path.c_str()) ;
 
 1719           f.cd(path.c_str()) ;
 
 1721           j -> second -> SetName(name.c_str()) ;
 
 1723           j -> second -> Write() ;
 
 1739     f.mkdir(
"Detector") ;
 
 1747     if (h_summary.
h_hrv) h_summary.
h_hrv -> Write() ;
 
 1779     Write_histogram_table_to_file(f , 
MAKE_STRING(
"Detector/Rate") , h_timeslice.
h_rate) ;
 
 1801     if (h_summary.
m_hrv) Write_manager_in_key_dir (f , h_summary.
m_hrv) ;
 
 1809     Write_manager_table_in_key_dir (f , h_timeslice.
m_ToT_255) ;
 
 1817     Write_manager_table_in_key_dir (f , h_timeslice.
m_mean_ToT) ;
 
 1821     f.cd (
"JDAQEvent") ;
 
 1827     f.mkdir ( 
MAKE_STRING (
"JDAQEvent/hits_per_event").c_str() ) ;
 
 1829     f.cd (
"JDAQEvent/hits_per_event") ;
 
 1835     f.mkdir ( 
MAKE_STRING (
"JDAQEvent/hits_pmt_distributions").c_str() ) ;
 
 1837     f.cd (
"JDAQEvent/hits_pmt_distributions") ;
 
 1843     f.mkdir ( 
MAKE_STRING (
"JDAQEvent/hits_tot_distributions").c_str() ) ;
 
 1845     f.cd (
"JDAQEvent/hits_tot_distributions") ;
 
 1851     f.mkdir ( 
MAKE_STRING (
"JDAQEvent/trigger_rates").c_str() ) ;
 
 1853     f.cd (
"JDAQEvent/trigger_rates") ;
 
 1859         i -> second -> Scale (1./(i->second->GetBinWidth(1) * 
getFrameTime() * 1e-9) ) ; 
 
 1861         i -> second -> Write() ;
 
 1867     f.cd (
"JDAQEvent") ;