14 #include "TTimeStamp.h"
40 double normalisation = 1;
41 if(norm) normalisation = h1->Integral();
43 for(
int i = 1; i <= h1->GetNbinsX(); ++i){
45 h2->Fill(run, h1->GetXaxis()->GetBinCenter(i), h1->GetBinContent(i)/normalisation);
49 int main(
int argc,
char **argv)
53 using namespace KM3NETDAQ;
61 JParser<> zap(
"Auxiliary program to merge JRunAnalyzer histograms.");
63 zap[
'f'] =
make_field(inputFile,
"input file (output from JRunAnalyzer).");
69 catch(
const exception &error) {
70 FATAL(error.what() << endl);
73 int min_run = numeric_limits<int>::max(), max_run = 0;
75 size_t min_date = numeric_limits<int>::max(), max_date = 0;
79 TFile
in(i->c_str(),
"read");
95 time_t tmin = min_date, tmax = max_date;
97 TTimeStamp date_min(tmin, 0);
98 TTimeStamp date_max(tmax, 0);
100 cout <<
"Minimum RUN: " << min_run <<
", "; date_min.Print(
"s");
101 cout <<
"Maximum RUN: " << max_run <<
", "; date_max.Print(
"s");
105 int xbins = (max_run - min_run) + 1;
106 string title = string(
"Data taken from: ") + date_min.AsString(
"s") +
" - " + date_max.AsString(
"s");
108 TH2D* h_pmt_rate_distribution =
new TH2D(
"h_pmt_rate_distribution",
string(title +
"; RUN; PMT Rate Distribution [kHz]").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5,
JDAQRate::getN(), JDAQRate::getData(1.0e-4));
110 TH2D* h_Trigger_bit_hit =
new TH2D(
"h_Trigger_bit_hit",
string(title +
"; RUN; Hits trigger bit").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5,
NUMBER_OF_TRIGGER_BITS, -0.5,
NUMBER_OF_TRIGGER_BITS - 0.5);
112 TH2D* h_Triggered_hits =
new TH2D(
"h_Triggered_hits",
string(title +
"; RUN; Number of triggered hits").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5, 50, 0, 4);
115 TH2D* h_Triggered_hits_3dmuon =
new TH2D(
"h_Triggered_hits_3dmuon",
string(title +
"; RUN; Number of triggered hits - JTRIGGER3DMUON").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5, 50, 0, 3);
118 TH2D* h_Snapshot_hits =
new TH2D(
"h_Snapshot_hits",
string(title +
"; RUN; Number of snapshot hits").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5, 50, 0, 4);
121 TH2D* h_Triggered_over_Snapshot_hits =
new TH2D(
"h_Triggered_over_Snapshot_hits",
string(title +
"; RUN; Triggered/Snapshot hits").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5, 100, 0, 0.5);
123 TH2D* h_Number_of_overlays =
new TH2D(
"h_Number_of_overlays",
string(title +
"; RUN; Number of Overlays").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5, 1000, -0.5, 1000 - 0.5);
125 TH2D* h_pmt_distribution_triggered_hits =
new TH2D(
"h_pmt_distribution_triggered_hits",
string(title +
"; RUN;Normalised PMT Distrib triggered hits (upper PMTs=[0-11])").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5,
NUMBER_OF_PMTS, -0.5 ,
NUMBER_OF_PMTS - 0.5);
127 TH2D* h_pmt_distribution_snapshot_hits =
new TH2D(
"h_pmt_distribution_snapshot_hits",
string(title +
"; RUN; Normalised PMT Distrib snapshot hits (upper PMTs=[0-11])").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5,
NUMBER_OF_PMTS, -0.5 ,
NUMBER_OF_PMTS - 0.5);
129 TH2D* h_event_duration =
new TH2D(
"h_event_duration",
string(title +
"; RUN; Event Duration [ns]").c_str(), xbins, (
double) min_run-0.5, (
double) max_run+0.5, 60, 1, 6);
134 DEBUG(
"Processing " << *i << endl) ;
136 TFile
in(i->c_str(),
"read");
138 cout << i->c_str() << endl;
150 TH1D* h1d_prd =
new TH1D();
151 TH1D* h1d_thb =
new TH1D();
152 TH1D* h1d_th =
new TH1D();
153 TH1D* h1d_th3D =
new TH1D();
154 TH1D* h1d_sh =
new TH1D();
155 TH1D* h1d_tosh =
new TH1D();
156 TH1D* h1d_noo =
new TH1D();
157 TH1D* h1d_pdth =
new TH1D();
158 TH1D* h1d_pdsh =
new TH1D();
159 TH1D* h1d_ed =
new TH1D();
161 in.GetDirectory(
"Detector")->GetObject(
"h_pmt_rate_distribution", h1d_prd);
164 TDirectory* dir =
in.GetDirectory(
"JDAQEvent");
166 dir->GetObject(
"h_Trigger_bit_hit", h1d_thb);
169 dir->GetObject(
"h_Triggered_hits", h1d_th);
172 dir->GetObject(
"h_Triggered_hits_3dmuon", h1d_th3D);
175 dir->GetObject(
"h_Snapshot_hits", h1d_sh);
178 dir->GetObject(
"h_Triggered_over_Snapshot_hits", h1d_tosh);
181 dir->GetObject(
"h_Number_of_overlays", h1d_noo);
184 dir->GetObject(
"h_pmt_distribution_triggered_hits", h1d_pdth);
187 dir->GetObject(
"h_pmt_distribution_snapshot_hits", h1d_pdsh);
190 dir->GetObject(
"h_event_duration", h1d_ed);
Utility class to parse command line options.
int main(int argc, char *argv[])
JDAQUTCExtended getTimesliceStart() const
Get start of timeslice.
static const unsigned int NUMBER_OF_TRIGGER_BITS
Number of trigger bits.
int getRunNumber() const
Get run number.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JUINT32_t getUTCseconds() const
Get time.
General purpose messaging.
void setLogarithmicY(TList *list)
Make y-axis of objects in list logarithmic (e.g. after using log10()).
void fill2DHistogram(int run, TH1D *h1, TH2D *h2, bool norm=false)
Utility class to parse command line options.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
#define DEBUG(A)
Message macros.