13 #include "FairLogger.h"
14 #include "FairParGenericSet.h"
15 #include "FairRootManager.h"
17 #include "FairRunOnline.h"
18 #include "FairRuntimeDb.h"
20 #include "TClonesArray.h"
22 #include "THttpServer.h"
37 , fbMonitorMode(kFALSE)
38 , fbDebugMonitorMode(kFALSE)
39 , fbSeparateArrayT0(kFALSE)
40 , fbWriteOutput(kTRUE)
41 , fuDigiMaskedIdT0(0x00005006)
42 , fuDigiMaskId(0x0001FFFF)
44 , fUnpackerAlgo(nullptr) {
53 LOG(info) <<
"CbmMcbm2018UnpackerTaskTof::Init";
54 LOG(info) <<
"Initializing mCBM TOF 2018 Unpacker";
56 FairRootManager* ioman = FairRootManager::Instance();
57 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
63 fpvDigiT0 =
new std::vector<CbmTofDigi>();
71 LOG(info) <<
"Setting parameter containers for " << GetName();
75 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
76 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
77 fParCList->Remove(tempObj);
79 std::string sParamName {tempObj->GetName()};
80 FairParGenericSet* newObj =
dynamic_cast<FairParGenericSet*
>(
81 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
83 if (
nullptr == newObj) {
84 LOG(error) <<
"Failed to obtain parameter container " << sParamName
85 <<
", for parameter index " << iparC;
89 fParCList->AddAt(newObj, iparC);
95 LOG(info) <<
"Init parameter containers for " << GetName();
99 FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018TofPar"));
100 if (
nullptr == pUnpackPar) {
101 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018TofPar";
121 new TH1I(
"fhArraySize",
122 "Size of the Array VS TS index; TS index; Size [bytes]",
127 new TH1I(
"fhArrayCapacity",
128 "Size of the Array VS TS index; TS index; Size [bytes]",
134 std::vector<std::pair<TNamed*, std::string>> vHistos =
138 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
139 if (
nullptr != server) {
140 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
141 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
142 vHistos[uHisto].first);
145 server->RegisterCommand(
"/Reset_UnpTof_Hist",
146 "bMcbm2018UnpackerTaskTofResetHistos=kTRUE");
147 server->Restrict(
"/Reset_UnpTof_Hist",
"allow=admin");
160 LOG(info) <<
"ReInit parameter containers for " << GetName();
167 UShort_t usDetectorId) {
174 LOG(info) <<
"Reset TOF unpacker histos ";
180 LOG(error) <<
"Failed processing TS " << ts.index()
181 <<
" in unpacker algorithm class";
187 LOG(debug) <<
"Found " << vDigi.size() <<
" TOF digis during unpacking";
199 for (
auto digi : vDigi) {
203 LOG(debug) <<
"Fill digi T0 vector with "
204 << Form(
"0x%08x", digi.GetAddress()) <<
" at "
210 LOG(debug) <<
"Fill digi TOF vector with "
211 << Form(
"0x%08x", digi.GetAddress()) <<
" at "
251 std::vector<std::pair<TNamed*, std::string>> vHistos =
255 TDirectory* oldDir = NULL;
256 TFile* histoFile = NULL;
260 histoFile =
new TFile(
"data/HistosUnpackerTof.root",
"RECREATE");
264 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
266 TString sFolder = vHistos[uHisto].second.data();
267 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
268 gDirectory->cd(sFolder);
271 vHistos[uHisto].first->Write();