1 #ifndef __JRUNHISTOGRAMS__
2 #define __JRUNHISTOGRAMS__
26 #include "TProfile2D.h"
29 #include "TPaveText.h"
34 #include "TDirectory.h"
36 #include "TObjArray.h"
37 #include "TObjString.h"
40 using namespace KM3NETDAQ ;
41 using namespace JLANG ;
43 using namespace JSUPPORT ;
66 h_fifo_per_dom = NULL;
67 h_daq_status_per_dom = NULL;
69 h_rate_summary = NULL;
70 h_pmt_rate_distribution = NULL;
71 h_dom_rate_distribution = NULL;
72 m_mean_summary_rate = NULL;
73 m_mean_summary_rate_distribution = NULL;
74 m_summary_rate_distribution = NULL;
82 h_fifo_per_dom =
new TH2D (
"h_fifo_per_dom",
" FIFO ; String ; Floor ; Number of slices with FIFO almost full x number of PMTs ",
83 *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , modules_per_string + 0.5 );
85 h_daq_status_per_dom =
new TH2D (
"h_daq_status_per_dom",
86 " Fraction of wrong DAQ Status [%]; String ; Floor ; Fraction of slices with wrong DAQ status of packets [%]",
87 *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , modules_per_string + 0.5 );
89 h_hrv_per_dom =
new TH2D (
"h_hrv_per_dom",
"HRV ; String ; Floor ; Number of slices x number of PMTs in HRV",
90 *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , modules_per_string + 0.5 );
92 h_rate_summary =
new TH2D (
"h_rate_summary",
"Summary slices ; String ; Floor ; Mean rate over all summary slices [kHz]",
93 *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 , modules_per_string , 0.5 , modules_per_string + 0.5 );
95 h_pmt_rate_distribution =
new TH1D (
"h_pmt_rate_distribution",
"PMT rate distribution from summary slices ; rate [kHz] ; Counts",
98 h_dom_rate_distribution =
new TH1D (
"h_dom_rate_distribution",
"DOM rate distribution from summary slices ; rate [kHz] ; Counts", 50 ,
log10(50) ,
log10(2000));
101 TH1D* h =
new TH1D(
"%/h_mean_summary_rate_distribution",
" ; rate [kHz] ; # PMTs", 40 , 0 ,
log10(1000));
105 m_mean_summary_rate =
new JManager < string , TH2D > (
new TH2D(
"%/h_mean_summary_rate",
" ; TDC Channel ; Floor ; rate [kHz]",
107 modules_per_string , 0.5 , 0.5 + modules_per_string));
109 TH2D* h_summary_rate_distribution =
new TH2D (
"%/h_pmt_rate_distributions_Summaryslice",
"Summaryslice ; TDC channel ; rate [kHz] ; counts",
146 h_dom_mean_rates .resize (number_of_timeslice_types , NULL);
147 m_mean_ToT .resize (number_of_timeslice_types , NULL);
148 m_mean_ToT_distribution .resize (number_of_timeslice_types , NULL);
149 m_pmt_tot_distributions .resize (number_of_timeslice_types , NULL);
150 m_pmt_rate_distributions .resize (number_of_timeslice_types , NULL);
163 h_dom_mean_rates[ts_type] =
new TH2D (
MAKE_STRING (
"h_mean_dom_rates_" + ts_name).c_str(),
164 MAKE_STRING (ts_name +
" ; DU number ; Floor number ; time slice averaged rate [Hz]").c_str() ,
165 *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 ,
166 modules_per_string , 0.5 , 0.5 + modules_per_string);
169 MAKE_STRING (ts_name +
" ; TDC channel ; Floor number ; mean ToT [ns] ").c_str(),
171 modules_per_string , 0.5 , 0.5 + modules_per_string));
174 MAKE_STRING (ts_name +
" ; ToT [ns] ; # PMTS ").c_str(),
177 TH2D* h =
new TH2D (
MAKE_STRING (
"%_" + ts_name +
"_2SToT").c_str(),
178 MAKE_STRING (ts_name +
" ; TDC channel ; ToT [ns] ; counts").c_str(),
199 TH2D* h_pmt_rate_distributions =
new TH2D (
MAKE_STRING (
"%/h_pmt_rate_distributions_" + ts_name).c_str(),
200 MAKE_STRING (ts_name +
" ; TDC channel ; rate [kHz] ; counts ").c_str(),
226 TPRegexp
r (
"(\\w+)/(\\DU)(\\d+)/(F)(\\d+)");
228 TObjArray*
o = r.MatchS(s);
230 int String = ((TObjString *)o->At(3))->GetString().Atoi();
231 int Floor = ((TObjString *)o->At(5))->GetString().Atoi();
233 for (
int pmt = 1 ; pmt <= (
j -> second) -> GetXaxis() -> GetNbins() ; pmt++){
235 (*m_mean_ToT[
i])[
MAKE_STRING(
"Detector/DU" +
to_string(String))] -> Fill((
j->second) -> GetXaxis() -> GetBinCenter(pmt) , Floor , (
j -> second) -> ProjectionY (
"" , pmt , pmt) -> GetMean () );
236 (*m_mean_ToT_distribution[
i])[
MAKE_STRING(
"Detector/DU" +
to_string(String))] -> Fill((
j -> second) -> ProjectionY (
"" , pmt , pmt) -> GetMean () );
273 h_Trigger_bit_event = NULL;
274 h_Trigger_bit_hit = NULL;
275 h_Snapshot_hits = NULL;
276 h_Triggered_hits = NULL;
277 h_Triggered_hits_3dmuon = NULL;
278 h_Triggered_hits_3dmuon_per_module = NULL;
279 h_Triggered_over_Snapshot_hits = NULL;
280 h_event_duration = NULL;
281 h_Number_of_overlays = NULL;
282 h_Snapshot_hits_per_module = NULL;
283 h_Triggered_hits_per_module = NULL;
284 m_Snapshot_hits_per_pmt = NULL;
285 h_pmt_distribution_triggered_hits = NULL;
286 h_tot_distribution_triggered_hits = NULL;
287 h_pmt_distribution_snapshot_hits = NULL;
288 h_tot_distribution_snapshot_hits = NULL;
299 h_Trigger_bit_event =
new TH1D (
"h_Trigger_bit_event",
300 "Number of events as a function of trigger bit in event ; Trigger Bit ; Counts",
310 h_Trigger_bit_event -> GetXaxis() -> SetBinLabel(
i+1 ,
"" );
313 h_Trigger_bit_event -> GetXaxis() -> LabelsOption(
"v");
316 h_Trigger_bit_hit =
new TH1D (
"h_Trigger_bit_hit",
317 "Number of hits per event as a function of trigger bit in hit ; Trigger Bit ; #Events",
327 h_Trigger_bit_hit -> GetXaxis() -> SetBinLabel(
i+1 ,
"" );
331 h_Trigger_bit_hit -> GetXaxis() -> LabelsOption(
"v");
333 h_Snapshot_hits =
new TH1D (
"h_Snapshot_hits",
" ; Number of snapshot hits; Events ", 50, 0, 4 );
336 h_Triggered_hits =
new TH1D (
"h_Triggered_hits",
" ; Number of triggered hits; Events ", 50 , 0, 4 );
339 h_Triggered_hits_3dmuon =
new TH1D (
"h_Triggered_hits_3dmuon",
" ; Number of triggered hits for JTRIGGER3DMUON; Events ", 50 , 0, 3 );
342 h_Triggered_hits_3dmuon_per_module =
new TH2D (
"h_Triggered_hits_3dmuon_per_module",
343 "Number of triggered hits for JTRIGGER3DMUON; String ; Floor ; Number of JTRIGGER3DMUON hits",
344 *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5,
345 modules_per_string , 0.5 , modules_per_string + 0.5 );
347 h_Triggered_over_Snapshot_hits =
new TH1D (
"h_Triggered_over_Snapshot_hits",
" ; Triggered/Snapshot hits; Events", 100 , 0, 0.5 );
349 h_event_duration =
new TH1D (
"h_event_duration",
" ; Event Duration [ns]; Events", 60 , 1, 6 );
352 h_Number_of_overlays =
new TH1D (
"h_Number_of_overlays",
" ; Number of overlays; Events ", 1000, -0.5, 1000 - 0.5 );
353 h_Snapshot_hits_per_module =
new TH2D (
"h_Snapshot_hits_per_module",
354 " ; String ; Floor ; Number of snapshot hits ",
355 *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 ,
356 modules_per_string , 0.5 , modules_per_string + 0.5 );
358 h_Triggered_hits_per_module =
new TH2D (
"h_Triggered_hits_per_module",
359 " ; String ; Floor ; Number of triggered hits",
360 *du_ids.rbegin() , 0.5 , *du_ids.rbegin() + 0.5 ,
361 modules_per_string , 0.5 , modules_per_string + 0.5 );
364 " ; TDC Channel ; Floor ; Number of snapshot hits",
366 modules_per_string , 0.5 , modules_per_string + 0.5 ) );
368 h_pmt_distribution_triggered_hits =
new TH1D (
"h_pmt_distribution_triggered_hits",
370 h_tot_distribution_triggered_hits =
new TH1D (
"h_tot_distribution_triggered_hits",
" ; ToT [ns] ; Counts [a.u.]", 256 , -0.5, 255.5);
371 h_pmt_distribution_snapshot_hits =
new TH1D (
"h_pmt_distribution_snapshot_hits",
" ; TDC Channel ; Counts [a.u.]",
NUMBER_OF_PMTS , -0.5 ,
NUMBER_OF_PMTS - 0.5);
372 h_tot_distribution_snapshot_hits =
new TH1D (
"h_tot_distribution_snapshot_hits",
" ; ToT [ns] ; Counts [a.u.]", 256, -0.5, 255.5);
407 h_summary.initialize(du_ids , modules_per_string);
419 const string prefix =
"KM3NETDAQ::JDAQ" ;
420 string ts_name = T::Class_Name();
421 string::size_type pos = ts_name.find(prefix);
423 if (pos != string::npos) ts_name.replace(ts_name.find(prefix) , prefix.length() ,
"");
425 h_timeslice.initialize(du_ids , modules_per_string , index , ts_name);
433 h_trigger.initialize (du_ids , modules_per_string);
446 if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str());
448 f.cd (dirname.c_str());
450 for (
int i=0 ;
i < (int)table.size();
i++){
452 for (
int j=0 ;
j< (int)table[
i].size();
j++){
454 if (table[
i][
j]) table [
i][
j] -> Write();
469 if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str());
471 f.cd (dirname.c_str());
473 for (
int i=0 ;
i < (int)table.size();
i++){
475 if (table[
i]) table[
i] -> Write();
486 template <
class T ,
class V>
489 if(f.GetDirectory(dirname.c_str()) == 0) f.mkdir (dirname.c_str());
491 f.cd (dirname.c_str());
495 i -> second -> Write();
504 template <
class T ,
class V>
509 if (
i -> second -> GetTitle()){
512 string::size_type ipos = buffer.find(wc);
514 if (ipos!=std::string::npos){
520 buffer.replace(ipos, 1, os.str());
522 i -> second -> SetTitle(buffer.c_str());
533 template <
class T ,
class V >
540 int pos = fullpath.rfind (
'/');
544 if (f.GetDirectory(path.c_str()) == 0) f.mkdir (path.c_str());
548 i -> second -> SetName(name.c_str());
549 i -> second -> Write();
558 template <
class T ,
class V >
569 int pos = fullpath.rfind (
'/');
573 if (f.GetDirectory(path.c_str()) == 0) f.mkdir (path.c_str());
577 j -> second -> SetName(name.c_str());
578 j -> second -> Write();
TH1D * h_pmt_distribution_snapshot_hits
TH2D * h_Snapshot_hits_per_module
ROOT TTree parameter settings of various packages.
static const unsigned int NUMBER_OF_TRIGGER_BITS
Number of trigger bits.
TH1D * h_pmt_distribution_triggered_hits
vector< JManager< string, TH2D > * > m_pmt_tot_distributions
JManager< string, TH1D > * m_mean_summary_rate_distribution
void Write_histogram_table_to_file(TFile &f, string dirname, vector< T * > table)
vector< TH2D * > h_dom_mean_rates
TH1D * h_Number_of_overlays
TH2D * h_Triggered_hits_per_module
std::set< int > getStringIDs(const JDetector &detector)
Get list of strings identifiers.
void initialize(std::set< int > &du_ids, int modules_per_string)
then echo Enter input within $TIMEOUT_S seconds echo n User name
o $QUALITY_ROOT d $DEBUG!CHECK_EXIT_CODE JPlot1D f
void initialize(std::set< int > &du_ids, int modules_per_string)
TH2D * h_daq_status_per_dom
Dynamic ROOT object management.
void initialize_summary_histograms()
JManager< string, TH2D > * m_mean_summary_rate
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
TH1D * h_dom_rate_distribution
#define MAKE_STRING(A)
Make string.
void Fill_mean_ToT_histograms()
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
TimesliceHistograms h_timeslice
void setLogarithmicX(TList *list)
Make x-axis of objects in list logarithmic (e.g. after using log10()).
TH1D * h_tot_distribution_snapshot_hits
TriggerHistograms h_trigger
set_variable E_E log10(E_{fit}/E_{#mu})"
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)
JRA_Histograms(const JDetector &detector)
TH1D * h_pmt_rate_distribution
$WORKDIR driver txt done cat $WORKDIR driver txt<< EOFprocess ${DATAFILTER}$FILTER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&(JDataFilter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAFILTER}-P $PORT</dev/null > &/dev/null &))';process ${DATAWRITER}$WRITER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&(JDataWriter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAWRITER}</dev/null > &/dev/null &))';print enterevent ev_init{RC_CMD}event ev_reset{RC_CMD}event ev_init{RC_CMD}event ev_configure{RC_DFLTR%<$WORKDIR/ev_configure_datafilter.txt > RC_DQSIM<$WORKDIR/ev_configure_dqsimulator.txt > RC_DWRT path
void Write_histogram_table_to_file(TFile &f, string dirname, vector< vector< T * > > table)
TH1D * h_Trigger_bit_event
static const JStringCounter getNumberOfStrings
Function object to count unique strings.
vector< JManager< string, TH1D > * > m_mean_ToT_distribution
void setLogarithmicY(TList *list)
Make y-axis of objects in list logarithmic (e.g. after using log10()).
SummaryHistograms h_summary
Direct access to module in detector data structure.
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.
std::string to_string(const T &value)
Convert value to string.
vector< JManager< string, TH2D > * > m_mean_ToT
vector< JManager< string, TH2D > * > m_pmt_rate_distributions
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
TH1D * h_tot_distribution_triggered_hits
TH1D * h_Triggered_hits_3dmuon
void initialize(std::set< int > du_ids, int modules_per_string, int ts_type, std::string ts_name)
TH2D * h_Triggered_hits_3dmuon_per_module
Indexing of data type in type list.
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
int getNumberOfModules(const JDetector &detector)
Get number of modules.
void initialize_trigger_histograms()
JManager< string, TH2D > * m_Snapshot_hits_per_pmt
void initialize_timeslice_histograms()
void Write_manager_to_file(TFile &f, string dirname, JManager< T, V > *table)
TH1D * h_Triggered_over_Snapshot_hits