13 #include "FairLogger.h"
14 #include "FairParGenericSet.h"
15 #include "FairRootManager.h"
17 #include "FairRunOnline.h"
18 #include "FairRuntimeDb.h"
21 #include "TClonesArray.h"
22 #include "THttpServer.h"
38 , fbEtofFeeIndexing(kTRUE)
39 , fsHistoFileName(
"data/HistosMonitorPulser.root")
45 , fuHistoryHistoSize(1800)
48 , fMonitorPulserAlgo(nullptr) {
57 LOG(info) <<
"CbmStar2019MonitorPulserTask::Init";
58 LOG(info) <<
"Initializing eTOF 2019 Monitor task";
64 LOG(info) <<
"Setting parameter containers for " << GetName();
68 for (Int_t iparC = 0; iparC <
fParCList->GetEntries(); ++iparC) {
69 FairParGenericSet* tempObj = (FairParGenericSet*) (
fParCList->At(iparC));
72 std::string sParamName {tempObj->GetName()};
73 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
74 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
76 if (
nullptr == newObj) {
77 LOG(error) <<
"Failed to obtain parameter container " << sParamName
78 <<
", for parameter index " << iparC;
88 LOG(info) <<
"Init parameter containers for " << GetName();
92 FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmStar2019TofPar"));
93 if (
nullptr == pUnpackPar) {
94 LOG(error) <<
"Failed to obtain parameter container CbmStar2019TofPar";
112 std::vector<std::pair<TNamed*, std::string>> vHistos =
115 std::vector<std::pair<TCanvas*, std::string>> vCanvases =
119 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
120 if (
nullptr != server) {
121 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
124 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
125 vHistos[uHisto].first);
128 for (UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv) {
131 server->Register(Form(
"/%s", vCanvases[uCanv].second.data()),
132 gROOT->FindObject((vCanvases[uCanv].first)->GetName()));
135 server->RegisterCommand(
"/Reset_Pulser_Hist",
136 "bStar2019MonitorPulserTaskResetHistos=kTRUE");
137 server->RegisterCommand(
"/Save_Pulser_Hist",
138 "bStar2019MonitorPulserTaskSaveHistos=kTRUE");
140 server->Restrict(
"/Reset_Moni_Hist",
"allow=admin");
141 server->Restrict(
"/Save_Pulser_Hist",
"allow=admin");
148 LOG(info) <<
"ReInit parameter containers for " << GetName();
155 UShort_t usDetectorId) {
162 LOG(info) <<
"Reset Monitor histos ";
168 LOG(info) <<
"Save Monitor histos & canvases";
174 LOG(error) <<
"Failed processing TS " << ts.index()
175 <<
" in unpacker algorithm class";
203 std::vector<std::pair<TNamed*, std::string>> vHistos =
205 std::vector<std::pair<TCanvas*, std::string>> vCanvas =
209 TDirectory* oldDir = NULL;
210 TFile* histoFile = NULL;
216 if (
nullptr == histoFile)
return kFALSE;
219 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
221 TString sFolder = vHistos[uHisto].second.data();
222 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
223 gDirectory->cd(sFolder);
226 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();