16#include "FairRootManager.h"
17#include "FairRunOnline.h"
20#include "TClonesArray.h"
23#include "THttpServer.h"
25#include <TDirectory.h>
32using std::setprecision;
58 FairRootManager* ioman = FairRootManager::Instance();
67 fBmonDigiVector = ioman->InitObjectAs<std::vector<CbmTofDigi>
const*>(
"BmonDigi");
69 LOG(info) <<
"No Bmon digi vector found; trying TClonesArray";
70 if (std::is_convertible<TObject*, CbmTofDigi*>::value) {
71 fBmonDigiArray =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"BmonDigi"));
81 LOG(info) <<
"No TRD digi input found.";
104 if (offsetRange < 251) {
105 Double_t dClocks = offsetRange;
107 return (dClocks * 112 * 2);
109 else if (offsetRange < 501) {
112 else if (offsetRange < 1001) {
115 else if (offsetRange < 10001) {
118 else if (offsetRange < 100001) {
131 uint32_t iNbBinsLog = 0;
134 double* dBinsLog = dBinsLogVector.data();
142 fBmonStsDiffEvo =
new TH2F(
"fBmonStsDiffEvo",
"Bmon-Sts;TS; time diff [ns];Counts", 1000, 0, 10000, nrOfBinsSts,
151 fBmonMuchDiffEvo =
new TH2F(
"fBmonMuchDiffEvo",
"Bmon-Much;TS; time diff [ns];Counts", 1000, 0, 10000, nrOfBinsMuch,
160 fBmonTrdDiffEvo =
new TH2F(
"fBmonTrdDiffEvo",
"Bmon-Trd;TS; time diff [ns];Counts", 1000, 0, 10000, nrOfBinsTrd,
169 fBmonTofDiffEvo =
new TH2F(
"fBmonTofDiffEvo",
"Bmon-Tof;TS; time diff [ns];Counts", 1000, 0, 10000, nrOfBinsTof,
178 fBmonRichDiffEvo =
new TH2F(
"fBmonRichDiffEvo",
"Bmon-Rich;TS; time diff [ns];Counts", 1000, 0, 10000, nrOfBinsRich,
186 fBmonPsdDiffEvo =
new TH2F(
"fBmonPsdDiffEvo",
"Bmon-Psd;TS; time diff [ns];Counts", 1000, 0, 10000, nrOfBinsPsd,
189 fBmonPsdDiffCharge =
new TH2F(
"fBmonPsdDiffCharge",
"Bmon-Psd;time diff [ns]; Charge [a.u]; ;Counts", nrOfBinsPsd,
194 fBmonStsDiffEvoLong =
new TH2F(
"fBmonStsDiffEvoLong",
"Bmon-Sts;TS; time diff [ns];Counts", 1800, 0, 180000,
197 fBmonMuchDiffEvoLong =
new TH2F(
"fBmonMuchDiffEvoLong",
"Bmon-Much;TS; time diff [ns];Counts", 1800, 0, 180000,
200 fBmonTrdDiffEvoLong =
new TH2F(
"fBmonTrdDiffEvoLong",
"Bmon-Trd;TS; time diff [ns];Counts", 1800, 0, 180000,
203 fBmonTofDiffEvoLong =
new TH2F(
"fBmonTofDiffEvoLong",
"Bmon-Tof;TS; time diff [ns];Counts", 1800, 0, 180000,
206 fBmonRichDiffEvoLong =
new TH2F(
"fBmonRichDiffEvoLong",
"Bmon-Rich;TS; time diff [ns];Counts", 1800, 0, 180000,
210 fBmonPsdDiffEvoLong =
new TH2F(
"fBmonPsdDiffEvoLong",
"Bmon-Psd;TS; time diff [ns];Counts", 1800, 0, 180000,
215 fBmonStsMeanEvo =
new TProfile(
"fBmonStsMeanEvo",
"Bmon-Sts; time in run [s]; Mean time diff [ns]", 4320, 0, 4320);
217 fBmonMuchMeanEvo =
new TProfile(
"fBmonMuchMeanEvo",
"Bmon-Much; time in run [s]; Mean time diff [ns]", 4320, 0, 4320);
219 fBmonTrdMeanEvo =
new TProfile(
"fBmonTrdMeanEvo",
"Bmon-Trd; time in run [s]; Mean time diff [ns]", 4320, 0, 4320);
221 fBmonTofMeanEvo =
new TProfile(
"fBmonTofMeanEvo",
"Bmon-Tof; time in run [s]; Mean time diff [ns]", 4320, 0, 4320);
223 fBmonRichMeanEvo =
new TProfile(
"fBmonRichMeanEvo",
"Bmon-Rich; time in run [s]; Mean time diff [ns]", 4320, 0, 4320);
225 fBmonPsdMeanEvo =
new TProfile(
"fBmonPsdMeanEvo",
"Bmon-Psd; time in run [s]; Mean time diff [ns]", 4320, 0, 4320);
230 fBmonStsDpbDiff =
new TH2F(
"fBmonStsDpbDiff",
"Bmon-Much;DPB; time diff [ns];Counts", 2, -0.5, 1.5, nrOfBinsSts,
235 new TH2F(Form(
"fBmonStsDpbDiffEvo%02u", uStsDpb), Form(
"Bmon-STS DPB %02u;TS; time diff [ns];Counts", uStsDpb),
238 new TH1F(Form(
"fStsDpbCntsEvo%02u", uStsDpb), Form(
"Time STS DPB %02u;TS; Hit Counts", uStsDpb), 1800, 0, 180000);
251 Form(
"Bmon-Much ASIC %02u;TS; time diff [ns];Counts", uMuchAsic), 1800,
255 fBmonBmonDiff =
new TH1F(
"fBmonBmonDiff",
"Bmon-Bmon_prev;time diff [ns];Counts", iNbBinsLog, dBinsLog);
257 fStsStsDiff =
new TH1F(
"fStsStsDiff",
"Sts-Sts_prev;time diff [ns];Counts", iNbBinsLog, dBinsLog);
259 fMuchMuchDiff =
new TH1F(
"fMuchMuchDiff",
"Much-Much_prev;time diff [ns];Counts", iNbBinsLog, dBinsLog);
261 fTrdTrdDiff =
new TH1F(
"fTrdTrdDiff",
"Trd-Trd_prev;time diff [ns];Counts", iNbBinsLog, dBinsLog);
263 fTofTofDiff =
new TH1F(
"fTofTofDiff",
"Tof-Tof_prev;time diff [ns];Counts", iNbBinsLog, dBinsLog);
265 fRichRichDiff =
new TH1F(
"fRichRichDiff",
"Rich-Rich_prev;time diff [ns];Counts", iNbBinsLog, dBinsLog);
267 fPsdPsdDiff =
new TH1F(
"fPsdPsdDiff",
"Psd-Psd_prev;time diff [ns];Counts", iNbBinsLog, dBinsLog);
270 fBmonStsNb =
new TH2F(
"fBmonStsNb",
"Bmon-STS;Nb Bmon; Nb STS;TS []", 100, 0, 100, 100, 0, 100);
271 fBmonMuchNb =
new TH2F(
"fBmonMuchNb",
"Bmon-MUCH;Nb Bmon; Nb MUCH;TS []", 100, 0, 100, 100, 0, 100);
272 fBmonTrdNb =
new TH2F(
"fBmonTrdNb",
"Bmon-TRD;Nb Bmon; Nb TRD;TS []", 100, 0, 100, 100, 0, 100);
273 fBmonTofNb =
new TH2F(
"fBmonTofNb",
"Bmon-TOF;Nb Bmon; Nb TOF;TS []", 100, 0, 100, 100, 0, 100);
274 fBmonRichNb =
new TH2F(
"fBmonRichNb",
"Bmon-RICH;Nb Bmon; Nb RICH;TS []", 100, 0, 100, 100, 0, 100);
275 fBmonPsdNb =
new TH2F(
"fBmonPsdNb",
"Bmon-PSD;Nb Bmon; Nb PSD;TS []", 100, 0, 100, 100, 0, 100);
277 fBmonAddress =
new TH1F(
"fBmonAddress",
"Bmon address;address;Counts", 1000000, 0, 1000000.);
279 fBmonChannel =
new TH1F(
"fBmonChannel",
"Bmon channel;channel nr;Counts", 100, -0.5, 99.5);
285 FairRunOnline* run = FairRunOnline::Instance();
287 THttpServer* server = run->GetHttpServer();
288 if (
nullptr != server) {
381 LOG(debug) <<
"executing TS " <<
fNrTs;
383 if (0 <
fNrTs && 0 ==
fNrTs % 1000) LOG(info) << Form(
"Processing TS %6d",
fNrTs);
387 if( fNrTs < 17600 || 17650 < fNrTs )
388// if( fNrTs < 17634 || 17637 < fNrTs )
449 LOG(debug) <<
"Begin";
450 Int_t nrBmonDigis = 0;
454 LOG(debug) <<
"BmonDigis: " << nrBmonDigis;
477 if (nrBmonDigis < 1000000) {
487 if (
nullptr ==
pTsMetaData) LOG(fatal) << Form(
"No TS metadata found for TS %6u.",
fNrTs);
489 for (Int_t iBmon = 0; iBmon < nrBmonDigis; ++iBmon) {
491 if (iBmon % 1000 == 0) LOG(debug) <<
"Executing entry " << iBmon;
502 Double_t T0Time = BmonDigi->
GetTime();
506 if (0x00005006 != BmonAddress && 0x04005006 != BmonAddress)
continue;
549 for (Int_t iDigi = 0; iDigi < nrStsDigis; ++iDigi) {
565 for (Int_t iDigi = 0; iDigi < nrMuchDigis; ++iDigi) {
568 UInt_t uAsic = digi->
GetNxId();
569 UInt_t uChan = digi->
GetNxCh();
581 for (Int_t iDigi = 0; iDigi < nrTrdDigis; ++iDigi) {
593 for (Int_t iDigi = 0; iDigi < nrTofDigis; ++iDigi) {
601 for (Int_t iDigi = 0; iDigi < nrRichDigis; ++iDigi) {
609 for (Int_t iDigi = 0; iDigi < nrPsdDigis; ++iDigi) {
682 TProfile* profMeanEvo, TH2* histoAFCK,
const Double_t T0Time,
683 const Int_t offsetRange, Int_t iStartDigi,
ECbmModuleId iDetId)
687 Int_t iFirstDigiInWin = iStartDigi;
689 for (Int_t i = iStartDigi; i < nrDigis; ++i) {
698 stsDigi = boost::any_cast<const CbmStsDigi*>(digi);
701 LOG(fatal) <<
"Failed boost any_cast in "
702 "CbmMcbm2019CheckPulser::FillSystemOffsetHistos for a "
704 << Digi::GetClassName();
724 muchDigi = boost::any_cast<const CbmMuchBeamTimeDigi*>(digi);
727 LOG(fatal) <<
"Failed boost any_cast in "
728 "CbmMcbm2019CheckPulser::FillSystemOffsetHistos for a "
730 << Digi::GetClassName();
733 UInt_t uAsic = muchDigi->GetNxId();
734 UInt_t uChan = muchDigi->GetNxCh();
759 UInt_t uAddr = digi->GetAddress();
784 UInt_t uAddr = digi->GetAddress();
789 if (digi->GetAddress() != (9 << 10) + 8)
continue;
797 Double_t diffTime = T0Time - digi->GetTime();
800 if (diffTime > offsetRange) {
804 if (diffTime < -offsetRange)
break;
806 histo->Fill(diffTime);
807 histoEvo->Fill(
fNrTs, diffTime);
808 histoEvoLong->Fill(
fNrTs, diffTime);
811 profMeanEvo->Fill(T0Time * 1e-9 -
fdStartTime, diffTime);
821 UInt_t uDPB = (0 < (digi->GetAddress() & 0x00000400));
822 histoAFCK->Fill(uDPB, diffTime);
830 muchDigi = boost::any_cast<const CbmMuchBeamTimeDigi*>(digi);
833 LOG(fatal) <<
"Failed boost any_cast in CbmCheckTiming::FillSystemOffsetHistos "
834 "for a digi of type "
835 << Digi::GetClassName();
838 UInt_t afck = muchDigi->GetRocId();
839 UInt_t asic = muchDigi->GetNxId();
840 histoAFCK->Fill(afck, diffTime);
846 return iFirstDigiInWin;
854 TFile* oldFile = gFile;
855 TDirectory* oldDir = gDirectory;
ClassImp(CbmConverterManager)
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kPsd
Projectile spectator detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
@ kRich
Ring-Imaging Cherenkov Detector.
static Int_t GetNofDigis(ECbmModuleId systemId)
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
void UseMuchBeamTimeDigi(Bool_t)
Use CbmMuchBeamTimeDigi instead of CbmMuchDigi for MUCH.
InitStatus Init()
Initialisation.
const Digi * Get(Int_t index) const
Get a digi object.
static CbmDigiManager * Instance()
Static instance.
void CheckInterSystemOffset()
UInt_t fuMaxAdcPulserMuch
virtual InitStatus Init()
static const UInt_t kuNbChanSMX
Constants.
const std::vector< CbmTofDigi > * fBmonDigiVector
TProfile * fBmonRichMeanEvo
TH2 * fBmonStsDiffEvoLong
Double_t fdLastBmonDigiPulser
CbmDigiManager * fDigiMan
TProfile * fBmonTrdMeanEvo
virtual void SetParContainers()
TH2 * fBmonTrdDiffEvoLong
UInt_t fuMinTotPulserRich
const TimesliceMetaData * pTsMetaData
static const UInt_t kuMaxNbMuchDpbs
virtual InitStatus ReInit()
static const UInt_t kuMaxNbMuchAsics
UInt_t fuMaxTotPulserBmon
static const UInt_t kuMaxChannelSts
Int_t fPrevBmonFirstDigiTof
TH1 * fStsDpbCntsEvo[kuMaxNbStsDpbs]
UInt_t fuMinAdcPulserMuch
TH2 * fBmonStsDpbDiffEvo[kuMaxNbStsDpbs]
TH2 * fBmonPsdDiffEvoLong
~CbmMcbm2019CheckPulser()
Int_t FillSystemOffsetHistos(TH1 *histo, TH2 *histoEvo, TH2 *histoEvoLong, TProfile *profMeanEvo, TH2 *histoAFCK, const Double_t T0Time, const Int_t offsetRange, Int_t iStartDigi, ECbmModuleId iDetId=ECbmModuleId::kLastModule)
static const UInt_t kuMaxNbStsDpbs
TProfile * fBmonTofMeanEvo
UInt_t fuStsAddress
Channel selection.
TProfile * fBmonPsdMeanEvo
UInt_t fuMaxChargePulserTrd
TH2 * fBmonMuchAsicDiffEvo[kuMaxNbMuchAsics]
static const UInt_t kuDefaultAddress
TProfile * fBmonMuchMeanEvo
Int_t fPrevBmonFirstDigiTrd
UInt_t fuMinTotPulserBmon
Int_t fPrevBmonFirstDigiRich
Int_t fPrevBmonFirstDigiMuch
TProfile * fBmonStsMeanEvo
Int_t fPrevBmonFirstDigiPsd
virtual void Exec(Option_t *)
UInt_t fuMaxTotPulserRich
TClonesArray * fTimeSliceMetaDataArray
TH2 * fBmonTofDiffEvoLong
TClonesArray * fBmonDigiArray
TH2 * fBmonMuchDiffEvoLong
TH2 * fBmonRichDiffEvoLong
Int_t fPrevBmonFirstDigiSts
UInt_t fuMinChargePulserTrd
double GetCharge() const
Charge.
Data class for PSD digital information.
uint32_t GetAddress() const
Address.
double GetCharge() const
Charge.
double GetCharge() const
Charge.
Data class for a single-channel message in the STS.
XPU_D uint16_t GetChannel() const
Channel number in module @value Channel number.
XPU_D int32_t GetAddress() const
Data class for expanded digital TOF information.
double GetChannel() const
Channel .
int32_t GetAddress() const
Inherited from CbmDigi.
double GetTime() const
Inherited from CbmDigi.
double GetCharge() const
Inherited from CbmDigi.
int32_t GetAddress() const
Address getter for module in the format defined by CbmTrdDigi (format of CbmTrdAddress can be accesse...
double GetCharge() const
Common purpose charge getter.