16 #include "FairLogger.h"
17 #include "FairParGenericSet.h"
18 #include "FairRootManager.h"
20 #include "FairRunOnline.h"
21 #include "FairRuntimeDb.h"
23 #include "TClonesArray.h"
24 #include "THttpServer.h"
39 , fbMonitorMode(kFALSE)
40 , fbWriteOutput(kTRUE)
43 , fUnpackerAlgo(nullptr) {
54 LOG(info) <<
"CbmMcbm2018UnpackerTaskHodo::Init";
55 LOG(info) <<
"Initializing mCBM STS 2018 Unpacker";
57 FairRootManager* ioman = FairRootManager::Instance();
58 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
60 if (
nullptr != ioman->InitObjectAs<std::vector<CbmStsDigi>
const*>(
"StsDigi"))
61 LOG(fatal) <<
"CbmMcbm2018UnpackerTaskHodo::Init => output vector already "
63 <<
" probably by CbmMcbm2018UnpackerTaskSts" << std::endl
64 <<
" THESE TWO CLASSES ARE INCOMPATIBLE!";
78 LOG(info) <<
"Setting parameter containers for " << GetName();
82 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
83 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
84 fParCList->Remove(tempObj);
86 std::string sParamName {tempObj->GetName()};
87 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
88 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
90 if (
nullptr == newObj) {
91 LOG(error) <<
"Failed to obtain parameter container " << sParamName
92 <<
", for parameter index " << iparC;
96 fParCList->AddAt(newObj, iparC);
102 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
103 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
104 fParCList->Remove(tempObj);
106 std::string sParamName {tempObj->GetName()};
107 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
108 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
110 if (
nullptr == newObj) {
111 LOG(error) <<
"Failed to obtain parameter container " << sParamName
112 <<
", for parameter index " << iparC;
116 fParCList->AddAt(newObj, iparC);
122 LOG(info) <<
"Init parameter containers for " << GetName();
126 FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018HodoPar"));
127 if (
nullptr == pUnpackPar) {
128 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018HodoPar";
150 std::vector<std::pair<TNamed*, std::string>> vHistos =
152 std::vector<std::pair<TNamed*, std::string>> vHistosSts =
154 vHistos.insert(vHistos.end(), vHistosSts.begin(), vHistosSts.end());
157 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
158 if (
nullptr != server) {
159 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
160 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
161 vHistos[uHisto].first);
164 server->RegisterCommand(
"/Reset_UnpHodo_Hist",
165 "bMcbm2018UnpackerTaskHodoResetHistos=kTRUE");
166 server->Restrict(
"/Reset_UnpHodo_Hist",
"allow=admin");
174 for (std::vector<FebChanMaskSts>::iterator it =
fvChanMasks.begin();
183 LOG(info) <<
"ReInit parameter containers for " << GetName();
191 UShort_t usDetectorId) {
199 LOG(info) <<
"Reset Hodo + STS unpacker histos ";
206 LOG(error) <<
"Failed processing TS " << ts.index()
207 <<
" in HODO unpacker algorithm class";
212 LOG(error) <<
"Failed processing TS " << ts.index()
213 <<
" in STS unpacker algorithm class";
229 return a.GetTime() < b.GetTime();
264 std::vector<std::pair<TNamed*, std::string>> vHistos =
266 std::vector<std::pair<TNamed*, std::string>> vHistosSts =
268 vHistos.insert(vHistos.end(), vHistosSts.begin(), vHistosSts.end());
271 TDirectory* oldDir = NULL;
272 TFile* histoFile = NULL;
276 histoFile =
new TFile(
"data/HistosUnpackerSts.root",
"RECREATE");
280 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
282 TString sFolder = vHistos[uHisto].second.data();
283 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
284 gDirectory->cd(sFolder);
287 vHistos[uHisto].first->Write();
312 Double_t dOffsetIn) {
317 Double_t dOffsetIn) {