19 #include "FairLogger.h"
20 #include "FairRootManager.h"
21 #include "FairRunOnline.h"
23 #include "TClonesArray.h"
26 #include "THttpServer.h"
33 #include <type_traits>
35 using std::setprecision;
39 : FairTask(
"CbmMcbm2019CheckDtInDet") {}
60 FairRootManager* ioman = FairRootManager::Instance();
69 fT0DigiVector = ioman->InitObjectAs<std::vector<CbmTofDigi>
const*>(
"T0Digi");
71 LOG(info) <<
"No T0 digi vector found; trying TClonesArray";
72 if (std::is_convertible<TObject*, CbmTofDigi*>::value) {
73 fT0DigiArray =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"T0Digi"));
74 if (!
fT0DigiArray) LOG(info) <<
"No T0 digi input found.";
79 LOG(info) <<
"No STS digi input found.";
83 LOG(info) <<
"No MUCH digi input found.";
87 LOG(info) <<
"No TRD digi input found.";
92 dynamic_cast<TClonesArray*
>(ioman->GetObject(
"TimesliceMetaData"));
94 LOG(fatal) <<
"No TS metadata input found while TRD needs it.";
98 LOG(info) <<
"No TOF digi input found.";
102 LOG(info) <<
"No RICH digi input found.";
106 LOG(info) <<
"No PSD digi input found.";
116 uint32_t iNbBinsLog = 0;
119 double* dBinsLog = dBinsLogVector.data();
125 "fT0T0SameTime",
"Fract. same time T0;Same Time? [];Counts", 2, -0.5, 1.5);
128 "Fract. same time Sts;Same Time? [];Counts",
134 "Fract. same time Much;Same Time? [];Counts",
140 "Fract. same time Trd;Same Time? [];Counts",
146 "Fract. same time Tof;Same Time? [];Counts",
152 "Fract. same time Rich;Same Time? [];Counts",
158 "Fract. same time Psd;Same Time? [];Counts",
166 "fT0T0Diff",
"T0-T0_prev;time diff [ns];Counts", 10001, -0.5, 10000.5);
169 "fStsStsDiff",
"Sts-Sts_prev;time diff [ns];Counts", 10001, -0.5, 10000.5);
172 "Much-Much_prev;time diff [ns];Counts",
178 "fTrdTrdDiff",
"Trd-Trd_prev;time diff [ns];Counts", 10001, -0.5, 10000.5);
181 "fTofTofDiff",
"Tof-Tof_prev;time diff [ns];Counts", 10001, -0.5, 10000.5);
184 "Rich-Rich_prev;time diff [ns];Counts",
190 "fPsdPsdDiff",
"Psd-Psd_prev;time diff [ns];Counts", 10001, -0.5, 10000.5);
193 "fT0T0DiffLog",
"T0-T0_prev;time diff [ns];Counts", iNbBinsLog, dBinsLog);
196 "Sts-Sts_prev;time diff [ns];Counts",
201 "Much-Much_prev;time diff [ns];Counts",
206 "Trd-Trd_prev;time diff [ns];Counts",
211 "Tof-Tof_prev;time diff [ns];Counts",
216 "Rich-Rich_prev;time diff [ns];Counts",
221 "Psd-Psd_prev;time diff [ns];Counts",
228 new TH2F(
"fT0T0DiffPerChan",
229 "T0-T0_prev Per Channel;time diff [ns]; Channel [];Counts",
237 new TH2F(
"fStsStsDiffPerChan",
238 "Sts-Sts_prev Per Channel;time diff [ns]; Channel [];Counts",
246 new TH2F(
"fMuchMuchDiffPerChan",
247 "Much-Much_prev Per Channel;time diff [ns]; Channel [];Counts",
255 new TH2F(
"fTrdTrdDiffPerChan",
256 "Trd-Trd_prev Per Channel;time diff [ns]; Channel [];Counts",
264 new TH2F(
"fTofTofDiffPerChan",
265 "Tof-Tof_prev Per Channel;time diff [ns]; Channel [];Counts",
273 new TH2F(
"fRichRichDiffPerChan",
274 "Rich-Rich_prev Per Channel;time diff [ns]; Channel [];Counts",
282 new TH2F(
"fPsdPsdDiffPerChan",
283 "Psd-Psd_prev Per Channel;time diff [ns]; Channel [];Counts",
291 FairRunOnline* run = FairRunOnline::Instance();
293 THttpServer* server = run->GetHttpServer();
294 if (
nullptr != server) {
327 LOG(debug) <<
"executing TS " <<
fNrTs;
330 LOG(info) << Form(
"Processing TS %6d",
fNrTs);
333 LOG(debug) <<
"Begin";
339 LOG(debug) <<
"T0Digis: " << nrT0Digis;
351 for (Int_t iT0 = 0; iT0 < nrT0Digis; ++iT0) {
353 if (iT0 % 1000 == 0) LOG(debug) <<
"Executing entry " << iT0;
362 Double_t T0Time = T0Digi->
GetTime();
369 if (0 < T0TimeDiff) {
426 Double_t dPrevTime = -1;
428 for (UInt_t uDigiIdx = 0; uDigiIdx < uNrDigis; ++uDigiIdx) {
431 Double_t dNewDigiTime = digi->GetTime();
434 Double_t dTimeDiff = dNewDigiTime - dPrevTime;
436 histoDt->Fill(dTimeDiff);
438 histoSameTime->Fill(0);
439 histoDtLog->Fill(dTimeDiff);
442 histoSameTime->Fill(1);
505 dPrevTime = dNewDigiTime;