Go to the documentation of this file.
4 #include "FairLogger.h"
5 #include "FairRootManager.h"
7 #include "FairRunOnline.h"
8 #include "FairRuntimeDb.h"
11 #include <THttpServer.h>
16 , fbMonitorMode(kFALSE)
17 , fbDebugMonitorMode(kFALSE)
18 , fbWriteOutput(kTRUE)
19 , fbDebugWriteOutput(kFALSE)
20 , fbBaselineAvg(kFALSE)
21 , fSystemIdentifier((std::uint8_t) fles::SubsystemIdentifier::TRD)
22 , fdMsSizeInNs(1.28e6)
23 , fMonitorHistoFileName(
"")
25 , fTrdDigiVector(nullptr)
26 , fTrdRawMessageVector(nullptr)
27 , fSpadicInfoMsgVector(nullptr)
28 , fUnpackerAlgo(nullptr) {
38 LOG(info) <<
"Initializing CbmMcbm2018UnpackerTaskTrdR...";
41 FairRootManager* ioman =
nullptr;
42 ioman = FairRootManager::Instance();
43 if (ioman ==
nullptr) { LOG(fatal) <<
"No FairRootManager instance"; }
51 LOG(fatal) <<
"fTrdDigiVector could not be registered at FairRootManager.";
58 new std::vector<std::pair<std::uint64_t, std::uint64_t>>();
67 LOG(fatal) <<
"[CbmMcbm2018UnpackerTaskTrdR::Init] Raw output could not "
68 "be registered at FairRootManager.";
78 LOG(info) <<
"Initialization of CbmMcbm2018UnpackerTaskTrdR and "
79 "CbmMcbm2018UnpackerAlgoTrdR successfull!";
81 LOG(fatal) <<
"Init of CbmMcbm2018UnpackerAlgoTrdR failed!";
91 LOG(error) <<
"CbmMcbm2018UnpackerTaskTrdR: Failed processing TS "
92 << ts.index() <<
" in unpacker algorithm class.";
111 LOG(info) <<
"Finish of CbmMcbm2018UnpackerTaskTrdR";
117 std::vector<std::pair<TNamed*, std::string>> vHistos =
121 TDirectory* oldDir =
nullptr;
122 TFile* histoFile =
nullptr;
127 histoFile =
new TFile(histoFileName.Data(),
"RECREATE");
130 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
132 TString sFolder = vHistos[uHisto].second.data();
133 if (
nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder);
134 gDirectory->cd(sFolder);
136 vHistos[uHisto].first->Write();
146 LOG(info) <<
"Setting parameter containers for " << GetName();
151 for (
auto parSetIt : *fParContList) {
153 fParContList->Remove(tempObj);
154 std::string sParamName {tempObj->GetName()};
158 FairRun::Instance()->GetRuntimeDb()->getContainer(sParamName.data()));
160 if (!updatedParSet) {
161 LOG(error) <<
"Failed to obtain parameter container " << sParamName
162 <<
", for parameter index " << iParCont;
165 fParContList->AddAt(updatedParSet, iParCont);
171 LOG(error) <<
"CbmMcbm2018UnpackerTaskTrdR::InitContainers failed! No "
175 LOG(info) <<
"Init containers for CbmMcbm2018UnpackerTaskTrdR";
196 std::vector<std::pair<TNamed*, std::string>> vHistos =
200 THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
201 if (
nullptr != server) {
202 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
203 server->Register(Form(
"/%s", vHistos[uHisto].second.data()),
204 vHistos[uHisto].first);
213 LOG(warning) <<
"The histograms from CbmMcbm2018UnpackerTaskTrdR will "
214 "not be available online as no server present";
224 LOG(info) <<
"ReInit parameter containers for CbmMcbm2018UnpackerTaskTrdR";
231 UShort_t usDetectorId) {
233 LOG(error) <<
"CbmMcbm2018UnpackerTaskTrdR::AddMsComponentToList : Wrong "
242 size_t uOverlapMsNb) {
Bool_t fbDebugWriteOutput
If ON the output vector of raw messages is filled and written to disk.
std::vector< bool > fIsActiveHistoVec
virtual void SetParContainers()
Timeslice unpacker FairTask for Spadic v.2.2 .
TString fMonitorHistoFileName
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
Bool_t fbBaselineAvg
Set to true if Baseline Averaging is activated in Spadic.
void SetDebugSortOutput(Bool_t bFlagIn=kTRUE)
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
void SetDebugWriteOutput(Bool_t bFlagIn=kTRUE)
Bool_t fbWriteOutput
If ON the output Vector of digis is written to disk.
Bool_t SetRawOutputPointer(std::vector< CbmTrdRawMessageSpadic > *const pVector, std::vector< std::pair< std::uint64_t, std::uint64_t >> *const qVector=nullptr)
Set fTrdRawMessageVector to the address of pVector.
Bool_t fbDebugSortOutput
If ON the output vector of raw messages is sorted in time.
virtual Bool_t ReInitContainers()
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
std::uint8_t fSystemIdentifier
by default set to: fles::SubsystemIdentifier::TRD, changable via setter
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
Bool_t ProcessTs(const fles::Timeslice &ts)
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetDebugMonitorMode(Bool_t bFlagIn=kTRUE)
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
Sets numbers of Core Microslices and overlap Microslices per Timeslice.
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 SetDigiOutputPointer(std::vector< CbmTrdDigi > *const pVector)
Set fTrdDigiVector to the address of pVector.
void SetWriteOutput(Bool_t bFlagIn=kTRUE)
void SetMsSizeInNs(Double_t msSizeInNs)
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
virtual ~CbmMcbm2018UnpackerTaskTrdR()
void SetHistoFileName(TString filename)
void SetBaselineAvg(Bool_t bFlagIn=kTRUE)
Call this when Spadic Average-Baseline feature is enabled.
Bool_t fbMonitorMode
< Set wether channels 00..15 are on the even (true) or the odd (false and default) elink
virtual Bool_t InitContainers()
Bool_t ReInitContainers()
std::vector< CbmTrdDigi > * fTrdDigiVector
Output Digi vector.
Bool_t CreateHistograms()
Goes through fIsActiveHistoVec and creates the activated histograms.
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
Bool_t fbDebugMonitorMode
Switch ON the filling of a additional set of histograms.
bool fIsFirstChannelsElinkEven
define if the first 16 channels (00..15) are found on the even (set true) or odd (false) eLinkId,...
std::vector< std::pair< std::uint64_t, std::uint64_t > > * fSpadicInfoMsgVector
vector< pair< fulltime, word > >
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
std::vector< CbmTrdRawMessageSpadic > * fTrdRawMessageVector
Output Spadic raw messages for debugging.
CbmMcbm2018UnpackerAlgoTrdR * fUnpackerAlgo
Processing algo.
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Adds an input component to the list of active components for this unpacker.
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
void SetFirstChannelsElinkEven(bool isEven)
CbmMcbm2018UnpackerTaskTrdR()
void SetActiveHistograms(std::vector< bool > isActiveHistoVec)
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
Timeslice unpacker algorithm for Spadic v.2.2 .