17#include "FairParGenericSet.h"
18#include "FairRootManager.h"
20#include "FairRunOnline.h"
21#include "FairRuntimeDb.h"
25#include "TClonesArray.h"
26#include "THttpServer.h"
43 , fbDebugMonitorMode(kFALSE)
44 , fbIgnoreCriticalErrors(kFALSE)
45 , fuHistoryHistoSize(3600)
46 , fsHistoFileName(
"data/HistosMonitor.root")
52 , fMonitorAlgo(nullptr)
61 LOG(info) <<
"CbmStar2019MonitorTask::Init";
62 LOG(info) <<
"Initializing eTOF 2019 Monitor task";
69 LOG(info) <<
"Setting parameter containers for " << GetName();
73 for (Int_t iparC = 0; iparC <
fParCList->GetEntries(); ++iparC) {
74 FairParGenericSet* tempObj = (FairParGenericSet*) (
fParCList->At(iparC));
77 std::string sParamName {tempObj->GetName()};
78 FairParGenericSet* newObj =
79 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
81 if (
nullptr == newObj) {
82 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
93 LOG(info) <<
"Init parameter containers for " << GetName();
97 dynamic_cast<CbmStar2019TofPar*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmStar2019TofPar"));
98 if (
nullptr == pUnpackPar) {
99 LOG(error) <<
"Failed to obtain parameter container CbmStar2019TofPar";
122 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
123 if (
nullptr != server) {
124 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
127 server->Register(Form(
"/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
130 for (UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv) {
133 server->Register(Form(
"/%s", vCanvases[uCanv].second.data()),
134 gROOT->FindObject((vCanvases[uCanv].first)->GetName()));
137 server->RegisterCommand(
"/Reset_Moni_Hist",
"bStar2019MonitorTaskResetHistos=kTRUE");
138 server->RegisterCommand(
"/Save_Moni_Hist",
"bStar2019MonitorTaskSaveHistos=kTRUE");
140 server->Restrict(
"/Reset_Moni_Hist",
"allow=admin");
148 LOG(info) <<
"ReInit parameter containers for " << GetName();
162 LOG(info) <<
"Reset Monitor histos ";
168 LOG(info) <<
"Save Monitor histos & canvases";
174 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in unpacker algorithm class";
206 TDirectory* oldDir = NULL;
207 TFile* histoFile = NULL;
213 if (
nullptr == histoFile)
return kFALSE;
215 LOG(info) <<
"Saving " << vHistos.size() <<
" monitor histograms ";
218 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
220 TString sFolder = vHistos[uHisto].second.data();
221 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
222 gDirectory->cd(sFolder);
225 vHistos[uHisto].first->Write();
231 for (UInt_t uCanvas = 0; uCanvas < vCanvas.size(); ++uCanvas) {
233 TString sFolder = vCanvas[uCanvas].second.data();
234 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
235 gDirectory->cd(sFolder);
238 vCanvas[uCanvas].first->Write();
ClassImp(CbmConverterManager)
Bool_t bStar2019MonitorTaskSaveHistos
Bool_t bStar2019MonitorTaskResetHistos
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
std::vector< T > & GetVector()
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()
void ClearVector()
For unpacker algos.
void SetIgnoreCriticalErrors(Bool_t bFlagIn=kTRUE)
Bool_t ProcessTs(const fles::Timeslice &ts)
void SetHistoryHistoSize(UInt_t inHistorySizeSec=1800)
void SetPulserTotLimits(UInt_t uMin, UInt_t uMax)
Bool_t SaveLatencyHistograms(TString fsHistoFileName)
Bool_t CreateHistograms()
Bool_t ReInitContainers()
void SetSectorIndex(Int_t iSector=-1)
void SetDebugMonitorMode(Bool_t bFlagIn=kTRUE)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
virtual ~CbmStar2019MonitorTask()
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
UInt_t fuHistoryHistoSize
If ON not printout at all for critical errors.
CbmStar2019MonitorAlgo * fMonitorAlgo
Processing algo.
uint64_t fulTsCounter
Statistics & first TS rejection.
Bool_t SaveLatencyHistograms(TString sFilename)
Bool_t fbDebugMonitorMode
Control flags.
Bool_t fbIgnoreCriticalErrors
Switch ON the filling of a additional set of histograms.
Bool_t ReInitContainers()
TList * fParCList
Parameters management.