9#include "FairRootManager.h"
11#include "FairRunOnline.h"
12#include "FairRuntimeDb.h"
16#include <THttpServer.h>
43 LOG(info) <<
"Initializing CbmMcbm2018UnpackerTaskTrdR...";
46 FairRootManager* ioman =
nullptr;
47 ioman = FairRootManager::Instance();
48 if (ioman ==
nullptr) { LOG(fatal) <<
"No FairRootManager instance"; }
57 LOG(fatal) <<
"fTrdDigiVector could not be registered at FairRootManager.";
70 LOG(fatal) <<
"[CbmMcbm2018UnpackerTaskTrdR::Init] Raw output could not "
71 "be registered at FairRootManager.";
80 LOG(info) <<
"Initialization of CbmMcbm2018UnpackerTaskTrdR and "
81 "CbmMcbm2018UnpackerAlgoTrdR successfull!";
84 LOG(fatal) <<
"Init of CbmMcbm2018UnpackerAlgoTrdR failed!";
94 LOG(error) <<
"CbmMcbm2018UnpackerTaskTrdR: Failed processing TS " << ts.index() <<
" in unpacker algorithm class.";
115 LOG(info) <<
"Finish of CbmMcbm2018UnpackerTaskTrdR";
120 std::vector<std::pair<TNamed*, std::string>> vHistos =
fUnpackerAlgo->GetHistoVector();
123 TFile* oldFile = gFile;
124 TDirectory* oldDir = gDirectory;
127 TFile* histoFile =
nullptr;
131 histoFile =
new TFile(histoFileName.Data(),
"RECREATE");
134 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
136 TString sFolder = vHistos[uHisto].second.data();
137 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
138 gDirectory->cd(sFolder);
140 vHistos[uHisto].first->Write();
154 LOG(info) <<
"Setting parameter containers for " << GetName();
159 for (
auto parSetIt : *fParContList) {
161 fParContList->Remove(tempObj);
162 std::string sParamName {tempObj->GetName()};
165 updatedParSet =
dynamic_cast<CbmTrdParSet*
>(FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
167 if (!updatedParSet) {
168 LOG(error) <<
"Failed to obtain parameter container " << sParamName <<
", for parameter index " << iParCont;
171 fParContList->AddAt(updatedParSet, iParCont);
176 FairRun::Instance()->GetRuntimeDb()->getContainer(
"CbmMcbm2020TrdTshiftPar"));
182 LOG(error) <<
"CbmMcbm2018UnpackerTaskTrdR::InitContainers failed! No "
186 LOG(info) <<
"Init containers for CbmMcbm2018UnpackerTaskTrdR";
203 LOG(info) <<
"CbmMcbm2018UnpackerTaskTrdR::SetParContainers() - Parsing "
204 "timeshift correction map to unpacker algo";
214 std::vector<std::pair<TNamed*, std::string>> vHistos =
fUnpackerAlgo->GetHistoVector();
217 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
218 if (
nullptr != server) {
219 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
220 server->Register(Form(
"/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first);
230 LOG(warning) <<
"The histograms from CbmMcbm2018UnpackerTaskTrdR will "
231 "not be available online as no server present";
242 LOG(info) <<
"ReInit parameter containers for CbmMcbm2018UnpackerTaskTrdR";
251 LOG(error) <<
"CbmMcbm2018UnpackerTaskTrdR::AddMsComponentToList : Wrong "
ClassImp(CbmConverterManager)
Timeslice unpacker algorithm for Spadic v.2.2 .
Timeslice unpacker FairTask for Spadic v.2.2 .
Bool_t fbDebugSortOutput
If ON the output vector of raw messages is sorted in time.
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
Bool_t fbWriteOutput
If ON the output Vector of digis is written to disk.
virtual Bool_t ReInitContainers()
std::vector< std::pair< size_t, size_t > > * fSpadicInfoMsgVector
vector< pair< fulltime, word > >
Bool_t fbDebugMonitorMode
Switch ON the filling of a additional set of histograms.
virtual ~CbmMcbm2018UnpackerTaskTrdR()
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
virtual Bool_t Init()
Registers output-data containers at the FairRootManager.
Double_t fdMsSizeInNs
microslice size in ns to be passed to the unpacker // TODO handle this with asic parameter files
Bool_t fbBaselineAvg
Set to true if Baseline Averaging is activated in Spadic.
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
Sets numbers of Core Microslices and overlap Microslices per Timeslice.
Bool_t fbDebugWriteOutput
If ON the output vector of raw messages is filled and written to disk.
virtual Bool_t InitContainers()
uint8_t fSystemIdentifier
by default set to: fles::Subsystem::TRD, changable via setter
CbmMcbm2020TrdTshiftPar * fTimeshiftPar
mCbm2020 timeshift correction parameters
virtual void SetParContainers()
std::vector< CbmTrdRawMessageSpadic > * fTrdRawMessageVector
Output Spadic raw messages for debugging.
std::vector< CbmTrdDigi > * fTrdDigiVector
Output Digi vector.
TString fMonitorHistoFileName
Bool_t fbMonitorMode
< Set wether channels 00..15 are on the even (true) or the odd (false and default) elink
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Adds an input component to the list of active components for this unpacker.
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
CbmMcbm2018UnpackerAlgoTrdR * fUnpackerAlgo
Processing algo.
void SetHistoFileName(TString filename)
bool fIsFirstChannelsElinkEven
define if the first 16 channels (00..15) are found on the even (set true) or odd (false) eLinkId,...
std::vector< bool > fIsActiveHistoVec
CbmMcbm2018UnpackerTaskTrdR()