CbmRoot
CbmStar2019Algo.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ----- -----
3 // ----- CbmStar2019Algo -----
4 // ----- Created 08.11.2018 by P.-A. Loizeau -----
5 // ----- Based on CbmStar2019Algo by F.Uhlig -----
6 // ----- -----
7 // -----------------------------------------------------------------------------
8 
9 #ifndef CbmStar2019Algo_H
10 #define CbmStar2019Algo_H
11 
12 
14 #include "CbmErrorMessage.h"
15 #include "Timeslice.hpp"
16 
18 
20 #include "Rtypes.h"
21 #include <boost/any.hpp>
22 
24 #include <map>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 class TList;
30 class TNamed;
31 class TCanvas;
32 
33 template<typename T>
34 bool is_this_type(const boost::any& varValue) {
35  if (auto q = boost::any_cast<T>(&varValue))
36  return true;
37  else
38  return false;
39 }
40 
41 
42 template<typename T>
44 public:
46  : fParCList(nullptr)
48  , fuNbCoreMsPerTs(0)
49  , fuNbOverMsPerTs(0)
50  , fuNbMsLoop(0)
51  , fbIgnoreOverlapMs(kFALSE)
52  , fdMsSizeInNs(-1.0)
53  , fdTsCoreSizeInNs(-1.0)
54  , fdTsFullSizeInNs(-1.0)
56  , fDigiVect()
57  , fParameterMap() {};
58  virtual ~CbmStar2019Algo() = default;
59  CbmStar2019Algo(const CbmStar2019Algo&) = delete;
61 
62  virtual Bool_t Init() = 0;
63  virtual void Reset() = 0;
64  virtual void Finish() = 0;
65 
66  virtual Bool_t ProcessTs(const fles::Timeslice& ts) = 0;
67  virtual Bool_t ProcessTs(const fles::Timeslice& ts, size_t component) = 0;
68  virtual Bool_t
69  ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx) = 0;
70 
71  virtual Bool_t InitContainers() = 0;
72  virtual Bool_t ReInitContainers() = 0;
73  virtual TList* GetParList() = 0;
74  virtual void SetParameter(std::string /*param*/) { ; }
75  virtual std::string GetParameter(std::string /*param*/) {
76  return std::string {""};
77  }
78 
80  void AddHistoToVector(TNamed* pointer, std::string sFolder = "") {
81  fvpAllHistoPointers.push_back(
82  std::pair<TNamed*, std::string>(pointer, sFolder));
83  }
84  std::vector<std::pair<TNamed*, std::string>> GetHistoVector() {
85  return fvpAllHistoPointers;
86  }
87  void AddCanvasToVector(TCanvas* pointer, std::string sFolder = "") {
88  fvpAllCanvasPointers.push_back(
89  std::pair<TCanvas*, std::string>(pointer, sFolder));
90  }
91  std::vector<std::pair<TCanvas*, std::string>> GetCanvasVector() {
92  return fvpAllCanvasPointers;
93  }
94 
96  void ClearVector() { fDigiVect.clear(); }
97  std::vector<T>& GetVector() { return fDigiVect; }
98  void ClearErrorVector() { fErrVect.clear(); }
99  std::vector<CbmErrorMessage>& GetErrorVector() { return fErrVect; }
100 
102  void SetIgnoreOverlapMs(Bool_t bFlagIn = kTRUE) {
103  fbIgnoreOverlapMs = bFlagIn;
104  }
105 
106 protected:
108  TList* fParCList;
109 
111  std::vector<size_t> fvMsComponentsList;
114  size_t fuNbMsLoop;
115  Bool_t
117  Double_t fdMsSizeInNs;
118  Double_t
120  Double_t
122 
134  std::vector<std::pair<TNamed*, std::string>>
136  std::vector<std::pair<TCanvas*, std::string>>
138 
140  std::vector<T> fDigiVect;
141  std::vector<CbmErrorMessage> fErrVect = {};
142 
144  std::map<std::string, std::string>
146 
147  Bool_t CheckParameterValidity(std::string /*parameterName*/,
148  std::string /*parameterType*/) {
149  return kTRUE;
150  }
151 
152 private:
153 };
154 
155 #endif
CbmStar2019Algo::CbmStar2019Algo
CbmStar2019Algo()
Definition: CbmStar2019Algo.h:45
CbmStar2019Algo::fvpAllHistoPointers
std::vector< std::pair< TNamed *, std::string > > fvpAllHistoPointers
Total size of the core MS in a TS, [nanoseconds].
Definition: CbmStar2019Algo.h:135
CbmStar2019Algo::fdMsSizeInNs
Double_t fdMsSizeInNs
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
Definition: CbmStar2019Algo.h:117
CbmStar2019Algo::GetParameter
virtual std::string GetParameter(std::string)
Definition: CbmStar2019Algo.h:75
CbmStar2019Algo::GetCanvasVector
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()
Definition: CbmStar2019Algo.h:91
CbmStar2019Algo::CheckParameterValidity
Bool_t CheckParameterValidity(std::string, std::string)
Map of parameter name and type.
Definition: CbmStar2019Algo.h:147
CbmStar2019Algo::GetHistoVector
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
Definition: CbmStar2019Algo.h:84
CbmStar2019Algo::fuNbMsLoop
size_t fuNbMsLoop
Definition: CbmStar2019Algo.h:114
CbmStar2019Algo::~CbmStar2019Algo
virtual ~CbmStar2019Algo()=default
CbmStar2019Algo::fErrVect
std::vector< CbmErrorMessage > fErrVect
Definition: CbmStar2019Algo.h:141
CbmStar2019Algo::SetParameter
virtual void SetParameter(std::string)
Definition: CbmStar2019Algo.h:74
CbmStar2019Algo::GetErrorVector
std::vector< CbmErrorMessage > & GetErrorVector()
Definition: CbmStar2019Algo.h:99
CbmStar2019Algo::GetVector
std::vector< T > & GetVector()
Definition: CbmStar2019Algo.h:97
CbmStar2019Algo::Reset
virtual void Reset()=0
CbmStar2019Algo::fvpAllCanvasPointers
std::vector< std::pair< TCanvas *, std::string > > fvpAllCanvasPointers
Vector of pointers to histograms + optional folder name.
Definition: CbmStar2019Algo.h:137
CbmStar2019Algo::fuNbOverMsPerTs
size_t fuNbOverMsPerTs
Definition: CbmStar2019Algo.h:113
CbmStar2019Algo::ProcessTs
virtual Bool_t ProcessTs(const fles::Timeslice &ts, size_t component)=0
CbmStar2019Algo::AddHistoToVector
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
For monitor algos.
Definition: CbmStar2019Algo.h:80
CbmStar2019Algo::fuNbCoreMsPerTs
size_t fuNbCoreMsPerTs
Definition: CbmStar2019Algo.h:112
CbmStar2019Algo::Init
virtual Bool_t Init()=0
CbmStar2019Algo::ClearErrorVector
void ClearErrorVector()
Definition: CbmStar2019Algo.h:98
CbmStar2019Algo::fParameterMap
std::map< std::string, std::string > fParameterMap
For any algo.
Definition: CbmStar2019Algo.h:145
CbmStar2019Algo::fdTsFullSizeInNs
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
Definition: CbmStar2019Algo.h:121
CbmStar2019Algo::fParCList
TList * fParCList
Parameter management.
Definition: CbmStar2019Algo.h:108
CbmStar2019Algo::ReInitContainers
virtual Bool_t ReInitContainers()=0
CbmStar2019Algo::fvMsComponentsList
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
Definition: CbmStar2019Algo.h:111
CbmStar2019Algo::InitContainers
virtual Bool_t InitContainers()=0
CbmStar2019Algo::ProcessTs
virtual Bool_t ProcessTs(const fles::Timeslice &ts)=0
is_this_type
bool is_this_type(const boost::any &varValue)
Definition: CbmStar2019Algo.h:34
CbmStar2019Algo::operator=
CbmStar2019Algo & operator=(const CbmStar2019Algo &)=delete
CbmErrorMessage.h
CbmStar2019Algo
Definition: CbmStar2019Algo.h:43
CbmStar2019Algo::CbmStar2019Algo
CbmStar2019Algo(const CbmStar2019Algo &)=delete
CbmStar2019Algo::fdTsCoreSizeInNs
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
Definition: CbmStar2019Algo.h:119
CbmStar2019Algo::fDigiVect
std::vector< T > fDigiVect
Vector of pointers to canvases + optional folder name.
Definition: CbmStar2019Algo.h:140
CbmStar2019Algo::ProcessMs
virtual Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)=0
CbmStar2019Algo::Finish
virtual void Finish()=0
CbmStar2019Algo::AddCanvasToVector
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
Definition: CbmStar2019Algo.h:87
CbmStar2019Algo::ClearVector
void ClearVector()
For unpacker algos.
Definition: CbmStar2019Algo.h:96
CbmStar2019Algo::fbIgnoreOverlapMs
Bool_t fbIgnoreOverlapMs
Definition: CbmStar2019Algo.h:116
CbmStar2019Algo::GetParList
virtual TList * GetParList()=0
CbmStar2019Algo::SetIgnoreOverlapMs
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
Definition: CbmStar2019Algo.h:102