17#include "FairParGenericSet.h"
18#include "FairRootManager.h"
20#include "FairRunOnline.h"
21#include "FairRuntimeDb.h"
24#include "TClonesArray.h"
26#include "THttpServer.h"
42 , fbMonitorMode(kFALSE)
43 , fbDebugMonitorMode(kFALSE)
44 , fbSeparateArrayBmon(kFALSE)
45 , fbWriteOutput(kTRUE)
46 , fuDigiMaskedIdBmon(0x00002806)
47 , fuDigiMaskId(0x001FFFFF)
49 , fUnpackerAlgo(nullptr)
58 LOG(info) <<
"CbmMcbm2018UnpackerTaskTof::Init";
59 LOG(info) <<
"Initializing mCBM TOF 2018 Unpacker";
61 FairRootManager* ioman = FairRootManager::Instance();
62 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
77 LOG(info) <<
"Setting parameter containers for " << GetName();
81 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
82 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
83 fParCList->Remove(tempObj);
85 std::string sParamName {tempObj->GetName()};
86 FairParGenericSet* newObj =
87 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
89 if (
nullptr == newObj) {
90 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
94 fParCList->AddAt(newObj, iparC);
101 LOG(info) <<
"Init parameter containers for " << GetName();
105 dynamic_cast<CbmMcbm2018TofPar*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018TofPar"));
106 if (
nullptr == pUnpackPar) {
107 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018TofPar";
126 fhArraySize =
new TH1I(
"fhArraySize",
"Size of the Array VS TS index; TS index; Size [bytes]", 10000, 0., 10000.);
128 new TH1I(
"fhArrayCapacity",
"Size of the Array VS TS index; TS index; Size [bytes]", 10000, 0., 10000.);
134 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
135 if (
nullptr != server) {
136 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
137 server->Register(Form(
"/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
140 server->RegisterCommand(
"/Reset_UnpTof_Hist",
"bMcbm2018UnpackerTaskTofResetHistos=kTRUE");
141 server->Restrict(
"/Reset_UnpTof_Hist",
"allow=admin");
155 LOG(info) <<
"ReInit parameter containers for " << GetName();
169 LOG(info) <<
"Reset TOF unpacker histos ";
175 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in unpacker algorithm class";
181 LOG(debug) <<
"Found " << vDigi.size() <<
" TOF digis during unpacking";
185 => Done in the algo!!!
186 sort(vDigi.begin(), vDigi.end(),
187 [](const CbmTofDigi & a, const CbmTofDigi & b) -> bool
189 return a.GetTime() < b.GetTime();
193 for (
auto digi : vDigi) {
196 LOG(debug) <<
"Fill digi Bmon vector with " << Form(
"0x%08x", digi.GetAddress()) <<
" at " <<
fpvDigiBmon->size();
201 LOG(debug) <<
"Fill digi TOF vector with " << Form(
"0x%08x", digi.GetAddress()) <<
" at " <<
fpvDigiTof->size();
241 TFile* oldFile = gFile;
242 TDirectory* oldDir = gDirectory;
244 TFile* histoFile =
nullptr;
247 histoFile =
new TFile(
"data/HistosUnpackerTof.root",
"RECREATE");
251 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
253 TString sFolder = vHistos[uHisto].second.data();
254 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
255 gDirectory->cd(sFolder);
258 vHistos[uHisto].first->Write();
ClassImp(CbmConverterManager)
Bool_t bMcbm2018UnpackerTaskTofResetHistos
Bool_t ProcessTs(const fles::Timeslice &ts)
void SetDiamondDpbIdx(UInt_t uIdx=2)
Bool_t ReInitContainers()
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
Bool_t CreateHistograms()
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.
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)
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
std::vector< T > & GetVector()
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
void ClearVector()
For unpacker algos.