17#include <TClonesArray.h>
19#include <THttpServer.h>
23#include <FairParGenericSet.h>
24#include <FairRootManager.h>
26#include <FairRunOnline.h>
27#include <FairRuntimeDb.h>
43 , fbMonitorMode(kFALSE)
44 , fbDebugMonitorMode(kFALSE)
45 , fbWriteOutput(kTRUE)
60 LOG(info) <<
"CbmMcbm2018UnpackerTaskRich::Init";
61 LOG(info) <<
"Initializing mCBM RICH 2018 Unpacker";
63 FairRootManager* ioman = FairRootManager::Instance();
64 if (ioman == NULL) { LOG(fatal) <<
"No FairRootManager instance"; }
77 LOG(info) <<
"Reset RICH unpacker histos ";
83 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in mRICH unpacker algorithm class";
89 //=> Done in the algo!!!
90 sort(fpvDigiRich->begin(), fpvDigiRich->end(),
91 [](const CbmRichDigi & a, const CbmRichDigi & b) -> bool
93 return a.GetTime() < b.GetTime();
116 TFile* oldFile = gFile;
117 TDirectory* oldDir = gDirectory;
119 TFile* histoFile =
nullptr;
122 histoFile =
new TFile(
"data/HistosUnpackerRich.root",
"RECREATE");
126 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
128 TString sFolder = vHistos[uHisto].second.data();
129 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
130 gDirectory->cd(sFolder);
133 vHistos[uHisto].first->Write();
151 LOG(info) <<
"Setting parameter containers for " << GetName();
155 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
156 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
157 fParCList->Remove(tempObj);
159 std::string sParamName {tempObj->GetName()};
160 FairParGenericSet* newObj =
161 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
163 if (
nullptr == newObj) {
164 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
168 fParCList->AddAt(newObj, iparC);
178 LOG(info) <<
"Init parameter containers for " << GetName();
182 dynamic_cast<CbmMcbm2018RichPar*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018RichPar"));
183 if (
nullptr == pUnpackPar) {
184 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018RichPar";
209 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
210 if (
nullptr != server) {
211 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
212 server->Register(Form(
"/rich/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
214 for (UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv) {
215 server->Register(Form(
"/rich/%s", vCanvases[uCanv].second.data()),
216 gROOT->FindObject((vCanvases[uCanv].first)->GetName()));
220 server->RegisterCommand(
"/Reset_UnpRich_Hist",
"bMcbm2018UnpackerTaskRichResetHistos=kTRUE");
221 server->Restrict(
"/Reset_UnpRich_Hist",
"allow=admin");
236 LOG(info) <<
"ReInit parameter containers for " << GetName();
ClassImp(CbmConverterManager)
Bool_t bMcbm2018UnpackerTaskRichResetHistos
virtual Bool_t InitContainers()
Bool_t CreateHistograms()
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
void DoTotCorr(Bool_t bDoToTCorr=kTRUE)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
virtual Bool_t ReInitContainers()
virtual TList * GetParList()
virtual Bool_t ProcessTs(const fles::Timeslice &ts)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
std::vector< CbmRichDigi > * fpvDigiRich
Output vectors.
CbmMcbm2018UnpackerAlgoRich * fUnpackerAlgo
Algo implementation of the unpacking.
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
void DoTotCorr(Bool_t bDoToTCorr=kTRUE)
virtual Bool_t InitContainers()
uint64_t fulTsCounter
If ON the output TClonesArray of digi is written to disk.
virtual ~CbmMcbm2018UnpackerTaskRich()
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
virtual Bool_t ReInitContainers()
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
CbmMcbm2018UnpackerTaskRich()
virtual void SetParContainers()
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
Bool_t fbWriteOutput
Switch ON the filling of a additional set of histograms.
Bool_t fbMonitorMode
Control flags.
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
std::vector< T > & GetVector()
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()
void ClearVector()
For unpacker algos.