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(kTRUE)
39 , fbDebugMonitorMode(kFALSE)
40 , fuHistoryHistoSize(1800)
41 , fviHistoChargeArgs(3, 0)
42 , fviHistoAmplArgs(3, 0)
43 , fviHistoZLArgs(3, 0)
44 , fsHistoFileName(
"data/HistosMonitorPsd.root")
46 , fMonitorAlgo(nullptr) {
53 LOG(info) <<
"CbmMcbm2018MonitorTaskPsd::Init";
54 LOG(info) <<
"Initializing mCBM Psd 2019 Monitor";
60 LOG(info) <<
"Setting parameter containers for " << GetName();
64 for (Int_t iparC = 0; iparC < parCList->GetEntries(); ++iparC) {
65 FairParGenericSet* tempObj = (FairParGenericSet*) (parCList->At(iparC));
66 parCList->Remove(tempObj);
68 std::string sParamName {tempObj->GetName()};
69 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
70 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
72 if (
nullptr == newObj) {
73 LOG(error) <<
"Failed to obtain parameter container " << sParamName
74 <<
", for parameter index " << iparC;
78 parCList->AddAt(newObj, iparC);
84 LOG(info) <<
"Init parameter containers for " << GetName();
88 FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018PsdPar"));
89 if (
nullptr == pUnpackPar) {
90 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018PsdPar";
116 std::vector<std::pair<TNamed*, std::string>> vHistos =
119 std::vector<std::pair<TCanvas*, std::string>> vCanvases =
123 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
124 if (
nullptr != server) {
125 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
128 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
129 vHistos[uHisto].first);
132 for (UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv) {
135 server->Register(Form(
"/%s", vCanvases[uCanv].second.data()),
136 gROOT->FindObject((vCanvases[uCanv].first)->GetName()));
139 server->RegisterCommand(
"/Reset_MoniPsd_Hist",
140 "bMcbm2018MonitorTaskPsdResetHistos=kTRUE");
148 LOG(info) <<
"ReInit parameter containers for " << GetName();
155 UShort_t usDetectorId) {
162 LOG(info) <<
"Reset Psd Monitor histos ";
168 LOG(error) <<
"Failed processing TS " << ts.index()
169 <<
" in unpacker algorithm class";
188 std::vector<std::pair<TNamed*, std::string>> vHistos =
192 TDirectory* oldDir = NULL;
193 TFile* histoFile = NULL;
201 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
203 TString sFolder = vHistos[uHisto].second.data();
204 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
205 gDirectory->cd(sFolder);
208 vHistos[uHisto].first->Write();