15 cout <<
"File not specified!" << endl;
18 FairLogger::GetLogger()->SetLogToScreen(
true);
19 FairLogger::GetLogger()->SetLogScreenLevel(
"info");
21 const vector<string> evt_tr_names{
30 "BT'",
"MBT",
"nFD",
"CCT1",
"L0_Trig",
"L1_Trig",
"L1_Trig_v2",
"L2_Trig",
"L2_Trig_v2",
"Busy"};
34 if (file->
IsOpen() ==
false) {
35 LOG(error) <<
"Cannot open file " << fileName <<
" !" << endl;
42 LOG(error) <<
"No run header!" << endl;
45 printf(
"Run Header content:\n");
48 uint64_t msc_delta = PeriodId > 8 ? 16 : 200;
49 uint64_t trc_delta = 8;
50 uint64_t trc_slices_shift = 4;
51 printf(
"\tPeriod: %u Run: %u\n", PeriodId, RunId);
54 printf(
"\tSTART : %s\n", RunStartTime.
AsString());
55 printf(
"\tFINISH : %s\n", RunEndTime.
AsString());
70 vector<unique_ptr<TH1D>> evt_tr_hist;
71 size_t trigCount = evt_tr_names.size();
72 size_t padCount = trigCount + 1;
75 can->Divide(1, padCount);
80 Double_t left_time(1.5956e9), right_time(1.5963e9);
87 UInt_t half_bin = (right_time - left_time) / (2 * nbins) - 1;
88 printf(
"NBins = %u\n", nbins);
91 for (
Int_t i = 0;
i < trigCount;
i++) {
93 evt_tr_hist.push_back(make_unique<TH1D>(name, name, nbins, left_time, right_time));
94 unique_ptr<TH1D>& h = evt_tr_hist.back();
96 h->GetXaxis()->SetLabelSize(0.08);
97 h->GetYaxis()->SetLabelSize(0.09);
98 h->GetXaxis()->SetTitleOffset(50);
99 h->GetXaxis()->SetLabelOffset(0.028);
100 h->GetYaxis()->SetLabelOffset(0.015);
103 name =
"TRC_bit_state";
116 for (int64_t iSpill : { NSpills - 2, NSpills - 1}) {
126 for (
Int_t i = 0;
i < trigCount;
i++) {
127 evt_tr_hist[
i]->Reset();
128 string sc_name = evt_tr_names[
i];
137 auto [itLower, itUpper] = msc_matrix->
GetScalerRange(sc_name, left_tp, right_tp);
140 for (
auto itTimes = itLower; itTimes != itUpper; itTimes++) {
142 uint8_t cnt = itTimes->second;
143 int64_t nans = (time.time_since_epoch() - sh->
GetStartTime().time_since_epoch()).count();
145 evt_tr_hist[
i]->Fill(nans, cnt);
160 for (
Int_t i = 0;
i < trigCount;
i++) {
162 gStyle->SetTitleFontSize(0.1);
165 evt_tr_hist[
i]->Draw(
"hist");
167 auto [itLower, itUpper] = msc_matrix->
GetBusyRanges(left_tp, right_tp);
168 for (
auto itRangeEntry = itLower; itRangeEntry != itUpper; itRangeEntry++) {
169 const SysPoint& timeBegin = itRangeEntry->first;
170 const SysPoint& timeEnd = itRangeEntry->second;
172 (timeBegin.time_since_epoch() - sh->
GetStartTime().time_since_epoch()).count();
173 int64_t nansEnd = (timeEnd.time_since_epoch() - sh->
GetStartTime().time_since_epoch()).count();
174 int32_t binLow = evt_tr_hist[
i]->FindBin(nansBegin);
175 double low = evt_tr_hist[
i]->GetBinLowEdge(binLow);
176 int32_t binHi = evt_tr_hist[
i]->FindBin(nansEnd);
177 double hi = evt_tr_hist[
i]->GetBinLowEdge(binHi);
182 hi, evt_tr_hist[
i]->GetMaximum());
284 can->SaveAs(
Form(
"scalers_%u_s%ld.png", RunId, iSpill));
auto GetBusyRanges(const SysPoint &timeBegin=SysPoint::min(), const SysPoint &timeEnd=SysPoint::max())
Returns the [begin,end) iterators for range of time point pairs representing begin and end of a busy ...
void DrawSpill(TString fileName="bmn_run7820_meta.root", TString digiPath=".", bool drawBusy=true)
DrawSpill Draw the MSC data.