CbmRoot
CbmMQTsaMultiSampler.h
Go to the documentation of this file.
1 
8 #ifndef CBMMQTSAMULTISAMPLER_H_
9 #define CBMMQTSAMULTISAMPLER_H_
10 
11 
12 #include "MicrosliceDescriptor.hpp"
13 #include "StorableTimeslice.hpp"
14 #include "Timeslice.hpp"
15 #include "TimesliceSource.hpp"
16 
17 #include "FairMQDevice.h"
18 
19 #include <ctime>
20 #include <string>
21 #include <vector>
22 
23 class CbmMQTsaMultiSampler : public FairMQDevice {
24 public:
26  virtual ~CbmMQTsaMultiSampler();
27 
28 protected:
29  uint64_t fMaxTimeslices;
30 
31  std::string fFileName;
32  std::string fDirName;
33 
34  std::vector<std::string> fInputFileList;
35  uint64_t fFileCounter;
36  std::string fHost;
37  uint64_t fPort;
38  uint64_t fHighWaterMark;
39 
40  bool fbNoSplitTs = false;
41  bool fbSendTsPerSysId = false;
42  bool fbSendTsPerChannel = false;
43  /*
44  std::string fsChannelNameHistosInput = "histogram-in";
45  std::string fsChannelNameHistosConfig = "histo-conf";
46  std::string fsChannelNameCanvasConfig = "canvas-conf";
47  uint32_t fuPublishFreqTs = 100;
48  double_t fdMinPublishTime = 0.5;
49  double_t fdMaxPublishTime = 5;
50 */
51  uint64_t fuPrevTsIndex = 0;
52  uint64_t fTSCounter;
53  uint64_t fMessageCounter;
54 
55  int fMaxMemory = 0;
56 
57  virtual void InitTask();
58  virtual bool ConditionalRun();
59 
60 private:
61  bool OpenNextFile();
62 
63  bool CheckTimeslice(const fles::Timeslice& ts);
64  void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor& mdsc);
65  bool SendData(const fles::StorableTimeslice& component);
66  void CalcRuntime();
67  bool IsChannelNameAllowed(std::string);
68  bool CreateAndSendComponent(const fles::Timeslice&, int);
69  bool CreateAndCombineComponentsPerSysId(const fles::Timeslice&);
70  bool CreateAndCombineComponentsPerChannel(const fles::Timeslice&);
71  bool CreateAndSendFullTs(const fles::Timeslice&);
72  bool SendData(const fles::StorableTimeslice&, int);
73  bool SendData(const fles::StorableTimeslice&, std::string);
74  bool SendMissedTsIdx(std::vector<uint64_t> vIndices);
75  bool SendCommand(std::string sCommand);
76  /*
77  bool SendHistograms();
78 */
79 
80  fles::TimesliceSource* fSource;
81  std::chrono::steady_clock::time_point fTime;
82 
83 
84  // The vector fAllowedChannels contain the list of defined channel names
85  // which are used for connecting the different devices. For the time
86  // being the correct connection are done checking the names. A connection
87  // using the name stscomponent will receive timeslices containing the
88  // sts component only. The corresponding system ids are defined in the
89  // vector fSysId. At startup it is checked which channels are defined
90  // in the startup script such that later on only timeslices whith the
91  // corresponding data are send to the correct channels.
92  // TODO: Up to now we have three disconnected vectors which is very
93  // error prone. Find a better solution
94 
95  std::vector<std::string> fAllowedChannels = {"stscomponent",
96  "richcomponent",
97  "trdcomponent",
98  "muchcomponent",
99  "tofcomponent",
100  "t0component"};
101  // std::vector<int> fSysId = {16, 48, 64, 96, 144, 80};
102  std::vector<int> fSysId = {0x10, 0x30, 0x40, 0x50, 0x60, 0x90};
103 
104 
105  std::vector<int> fComponentsToSend = {0, 0, 0, 0, 0, 0};
106  std::vector<std::vector<std::string>> fChannelsToSend =
107  {{}, {}, {}, {}, {}, {}};
108 
110  std::vector<std::vector<uint32_t>> fvvCompPerSysId = {{}, {}, {}, {}, {}, {}};
111 
113  std::vector<std::string> fvChannelsToSend = {};
114  std::vector<std::vector<uint32_t>> fvvCompPerChannel = {};
115 
116  std::string fsChannelNameMissedTs = "";
117  std::string fsChannelNameCommands = "";
118  /*
120  std::vector< std::pair< TNamed *, std::string > > vHistos = fMonitorAlgo->GetHistoVector();
122  std::vector< std::pair< TCanvas *, std::string > > vCanvases = fMonitorAlgo->GetCanvasVector();
123 
125  TObjArray fArrayHisto = {};
127  std::vector< std::pair< std::string, std::string > > fvpsHistosFolder = {};
131  std::vector< std::pair< std::string, std::string > > fvpsCanvasConfig = {};
132 */
133 };
134 
135 #endif /* CBMMQTSASAMPLER_H_ */
CbmMQTsaMultiSampler::fMaxTimeslices
uint64_t fMaxTimeslices
Definition: CbmMQTsaMultiSampler.h:29
CbmMQTsaMultiSampler::CheckTimeslice
bool CheckTimeslice(const fles::Timeslice &ts)
Definition: CbmMQTsaMultiSampler.cxx:945
CbmMQTsaMultiSampler::fAllowedChannels
std::vector< std::string > fAllowedChannels
Definition: CbmMQTsaMultiSampler.h:95
CbmMQTsaMultiSampler::fbNoSplitTs
bool fbNoSplitTs
Definition: CbmMQTsaMultiSampler.h:40
CbmMQTsaMultiSampler::~CbmMQTsaMultiSampler
virtual ~CbmMQTsaMultiSampler()
Definition: CbmMQTsaMultiSampler.cxx:916
CbmMQTsaMultiSampler::CreateAndCombineComponentsPerSysId
bool CreateAndCombineComponentsPerSysId(const fles::Timeslice &)
Definition: CbmMQTsaMultiSampler.cxx:561
CbmMQTsaMultiSampler::fChannelsToSend
std::vector< std::vector< std::string > > fChannelsToSend
Definition: CbmMQTsaMultiSampler.h:106
CbmMQTsaMultiSampler::CreateAndSendFullTs
bool CreateAndSendFullTs(const fles::Timeslice &)
Definition: CbmMQTsaMultiSampler.cxx:749
CbmMQTsaMultiSampler::fSource
fles::TimesliceSource * fSource
Definition: CbmMQTsaMultiSampler.h:80
CbmMQTsaMultiSampler::fComponentsToSend
std::vector< int > fComponentsToSend
Definition: CbmMQTsaMultiSampler.h:105
CbmMQTsaMultiSampler::fFileCounter
uint64_t fFileCounter
Definition: CbmMQTsaMultiSampler.h:35
CbmMQTsaMultiSampler::SendData
bool SendData(const fles::StorableTimeslice &component)
CbmMQTsaMultiSampler::fTSCounter
uint64_t fTSCounter
Definition: CbmMQTsaMultiSampler.h:52
CbmMQTsaMultiSampler::fMaxMemory
int fMaxMemory
Definition: CbmMQTsaMultiSampler.h:55
CbmMQTsaMultiSampler::SendCommand
bool SendCommand(std::string sCommand)
Definition: CbmMQTsaMultiSampler.cxx:861
CbmMQTsaMultiSampler::PrintMicroSliceDescriptor
void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor &mdsc)
Definition: CbmMQTsaMultiSampler.cxx:927
CbmMQTsaMultiSampler::IsChannelNameAllowed
bool IsChannelNameAllowed(std::string)
Definition: CbmMQTsaMultiSampler.cxx:332
CbmMQTsaMultiSampler::SendMissedTsIdx
bool SendMissedTsIdx(std::vector< uint64_t > vIndices)
Definition: CbmMQTsaMultiSampler.cxx:833
CbmMQTsaMultiSampler::fHost
std::string fHost
Definition: CbmMQTsaMultiSampler.h:36
CbmMQTsaMultiSampler::fbSendTsPerChannel
bool fbSendTsPerChannel
Definition: CbmMQTsaMultiSampler.h:42
CbmMQTsaMultiSampler
Definition: CbmMQTsaMultiSampler.h:23
CbmMQTsaMultiSampler::fbSendTsPerSysId
bool fbSendTsPerSysId
Definition: CbmMQTsaMultiSampler.h:41
CbmMQTsaMultiSampler::fbListCompPerSysIdReady
bool fbListCompPerSysIdReady
Definition: CbmMQTsaMultiSampler.h:109
CbmMQTsaMultiSampler::CreateAndCombineComponentsPerChannel
bool CreateAndCombineComponentsPerChannel(const fles::Timeslice &)
Definition: CbmMQTsaMultiSampler.cxx:635
CbmMQTsaMultiSampler::fvvCompPerChannel
std::vector< std::vector< uint32_t > > fvvCompPerChannel
Definition: CbmMQTsaMultiSampler.h:114
CbmMQTsaMultiSampler::fDirName
std::string fDirName
Definition: CbmMQTsaMultiSampler.h:32
CbmMQTsaMultiSampler::fvvCompPerSysId
std::vector< std::vector< uint32_t > > fvvCompPerSysId
Definition: CbmMQTsaMultiSampler.h:110
CbmMQTsaMultiSampler::fPort
uint64_t fPort
Definition: CbmMQTsaMultiSampler.h:37
CbmMQTsaMultiSampler::CreateAndSendComponent
bool CreateAndSendComponent(const fles::Timeslice &, int)
Definition: CbmMQTsaMultiSampler.cxx:524
CbmMQTsaMultiSampler::InitTask
virtual void InitTask()
Definition: CbmMQTsaMultiSampler.cxx:63
CbmMQTsaMultiSampler::fvChannelsToSend
std::vector< std::string > fvChannelsToSend
Definition: CbmMQTsaMultiSampler.h:113
CbmMQTsaMultiSampler::fsChannelNameCommands
std::string fsChannelNameCommands
Definition: CbmMQTsaMultiSampler.h:117
CbmMQTsaMultiSampler::fTime
std::chrono::steady_clock::time_point fTime
Definition: CbmMQTsaMultiSampler.h:81
CbmMQTsaMultiSampler::fuPrevTsIndex
uint64_t fuPrevTsIndex
Definition: CbmMQTsaMultiSampler.h:51
CbmMQTsaMultiSampler::CbmMQTsaMultiSampler
CbmMQTsaMultiSampler()
Definition: CbmMQTsaMultiSampler.cxx:48
CbmMQTsaMultiSampler::ConditionalRun
virtual bool ConditionalRun()
Definition: CbmMQTsaMultiSampler.cxx:375
CbmMQTsaMultiSampler::fbListCompPerChannelReady
bool fbListCompPerChannelReady
Definition: CbmMQTsaMultiSampler.h:112
CbmMQTsaMultiSampler::fsChannelNameMissedTs
std::string fsChannelNameMissedTs
Definition: CbmMQTsaMultiSampler.h:116
CbmMQTsaMultiSampler::fFileName
std::string fFileName
Definition: CbmMQTsaMultiSampler.h:31
CbmMQTsaMultiSampler::fHighWaterMark
uint64_t fHighWaterMark
Definition: CbmMQTsaMultiSampler.h:38
CbmMQTsaMultiSampler::fInputFileList
std::vector< std::string > fInputFileList
List of input files.
Definition: CbmMQTsaMultiSampler.h:34
CbmMQTsaMultiSampler::OpenNextFile
bool OpenNextFile()
CbmMQTsaMultiSampler::fSysId
std::vector< int > fSysId
Definition: CbmMQTsaMultiSampler.h:102
CbmMQTsaMultiSampler::CalcRuntime
void CalcRuntime()
Definition: CbmMQTsaMultiSampler.cxx:918
CbmMQTsaMultiSampler::fMessageCounter
uint64_t fMessageCounter
Definition: CbmMQTsaMultiSampler.h:53