13 #include "FairLogger.h"
14 #include "FairParGenericSet.h"
15 #include "FairRootManager.h"
17 #include "FairRunOnline.h"
18 #include "FairRuntimeDb.h"
21 #include "THttpServer.h"
37 , fbMonitorMode(kTRUE)
38 , fbDebugMonitorMode(kFALSE)
39 , fuHistoryHistoSize(3600)
40 , fsHistoFileName(
"data/HistosMonitorT0.root")
43 , fuOffSpillCountLimit(200)
45 , fMonitorAlgo(nullptr) {
52 LOG(info) <<
"CbmMcbm2018MonitorTaskT0::Init";
53 LOG(info) <<
"Initializing mCBM T0 2019 Monitor";
59 LOG(info) <<
"Setting parameter containers for " << GetName();
63 for (Int_t iparC = 0; iparC < parCList->GetEntries(); ++iparC) {
64 FairParGenericSet* tempObj = (FairParGenericSet*) (parCList->At(iparC));
65 parCList->Remove(tempObj);
67 std::string sParamName {tempObj->GetName()};
68 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
69 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
71 if (
nullptr == newObj) {
72 LOG(error) <<
"Failed to obtain parameter container " << sParamName
73 <<
", for parameter index " << iparC;
77 parCList->AddAt(newObj, iparC);
83 LOG(info) <<
"Init parameter containers for " << GetName();
87 FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018TofPar"));
88 if (
nullptr == pUnpackPar) {
89 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018TofPar";
114 std::vector<std::pair<TNamed*, std::string>> vHistos =
117 std::vector<std::pair<TCanvas*, std::string>> vCanvases =
121 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
122 if (
nullptr != server) {
123 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
126 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
127 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_MoniT0_Hist",
138 "bMcbm2018MonitorTaskT0ResetHistos=kTRUE");
139 server->Restrict(
"/Reset_MoniT0_Hist",
"allow=admin");
146 LOG(info) <<
"ReInit parameter containers for " << GetName();
153 UShort_t usDetectorId) {
160 LOG(info) <<
"Reset T0 Monitor histos ";
166 LOG(error) <<
"Failed processing TS " << ts.index()
167 <<
" in unpacker algorithm class";
186 std::vector<std::pair<TNamed*, std::string>> vHistos =
190 TDirectory* oldDir = NULL;
191 TFile* histoFile = NULL;
199 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
201 TString sFolder = vHistos[uHisto].second.data();
202 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
203 gDirectory->cd(sFolder);
206 vHistos[uHisto].first->Write();
229 uChan0, uChan1, uChan2, uChan3, uChan4, uChan5, uChan6, uChan7);