13 #include "FairLogger.h"
14 #include "FairParGenericSet.h"
15 #include "FairRootManager.h"
17 #include "FairRunOnline.h"
18 #include "FairRuntimeDb.h"
21 #include "THttpServer.h"
38 , fsHistoFileName(
"data/HistosMonitorPulser.root")
44 , fuHistoryHistoSize(1800)
46 , fMonitorPulserAlgo(nullptr) {
55 LOG(info) <<
"CbmMcbm2018MonitorTaskTofPulser::Init";
56 LOG(info) <<
"Initializing mCBM 2019 Monitor task";
62 LOG(info) <<
"Setting parameter containers for " << GetName();
66 for (Int_t iparC = 0; iparC < parCList->GetEntries(); ++iparC) {
67 FairParGenericSet* tempObj = (FairParGenericSet*) (parCList->At(iparC));
68 parCList->Remove(tempObj);
70 std::string sParamName {tempObj->GetName()};
71 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
72 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
74 if (
nullptr == newObj) {
75 LOG(error) <<
"Failed to obtain parameter container " << sParamName
76 <<
", for parameter index " << iparC;
80 parCList->AddAt(newObj, iparC);
86 LOG(info) <<
"Init parameter containers for " << GetName();
90 FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018TofPar"));
91 if (
nullptr == pUnpackPar) {
92 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018TofPar";
109 std::vector<std::pair<TNamed*, std::string>> vHistos =
112 std::vector<std::pair<TCanvas*, std::string>> vCanvases =
116 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
117 if (
nullptr != server) {
118 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
121 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
122 vHistos[uHisto].first);
125 for (UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv) {
128 server->Register(Form(
"/%s", vCanvases[uCanv].second.data()),
129 gROOT->FindObject((vCanvases[uCanv].first)->GetName()));
132 server->RegisterCommand(
"/Reset_Pulser_Hist",
133 "bMcbm2018MonitorTaskTofPulserResetHistos=kTRUE");
134 server->RegisterCommand(
"/Save_Pulser_Hist",
135 "bMcbm2018MonitorTaskTofPulserSaveHistos=kTRUE");
137 server->Restrict(
"/Reset_Moni_Hist",
"allow=admin");
144 LOG(info) <<
"ReInit parameter containers for " << GetName();
152 UShort_t usDetectorId) {
159 LOG(info) <<
"Reset Monitor histos ";
165 LOG(info) <<
"Save Monitor histos & canvases";
171 LOG(error) <<
"Failed processing TS " << ts.index()
172 <<
" in unpacker algorithm class";
200 std::vector<std::pair<TNamed*, std::string>> vHistos =
202 std::vector<std::pair<TCanvas*, std::string>> vCanvas =
206 TDirectory* oldDir = NULL;
207 TFile* histoFile = NULL;
213 if (
nullptr == histoFile)
return kFALSE;
216 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
218 TString sFolder = vHistos[uHisto].second.data();
219 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
220 gDirectory->cd(sFolder);
223 vHistos[uHisto].first->Write();
228 for (UInt_t uCanvas = 0; uCanvas < vCanvas.size(); ++uCanvas) {
230 TString sFolder = vCanvas[uCanvas].second.data();
231 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
232 gDirectory->cd(sFolder);
235 vCanvas[uCanvas].first->Write();