14 #include "FairLogger.h"
15 #include "FairParGenericSet.h"
16 #include "FairRootManager.h"
18 #include "FairRunOnline.h"
19 #include "FairRuntimeDb.h"
21 #include "TClonesArray.h"
23 #include "THttpServer.h"
38 , fbMonitorMode(kFALSE)
39 , fbDebugMonitorMode(kFALSE)
40 , fbWriteOutput(kTRUE)
41 , fuDigiMaskId(0x0001FFFF)
43 , fUnpackerAlgo(nullptr) {
52 LOG(info) <<
"CbmMcbm2018UnpackerTaskPsd::Init";
53 LOG(info) <<
"Initializing mCBM PSD 2018 Unpacker";
55 FairRootManager* ioman = FairRootManager::Instance();
56 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
66 LOG(info) <<
"Setting parameter containers for " << GetName();
70 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
71 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
72 fParCList->Remove(tempObj);
74 std::string sParamName {tempObj->GetName()};
75 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
76 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
78 if (
nullptr == newObj) {
79 LOG(error) <<
"Failed to obtain parameter container " << sParamName
80 <<
", for parameter index " << iparC;
84 fParCList->AddAt(newObj, iparC);
90 LOG(info) <<
"Init parameter containers for " << GetName();
94 FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018PsdPar"));
95 if (
nullptr == pUnpackPar) {
96 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018PsdPar";
116 new TH1I(
"fhArraySize",
117 "Size of the Array VS TS index; TS index; Size [bytes]",
122 new TH1I(
"fhArrayCapacity",
123 "Size of the Array VS TS index; TS index; Size [bytes]",
129 std::vector<std::pair<TNamed*, std::string>> vHistos =
133 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
134 if (
nullptr != server) {
135 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
136 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
137 vHistos[uHisto].first);
140 server->RegisterCommand(
"/Reset_UnpPsd_Hist",
141 "bMcbm2018UnpackerTaskPsdResetHistos=kTRUE");
142 server->Restrict(
"/Reset_UnpPsd_Hist",
"allow=admin");
155 LOG(info) <<
"ReInit parameter containers for " << GetName();
162 UShort_t usDetectorId) {
170 LOG(info) <<
"Reset PSD unpacker histos ";
176 LOG(error) <<
"Failed processing TS " << ts.index()
177 <<
" in unpacker algorithm class";
209 std::vector<std::pair<TNamed*, std::string>> vHistos =
213 TDirectory* oldDir = NULL;
214 TFile* histoFile = NULL;
218 histoFile =
new TFile(
"data/HistosUnpackerPsd.root",
"RECREATE");
222 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
224 TString sFolder = vHistos[uHisto].second.data();
225 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
226 gDirectory->cd(sFolder);
229 vHistos[uHisto].first->Write();