14 #include "FairLogger.h"
15 #include "FairParGenericSet.h"
16 #include "FairRootManager.h"
18 #include "FairRunOnline.h"
19 #include "FairRuntimeDb.h"
22 #include "THttpServer.h"
38 , fbMonitorMode(kFALSE)
39 , fbWriteOutput(kTRUE)
43 fMonitorAlgo(nullptr) {
52 LOG(info) <<
"CbmMcbm2018MonitorTaskHodo::Init";
53 LOG(info) <<
"Initializing mCBM Hodoscopes Monitor";
72 LOG(info) <<
"Setting parameter containers for " << GetName();
76 for (Int_t iparC = 0; iparC < parCList->GetEntries(); ++iparC) {
77 FairParGenericSet* tempObj = (FairParGenericSet*) (parCList->At(iparC));
78 parCList->Remove(tempObj);
80 std::string sParamName {tempObj->GetName()};
81 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
82 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
84 if (
nullptr == newObj) {
85 LOG(error) <<
"Failed to obtain parameter container " << sParamName
86 <<
", for parameter index " << iparC;
90 parCList->AddAt(newObj, iparC);
96 LOG(info) <<
"Init parameter containers for " << GetName();
123 std::vector<std::pair<TNamed*, std::string>> vHistos =
125 std::vector<std::pair<TCanvas*, std::string>> vCanvas =
129 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
130 if (
nullptr != server) {
131 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
132 if (
nullptr != vHistos[uHisto].
first)
133 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
134 vHistos[uHisto].first);
137 for (UInt_t uCanvas = 0; uCanvas < vCanvas.size(); ++uCanvas) {
138 if (
nullptr != vCanvas[uCanvas].
first)
139 server->Register(Form(
"/%s", vCanvas[uCanvas].second.data()),
140 vCanvas[uCanvas].first);
143 server->RegisterCommand(
"/Reset_MoniHodo_Hist",
144 "bMcbm2018MonitorTaskHodoResetHistos=kTRUE");
145 server->Restrict(
"/Reset_MoniHodo_Hist",
"allow=admin");
154 LOG(info) <<
"ReInit parameter containers for " << GetName();
161 UShort_t usDetectorId) {
168 LOG(info) <<
"Reset Hodoscopes monitor histos ";
174 LOG(error) <<
"Failed processing TS " << ts.index()
175 <<
" in monitor algorithm class";
217 std::vector<std::pair<TNamed*, std::string>> vHistos =
219 std::vector<std::pair<TCanvas*, std::string>> vCanvas =
223 TDirectory* oldDir = NULL;
224 TFile* histoFile = NULL;
228 histoFile =
new TFile(
"data/HistosMonitorHodo.root",
"RECREATE");
230 if (
nullptr == histoFile)
return kFALSE;
235 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
237 TString sFolder = vHistos[uHisto].second.data();
238 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
239 gDirectory->cd(sFolder);
242 vHistos[uHisto].first->Write();
247 for (UInt_t uCanvas = 0; uCanvas < vCanvas.size(); ++uCanvas) {
249 TString sFolder = vCanvas[uCanvas].second.data();
250 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
251 gDirectory->cd(sFolder);
254 vCanvas[uCanvas].first->Write();
277 UInt_t uElinkHodoB) {