19#include "FairParGenericSet.h"
20#include "FairRootManager.h"
22#include "FairRunOnline.h"
23#include "FairRuntimeDb.h"
24#include "TClonesArray.h"
25#include "THttpServer.h"
61 LOG(info) <<
"CbmCosy2019UnpackerTaskHodo::Init";
62 LOG(info) <<
"Initializing mCBM STS 2018 Unpacker";
64 FairRootManager* ioman = FairRootManager::Instance();
65 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
67 if (
nullptr != ioman->InitObjectAs<std::vector<CbmStsDigi>
const*>(
"StsDigi"))
68 LOG(fatal) <<
"CbmCosy2019UnpackerTaskHodo::Init => output vector already "
70 <<
" probably by CbmMcbm2018UnpackerTaskSts" << std::endl
71 <<
" THESE TWO CLASSES ARE INCOMPATIBLE!";
86 LOG(info) <<
"Setting parameter containers for " << GetName();
90 for (
Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
91 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
92 fParCList->Remove(tempObj);
94 std::string sParamName {tempObj->GetName()};
95 FairParGenericSet* newObj =
96 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
98 if (
nullptr == newObj) {
99 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
103 fParCList->AddAt(newObj, iparC);
109 for (
Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
110 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
111 fParCList->Remove(tempObj);
113 std::string sParamName {tempObj->GetName()};
114 FairParGenericSet* newObj =
115 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
117 if (
nullptr == newObj) {
118 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
122 fParCList->AddAt(newObj, iparC);
129 LOG(info) <<
"Init parameter containers for " << GetName();
133 dynamic_cast<CbmCosy2019HodoPar*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmCosy2019HodoPar"));
134 if (
nullptr == pUnpackPar) {
135 LOG(error) <<
"Failed to obtain parameter container CbmCosy2019HodoPar";
157 std::vector<std::pair<TNamed*, std::string>> vHistos =
fUnpackerAlgo->GetHistoVector();
158 std::vector<std::pair<TNamed*, std::string>> vHistosSts =
fUnpackerAlgoSts->GetHistoVector();
159 vHistos.insert(vHistos.end(), vHistosSts.begin(), vHistosSts.end());
162 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
163 if (
nullptr != server) {
164 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
165 server->Register(Form(
"/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
168 server->RegisterCommand(
"/Reset_UnpHodo_Hist",
"bCosy2019UnpackerTaskHodoResetHistos=kTRUE");
169 server->Restrict(
"/Reset_UnpHodo_Hist",
"allow=admin");
185 LOG(info) <<
"ReInit parameter containers for " << GetName();
194 fUnpackerAlgo->AddMsComponentToList(component, usDetectorId);
201 LOG(info) <<
"Reset Hodo + STS unpacker histos ";
208 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in HODO unpacker algorithm class";
213 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in STS unpacker algorithm class";
256 std::vector<std::pair<TNamed*, std::string>> vHistos =
fUnpackerAlgo->GetHistoVector();
257 std::vector<std::pair<TNamed*, std::string>> vHistosSts =
fUnpackerAlgoSts->GetHistoVector();
258 vHistos.insert(vHistos.end(), vHistosSts.begin(), vHistosSts.end());
261 TFile* oldFile = gFile;
262 TDirectory* oldDir = gDirectory;
264 TFile* histoFile =
nullptr;
267 histoFile =
new TFile(
"data/HistosUnpackerSts.root",
"RECREATE");
271 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
273 TString sFolder = vHistos[uHisto].second.data();
274 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
275 gDirectory->cd(sFolder);
278 vHistos[uHisto].first->Write();
ClassImp(CbmConverterManager)
Bool_t bCosy2019UnpackerTaskHodoResetHistos
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.
Data class for a single-channel message in the STS.