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