CbmRoot
Loading...
Searching...
No Matches
CbmStar2019Algo.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Florian Uhlig [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmStar2019Algo -----
8// ----- Created 08.11.2018 by P.-A. Loizeau -----
9// ----- Based on CbmStar2019Algo by F.Uhlig -----
10// ----- -----
11// -----------------------------------------------------------------------------
12
13#ifndef CbmStar2019Algo_H
14#define CbmStar2019Algo_H
15
16
18#include "CbmErrorMessage.h"
19
20#include "Timeslice.hpp"
21
23
25#include "Rtypes.h"
26
27#include <boost/any.hpp>
28
30#include <map>
31#include <string>
32#include <utility>
33#include <vector>
34
35class TList;
36class TNamed;
37class TCanvas;
38
39template<typename T>
40bool is_this_type(const boost::any& varValue)
41{
42 if (auto q = boost::any_cast<T>(&varValue)) return true;
43 else
44 return false;
45}
46
47
48template<typename T>
50public:
52 : fParCList(nullptr)
56 , fuNbMsLoop(0)
57 , fbIgnoreOverlapMs(kFALSE)
58 , fdMsSizeInNs(-1.0)
59 , fdTsCoreSizeInNs(-1.0)
60 , fdTsFullSizeInNs(-1.0)
62 , fDigiVect()
63 , fParameterMap() {};
64 virtual ~CbmStar2019Algo() = default;
67
68 virtual Bool_t Init() = 0;
69 virtual void Reset() = 0;
70 virtual void Finish() = 0;
71
72 virtual Bool_t ProcessTs(const fles::Timeslice& ts) = 0;
73 virtual Bool_t ProcessTs(const fles::Timeslice& ts, size_t component) = 0;
74 virtual Bool_t ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx) = 0;
75
76 virtual Bool_t InitContainers() = 0;
77 virtual Bool_t ReInitContainers() = 0;
78 virtual TList* GetParList() = 0;
79 virtual void SetParameter(std::string /*param*/) { ; }
80 virtual std::string GetParameter(std::string /*param*/) { return std::string {""}; }
81
83 void AddHistoToVector(TNamed* pointer, std::string sFolder = "")
84 {
85 fvpAllHistoPointers.push_back(std::pair<TNamed*, std::string>(pointer, sFolder));
86 }
87 std::vector<std::pair<TNamed*, std::string>> GetHistoVector() { return fvpAllHistoPointers; }
88 void AddCanvasToVector(TCanvas* pointer, std::string sFolder = "")
89 {
90 fvpAllCanvasPointers.push_back(std::pair<TCanvas*, std::string>(pointer, sFolder));
91 }
92 std::vector<std::pair<TCanvas*, std::string>> GetCanvasVector() { return fvpAllCanvasPointers; }
93
95 void ClearVector() { fDigiVect.clear(); }
96 std::vector<T>& GetVector() { return fDigiVect; }
97 void ClearErrorVector() { fErrVect.clear(); }
98 std::vector<CbmErrorMessage>& GetErrorVector() { return fErrVect; }
99
101 void SetIgnoreOverlapMs(Bool_t bFlagIn = kTRUE) { fbIgnoreOverlapMs = bFlagIn; }
102
103protected:
105 TList* fParCList;
106
108 std::vector<size_t> fvMsComponentsList;
111 size_t fuNbMsLoop;
113 Double_t fdMsSizeInNs;
116
128 std::vector<std::pair<TNamed*, std::string>>
130 std::vector<std::pair<TCanvas*, std::string>>
132
134 std::vector<T> fDigiVect;
135 std::vector<CbmErrorMessage> fErrVect = {};
136
138 std::map<std::string, std::string> fParameterMap;
139
140 Bool_t CheckParameterValidity(std::string /*parameterName*/, std::string /*parameterType*/) { return kTRUE; }
141
142private:
143};
144
145#endif
bool is_this_type(const boost::any &varValue)
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
virtual Bool_t ProcessTs(const fles::Timeslice &ts, size_t component)=0
virtual std::string GetParameter(std::string)
virtual Bool_t ProcessTs(const fles::Timeslice &ts)=0
CbmStar2019Algo(const CbmStar2019Algo &)=delete
virtual void Reset()=0
std::vector< CbmErrorMessage > fErrVect
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
For monitor algos.
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
CbmStar2019Algo & operator=(const CbmStar2019Algo &)=delete
std::vector< T > & GetVector()
virtual TList * GetParList()=0
virtual Bool_t Init()=0
TList * fParCList
Parameter management.
virtual void SetParameter(std::string)
virtual Bool_t InitContainers()=0
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
virtual ~CbmStar2019Algo()=default
std::map< std::string, std::string > fParameterMap
For any algo.
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
std::vector< std::pair< TNamed *, std::string > > fvpAllHistoPointers
Total size of the core MS in a TS, [nanoseconds].
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()
Bool_t CheckParameterValidity(std::string, std::string)
Map of parameter name and type.
std::vector< CbmErrorMessage > & GetErrorVector()
void ClearVector()
For unpacker algos.
Double_t fdMsSizeInNs
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
std::vector< std::pair< TCanvas *, std::string > > fvpAllCanvasPointers
Vector of pointers to histograms + optional folder name.
virtual void Finish()=0
virtual Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)=0
virtual Bool_t ReInitContainers()=0
std::vector< T > fDigiVect
Vector of pointers to canvases + optional folder name.
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].