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) <<
"CbmMcbm2018UnpackerTaskMuch::Init";
55 LOG(info) <<
"Initializing mCBM MUCH 2018 Unpacker";
57 FairRootManager* ioman = FairRootManager::Instance();
58 if (NULL == ioman) { LOG(fatal) <<
"No FairRootManager instance"; }
73 LOG(info) <<
"Setting parameter containers for " << GetName();
77 for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
78 FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
79 fParCList->Remove(tempObj);
81 std::string sParamName {tempObj->GetName()};
82 FairParGenericSet* newObj =
83 dynamic_cast<FairParGenericSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
85 if (
nullptr == newObj) {
86 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iparC;
90 fParCList->AddAt(newObj, iparC);
97 LOG(info) <<
"Init parameter containers for " << GetName();
101 dynamic_cast<CbmMcbm2018MuchPar*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2018MuchPar"));
102 if (
nullptr == pUnpackPar) {
103 LOG(error) <<
"Failed to obtain parameter container CbmMcbm2018MuchPar";
126 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
127 if (
nullptr != server) {
128 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
129 server->Register(Form(
"/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
132 server->RegisterCommand(
"/Reset_UnpMuch_Hist",
"bMcbm2018UnpackerTaskMuchResetHistos=kTRUE");
133 server->Restrict(
"/Reset_UnpMuch_Hist",
"allow=admin");
148 LOG(info) <<
"ReInit parameter containers for " << GetName();
162 LOG(info) <<
"Reset MUCH unpacker histos ";
168 LOG(error) <<
"Failed processing TS " << ts.index() <<
" in unpacker algorithm class";
174 => Done in the algo!!!
175 sort(fpvDigiMuch->begin(), fpvDigiMuch->end(),
176 [](const CbmMuchBeamTimeDigi & a, const CbmMuchBeamTimeDigi & b) -> bool
178 return a.GetTime() < b.GetTime();
202 TFile* oldFile = gFile;
203 TDirectory* oldDir = gDirectory;
205 TFile* histoFile =
nullptr;
208 histoFile =
new TFile(
"data/HistosUnpackerMuch.root",
"RECREATE");
212 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
214 TString sFolder = vHistos[uHisto].second.data();
215 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
216 gDirectory->cd(sFolder);
219 vHistos[uHisto].first->Write();
ClassImp(CbmConverterManager)
Bool_t bMcbm2018UnpackerTaskMuchResetHistos
void SetBinningFwFlag(Bool_t bEnable=kTRUE)
=> Quick and dirty hack for binning FW!!!
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
Bool_t ReInitContainers()
Bool_t CreateHistograms()
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
void EnableAsicType(Int_t flag=0)
Bool_t ProcessTs(const fles::Timeslice &ts)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetAdcCut(UInt_t uAdc)
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
CbmMcbm2018UnpackerTaskMuch(UInt_t uNbSdpb=1)
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
std::vector< CbmMuchBeamTimeDigi > * fpvDigiMuch
Output vectors.
void SetAdcCut(UInt_t uAdc)
ADC cut.
void SetBinningFwFlag(Bool_t bEnable=kTRUE)
=> Quick and dirty hack for binning FW!!!
Bool_t fbWriteOutput
Switch ON the filling of a additional set of histograms.
void EnableAsicType(Int_t fiFlag=0)
CbmMcbm2018UnpackerAlgoMuch * fUnpackerAlgo
Processing algo.
std::vector< CbmErrorMessage > * fpvErrorMuch
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
uint64_t fulTsCounter
Statistics & first TS rejection.
Bool_t fbMonitorMode
Control flags.
std::vector< MuchFebChanMask > fvChanMasks
If ON the output TClonesArray of digi is written to disk.
Bool_t ReInitContainers()
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Temp until we change from CbmMcbmUnpack to something else.
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
virtual ~CbmMcbm2018UnpackerTaskMuch()
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.