CbmRoot
CbmUnpack.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ----- -----
3 // ----- CbmUnpack -----
4 // ----- Created 07.02.2020 by P.-A. Loizeau -----
5 // ----- -----
6 // -----------------------------------------------------------------------------
7 
8 #ifndef CBMUNPACK_H
9 #define CBMUNPACK_H
10 
12 #include "CbmErrorMessage.h"
13 #include "Timeslice.hpp"
14 
16 
18 #include "Rtypes.h"
19 
20 #include <boost/any.hpp>
21 
23 #include <map>
24 #include <string>
25 #include <utility>
26 #include <vector>
27 
28 class TList;
29 class TNamed;
30 class TCanvas;
31 
32 template<class T>
33 bool is_this_type(const boost::any& varValue) {
34  if (auto q = boost::any_cast<T>(&varValue))
35  return true;
36  else
37  return false;
38 }
39 
40 
41 template<class T>
42 class CbmUnpack {
43 public:
45  : fParCList(nullptr)
47  , fuNbCoreMsPerTs(0)
48  , fuNbOverMsPerTs(0)
49  , fuNbMsLoop(0)
50  , fbIgnoreOverlapMs(kFALSE)
51  , fdMsSizeInNs(-1.0)
52  , fdTsCoreSizeInNs(-1.0)
53  , fdTsFullSizeInNs(-1.0)
55  , fDigiVect()
56  , fErrVect()
57  , fParameterMap() {};
58  virtual ~CbmUnpack() = default;
59  CbmUnpack(const CbmUnpack&) = delete;
60  CbmUnpack& operator=(const CbmUnpack&) = 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 ProcessMs( const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx ) = 0;
69 
70  virtual Bool_t InitContainers() = 0;
71  virtual Bool_t ReInitContainers() = 0;
72  virtual TList* GetParList() = 0;
73  virtual void SetParameter(std::string /*param*/) { ; }
74  virtual std::string GetParameter(std::string /*param*/) {
75  return std::string {""};
76  }
77 
79  void AddHistoToVector(TNamed* pointer, std::string sFolder = "") {
80  fvpAllHistoPointers.push_back(
81  std::pair<TNamed*, std::string>(pointer, sFolder));
82  }
83  std::vector<std::pair<TNamed*, std::string>> GetHistoVector() {
84  return fvpAllHistoPointers;
85  }
86  void AddCanvasToVector(TCanvas* pointer, std::string sFolder = "") {
87  fvpAllCanvasPointers.push_back(
88  std::pair<TCanvas*, std::string>(pointer, sFolder));
89  }
90  std::vector<std::pair<TCanvas*, std::string>> GetCanvasVector() {
91  return fvpAllCanvasPointers;
92  }
93 
95  void AssignOutputVector(std::vector<T>& rVect) { fDigiVect = rVect; }
96  void AssignErrorVector(std::vector<CbmErrorMessage>& rVect) {
97  fErrVect = rVect;
98  }
99  // void ClearVector() {fDigiVect->clear();}
100  // std::vector<T> * GetVector() {return fDigiVect;}
101 
103  void SetIgnoreOverlapMs(Bool_t bFlagIn = kTRUE) {
104  fbIgnoreOverlapMs = bFlagIn;
105  }
106 
107 protected:
109  TList* fParCList = nullptr;
110 
112  std::vector<size_t>
116  size_t
118  Bool_t
120  Double_t fdMsSizeInNs;
121  Double_t
123  Double_t
125 
137  std::vector<std::pair<TNamed*, std::string>>
139  std::vector<std::pair<TCanvas*, std::string>>
141 
143  std::vector<T>&
145  std::vector<CbmErrorMessage>& fErrVect = {};
146 
148  std::map<std::string, std::string>
150 
151  Bool_t CheckParameterValidity(std::string /*parameterName*/,
152  std::string /*parameterType*/) {
153  return kTRUE;
154  }
155 
156 private:
157 };
158 
159 #endif // CBMUNPACK_H
CbmUnpack::fuNbMsLoop
size_t fuNbMsLoop
Number of Overlap MS at the end of the TS.
Definition: CbmUnpack.h:117
CbmUnpack::fParameterMap
std::map< std::string, std::string > fParameterMap
Vector of error messages.
Definition: CbmUnpack.h:149
CbmUnpack::AssignErrorVector
void AssignErrorVector(std::vector< CbmErrorMessage > &rVect)
Definition: CbmUnpack.h:96
CbmUnpack::fdMsSizeInNs
Double_t fdMsSizeInNs
Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice.
Definition: CbmUnpack.h:120
CbmUnpack::GetParList
virtual TList * GetParList()=0
CbmUnpack::fvpAllHistoPointers
std::vector< std::pair< TNamed *, std::string > > fvpAllHistoPointers
Total size of the core MS in a TS, [nanoseconds].
Definition: CbmUnpack.h:138
is_this_type
bool is_this_type(const boost::any &varValue)
Definition: CbmUnpack.h:33
CbmUnpack::fdTsFullSizeInNs
Double_t fdTsFullSizeInNs
Total size of the core MS in a TS, [nanoseconds].
Definition: CbmUnpack.h:124
CbmUnpack::operator=
CbmUnpack & operator=(const CbmUnpack &)=delete
CbmUnpack::CheckParameterValidity
Bool_t CheckParameterValidity(std::string, std::string)
Map of parameter name and type.
Definition: CbmUnpack.h:151
CbmUnpack::InitContainers
virtual Bool_t InitContainers()=0
CbmUnpack::fvpAllCanvasPointers
std::vector< std::pair< TCanvas *, std::string > > fvpAllCanvasPointers
Vector of pointers to histograms + optional folder name.
Definition: CbmUnpack.h:140
CbmUnpack::GetParameter
virtual std::string GetParameter(std::string)
Definition: CbmUnpack.h:74
CbmUnpack::~CbmUnpack
virtual ~CbmUnpack()=default
CbmUnpack::CbmUnpack
CbmUnpack()
Definition: CbmUnpack.h:44
CbmUnpack::Init
virtual Bool_t Init()=0
CbmUnpack::Finish
virtual void Finish()=0
CbmUnpack::fErrVect
std::vector< CbmErrorMessage > & fErrVect
Vector of digis FIXME: check that the reference works as expected.
Definition: CbmUnpack.h:145
CbmUnpack::ProcessTs
virtual Bool_t ProcessTs(const fles::Timeslice &ts)=0
CbmUnpack::SetIgnoreOverlapMs
void SetIgnoreOverlapMs(Bool_t bFlagIn=kTRUE)
Control flags.
Definition: CbmUnpack.h:103
CbmUnpack::fDigiVect
std::vector< T > & fDigiVect
Vector of pointers to canvases + optional folder name.
Definition: CbmUnpack.h:144
CbmErrorMessage.h
CbmUnpack::Reset
virtual void Reset()=0
CbmUnpack::ReInitContainers
virtual Bool_t ReInitContainers()=0
CbmUnpack::GetCanvasVector
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector()
Definition: CbmUnpack.h:90
CbmUnpack::fuNbOverMsPerTs
size_t fuNbOverMsPerTs
Number of Core MS in the TS.
Definition: CbmUnpack.h:115
CbmUnpack::CbmUnpack
CbmUnpack(const CbmUnpack &)=delete
CbmUnpack::fvMsComponentsList
std::vector< size_t > fvMsComponentsList
Parameters related to FLES containers.
Definition: CbmUnpack.h:113
CbmUnpack::SetParameter
virtual void SetParameter(std::string)
Definition: CbmUnpack.h:73
CbmUnpack::GetHistoVector
std::vector< std::pair< TNamed *, std::string > > GetHistoVector()
Definition: CbmUnpack.h:83
CbmUnpack
Definition: CbmUnpack.h:42
CbmUnpack::AddHistoToVector
void AddHistoToVector(TNamed *pointer, std::string sFolder="")
For monitoring of internal processes.
Definition: CbmUnpack.h:79
CbmUnpack::AssignOutputVector
void AssignOutputVector(std::vector< T > &rVect)
Output vector.
Definition: CbmUnpack.h:95
CbmUnpack::AddCanvasToVector
void AddCanvasToVector(TCanvas *pointer, std::string sFolder="")
Definition: CbmUnpack.h:86
CbmUnpack::fParCList
TList * fParCList
Parameter management.
Definition: CbmUnpack.h:109
CbmUnpack::fbIgnoreOverlapMs
Bool_t fbIgnoreOverlapMs
Number of MS for the loop in each MS, updated internaly by the Algos to read OverMS or not.
Definition: CbmUnpack.h:119
CbmUnpack::fuNbCoreMsPerTs
size_t fuNbCoreMsPerTs
List of components used in the TS, updated internaly by the Algos.
Definition: CbmUnpack.h:114
CbmUnpack::fdTsCoreSizeInNs
Double_t fdTsCoreSizeInNs
Size of a single MS, [nanoseconds].
Definition: CbmUnpack.h:122