Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JRunHistograms.hh
Go to the documentation of this file.
1 #ifndef __JRUNHISTOGRAMS__
2 #define __JRUNHISTOGRAMS__
3 
4 
5 
6 #include "JSupport/JSupport.hh"
8 
10 #include "JTrigger/JTriggerBits.hh"
11 
14 
15 #include "JDAQ/JDAQClock.hh"
16 #include "JDAQ/JDAQ.hh"
17 #include "JDAQ/JDAQTimeslice.hh"
18 
19 #include "JGizmo/JManager.hh"
20 
21 #include "TH1D.h"
22 #include "TH2D.h"
23 #include "TProfile2D.h"
24 #include "TAxis.h"
25 #include "TCanvas.h"
26 #include "TPaveText.h"
27 #include "TStyle.h"
28 #include "TString.h"
29 #include "TMath.h"
30 #include "TColor.h"
31 #include "TDirectory.h"
32 #include "TPRegexp.h"
33 #include "TObjArray.h"
34 #include "TObjString.h"
35 
36 using namespace std ;
37 using namespace KM3NETDAQ ;
38 using namespace JLANG ;
39 using namespace JPP ;
40 using namespace JSUPPORT ;
41 
42 /*
43  * Rebins a histogram with constant bin width in a linear scale, so that the bins will have constant width in log10 scale.
44  *
45  * \param h The histogram.
46  */
47 template <class T>
48 void BinLogX (T* h){
49 
50  TAxis *axis = h->GetXaxis();
51 
52  int bins = axis->GetNbins();
53 
54  Axis_t from = axis->GetXmin();
55 
56  Axis_t to = axis->GetXmax();
57 
58  Axis_t width = (to - from) / bins;
59 
60  Axis_t *new_bins = new Axis_t[bins + 1];
61 
62  for (int i = 0; i <= bins; i++) {
63 
64  new_bins[i] = TMath::Power(10, from + i * width);
65 
66  }
67 
68  axis->Set(bins, new_bins);
69 
70  delete new_bins;
71 
72 }
73 
74 /*
75  * Normalizes a histogram to a given value.
76  *
77  * \param h The histogram.
78  * \param n The normalization constant
79  */
80 template <class T>
81 void normalize (T* h , double n = 1.0){
82 
83  h -> Scale(n / h -> Integral()) ;
84 
85 }
86 
87 
88 /*
89  * Structure to store histograms obtained from the JDAQSummary TTree.
90  */
92 
93  TH1D* h_fifo ;
94 
95  TH1D* h_daq_status ;
96 
97  TH1D* h_hrv ;
98 
100 
102 
104 
106 
108 
109  /* One histogram for each DU */
110 
112 
113  /* One histogram for each module */
114 
116 
118 
120 
122 
124 
125  TProfile* h_rate ;
126 
128 
129  h_fifo = NULL;
130 
131  h_daq_status = NULL;
132 
133  h_hrv = NULL ;
134 
135  h_fifo_per_dom = NULL ;
136 
137  h_daq_status_per_dom = NULL ;
138 
139  h_hrv_per_dom = NULL ;
140 
141  h_rate_summary = NULL ;
142 
143  h_pmt_rate_distribution = NULL ;
144 
145  m_mean_summary_rate = NULL ;
146 
147  m_summary_rate_vs_time = NULL ;
148 
149  m_summary_rate_distribution = NULL ;
150 
151  m_fifo_full = NULL ;
152 
153  m_hrv = NULL ;
154 
155  m_module_rates_vs_time = NULL ;
156 
157  h_rate = NULL ;
158  }
159 
160  /*
161  * Initializes the histograms for summary slices
162  */
163  void initialize(std::set<int> & du_ids , int modules_per_string , JFrameIndexRange & frame_index_range){
164 
165  int first_frame = frame_index_range.first ;
166 
167  int last_frame = frame_index_range.second ;
168 
169  int n_frames = last_frame - first_frame + 1 ;
170 
171  double frame_time_s = getFrameTime() * 1.0e-9 ;
172 
173  double min_time = -0.5 * frame_time_s ;
174 
175  double max_time = (frame_index_range.second - frame_index_range.first + 0.5 ) * frame_time_s ;
176 
177  init_h_fifo (n_frames , first_frame , last_frame) ;
178 
179  init_h_daq_status (n_frames , first_frame , last_frame) ;
180 
181  init_h_hrv (n_frames , first_frame , last_frame) ;
182 
183  init_h_fifo_per_dom (du_ids , modules_per_string) ;
184 
185  init_h_daq_status_per_dom (du_ids , modules_per_string) ;
186 
187  init_h_hrv_per_dom (du_ids , modules_per_string) ;
188 
189  init_h_rate_summary (du_ids , modules_per_string) ;
190 
191  init_h_pmt_rate_distribution() ;
192 
193  init_m_mean_summary_rate (modules_per_string) ;
194 
195  init_m_summary_rate_vs_time (n_frames , min_time , max_time) ;
196 
197  init_m_summary_rate_distribution () ;
198 
199  init_m_fifo_full (n_frames , min_time , max_time) ;
200 
201  init_m_hrv (n_frames , min_time , max_time) ;
202 
203  init_m_module_rates_vs_time (n_frames , min_time , max_time) ;
204 
205  init_h_rate (n_frames , first_frame , last_frame) ;
206 
207  }
208 
209  /*
210  * Initializes the histogram.
211  *
212  * \param n_frames The number of frames.
213  * \param first_frame the index of the first frame.
214  * \param last_frame tha index of the last frame.
215  */
216  void init_h_fifo (int n_frames , int first_frame , int last_frame){
217 
218  string name = MAKE_STRING ("h_fifo") ;
219 
220  string title = MAKE_STRING ("FIFO status ; slice number ; Average number of PMTs per module with FIFO almost full") ;
221 
222  h_fifo = new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
223 
224  }
225 
226  /*
227  * Initializes the histogram.
228  *
229  * \param n_frames The number of frames.
230  * \param first_frame the index of the first frame.
231  * \param last_frame tha index of the last frame.
232  */
233  void init_h_daq_status (int n_frames , int first_frame , int last_frame){
234 
235  string name = MAKE_STRING ("h_daq_status") ;
236 
237  string title = MAKE_STRING ("DAQ status ; slice number ; Number of DOMS with wrong DAQ status of packets") ;
238 
239  h_daq_status = new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
240 
241  }
242 
243  /*
244  * Initializes the histogram.
245  *
246  * \param n_frames The number of frames.
247  * \param first_frame the index of the first frame.
248  * \param last_frame the index of the last frame.
249  */
250  void init_h_hrv (int n_frames , int first_frame , int last_frame){
251 
252  string name = MAKE_STRING ("h_hrv") ;
253 
254  string title = MAKE_STRING ("High Rate Veto ; slice number ; Average number of PMTs per module in HRV regime") ;
255 
256  h_hrv = new TH1D (name.c_str() , title.c_str() , n_frames , -0.5 , last_frame - first_frame + 0.5 ) ;
257 
258  }
259 
260  /*
261  * Initializes the histogram.
262  *
263  * \param du_ids The list of ids for the DUs in the detector.
264  * \param modules_per_string the number of modules in a string.
265  */
266  void init_h_fifo_per_dom (std::set<int> & du_ids , int modules_per_string){
267 
268  string name = MAKE_STRING ("h_fifo_per_dom") ;
269 
270  string title = MAKE_STRING (" FIFO ; String ; Floor ; Number of slices with FIFO almost full ") ;
271 
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 ) ;
273 
274  }
275 
276  /*
277  * Initializes the histogram.
278  *
279  * \param du_ids The list of ids for the DUs in the detector.
280  * \param modules_per_string the number of modules in a string.
281  */
282  void init_h_daq_status_per_dom (std::set<int> & du_ids , int modules_per_string){
283 
284  string name = MAKE_STRING ("h_daq_status_per_dom") ;
285 
286  string title = MAKE_STRING (" DAQ Status ; String ; Floor ; Number of slices with wrong DAQ status of packets ") ;
287 
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 ) ;
289 
290  }
291 
292  /*
293  * Initializes the histogram.
294  *
295  * \param du_ids The list of ids for the DUs in the detector.
296  * \param modules_per_du the number of modules in a string.
297  */
298  void init_h_hrv_per_dom (set<int> & du_ids , int modules_per_string){
299 
300  string name = MAKE_STRING ("h_hrv_per_dom") ;
301 
302  string title = MAKE_STRING (" HRV ; String ; Floor ; Number of slices with at least 1 PMT in HRV ") ;
303 
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 ) ;
305 
306  }
307 
308  /*
309  * Initializes the histogram.
310  *
311  * \param du_ids The list of ids for the DUs in the detector.
312  * \param modules_per_du the number of modules in a string.
313  */
314  void init_h_rate_summary (set<int> & du_ids , int modules_per_string){
315 
316  string name = MAKE_STRING ("h_rate_summary") ;
317 
318  string title = MAKE_STRING (" Summary slices ; String ; Floor ; Mean rate over all summary slices [kHz] ") ;
319 
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 ) ;
321 
322  }
323 
324  /*
325  * Initializes the histogram.
326  */
328 
329  string name = MAKE_STRING ("h_pmt_rate_distribution") ;
330 
331  string title = MAKE_STRING (" PMT rate distribution from summary slices ; rate [kHz] ; Counts ") ;
332 
333  h_pmt_rate_distribution = new TH1D (name.c_str() , title.c_str() , 40 , 0 , log10(1000)) ;
334 
335  BinLogX (h_pmt_rate_distribution) ;
336 
337  h_pmt_rate_distribution -> SetMinimum(1) ;
338 
339  }
340 
341  /*
342  * Initializes the histogram.
343  *
344  * \param modules_per_string the number of modules in a string.
345  */
346  void init_m_mean_summary_rate (int modules_per_string){
347 
348  string name = MAKE_STRING ("%/h_mean_summary_rate") ;
349 
350  string title = MAKE_STRING (" ; PMT ; Floor ; rate [kHz] ") ;
351 
352  m_mean_summary_rate = new JManager < string , TH2D > (new TH2D(name.c_str() , title.c_str() , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5 , modules_per_string , 0.5 , 0.5 + modules_per_string)) ;
353 
354  }
355 
356  /*
357  * Initializes the histograms.
358  *
359  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
360  * \param ts_name String containing the timeslice type.
361  * \param n_frames The number of frames
362  * \param min_time The minimum time
363  * \param max_time The maximum time
364  */
365  void init_m_summary_rate_vs_time(int n_frames , double first_frame , double last_frame){
366 
367  string name = MAKE_STRING ( "%/h_rate_vs_time_Summaryslice" ) ;
368 
369  string title = MAKE_STRING ("Summary slices ; frame index ; TDC channel ; rate [Hz]") ;
370 
371  m_summary_rate_vs_time = new JManager < string , TProfile2D > (new TProfile2D (name.c_str() , title.c_str() , int (n_frames/600) , -0.5 , last_frame - first_frame + 0.5 , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5)) ;
372 
373  }
374 
375  /*
376  * Initializes the histograms. The frame index range information is needed.
377  *
378  */
380 
381  string name = MAKE_STRING ("%/h_pmt_rate_distributions_Summaryslice") ;
382 
383  string title = MAKE_STRING ("Summaryslice ; rate [kHz] ; TDC channel ; counts ") ;
384 
385  TH2D* h_summary_rate_distribution = new TH2D (name.c_str() , title.c_str() ,
386  40 , 0 , log10(1000),
387  NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5) ;
388 
389  BinLogX (h_summary_rate_distribution) ;
390 
391  m_summary_rate_distribution = new JManager < string , TH2D > (h_summary_rate_distribution) ;
392 
393  }
394 
395  /*
396  * Initializes the histograms.
397  *
398  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
399  * \param ts_name String containing the timeslice type.
400  * \param n_frames The number of frames
401  * \param min_time The minimum time
402  * \param max_time The maximum time
403  */
404  void init_m_fifo_full(int n_frames , double first_frame , double last_frame){
405 
406  string name = MAKE_STRING ( "%/h_fifo_almost_full" ) ;
407 
408  string title = MAKE_STRING (" ; frame index ; TDC channel ; FIFO almost full") ;
409 
410  m_fifo_full = new JManager < string , TProfile2D > (new TProfile2D (name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5)) ;
411 
412  }
413 
414  /*
415  * Initializes the histograms.
416  *
417  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
418  * \param ts_name String containing the timeslice type.
419  * \param n_frames The number of frames
420  * \param min_time The minimum time
421  * \param max_time The maximum time
422  */
423  void init_m_hrv(int n_frames , double first_frame , double last_frame){
424 
425  string name = MAKE_STRING ( "%/h_hrv" ) ;
426 
427  string title = MAKE_STRING (" ; frame index ; TDC channel ; HRV ") ;
428 
429  m_hrv = new JManager < string , TProfile2D > (new TProfile2D (name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5)) ;
430 
431  }
432 
433 
434  /*
435  * Initializes the histograms.
436  *
437  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
438  * \param ts_name String containing the timeslice type.
439  * \param min_time The minimum time
440  * \param max_time The maximum time
441  */
442  void init_m_module_rates_vs_time(int n_frames , double min_time , double max_time){
443 
444  string name = MAKE_STRING ( "%/h_module_rate_vs_time_Summaryslice") ;
445 
446  string title = MAKE_STRING ("Summaryslice ; time since run start [s] ; rate [Hz]" ) ;
447 
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)) ;
449 
450  }
451 
452  /*
453  * Initializes the histogram.
454  *
455  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
456  * \param n_frames The number of frames.
457  * \param first_frame the index of the first frame.
458  * \param last_frame tha index of the last frame.
459  * \param ts_name String containing the timeslice type.
460  */
461  void init_h_rate (int n_frames , int first_frame , int last_frame){
462 
463  string name = MAKE_STRING ("h_rate_Summaryslice") ;
464 
465  string title = MAKE_STRING ("Average module rate (Summaryslice) ; slice number ; rate [Hz]") ;
466 
467  h_rate = new TProfile ( name.c_str() , title.c_str() , int(n_frames/600) , -0.5 , last_frame - first_frame + 0.5 ) ;
468 
469  }
470 
471 };
472 
474 
475  int min_ToT ;
476 
477  int max_ToT ;
478 
479  int min_logdt ;
480 
481  int max_logdt ;
482 
484 
486 
487  /* One histogram per timeslice type. I decided not to use a JManager here because the range of each histogram could be different for each timeslice type. */
488 
490 
491  // vector < TH1D* > h_rate ;
492 
494 
495  // vector < TH1D* > h_active_modules ;
496 
498 
499  // vector < TH2D* > h_du_active_modules ;
500 
502 
504 
506 
508 
510 
511  /* One JManager per timeslice type. Each JManager hosts a histogram for each DU */
512 
514 
516 
517  /* One JManager per timeslice type. Each manager hosts a histogram for an optical module. The key is expected to follow the pattern SXXFXX */
518 
520 
522 
524 
526 
528 
530 
532 
533  min_ToT (0),
534 
535  max_ToT (255),
536 
537  min_logdt (0),
538 
539  max_logdt (9),
540 
541  nbins_logdt (150),
542 
543  nbins_time (200)
544 
545  {
546 
547  int number_of_timeslice_types = JLength<JDAQTimesliceTypes_t>::value ;
548 
549  h_slice_start_time.resize (number_of_timeslice_types , NULL) ;
550 
551  h_rate.resize (number_of_timeslice_types , NULL) ;
552 
553  h_active_modules.resize (number_of_timeslice_types , NULL) ;
554 
555  h_du_active_modules.resize (number_of_timeslice_types , NULL) ;
556 
557  h_dom_mean_rates.resize (number_of_timeslice_types , NULL) ;
558 
559  h_ToT_255_vs_time.resize (number_of_timeslice_types , NULL) ;
560 
561  h_ToT_255_Floor_vs_time.resize (number_of_timeslice_types , NULL) ;
562 
563  h_ToT_255_Floor_vs_time_2.resize (number_of_timeslice_types , NULL) ;
564 
565  m_mean_ToT.resize (number_of_timeslice_types , NULL) ;
566 
567  m_ToT_255.resize (number_of_timeslice_types , NULL) ;
568 
569  m_module_rates_vs_time.resize (number_of_timeslice_types , NULL) ;
570 
571  m_pmt_tot_distributions.resize (number_of_timeslice_types , NULL) ;
572 
573  m_pmt_rate_distributions.resize (number_of_timeslice_types , NULL) ;
574 
575  m_pmt_rates_vs_time.resize (number_of_timeslice_types , NULL) ;
576 
577  m_pmt_tot_vs_time.resize (number_of_timeslice_types , NULL) ;
578 
579  m_pmt_dt_consecutive_hits.resize (number_of_timeslice_types , NULL) ;
580 
581  }
582 
583  /*
584  * Initializes histograms for a given timeslice type.
585  *
586  * \param du_ids The list of ids for the DUs in the detector
587  * \param modules_per_string the number of modules in a string
588  * \param frame_index_range maximum and minimum time slice indices in the run. The range of some histograms is based on the number of time slices, and their indices.
589  * \param ts_type Index of the timeslice types on the JDAQTimesliceTypes_t typelist.
590  * \param ts_name The name of the timeslice type
591  */
592  void initialize(std::set<int> du_ids , int modules_per_string , JFrameIndexRange & frame_index_range , int ts_type , std::string ts_name){
593 
594  int first_frame = frame_index_range.first ;
595 
596  int last_frame = frame_index_range.second ;
597 
598  int n_frames = last_frame - first_frame + 1 ;
599 
600  double frame_time_s = getFrameTime() * 1.0e-9 ;
601 
602  double min_time = -0.5 * frame_time_s ;
603 
604  double max_time = (frame_index_range.second - frame_index_range.first + 0.5 ) * frame_time_s ;
605 
606  init_h_slice_starting_time (ts_type , n_frames , first_frame , last_frame , ts_name) ;
607 
608  init_h_rate (ts_type , n_frames , first_frame , last_frame , ts_name) ;
609 
610  init_h_active_modules (ts_type , n_frames , first_frame , last_frame , ts_name) ;
611 
612  init_h_du_active_modules (ts_type , du_ids , n_frames , first_frame , last_frame , ts_name) ;
613 
614  init_h_dom_mean_rates (ts_type , du_ids , modules_per_string , ts_name) ;
615 
616  init_h_ToT_255_vs_time (ts_type , ts_name) ;
617 
618  init_h_ToT_255_Floor_vs_time (ts_type , modules_per_string , ts_name) ;
619 
620  init_h_ToT_255_Floor_vs_time_2 (ts_type , modules_per_string , ts_name) ;
621 
622  init_m_mean_ToT (ts_type , modules_per_string , ts_name) ;
623 
624  init_m_ToT_255 (ts_type , modules_per_string , ts_name) ;
625 
626  init_m_module_rates_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ;
627 
628  init_m_pmt_tot_distributions (ts_type , ts_name) ;
629 
630  init_m_pmt_rate_distributions (ts_type , ts_name) ;
631 
632  init_m_pmt_tot_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ;
633 
634  init_m_pmt_rates_vs_time (ts_type , n_frames , min_time , max_time , ts_name) ;
635 
636  init_m_pmt_dt_consecutive_hits(ts_type , ts_name) ;
637 
638  }
639 
640  /*
641  * Fills the mean ToT as a function of the PMT and floor number for a given DU
642  *
643  * \param table table with the ToT distributions for each PMT in a module, for every timeslice type
644  * \param string The string number
645  * \param floor The floor number
646  */
648 
649  int i = 0 ;
650 
651  for (typename vector < JManager < string , TH2D >* >::const_iterator it = m_pmt_tot_distributions.begin() ; it != m_pmt_tot_distributions.end() ; ++it , ++i){
652 
653  if ((*it)){
654 
655  for (typename JManager < string , TH2D >::const_iterator j = (*it) -> begin() ; j != (*it) -> end() ; ++j){
656 
657  TString s (MAKE_STRING(j -> first).c_str()) ;
658 
659  TPRegexp r ("(\\w+)/(\\DU)(\\d+)/(F)(\\d+)") ;
660 
661  TObjArray* o = r.MatchS(s) ;
662 
663  int String = ((TObjString *)o->At(3))->GetString().Atoi();
664 
665  int Floor = ((TObjString *)o->At(5))->GetString().Atoi();
666 
667  for (int pmt = 1 ; pmt <= (j -> second) -> GetYaxis() -> GetNbins() ; pmt++){
668 
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 () ) ;
670 
671  }
672 
673  }
674 
675  }
676 
677  }
678 
679  }
680 
681  /*
682  * Initializes the histogram.
683  *
684  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
685  * \param n_frames The number of frames.
686  * \param first_frame the index of the first frame.
687  * \param last_frame the index of the last frame.
688  * \param ts_name The name of the timeslice type.
689  */
690  void init_h_slice_starting_time (int ts_type , int n_frames , int first_frame , int last_frame , std::string ts_name){
691 
692  string name = MAKE_STRING ("h_slice_starting_time_" + ts_name ) ;
693 
694  string title = MAKE_STRING ("Slice Starting Time (" + ts_name + "); slice number ; time since first slice [s]") ;
695 
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 ) ;
697 
698  }
699 
700  /*
701  * Initializes the histogram.
702  *
703  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
704  * \param n_frames The number of frames.
705  * \param first_frame the index of the first frame.
706  * \param last_frame tha index of the last frame.
707  * \param ts_name String containing the timeslice type.
708  */
709  void init_h_rate (int ts_type , int n_frames , int first_frame , int last_frame , std::string ts_name){
710 
711  string name = MAKE_STRING ("h_rate_" + ts_name) ;
712 
713  string title = MAKE_STRING ("Average module rate ("+ts_name+") ; slice number ; rate [Hz]") ;
714 
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 ) ;
716 
717  }
718 
719  /*
720  * Initializes the histogram.
721  *
722  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
723  * \param n_frames The number of frames.
724  * \param first_frame the index of the first frame.
725  * \param last_frame tha index of the last frame.
726  * \param ts_name String containing the timeslice type.
727  */
728  void init_h_active_modules (int ts_type , int n_frames , int first_frame , int last_frame , std::string ts_name){
729 
730  string name = MAKE_STRING ("h_active_DOMS_" + ts_name) ;
731 
732  string title = MAKE_STRING (" Active modules (" + ts_name + "); slice number ; fraction of active modules") ;
733 
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 ) ;
735 
736  }
737 
738  /*
739  * Initializes the histogram.
740  *
741  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
742  * \param du_ids The list of ids for the DUs in the detector.
743  * \param n_frames The number of frames.
744  * \param first_frame the index of the first frame.
745  * \param last_frame tha index of the last frame.
746  * \param ts_name String containing the timeslice type.
747  */
748  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){
749 
750  string name = MAKE_STRING ("h_du_active_DOMS_" + ts_name) ;
751 
752  string title = MAKE_STRING ("Active modules in DU (" + ts_name + "); slice number ; DU number ; number of active modules") ;
753 
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 ) ;
755 
756  }
757 
758  /*
759  * Initializes the histogram.
760  *
761  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
762  * \param modules_per_string The number of modules in a string.
763  * \param ts_name String containing the timeslice type.
764  */
765  void init_h_dom_mean_rates (int ts_type , std::set<int> du_ids , int modules_per_string , std::string ts_name){
766 
767  string name = MAKE_STRING ("h_mean_dom_rates_" + ts_name) ;
768 
769  string title = MAKE_STRING (ts_name + " ; Floor number ; DU number ; time slice averaged rate [Hz]") ;
770 
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) ;
772 
773  }
774 
775  /*
776  * Initializes the histogram.
777  *
778  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
779  * \param ts_name String containing the timeslice type.
780  */
781  void init_h_ToT_255_vs_time (int ts_type , string ts_name){
782 
783  string name = MAKE_STRING ("h_ToT_255_vs_time_" + ts_name) ;
784 
785  string title = MAKE_STRING (" (" + ts_name + ") Hits with ToT = 255 ns. All PMTs, all timeslices ; Time since beginning of slice [ns] ; counts ") ;
786 
787  h_ToT_255_vs_time[ts_type] = new TH1D (name.c_str() , title.c_str() , 100 , 0 , log10(getFrameTime())) ;
788 
789  BinLogX (h_ToT_255_vs_time[ts_type]) ;
790 
791  }
792 
793  /*
794  * Initializes the histogram.
795  *
796  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
797  * \param modules_per_string the number of modules in a string.
798  * \param ts_name String containing the timeslice type.
799  */
800  void init_h_ToT_255_Floor_vs_time (int ts_type , int modules_per_string , string ts_name){
801 
802  string name = MAKE_STRING ("h_ToT_255_Floor_vs_time_" + ts_name) ;
803 
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 ") ;
805 
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) ;
807 
808  BinLogX(h_ToT_255_Floor_vs_time[ts_type]) ;
809 
810  }
811 
812  /*
813  * Initializes the histogram.
814  *
815  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
816  * \param modules_per_string the number of modules in a string.
817  * \param ts_name String containing the timeslice type.
818  */
819  void init_h_ToT_255_Floor_vs_time_2 (int ts_type , int modules_per_string , string ts_name){
820 
821  string name = MAKE_STRING ("h_ToT_255_Floor_vs_time_2_" + ts_name) ;
822 
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 ") ;
824 
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) ;
826 
827  }
828 
829  /*
830  * Initializes the histogram.
831  *
832  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
833  * \param modules_per_string the number of modules in a string.
834  * \param ts_name String containing the timeslice type.
835  */
836  void init_m_mean_ToT (int ts_type , int modules_per_string , string ts_name){
837 
838  string name = MAKE_STRING ("%/h_mean_ToT_" + ts_name) ;
839 
840  string title = MAKE_STRING (ts_name + " ; Floor number ; TDC channel ; mean ToT over all timeslices [ns] ") ;
841 
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)) ;
843 
844  }
845 
846  /*
847  * Initializes the histogram.
848  *
849  * \param detector A JDetector.
850  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
851  * \param ts_name String containing the timeslice type.
852  */
853  void init_m_ToT_255 (int ts_type , int modules_per_string , string ts_name){
854 
855  string name = MAKE_STRING ("%/h_ToT_255_" + ts_name) ;
856 
857  string title = MAKE_STRING (ts_name + " ; Floor number ; TDC channel ; number of hits with ToT = 255 ns ") ;
858 
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)) ;
860 
861  }
862 
863  /*
864  * Initializes the histograms.
865  *
866  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
867  * \param ts_name String containing the timeslice type.
868  * \param min_time The minimum time
869  * \param max_time The maximum time
870  */
871  void init_m_module_rates_vs_time(int ts_type , int n_frames , double min_time , double max_time , string ts_name){
872 
873  string name = MAKE_STRING ( "%/h_module_rate_vs_time_" + ts_name ) ;
874 
875  string title = MAKE_STRING (ts_name + " ; time since run start [s] ; rate [Hz]" ) ;
876 
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)) ;
878 
879  }
880 
881  /*
882  * Initializes the histograms. The frame index range information is needed.
883  *
884  * \param ts_type index for the timeslice type, according to the JDAQTimeslicetypes_t typelist
885  * \param ts_name suffix string
886  */
887  void init_m_pmt_tot_distributions (int ts_type , string ts_name){
888 
889  string name = MAKE_STRING ("%_" + ts_name + "_2SToT") ;
890 
891  string title = MAKE_STRING (ts_name + " ; TDC channel ; ToT [ns] ; counts") ;
892 
893  m_pmt_tot_distributions[ts_type] = new JManager < string , TH2D > (new TH2D (name.c_str() , title.c_str() ,
894  NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5 ,
895  max_ToT - min_ToT + 1 , min_ToT - 0.5 , max_ToT + 0.5)) ;
896 
897  }
898 
899  /*
900  * Initializes the histograms. The frame index range information is needed.
901  *
902  * \param ts_type index for the timeslice type, according to the JDAQTimeslicetypes_t typelist
903  * \param ts_name suffix string
904  */
905  void init_m_pmt_rate_distributions(int ts_type , string ts_name){
906 
907  string name = MAKE_STRING ("%/h_pmt_rate_distributions_" + ts_name) ;
908 
909  string title = MAKE_STRING (ts_name + " ; rate [kHz] ; TDC channel ; counts ") ;
910 
911  TH2D* h_pmt_rate_distributions = new TH2D (name.c_str() , title.c_str() ,
912  60 , -6 , log10(20),
913  NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5) ;
914 
915  BinLogX (h_pmt_rate_distributions) ;
916 
917  m_pmt_rate_distributions[ts_type] = new JManager < string , TH2D > (h_pmt_rate_distributions) ;
918 
919  }
920 
921  /*
922  * Initializes the histograms.
923  *
924  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
925  * \param ts_name String containing the timeslice type.
926  * \param n_frames The number of frames in the run
927  * \param min_time The minimum time
928  * \param max_time The maximum time
929  */
930  void init_m_pmt_tot_vs_time(int ts_type , int n_frames , double min_time , double max_time , string ts_name){
931 
932  string name = MAKE_STRING ("%/ToT_vs_time_" + ts_name) ;
933 
934  string title = MAKE_STRING (ts_name + " ; time [s] ; TDC channel ; ToT [ns]") ;
935 
936  m_pmt_tot_vs_time[ts_type] = new JManager < string , TProfile2D > (new TProfile2D (name.c_str() , title.c_str() , int(n_frames/600) , min_time , max_time , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5)) ;
937 
938  }
939 
940  /*
941  * Initializes the histograms.
942  *
943  * \param ts_type index of the timeslicetype indicating its position on the JDAQTimeslicetypes_t typelist
944  * \param ts_name String containing the timeslice type.
945  * \param n_frames The number of frames
946  * \param min_time The minimum time
947  * \param max_time The maximum time
948  */
949  void init_m_pmt_rates_vs_time(int ts_type , int n_frames , double min_time , double max_time , string ts_name){
950 
951  string name = MAKE_STRING ( "%/h_rate_vs_time_" + ts_name ) ;
952 
953  string title = MAKE_STRING (ts_name + " ; time since run start [s] ; TDC channel ; rate [Hz]") ;
954 
955  m_pmt_rates_vs_time[ts_type] = new JManager < string , TProfile2D > (new TProfile2D (name.c_str() , title.c_str() , int(n_frames/600) , min_time , max_time , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5)) ;
956 
957  }
958 
959  /*
960  * Initializes the histograms. The frame index range information is needed.
961  *
962  * \param ts_type index for the timeslice type, according to the JDAQTimeslicetypes_t typelist
963  * \param ts_name suffix string
964  */
965  void init_m_pmt_dt_consecutive_hits(int ts_type , string ts_name){
966 
967  string name = MAKE_STRING ("%/h_dt_consecutive_hits_" + ts_name) ;
968 
969  string title = MAKE_STRING (ts_name + " ; log(dt [ns]) ; TDC channel ; counts") ;
970 
971  m_pmt_dt_consecutive_hits[ts_type] = new JManager < string , TH2D > (new TH2D (name.c_str() , title.c_str() , nbins_logdt , min_logdt , max_logdt, NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5)) ;
972 
973  }
974 
975 };
976 
977 /*
978  * Structure to store histograms obtained from the JDAQEvent TTree
979  */
981 
983 
985 
987 
989 
991 
993 
995 
996  /* One histogram per trigger */
997 
999 
1000  /* One histogram per DU*/
1001 
1003 
1005 
1007 
1009 
1011 
1013 
1015 
1016  /*
1017  * Constructor
1018  */
1020 
1021  h_Trigger_bit_event = NULL ;
1022 
1023  h_Trigger_bit_hit = NULL ;
1024 
1025  h_Snapshot_hits = NULL ;
1026 
1027  h_Triggered_hits = NULL ;
1028 
1029  h_Snapshot_hits_per_module = NULL ;
1030 
1031  h_Triggered_hits_per_module = NULL ;
1032 
1033  h_Trigger_map = NULL ;
1034 
1035  m_trigger_rates = NULL ;
1036 
1037  m_Snapshot_hits_per_pmt = NULL ;
1038 
1039  m_Trigger_map = NULL ;
1040 
1041  h_pmt_distribution_triggered_hits = NULL ;
1042 
1043  h_tot_distribution_triggered_hits = NULL ;
1044 
1045  h_pmt_distribution_snapshot_hits = NULL ;
1046 
1047  h_tot_distribution_snapshot_hits = NULL ;
1048 
1049  h_n_triggered_hits_distribution = NULL ;
1050 
1051  }
1052 
1053  /*
1054  * Initializes the histograms.
1055  * \param du_ids The list of du ids in the detector
1056  * \param frame_index_range The range of frame indices
1057  * \param modules_per_string The number of modules in a string.
1058  */
1059  void initialize(std::set<int> & du_ids , JFrameIndexRange & frame_index_range , int modules_per_string){
1060 
1061  int first_frame = frame_index_range.first ;
1062 
1063  int last_frame = frame_index_range.second ;
1064 
1065  int n_frames = last_frame - first_frame + 1 ;
1066 
1067  int n_pmts = du_ids.size() * modules_per_string * NUMBER_OF_PMTS ;
1068 
1069  init_h_Trigger_bit_event () ;
1070 
1071  init_h_Trigger_bit_hit () ;
1072 
1073  init_h_Snapshot_hits () ;
1074 
1075  init_h_Triggered_hits () ;
1076 
1077  init_h_Snapshot_hits_per_module (modules_per_string , du_ids) ;
1078 
1079  init_h_Triggered_hits_per_module (modules_per_string , du_ids) ;
1080 
1081  init_m_trigger_rates(first_frame , last_frame) ;
1082 
1083  init_m_Snapshot_hits_per_pmt (modules_per_string) ;
1084 
1085  init_m_Trigger_map (modules_per_string , n_frames , first_frame , last_frame) ;
1086 
1087  init_h_Trigger_map (modules_per_string , n_frames , first_frame , last_frame) ;
1088 
1089  init_h_pmt_distribution_triggered_hits() ;
1090 
1091  init_h_tot_distribution_triggered_hits() ;
1092 
1093  init_h_pmt_distribution_snapshot_hits() ;
1094 
1095  init_h_tot_distribution_snapshot_hits() ;
1096 
1097  init_h_n_triggered_hits_distribution (n_pmts) ;
1098 
1099  }
1100 
1101  /*
1102  * Initializes the histogram.
1103  */
1105 
1106  string name = MAKE_STRING ("h_Trigger_bit_event") ;
1107 
1108  string title = MAKE_STRING ("Number of events as a function of trigger bit in event ; Trigger Bit ; Counts ") ;
1109 
1110  h_Trigger_bit_event = new TH1D (name.c_str() , title.c_str() , NUMBER_OF_TRIGGER_BITS , -0.5, NUMBER_OF_TRIGGER_BITS - 0.5 ) ;
1111 
1112  for (int i = 0 ; i < (int) NUMBER_OF_TRIGGER_BITS ; i++){
1113 
1114  if (getTriggerName(i)){
1115 
1116  h_Trigger_bit_event -> GetXaxis() -> SetBinLabel(i+1 , getTriggerName(i) ) ;
1117 
1118  } else {
1119 
1120  h_Trigger_bit_event -> GetXaxis() -> SetBinLabel(i+1 , "" ) ;
1121 
1122  }
1123 
1124  }
1125 
1126  h_Trigger_bit_event -> GetXaxis() -> LabelsOption("v") ;
1127 
1128  }
1129 
1130  /*
1131  * Initializes the histogram.
1132  */
1134 
1135  string name = MAKE_STRING ("h_Trigger_bit_hit") ;
1136 
1137  string title = MAKE_STRING ("Number of hits per event as a function of trigger bit in hit ; Trigger Bit ; #Events ") ;
1138 
1139  h_Trigger_bit_hit = new TH1D (name.c_str() , title.c_str() , NUMBER_OF_TRIGGER_BITS, -0.5, NUMBER_OF_TRIGGER_BITS - 0.5 ) ;
1140 
1141  for (int i = 0 ; i < (int) NUMBER_OF_TRIGGER_BITS ; i++){
1142 
1143  if (getTriggerName(i)){
1144 
1145  h_Trigger_bit_hit -> GetXaxis() -> SetBinLabel(i+1 , getTriggerName(i) ) ;
1146 
1147  } else {
1148 
1149  h_Trigger_bit_hit -> GetXaxis() -> SetBinLabel(i+1 , "" ) ;
1150 
1151  }
1152 
1153  }
1154 
1155  h_Trigger_bit_hit -> GetXaxis() -> LabelsOption("v") ;
1156 
1157  }
1158 
1159  /*
1160  * Initializes the histogram.
1161  */
1163 
1164  string name = MAKE_STRING ("h_Snapshot_hits") ;
1165 
1166  string title = MAKE_STRING (" Snapshot hits ; Number of hits ; Counts/#Events ") ;
1167 
1168  h_Snapshot_hits = new TH1D (name.c_str() , title.c_str() , 50, 0, 4 ) ;
1169 
1170  BinLogX (h_Snapshot_hits) ;
1171 
1172  }
1173 
1174  /*
1175  * Initializes the histogram.
1176  */
1178 
1179  string name = MAKE_STRING ("h_Triggered_hits") ;
1180 
1181  string title = MAKE_STRING (" Triggered hits ; Number of hits ; Counts/#Events ") ;
1182 
1183  h_Triggered_hits = new TH1D (name.c_str() , title.c_str() , 50 , 0, 4 ) ;
1184 
1185  BinLogX (h_Triggered_hits) ;
1186 
1187  }
1188 
1189  /*
1190  * Initializes the histogram.
1191  * \param du_ids The list of du ids in the detector
1192  * \param modules_per_string.
1193  */
1194  void init_h_Snapshot_hits_per_module(int modules_per_string , std::set<int> & du_ids){
1195 
1196  string name = MAKE_STRING ("h_Snapshot_hits_per_module") ;
1197 
1198  string title = MAKE_STRING (" ; String ; Floor ; Number of snapshot hits ") ;
1199 
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 ) ;
1203 
1204  }
1205 
1206  /*
1207  * Initializes the histogram.
1208  * \param du_ids The list of du ids in the detector
1209  * \param modules_per_string.
1210  */
1211  void init_h_Triggered_hits_per_module(int modules_per_string , std::set<int> & du_ids){
1212 
1213  string name = MAKE_STRING ("h_Triggered_hits_per_module") ;
1214 
1215  string title = MAKE_STRING (" ; String ; Floor ; Number of triggered hits ") ;
1216 
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 ) ;
1220 
1221  }
1222 
1223  /*
1224  * Initializes the histogram manager.
1225  * \param modules_per_string The number of modules in a string
1226  * \param first_frame The first frame index.
1227  * \param last_frame The last frame index
1228  * \param seconds_per_bin Bin width in seconds
1229  */
1230  void init_h_Trigger_map(int modules_per_string , int n_frames , int first_frame , int last_frame){
1231 
1232  string name = MAKE_STRING ("h_Trigger_map") ;
1233 
1234  string title = MAKE_STRING (" ; Frame index ; DOM ; Number of triggered hits ") ;
1235 
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 ) ;
1238 
1239  }
1240 
1241  /*
1242  * Initializes the histogram manager.
1243  *
1244  * \param first_frame The first frame index.
1245  * \param last_frame The last frame index
1246  * \param seconds_per_bin Bin width in seconds
1247  */
1248  void init_m_trigger_rates(int first_frame , int last_frame , int seconds_per_bin = 30){
1249 
1250  int frames_per_bin = seconds_per_bin / getFrameTime() / 1e-9 ;
1251 
1252  int n_bins = (last_frame - first_frame) / frames_per_bin ;
1253 
1254  string title = MAKE_STRING (" ; Frame Index ; rate [Hz] ") ;
1255 
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)) ;
1257 
1258  }
1259 
1260  /*
1261  * Initializes the histogram.
1262  *
1263  * \param modules_per_string The number of modules in a string.
1264  */
1265  void init_m_Snapshot_hits_per_pmt(int modules_per_string){
1266 
1267  string name = MAKE_STRING ("%/h_Snapshot_hits_per_pmt") ;
1268 
1269  string title = MAKE_STRING (" ; PMT ; Floor ; Number of snapshot hits ") ;
1270 
1271  m_Snapshot_hits_per_pmt = new JManager < string , TH2D > ( new TH2D (name.c_str() , title.c_str() , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5 ,
1272  modules_per_string , 0.5 , modules_per_string + 0.5 ) ) ;
1273 
1274  }
1275 
1276  /*
1277  * Initializes the histogram manager.
1278  * \param modules_per_string The number of modules in a string
1279  * \param first_frame The first frame index.
1280  * \param last_frame The last frame index
1281  * \param seconds_per_bin Bin width in seconds
1282  */
1283  void init_m_Trigger_map(int modules_per_string , int n_frames , int first_frame , int last_frame){
1284 
1285  string name = MAKE_STRING ("%/h_Trigger_map") ;
1286 
1287  string title = MAKE_STRING (" ; Frame index ; DOM ; Mean number of triggered hits per event") ;
1288 
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)) ;
1291 
1292  }
1293 
1294  /*
1295  * Initializes the histogram.
1296  *
1297  * \param detector A JDetector.
1298  */
1300 
1301  string name = MAKE_STRING ("h_pmt_distribution_triggered_hits") ;
1302 
1303  string title = MAKE_STRING (" ; PMT number ; Counts [a.u.]") ;
1304 
1305  h_pmt_distribution_triggered_hits = new TH1D (name.c_str() , title.c_str() , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5) ;
1306 
1307  }
1308 
1309  /*
1310  * Initializes the histogram.
1311  */
1313 
1314  string name = MAKE_STRING ("h_tot_distribution_triggered_hits") ;
1315 
1316  string title = MAKE_STRING (" ; ToT [ns] ; Counts [a.u.]") ;
1317 
1318  h_tot_distribution_triggered_hits = new TH1D (name.c_str() , title.c_str() , 255 , 0.5 , 255.5 ) ;
1319 
1320  }
1321 
1322  /*
1323  * Initializes the histogram.
1324  */
1326 
1327  string name = MAKE_STRING ("h_pmt_distribution_snapshot_hits") ;
1328 
1329  string title = MAKE_STRING (" ; PMT number ; Counts [a.u.]") ;
1330 
1331  h_pmt_distribution_snapshot_hits = new TH1D (name.c_str() , title.c_str() , NUMBER_OF_PMTS , -0.5 , NUMBER_OF_PMTS - 0.5) ;
1332 
1333  }
1334 
1335  /*
1336  * Initializes the histogram.
1337  */
1339 
1340  string name = MAKE_STRING ("h_tot_distribution_snapshot_hits") ;
1341 
1342  string title = MAKE_STRING (" ; ToT [ns] ; Counts [a.u.]") ;
1343 
1344  h_tot_distribution_snapshot_hits = new TH1D (name.c_str() , title.c_str() , 255 , 0.5 , 255.5 ) ;
1345 
1346  }
1347 
1348  /*
1349  * Initializes the histogram.
1350  *
1351  * \param n_pmts The number of pmts in the detector.
1352  */
1354 
1355  string name = MAKE_STRING ("h_n_triggered_hits_distribution") ;
1356 
1357  string title = MAKE_STRING (" ; Number of hits ; Counts") ;
1358 
1359  h_n_triggered_hits_distribution = new TH1D (name.c_str() , title.c_str() , n_pmts , 0.5 , n_pmts + 0.5 ) ;
1360 
1361  }
1362 
1363 };
1364 
1365 /*
1366  * Class to manage the histograms produced by JRunAnalyzer.
1367  */
1369 
1370 public:
1371 
1373 
1375 
1377 
1379 
1381 
1383 
1385 
1387 
1388  detector = det ;
1389 
1390  du_ids = getStringIDs(detector) ;
1391 
1393 
1394  h_summary = SummaryHistograms() ;
1395 
1396  h_timeslice = TimesliceHistograms() ;
1397 
1398  h_trigger = TriggerHistograms () ;
1399 
1400  }
1401 
1402  /*
1403  * Initializes summary slice histograms.
1404  *
1405  * \param range The range of values for the summary slice indices in the run. The range of some histograms is based on the number of time slices, and their indices.
1406  */
1408 
1409  h_summary.initialize(du_ids , modules_per_string , range) ;
1410 
1411  }
1412 
1413  /*
1414  * Initializes summary slice histograms.
1415  *
1416  * \param range The range of values for the summary slice indices in the run. The range of some histograms is based on the number of time slices, and their indices.
1417  */
1418  template <class T>
1420 
1421  const int index = JIndexOf<JDAQTimesliceTypes_t , T>::value ;
1422 
1423  const string prefix = "KM3NETDAQ::JDAQ" ;
1424 
1425  string ts_name = T::Class_Name() ;
1426 
1427  string::size_type pos = ts_name.find(prefix);
1428 
1429  if (pos != string::npos) ts_name.replace(ts_name.find(prefix) , prefix.length() , "") ;
1430 
1431  h_timeslice.initialize(du_ids , modules_per_string , range , index , ts_name) ;
1432 
1433  }
1434 
1435  /*
1436  * Initializes JDAQEvent histograms.
1437  */
1439 
1440  h_trigger.initialize (du_ids , range , modules_per_string) ;
1441 
1442  }
1443 
1444  /*
1445  * Checks if the histograms in a table have been initialized. If yes, it writes them on the indicated directory of a root file
1446  *
1447  * \param f The root file
1448  * \param dirname The directory where the histograms will be written
1449  * \param table A vector of histograms.
1450  */
1451  template <class T>
1452  void Write_histogram_table_to_file(TFile & f , string dirname , vector < vector < T* > > table){
1453 
1454  if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
1455 
1456  f.cd (dirname.c_str()) ;
1457 
1458  for (int i=0 ; i < (int)table.size() ; i++){
1459 
1460  for (int j=0 ; j< (int)table[i].size() ; j++){
1461 
1462  if (table[i][j]) table [i][j] -> Write() ;
1463 
1464  }
1465 
1466  }
1467 
1468  }
1469 
1470  /*
1471  * Checks if the histograms in a table have been initialized. If yes, it writes them on the indicated directory of a root file
1472  *
1473  * \param f The root file
1474  * \param dirname The directory where the histograms will be written
1475  * \param table A vector of histograms.
1476  */
1477  template <class T>
1478  void Write_histogram_table_to_file(TFile & f , string dirname , vector < T* > table){
1479 
1480  if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
1481 
1482  f.cd (dirname.c_str()) ;
1483 
1484  for (int i=0 ; i < (int)table.size() ; i++){
1485 
1486  if (table[i]) table[i] -> Write() ;
1487 
1488  }
1489 
1490  }
1491 
1492  /*
1493  * Checks if the histograms in a table have been initialized. If yes, it writes them on the indicated directory of a root file
1494  *
1495  * \param f The root file
1496  * \param dirname The directory where the histograms will be written
1497  * \param table A vector of histograms.
1498  */
1499  template <class T , class V>
1500  void Write_manager_to_file(TFile & f , string dirname , JManager < T , V >* table){
1501 
1502  if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str()) ;
1503 
1504  f.cd (dirname.c_str()) ;
1505 
1506  for (typename JManager < T , V >::const_iterator i = table -> begin() ; i != table -> end() ; ++i){
1507 
1508  i -> second -> Write() ;
1509 
1510  }
1511 
1512  }
1513 
1514  /*
1515  * Replaces wildcard in manager objects titles by their keys.
1516  * \param A manager.
1517  * \param wc The wildcard
1518  */
1519  template <class T , class V>
1520  void Replace_wildcard_in_name(JManager < T , V >* manager , char wc = '%'){
1521 
1522  for (typename JManager < T , V >::const_iterator i = manager -> begin() ; i != manager -> end() ; ++i){
1523 
1524  if (i -> second -> GetTitle()){
1525 
1526  std::string buffer = i -> second -> GetTitle() ;
1527 
1528  string::size_type ipos = buffer.find(wc) ;
1529 
1530  if (ipos!=std::string::npos){
1531 
1532  ostringstream os;
1533 
1534  os << i -> first ;
1535 
1536  buffer.replace(ipos, 1, os.str());
1537 
1538  i -> second -> SetTitle(buffer.c_str()) ;
1539 
1540  }
1541 
1542  }
1543 
1544  }
1545 
1546  }
1547 
1548  /*
1549  * Writes the contents of a JManager into a file. Each object in each will be written in a directory specified by its key.
1550  * \param f The root file
1551  * \param A manager.
1552  */
1553  template < class T , class V >
1554  void Write_manager_in_key_dir(TFile & f ,JManager <T , V>* manager){
1555 
1556  for (typename JManager < T , V >::const_iterator i = manager -> begin() ; i != manager -> end() ; ++i){
1557 
1558  std::string fullpath = MAKE_STRING(i-> second -> GetName()) ;
1559 
1560  int pos = fullpath.rfind ('/');
1561 
1562  std::string name = fullpath.substr (pos + 1) ;
1563 
1564  std::string path = fullpath.substr (0 , pos) ;
1565 
1566  if (f.GetDirectory(path.c_str()) == 0) f.mkdir (path.c_str()) ;
1567 
1568  f.cd(path.c_str()) ;
1569 
1570  i -> second -> SetName(name.c_str()) ;
1571 
1572  i -> second -> Write() ;
1573 
1574  }
1575 
1576  }
1577 
1578  /*
1579  * Writes the contents of a vector of JManager objects into a file. Each object in each will be written in a directory specified by its key.
1580  * \param f The root file
1581  * \param table the list of JManager objects.
1582  */
1583  template < class T , class V >
1585 
1586  for (typename vector < JManager < T , V >* >::const_iterator i = table.begin() ; i != table.end() ; ++i){
1587 
1588  if ((*i)){
1589 
1590  for (typename JManager < T , V >::const_iterator j = (*i) -> begin() ; j != (*i) -> end() ; ++j){
1591 
1592  std::string fullpath = MAKE_STRING(j-> second -> GetName()) ;
1593 
1594  int pos = fullpath.rfind ('/');
1595 
1596  std::string name = fullpath.substr (pos + 1) ;
1597 
1598  std::string path = fullpath.substr (0 , pos) ;
1599 
1600  if (f.GetDirectory(path.c_str()) == 0) f.mkdir (path.c_str()) ;
1601 
1602  f.cd(path.c_str()) ;
1603 
1604  j -> second -> SetName(name.c_str()) ;
1605 
1606  j -> second -> Write() ;
1607 
1608  }
1609 
1610  }
1611 
1612  }
1613 
1614  }
1615 
1616  /*
1617  * Writes the histograms to a root file.
1618  * \param f The root file.
1619  */
1620  void Write_to_file(TFile & f){
1621 
1622  f.mkdir("Detector") ;
1623 
1624  f.cd("Detector") ;
1625 
1626  if (h_summary.h_fifo) h_summary.h_fifo -> Write() ;
1627 
1628  if (h_summary.h_daq_status) h_summary.h_daq_status -> Write() ;
1629 
1630  if (h_summary.h_hrv) h_summary.h_hrv -> Write() ;
1631 
1632  if (h_summary.h_fifo_per_dom) h_summary.h_fifo_per_dom -> Write() ;
1633 
1634  if (h_summary.h_daq_status_per_dom) h_summary.h_daq_status_per_dom -> Write() ;
1635 
1636  if (h_summary.h_hrv_per_dom) h_summary.h_hrv_per_dom -> Write() ;
1637 
1638  if (h_summary.h_rate_summary) h_summary.h_rate_summary -> Write() ;
1639 
1640  if (h_summary.h_pmt_rate_distribution) h_summary.h_pmt_rate_distribution -> Write() ;
1641 
1642  Write_histogram_table_to_file(f , MAKE_STRING("Detector/ToT_255_vs_time") , h_timeslice.h_ToT_255_vs_time) ;
1643 
1644  Write_histogram_table_to_file(f , MAKE_STRING("Detector/ToT_255_Floor_vs_time") , h_timeslice.h_ToT_255_Floor_vs_time) ;
1645 
1646  Write_histogram_table_to_file(f , MAKE_STRING("Detector/ToT_255_Floor_vs_time") , h_timeslice.h_ToT_255_Floor_vs_time_2) ;
1647 
1648  Write_histogram_table_to_file(f , MAKE_STRING("Detector/slice_start_time") , h_timeslice.h_slice_start_time) ;
1649 
1650  Write_histogram_table_to_file(f , MAKE_STRING("Detector/Rate") , h_timeslice.h_rate) ;
1651 
1652  Write_histogram_table_to_file(f , MAKE_STRING("Detector/Active_modules_detector") , h_timeslice.h_active_modules) ;
1653 
1654  Write_histogram_table_to_file(f , MAKE_STRING("Detector/Active_modules_du") , h_timeslice.h_du_active_modules) ;
1655 
1656  Write_histogram_table_to_file(f , MAKE_STRING("Detector/DOM_mean_rates") , h_timeslice.h_dom_mean_rates) ;
1657 
1658  Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_tot_distributions) ;
1659 
1660  Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_rate_distributions) ;
1661 
1662  Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_tot_vs_time) ;
1663 
1664  Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_rates_vs_time) ;
1665 
1666  Write_manager_in_key_dir (f , h_summary.m_summary_rate_vs_time) ;
1667 
1668  Write_manager_in_key_dir (f , h_summary.m_summary_rate_distribution) ;
1669 
1670  Write_manager_in_key_dir (f , h_summary.m_fifo_full) ;
1671 
1672  Write_manager_in_key_dir (f , h_summary.m_hrv) ;
1673 
1674  Write_manager_in_key_dir (f , h_summary.m_module_rates_vs_time) ;
1675 
1676  Write_manager_in_key_dir (f , h_trigger.m_Trigger_map) ;
1677 
1678  Write_manager_table_in_key_dir (f , h_timeslice.m_pmt_dt_consecutive_hits) ;
1679 
1680  Write_manager_table_in_key_dir (f , h_timeslice.m_ToT_255) ;
1681 
1682  Write_manager_table_in_key_dir (f , h_timeslice.m_module_rates_vs_time) ;
1683 
1684  if (h_summary.m_mean_summary_rate) Write_manager_in_key_dir( f , h_summary.m_mean_summary_rate) ;
1685 
1686  h_timeslice.Fill_mean_ToT_histograms() ;
1687 
1688  Write_manager_table_in_key_dir (f , h_timeslice.m_mean_ToT) ;
1689 
1690  f.mkdir ( MAKE_STRING ("JDAQEvent").c_str() ) ;
1691 
1692  f.cd ("JDAQEvent") ;
1693 
1694  if (h_trigger.h_Trigger_bit_event) h_trigger.h_Trigger_bit_event -> Write() ;
1695 
1696  if (h_trigger.h_Trigger_bit_hit) h_trigger.h_Trigger_bit_hit -> Write() ;
1697 
1698  f.mkdir ( MAKE_STRING ("JDAQEvent/hits_per_event").c_str() ) ;
1699 
1700  f.cd ("JDAQEvent/hits_per_event") ;
1701 
1702  if (h_trigger.h_Triggered_hits) h_trigger.h_Triggered_hits -> Write() ;
1703 
1704  if (h_trigger.h_Snapshot_hits) h_trigger.h_Snapshot_hits -> Write() ;
1705 
1706  f.mkdir ( MAKE_STRING ("JDAQEvent/hits_pmt_distributions").c_str() ) ;
1707 
1708  f.cd ("JDAQEvent/hits_pmt_distributions") ;
1709 
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() ; }
1711 
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() ; }
1713 
1714  f.mkdir ( MAKE_STRING ("JDAQEvent/hits_tot_distributions").c_str() ) ;
1715 
1716  f.cd ("JDAQEvent/hits_tot_distributions") ;
1717 
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() ; }
1719 
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() ; }
1721 
1722  f.mkdir ( MAKE_STRING ("JDAQEvent/trigger_rates").c_str() ) ;
1723 
1724  f.cd ("JDAQEvent/trigger_rates") ;
1725 
1726  if (h_trigger.m_trigger_rates){
1727 
1728  for (JManager<string , TH1D>::const_iterator i = h_trigger.m_trigger_rates->begin() ; i != h_trigger.m_trigger_rates->end() ; ++i){
1729 
1730  i -> second -> Scale (1./(i->second->GetBinWidth(1) * getFrameTime() * 1e-9) ) ;
1731 
1732  i -> second -> Write() ;
1733 
1734  }
1735 
1736  }
1737 
1738  f.cd ("JDAQEvent") ;
1739 
1740  //if (h_trigger.h_Trigger_map) { h_trigger.h_Trigger_map -> Write() ; }
1741 
1742  if (h_trigger.h_Triggered_hits_per_module) { h_trigger.h_Triggered_hits_per_module -> Write() ; }
1743 
1744  if (h_trigger.h_Snapshot_hits_per_module) { h_trigger.h_Snapshot_hits_per_module -> Write() ; }
1745 
1746  if (h_trigger.h_n_triggered_hits_distribution) { h_trigger.h_n_triggered_hits_distribution -> Write() ; }
1747 
1748  if (h_trigger.m_Snapshot_hits_per_pmt) Write_manager_in_key_dir( f , h_trigger.m_Snapshot_hits_per_pmt) ;
1749 
1750  }
1751 
1752 };
1753 
1754 #endif
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
std::set< int > du_ids
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 BinLogX(T *h)
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_Triggered_hits_per_module(int modules_per_string, std::set< int > &du_ids)
TH2D * h_Triggered_hits_per_module
Detector data structure.
Definition: JDetector.hh:77
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)
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.
Definition: JPrint.hh:602
Length of type list.
Definition: JTypeList.hh:176
JValue_t second
Definition: JPair.hh:129
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.
Definition: JManager.hh:38
void Write_to_file(TFile &f)
void init_m_summary_rate_distribution()
void init_h_tot_distribution_triggered_hits()
JKey_t first
Definition: JPair.hh:128
void initialize(std::set< int > &du_ids, int modules_per_string, JFrameIndexRange &frame_index_range)
TimesliceHistograms h_timeslice
Detector file.
Definition: JHead.hh:126
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.
Definition: JDAQClock.hh:162
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)
Support methods.
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)
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)
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.
Definition: JHead.hh:98
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
Setting of trigger bits.
Indexing of data type in type list.
Definition: JTypeList.hh:310
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26
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.
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)