17#include "FairParGenericSet.h"
18#include "FairRootManager.h"
20#include "FairRunOnline.h"
21#include "FairRuntimeDb.h"
24#include "TClonesArray.h"
25#include "THttpServer.h"
41 , fbMonitorMode(kFALSE)
42 , fbWriteOutput(kTRUE)
45 , fUnpackerAlgo(nullptr)
54 LOG(info) <<
"CbmMcbm2018UnpackerTaskSts::Init";
55 LOG(info) <<
"Initializing mCBM STS 2018 Unpacker";
57 FairRootManager* ioman = FairRootManager::Instance();
58 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
61 if (
nullptr != ioman->InitObjectAs<std::vector<CbmStsDigi>
const*>(
"StsDigi"))
62 LOG(fatal) <<
"CbmMcbm2018UnpackerTaskSts::Init => output vector already registered,"
63 <<
" probably by CbmMcbm2018UnpackerTaskHodo" << std::endl
64 <<
" THESE TWO CLASSES ARE INCOMPATIBLE!";
85 LOG(info) <<
"Setting parameter containers for " << GetName();
89 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
90 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
91 fParCList->Remove(tempObj);
93 std::string sParamName {tempObj->GetName()};
94 FairParGenericSet* newObj =
95 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
97 if (
nullptr == newObj) {
98 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
102 fParCList->AddAt(newObj, iparC);
109 LOG(info) <<
"Init parameter containers for " << GetName();
113 dynamic_cast<CbmMcbm2018StsPar*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018StsPar"));
114 if (
nullptr == pUnpackPar) {
115 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018StsPar";
138 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
139 if (
nullptr != server) {
140 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
141 server->Register(Form(
"/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
144 server->RegisterCommand(
"/Reset_UnpSts_Hist",
"bMcbm2018UnpackerTaskStsResetHistos=kTRUE");
145 server->Restrict(
"/Reset_UnpSts_Hist",
"allow=admin");
159 LOG(info) <<
"ReInit parameter containers for " << GetName();
173 LOG(info) <<
"Reset STS unpacker histos ";
179 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in unpacker algorithm class";
185 => Done in the algo!!!
186 sort(fpvDigiSts->begin(), fpvDigiSts->end(),
187 [](const CbmStsDigi & a, const CbmStsDigi & b) -> bool
189 return a.GetTime() < b.GetTime();
214 TFile* oldFile = gFile;
215 TDirectory* oldDir = gDirectory;
217 TFile* histoFile =
nullptr;
220 histoFile =
new TFile(
"data/HistosUnpackerSts.root",
"RECREATE");
224 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
226 TString sFolder = vHistos[uHisto].second.data();
227 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
228 gDirectory->cd(sFolder);
231 vHistos[uHisto].first->Write();
ClassImp(CbmConverterManager)
Bool_t bMcbm2018UnpackerTaskStsResetHistos
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< CbmStsDigi > & GetPulserVector()
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void SetBinningFwFlag(Bool_t bEnable=kTRUE)
=> Quick and dirty hack for binning FW!!!
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)
void SeparatePulserOutput(Bool_t bFlagIn)
Bool_t fbWriteOutput
Switch ON the filling of a additional set of histograms.
void SetAdcCut(UInt_t uAdc)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
uint64_t fulTsCounter
Statistics & first TS rejection.
Bool_t fbPulserOutput
If ON the output TClonesArray of digi is written to disk.
void SetBinningFwFlag(Bool_t bEnable=kTRUE)
=> Quick and dirty hack for binning FW!!!
CbmMcbm2018UnpackerAlgoSts * fUnpackerAlgo
Processing algo.
CbmMcbm2018UnpackerTaskSts(UInt_t uNbSdpb=1)
virtual ~CbmMcbm2018UnpackerTaskSts()
void SeparatePulserOutput(Bool_t bFlagIn)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
std::vector< CbmStsDigi > * fpvDigiSts
Output vectors.
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
std::vector< CbmStsDigi > * fpvPulserDigiSts
std::vector< CbmErrorMessage > * fpvErrorSts
Bool_t fbMonitorMode
Control flags.
std::vector< FebChanMask > fvChanMasks
If ON a separate output vector of digi is used for the pulser.
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Bool_t ReInitContainers()
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.