9#include "MicrosliceDescriptor.hpp"
11#include <FairRunOnline.h>
14#include <RtypesCore.h>
20#include <THttpServer.h>
22#include <TPaveStats.h>
58 TFile* oldFile = gFile;
59 TDirectory* oldDir = gDirectory;
71 std::vector<std::pair<TNamed*, std::string>> vHistos =
GetHistoVector();
74 std::vector<std::pair<TCanvas*, std::string>> vCanvases =
GetCanvasVector();
77 std::string sSystem =
"tof";
84 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
85 if (
nullptr != server) {
86 for (UInt_t uCanvas = 0; uCanvas < vCanvases.size(); ++uCanvas) {
87 server->Register(Form(
"/%s/%s", sSystem.data(), vCanvases[uCanvas].second.data()), vCanvases[uCanvas].first);
89 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
90 server->Register(Form(
"/%s/%s", sSystem.data(), vHistos[uHisto].second.data()), vHistos[uHisto].first);
105 std::string sSystem =
"tof";
118 "Nb of message for each type per GET4; GET4 chip # ; Type",
137 new TH1I(Form(
"hTimeDiffPulser_g%02u_f%1u_g%02u_f%1u", uCompA, uFeeIdA, uCompB, uFeeIdB),
138 Form(
"Time difference for pulser on gDPB %02u FEE %1u and gDPB %02u FEE %1u; DeltaT [ps]; Counts",
139 uCompA, uFeeIdA, uCompB, uFeeIdB),
148 "Time difference Mean for each FEE pairs; FEE A; FEE B ; Mean [ps]",
153 "Time difference RMS for each FEE pairs; FEE A; FEE B ; RMS [ps]",
158 "Time difference RMS after zoom for each FEE pairs; FEE A; FEE B ; RMS [ps]",
163 "Time difference Res from fit for each FEE pairs; FEE A; FEE B ; Sigma [ps]",
172 for (UInt_t uComp = 0; uComp <
fuNbOfComps; ++uComp) {
174 Form(
"Pulser count per FEE in gDPB %02u; time in run [s]; dt [ps]",
191 for (UInt_t uCompB = uComp + 1; uCompB <
fuNbOfComps; ++uCompB) {
193 new TProfile(Form(
"hPulserTimeDiffEvoComp%02uComp%02u", uComp, uCompB),
194 Form(
"Time difference of the 1st FEE in the 1st GBTx of gDPB %02u vs %02u; time in run [s];"
195 " dt [ps]", uComp, uCompB),
201 for (UInt_t uFeeRef = 0; uFeeRef <
kuNbRefFeeEvo; ++uFeeRef) {
211 new TProfile(Form(
"hTimeDiffEvoFeeFee_g%02u_f%02u_g%02u_f%02u", uCompRef, uFeeIdRef, uComp, uFeeId),
212 Form(
"Time difference for pulser on gDPB %02u FEE %1u and gDPB %02u FEE %02u; time in run [s]"
213 "; DeltaT [ps]", uCompRef, uFeeIdRef, uComp, uFeeId),
226 Form(
"hFeeFtDistribPerCh_g%02u_f%02u", uComp, uFeeId ),
227 Form(
"FT distribution per channel for gDPB %02u FEE %02u", uComp, uFeeId ),
231 Form(
"hFeeFtNormDnl_g%02u_f%02u", uComp, uFeeId ),
232 Form(
"Normalized DNL per channel for gDPB %02u FEE %02u", uComp, uFeeId ),
236 Form(
"hFeeFtNormInl_g%02u_f%02u", uComp, uFeeId ),
237 Form(
"Normalized INL per channel for gDPB %02u FEE %02u", uComp, uFeeId ),
246 std::string sFolder =
"TofDt";
263 sFolder =
"TofDtEvo";
264 for (UInt_t uComp = 0; uComp <
fuNbOfComps; ++uComp) {
276 for (UInt_t uCompB = uComp + 1; uCompB <
fuNbOfComps; ++uCompB) {
296 std::string sSystem =
"tof";
300 new TCanvas(Form(
"c%sSummaryGet4s", sSystem.data()), Form(
"GET4s message stats, %s", sSystem.data()));
309 std::string sFolder =
"canvases";
314 fcPulser =
new TCanvas(
"cPulser",
"Time difference RMS for pulser channels when FEE pulser mode is ON");
341 fcPulserEvo =
new TCanvas(
"cPulserEvo",
"Time difference evolution between 1st FEE of 1st GBTx of Comp pairs");
343 for (UInt_t uComp = 0; uComp <
fuNbOfComps - 1; uComp++) {
401 const uint32_t& uGet4Id,
const uint32_t& uRawCh,
402 const uint32_t& ,
const uint32_t& uTot,
403 const double_t& dHitTime,
const uint32_t& uFts,
bool bDiamond)
496 if (uCompNr == uCompNrB) {
509 if (0 == uGbtxNr && 0 == uGbtxNrB)
528 LOG(info) <<
"CbmTofUnpackMonitorPulser::FinalizeTsHistos => Update pulser statistics ";
572 LOG(debug) <<
"CbmTofUnpackMonitorPulser::UpdateZoomedFit => Empty input "
573 <<
"for FEE pair " << uFeeA <<
" and " << uFeeB <<
" !!! ";
582 Double_t dPeakPos =
fvhTimeDiffPulser[uFeeA][uFeeB]->GetXaxis()->GetBinCenter(iBinWithMax);
588 if ((dZoomCounts / dNbCounts) < 0.99) {
591 LOG(warning) <<
"CbmTofUnpackMonitorPulser::UpdateZoomedFit => Zoom too strong, "
592 <<
"more than 1% loss for FEE pair " << uFeeA <<
" and " << uFeeB <<
" !!! ";
602 fitFuncPairs[uFeeA][uFeeB] =
new TF1(Form(
"fPair_%02d_%02d", uFeeA, uFeeB),
"gaus",
605 fitFuncPairs[uFeeA][uFeeB]->SetParameter(0, dZoomCounts);
606 fitFuncPairs[uFeeA][uFeeB]->SetParameter(1, dPeakPos);
607 fitFuncPairs[uFeeA][uFeeB]->SetParameter(2, 200.0);
609 fvhTimeDiffPulser[uFeeA][uFeeB]->Fit(Form(
"fPair_%02d_%02d", uFeeA, uFeeB),
"QRM0");
611 dRes = fitFuncPairs[uFeeA][uFeeB]->GetParameter(2);
613 delete fitFuncPairs[uFeeA][uFeeB];
618 LOG(info) <<
"CbmTofUnpackMonitorPulser::UpdateZoomedFit => "
619 <<
"For FEE pair " << uFeeA <<
" and " << uFeeB
620 <<
" we have zoomed RMS = " <<
fvhTimeDiffPulser[uFeeA][uFeeB]->GetRMS() <<
" and a resolution of "
621 << dRes / TMath::Sqrt2();
628 LOG(error) <<
"CbmTofUnpackMonitorPulser::UpdateZoomedFit => Zoom width not defined, "
629 <<
"please use SetFitZoomWidthPs, e.g. in macro, before trying this update !!!";
635 TDirectory* oldDir = gDirectory;
646 fhFeeFtDistribPerCh[uFeeNrInSys]->ProjectionX(
"temp_pFtSelChSlice", 1 + uChannel, 1 + uChannel);
647 if (0 < pFtSelChSlice->GetEntries()) {
649 pFtSelChSlice->Scale(1.0 / dNormFactRise);
650 pFtSelChSlice->Add(constantVal, -1.);
657 dDnl = pFtSelChSlice->GetBinContent(1 + uFtBin);
663 delete pFtSelChSlice;
675 LOG(fatal) <<
"SetBmonMode mode not available in CbmTofUnpackMonitorPulser (forced off)";
680 LOG(fatal) <<
"SetBmonMicroSpillMode mode not available in CbmTofUnpackMonitorPulser (forced off)";
685 LOG(fatal) <<
"SetBmonScvdMode mode not available in CbmTofUnpackMonitorPulser (forced off)";
690 LOG(fatal) <<
"SetBmonQFactorMode mode not available in CbmTofUnpackMonitorPulser (forced off)";
695 LOG(fatal) <<
"SetTofQFactorMode mode not available in CbmTofUnpackMonitorPulser (forced off)";
ClassImp(CbmConverterManager)
static double dTsStartTime
std::vector< std::vector< TH1 * > > fvhTimeDiffPulser
[ fuNrOfComps ][ fuNrOfChannelsPerComp ]
void SetTofQFactorMode(bool value)
void SetBmonScvdMode(bool value)
static const UInt_t kuNbRefFeeEvo
const double_t kdMaxDtPulserPs
Constants.
void SetBmonMicroSpillMode(bool value)
const UInt_t kuRefFeeEvoIdx[kuNbRefFeeEvo]
std::vector< double_t > fdTsLastPulserHit
[ fuFeeNr ]
std::vector< uint32_t > fvuFeeNbHitsLastMs
Number of channels in each FEE.
virtual void Finish()
Write all histograms and canvases to file.
const uint32_t kuNbFeePerGbtx
uint32_t fuNbOfChannelsPerFee
Max number of Get4 per FEE (has to match nb FEE and GET4 per comp)
std::vector< TH2 * > fvhPulserCountEvoPerFeeComp
virtual void FillHitMonitoringHistos(const double_t &dMsTime, const uint32_t &uCurrCompIdx, const uint32_t &uGet4Id, const uint32_t &uRawCh, const uint32_t &uRemapCh, const uint32_t &uTot, const double_t &dHitTime, const uint32_t &uFts, bool bDiamond=false)
Fill pulser histograms.
virtual ~CbmTofUnpackMonitorPulser()
void SetBmonMode(bool value)
uint32_t fuNbOfFeePerComp
FIXME: recheck if OK and if not conflicting with fuNrOfFeePerComp!
CbmTofUnpackMonitorPulser()
virtual void FinalizeTsHistos(double_t dTsStartTime)
Finalize pulser histograms.
double_t fdLastRmsUpdateTime
uint32_t fuNbOfGet4PerFee
Max number of FEE per component.
TCanvas * fcPulser
Canvases.
double_t fdFitZoomWidthPs
Settings and tracers.
virtual Bool_t Init(CbmMcbm2018TofPar *digiParSet)
Init all required parameter informations and histograms.
void SetBmonQFactorMode(bool value)
virtual Bool_t CreateHistograms()
std::vector< TH2 * > fhFeeFtNormDnl
std::vector< TH2 * > fhFeeFtNormInl
TH2 * fhTimeRmsZoomFitPuls
std::vector< std::vector< TProfile * > > fvvhPulserTimeDiffEvoCompComp
std::vector< std::vector< TProfile * > > fvvhPulserTimeDiffEvoFeeFee
virtual void DrawCanvases()
void UpdateNormedDnlInl()
virtual void FinalizeMsHistos()
Finalize pulser histograms.
const uint32_t kuNbBinsDt
std::vector< TH2 * > fhFeeFtDistribPerCh
virtual Bool_t ResetHistograms()
uint32_t fuNbFeePlotsPerComp
void SetBmonMicroSpillMode(bool value)
Activate the BMon mode.
CbmMcbm2018TofPar * fUnpackPar
Settings from parameter file.
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()
UInt_t fuHistoryHistoSize
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
void SetBmonMode(bool value)
Activate the BMon mode.
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
Double_t fdStartTime
Total/maximum number of Get4 in system.
void SetBmonQFactorMode(bool value)
Activate the Bmon QFactor mode.
UInt_t fuNbOfComps
Readout chain dimensions and mapping.
UInt_t fuNbOfGet4PerComp
Total number of Components in the system.
bool fBmonMode
Flag if debug mode is active or not.
UInt_t fuMinTotPulser
---> User settings: Data correction parameters
UInt_t fuNbOfChannelsPerComp
Number of channels per Get4, constant.
void SetBmonScvdMode(bool value)
Activate the BMon sCVD mode.
void SetTofQFactorMode(bool value)
Activate the Tof QFactor mode.
UInt_t fuNbOfChannelsPerGet4
Max number of Get4 per component.
void Finish()
Write all histograms and canvases to file.
UInt_t fuNbOfGet4InSyst
Number of channels per Component, recalculated.
const uint32_t kuFeePulserChannelDiam
const uint32_t kuFeePulserChannel