20#include "FairParGenericSet.h"
21#include "FairRootManager.h"
23#include "FairRunOnline.h"
24#include "FairRuntimeDb.h"
27#include "TClonesArray.h"
28#include "THttpServer.h"
44 , fbMonitorMode(kFALSE)
45 , fbWriteOutput(kTRUE)
48 , fUnpackerAlgo(nullptr)
62 LOG(info) <<
"CbmCosy2019UnpackerTaskHodo::Init";
63 LOG(info) <<
"Initializing mCBM STS 2018 Unpacker";
65 FairRootManager* ioman = FairRootManager::Instance();
66 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
68 if (
nullptr != ioman->InitObjectAs<std::vector<CbmStsDigi>
const*>(
"StsDigi"))
69 LOG(fatal) <<
"CbmCosy2019UnpackerTaskHodo::Init => output vector already "
71 <<
" probably by CbmMcbm2018UnpackerTaskSts" << std::endl
72 <<
" THESE TWO CLASSES ARE INCOMPATIBLE!";
87 LOG(info) <<
"Setting parameter containers for " << GetName();
91 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
92 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
93 fParCList->Remove(tempObj);
95 std::string sParamName {tempObj->GetName()};
96 FairParGenericSet* newObj =
97 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
99 if (
nullptr == newObj) {
100 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
104 fParCList->AddAt(newObj, iparC);
110 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
111 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
112 fParCList->Remove(tempObj);
114 std::string sParamName {tempObj->GetName()};
115 FairParGenericSet* newObj =
116 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
118 if (
nullptr == newObj) {
119 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
123 fParCList->AddAt(newObj, iparC);
130 LOG(info) <<
"Init parameter containers for " << GetName();
134 dynamic_cast<CbmCosy2019HodoPar*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmCosy2019HodoPar"));
135 if (
nullptr == pUnpackPar) {
136 LOG(error) <<
"Failed to obtain parameter container CbmCosy2019HodoPar";
160 vHistos.insert(vHistos.end(), vHistosSts.begin(), vHistosSts.end());
163 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
164 if (
nullptr != server) {
165 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
166 server->Register(Form(
"/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
169 server->RegisterCommand(
"/Reset_UnpHodo_Hist",
"bCosy2019UnpackerTaskHodoResetHistos=kTRUE");
170 server->Restrict(
"/Reset_UnpHodo_Hist",
"allow=admin");
186 LOG(info) <<
"ReInit parameter containers for " << GetName();
202 LOG(info) <<
"Reset Hodo + STS unpacker histos ";
209 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in HODO unpacker algorithm class";
214 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in STS unpacker algorithm class";
259 vHistos.insert(vHistos.end(), vHistosSts.begin(), vHistosSts.end());
262 TFile* oldFile = gFile;
263 TDirectory* oldDir = gDirectory;
265 TFile* histoFile =
nullptr;
268 histoFile =
new TFile(
"data/HistosUnpackerSts.root",
"RECREATE");
272 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
274 TString sFolder = vHistos[uHisto].second.data();
275 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
276 gDirectory->cd(sFolder);
279 vHistos[uHisto].first->Write();
ClassImp(CbmConverterManager)
Bool_t bCosy2019UnpackerTaskHodoResetHistos
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
Bool_t CreateHistograms()
Bool_t ReInitContainers()
Bool_t ProcessTs(const fles::Timeslice &ts)
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
virtual ~CbmCosy2019UnpackerTaskHodo()
Bool_t ReInitContainers()
void MaskNoisyChannelSts(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
CbmCosy2019UnpackerAlgoHodo * fUnpackerAlgo
Processing algo.
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
void SetAdcCutSts(UInt_t uAdc)
CbmMcbm2018UnpackerAlgoSts * fUnpackerAlgoSts
uint64_t fulTsCounter
Statistics & first TS rejection.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
std::vector< CbmStsDigi > * fpvDigiSts
Output vectors.
void SetTimeOffsetNsAsicSts(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
CbmCosy2019UnpackerTaskHodo(UInt_t uNbSdpb=1)
Bool_t fbWriteOutput
Switch ON the filling of a additional set of histograms.
Bool_t fbMonitorMode
Control flags.
void SetTimeOffsetNsSts(Double_t dOffsetIn=0.0)
std::vector< CbmErrorMessage > * fpvErrorSts
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
std::vector< FebChanMaskSts > fvChanMasks
If ON the output TClonesArray of digi is written to disk.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void SetAdcCut(UInt_t uAdc)
Bool_t CreateHistograms()
Bool_t ReInitContainers()
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
Bool_t ProcessTs(const fles::Timeslice &ts)
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
std::vector< T > & GetVector()
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
std::vector< CbmErrorMessage > & GetErrorVector()
void ClearVector()
For unpacker algos.
Data class for a single-channel message in the STS.