CbmRoot
Loading...
Searching...
No Matches
CbmRichUnpackAlgoBase.cxx
Go to the documentation of this file.
1/* Copyright (C) 2021 Goethe-University Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pascal Raisig [committer] */
4
6
7#include <FairParGenericSet.h>
8#include <FairTask.h>
9#include <Logger.h>
10
11#include <Rtypes.h>
12#include <RtypesCore.h>
13
14#include <cstdint>
15
16
17CbmRichUnpackAlgoBase::CbmRichUnpackAlgoBase(std::string name) : CbmRecoUnpackAlgo(name) {}
18
20
21// ---- GetParContainerRequest ----
22std::vector<std::pair<std::string, std::shared_ptr<FairParGenericSet>>>*
23 CbmRichUnpackAlgoBase::GetParContainerRequest(std::string /*geoTag*/, std::uint32_t /*runId*/)
24{
25 // Basepath for default Trd parameter sets (those connected to a geoTag)
26 std::string basepath = Form("%s", fParFilesBasePath.data());
27 std::string temppath = "";
28
29 // // Get parameter container
30 temppath = basepath + "mRichPar_70.par";
31
32 LOG(info) << fName << "::GetParContainerRequest - get parameters from file: \n" << temppath;
33
34 fParContVec.emplace_back(std::make_pair(temppath, std::make_shared<CbmMcbm2018RichPar>()));
35
36 return &fParContVec;
37}
38
39// ---- calculateTime
40double CbmRichUnpackAlgoBase::calculateTime(uint32_t epoch, uint32_t coarse, uint32_t fine)
41{
42 return ((double) epoch) * 2048. * 5. + ((double) coarse) * 5. - ((double) fine) * 0.005;
43}
44
45// ---- getLogHeader
47{
48 std::stringstream stream;
49 stream << "[" << fNrProcessedTs << "-" << reader.GetWordCounter() << "/" << reader.GetSize() / 4 << " "
50 << reader.GetWordAsHexString(reader.GetCurWord()) << "] ";
51 return stream.str();
52}
53
54// ---- init
55Bool_t CbmRichUnpackAlgoBase::init() { return kTRUE; }
56
57// ---- initParSet(FairParGenericSet* parset) ----
58Bool_t CbmRichUnpackAlgoBase::initParSet(FairParGenericSet* parset)
59{
60 LOG(info) << fName << "::initParSet - for container " << parset->ClassName();
61 if (parset->IsA() == CbmMcbm2018RichPar::Class()) return initParSet(static_cast<CbmMcbm2018RichPar*>(parset));
62
63 // If we do not know the derived ParSet class we return false
64 LOG(error) << fName << "::initParSet - for container " << parset->ClassName() << " failed, since" << fName
65 << "::initParSet() does not know the derived ParSet and what to do with it!";
66 return kFALSE;
67}
68
69// ---- initParSet(CbmTrdParSetAsic* parset) ----
71{
72 LOG(debug) << fName << "::initParSetAsic - ";
73 fUnpackPar = *parset;
75
76 LOG(info) << fName << "::initParSetRichMcbm2018 - Successfully initialized RICH unpacking parameters";
77
78 if (fMonitor) fMonitor->Init(parset);
79
80 return kTRUE;
81}
82
83// ---- isLog ----
85{
86 //if (fTsCounter == 25215) return true;
87 return false;
88}
89
90
92{
93 for (unsigned int i = 0; i < fMaskedDiRICHes->size(); ++i) {
94 if (fMaskedDiRICHes->at(i) == subSubEventId) return true;
95 }
96
97 return false;
98}
99
ClassImp(CbmConverterManager)
void Print(Option_t *option="") const
CbmRichUnpackAlgoBase(std::string name)
Create the Cbm Trd Unpack AlgoBase object.
bool checkMaskedDiRICH(Int_t subSubEventId)
Unpack a given microslice. To be implemented in the derived unpacker algos.
CbmMcbm2018RichPar fUnpackPar
Parameters for the unpacking.
double calculateTime(uint32_t epoch, uint32_t coarse, uint32_t fine)
std::shared_ptr< CbmRichUnpackMonitor > fMonitor
Potential (online) monitor for the unpacking process.
virtual std::vector< std::pair< std::string, std::shared_ptr< FairParGenericSet > > > * GetParContainerRequest(std::string geoTag, std::uint32_t runId)
Get the requested parameter containers. To be defined in the derived classes! Return the required par...
std::string getLogHeader(CbmRichUnpackAlgoMicrosliceReader &reader)
Bool_t initParSet(FairParGenericSet *parset)
Handles the distribution of the hidden derived classes to their explicit functions.
Bool_t init()
Intialisation at begin of run. Special inits of the derived algos.
std::vector< Int_t > * fMaskedDiRICHes
virtual ~CbmRichUnpackAlgoBase()
Destroy the Cbm Trd Unpack Task object.
std::string GetWordAsHexString(uint32_t word)