16#include "FairParGenericSet.h"
17#include "FairRootManager.h"
19#include "FairRunOnline.h"
20#include "FairRuntimeDb.h"
21#include "TClonesArray.h"
23#include "THttpServer.h"
57 LOG(info) <<
"CbmMcbm2018UnpackerTaskTof::Init";
58 LOG(info) <<
"Initializing mCBM TOF 2018 Unpacker";
60 FairRootManager* ioman = FairRootManager::Instance();
61 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
76 LOG(info) <<
"Setting parameter containers for " << GetName();
80 for (
Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
81 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
82 fParCList->Remove(tempObj);
84 std::string sParamName {tempObj->GetName()};
85 FairParGenericSet* newObj =
86 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
88 if (
nullptr == newObj) {
89 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
93 fParCList->AddAt(newObj, iparC);
100 LOG(info) <<
"Init parameter containers for " << GetName();
104 dynamic_cast<CbmMcbm2018TofPar*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018TofPar"));
105 if (
nullptr == pUnpackPar) {
106 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018TofPar";
125 fhArraySize =
new TH1I(
"fhArraySize",
"Size of the Array VS TS index; TS index; Size [bytes]", 10000, 0., 10000.);
127 new TH1I(
"fhArrayCapacity",
"Size of the Array VS TS index; TS index; Size [bytes]", 10000, 0., 10000.);
130 std::vector<std::pair<TNamed*, std::string>> vHistos =
fUnpackerAlgo->GetHistoVector();
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()), vHistos[uHisto].first);
139 server->RegisterCommand(
"/Reset_UnpTof_Hist",
"bMcbm2018UnpackerTaskTofResetHistos=kTRUE");
140 server->Restrict(
"/Reset_UnpTof_Hist",
"allow=admin");
154 LOG(info) <<
"ReInit parameter containers for " << GetName();
162 fUnpackerAlgo->AddMsComponentToList(component, usDetectorId);
168 LOG(info) <<
"Reset TOF unpacker histos ";
174 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in unpacker algorithm class";
180 LOG(debug) <<
"Found " << vDigi.size() <<
" TOF digis during unpacking";
184 => Done in the algo!!!
185 sort(vDigi.begin(), vDigi.end(),
186 [](const CbmTofDigi & a, const CbmTofDigi & b) -> bool
188 return a.GetTime() < b.GetTime();
192 for (
auto digi : vDigi) {
195 LOG(debug) <<
"Fill digi Bmon vector with " << Form(
"0x%08x", digi.GetAddress()) <<
" at " <<
fpvDigiBmon->size();
200 LOG(debug) <<
"Fill digi TOF vector with " << Form(
"0x%08x", digi.GetAddress()) <<
" at " <<
fpvDigiTof->size();
237 std::vector<std::pair<TNamed*, std::string>> vHistos =
fUnpackerAlgo->GetHistoVector();
240 TFile* oldFile = gFile;
241 TDirectory* oldDir = gDirectory;
243 TFile* histoFile =
nullptr;
246 histoFile =
new TFile(
"data/HistosUnpackerTof.root",
"RECREATE");
250 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
252 TString sFolder = vHistos[uHisto].second.data();
253 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
254 gDirectory->cd(sFolder);
257 vHistos[uHisto].first->Write();
ClassImp(CbmConverterManager)
Bool_t bMcbm2018UnpackerTaskTofResetHistos
std::vector< CbmTofDigi > * fpvDigiTof
Output vectors.
void SetDiamondDpbIdx(UInt_t uIdx=2)
uint64_t fulTsCounter
Statistics & first TS rejection.
CbmMcbm2018UnpackerAlgoTof * fUnpackerAlgo
Processing algo.
Bool_t fbSeparateArrayBmon
Switch ON the filling of a additional set of histograms.
TH1 * fhArraySize
Histograms.
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
std::vector< CbmTofDigi > * fpvDigiBmon
UInt_t fuDigiMaskedIdBmon
If ON the output TClonesArray of digi is written to disk.
CbmMcbm2018UnpackerTaskTof(UInt_t uNbSdpb=1)
Bool_t ReInitContainers()
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
virtual ~CbmMcbm2018UnpackerTaskTof()
Bool_t fbMonitorMode
Control flags.
Bool_t fbWriteOutput
If ON, Bmon digis are saved in separate TClonesArray.
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)