CbmRoot
CbmMQTsaMultiSamplerTof.h
Go to the documentation of this file.
1 
8 #ifndef CBMMQTSAMULTISAMPLERTOF_H_
9 #define CBMMQTSAMULTISAMPLERTOF_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 CbmMQTsaMultiSamplerTof : public FairMQDevice {
24 public:
26  virtual ~CbmMQTsaMultiSamplerTof();
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  uint64_t fTSNumber;
41  uint64_t fTSCounter;
42  uint64_t fMessageCounter;
43 
44  int fMaxMemory = 0;
45 
46  virtual void InitTask();
47  virtual bool ConditionalRun();
48 
49 private:
50  bool OpenNextFile();
51 
52  bool CheckTimeslice(const fles::Timeslice& ts);
53  void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor& mdsc);
54  bool SendData(const fles::StorableTimeslice& component);
55  void CalcRuntime();
56  bool IsChannelNameAllowed(std::string);
57  bool IsChannelUp(std::string);
58  bool CreateAndSendComponent(const fles::Timeslice&, int);
59  bool SendData(const fles::StorableTimeslice&, int);
60  bool CreateAndCombineComponents(const fles::Timeslice&, int);
61  bool AppendData(const fles::StorableTimeslice&, int);
62  bool SendTs();
63  void SendSysCmdStop();
64 
65  fles::TimesliceSource* fSource;
66  std::chrono::steady_clock::time_point fTime;
67 
68 
69  // The vector fAllowedChannels contain the list of defined channel names
70  // which are used for connecting the different devices. For the time
71  // being the correct connection are done checking the names. A connection
72  // using the name stscomponent will receive timeslices containing the
73  // sts component only. The corresponding system ids are defined in the
74  // vector fSysId. At startup it is checked which channels are defined
75  // in the startup script such that later on only timeslices whith the
76  // corresponding data are send to the correct channels.
77  // TODO: Up to now we have three disconnected vectors which is very
78  // error prone. Find a better solution
79 
80  std::vector<std::string> fAllowedChannels = {"stscomponent",
81  "trdcomponent",
82  "tofcomponent",
83  "syscmd",
84  "syscmdin"};
85  std::vector<int> fSysId = {16, 64, 96};
86 
87 
88  std::vector<int> fComponentsToSend = {0, 0, 0};
89  std::vector<std::vector<std::string>> fChannelsToSend = {{}, {}, {}};
90 };
91 
92 #endif /* CBMMQTSAMULTISAMPLERTOF_H_ */
CbmMQTsaMultiSamplerTof::CheckTimeslice
bool CheckTimeslice(const fles::Timeslice &ts)
Definition: CbmMQTsaMultiSamplerTof.cxx:534
CbmMQTsaMultiSamplerTof::AppendData
bool AppendData(const fles::StorableTimeslice &, int)
Definition: CbmMQTsaMultiSamplerTof.cxx:396
CbmMQTsaMultiSamplerTof::SendSysCmdStop
void SendSysCmdStop()
Definition: CbmMQTsaMultiSamplerTof.cxx:568
CbmMQTsaMultiSamplerTof::fHighWaterMark
uint64_t fHighWaterMark
Definition: CbmMQTsaMultiSamplerTof.h:38
CbmMQTsaMultiSamplerTof::PrintMicroSliceDescriptor
void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor &mdsc)
Definition: CbmMQTsaMultiSamplerTof.cxx:516
CbmMQTsaMultiSamplerTof::fTSCounter
uint64_t fTSCounter
Definition: CbmMQTsaMultiSamplerTof.h:41
CbmMQTsaMultiSamplerTof::fMaxTimeslices
uint64_t fMaxTimeslices
Definition: CbmMQTsaMultiSamplerTof.h:29
CbmMQTsaMultiSamplerTof::InitTask
virtual void InitTask()
Definition: CbmMQTsaMultiSamplerTof.cxx:61
CbmMQTsaMultiSamplerTof::CbmMQTsaMultiSamplerTof
CbmMQTsaMultiSamplerTof()
Definition: CbmMQTsaMultiSamplerTof.cxx:45
CbmMQTsaMultiSamplerTof::OpenNextFile
bool OpenNextFile()
CbmMQTsaMultiSamplerTof::fFileName
std::string fFileName
Definition: CbmMQTsaMultiSamplerTof.h:31
CbmMQTsaMultiSamplerTof
Definition: CbmMQTsaMultiSamplerTof.h:23
CbmMQTsaMultiSamplerTof::fSource
fles::TimesliceSource * fSource
Definition: CbmMQTsaMultiSamplerTof.h:65
CbmMQTsaMultiSamplerTof::fPort
uint64_t fPort
Definition: CbmMQTsaMultiSamplerTof.h:37
CbmMQTsaMultiSamplerTof::IsChannelNameAllowed
bool IsChannelNameAllowed(std::string)
Definition: CbmMQTsaMultiSamplerTof.cxx:172
CbmMQTsaMultiSamplerTof::fDirName
std::string fDirName
Definition: CbmMQTsaMultiSamplerTof.h:32
CbmMQTsaMultiSamplerTof::fMessageCounter
uint64_t fMessageCounter
Definition: CbmMQTsaMultiSamplerTof.h:42
CbmMQTsaMultiSamplerTof::CreateAndSendComponent
bool CreateAndSendComponent(const fles::Timeslice &, int)
Definition: CbmMQTsaMultiSamplerTof.cxx:434
CbmMQTsaMultiSamplerTof::fHost
std::string fHost
Definition: CbmMQTsaMultiSamplerTof.h:36
CbmMQTsaMultiSamplerTof::fComponentsToSend
std::vector< int > fComponentsToSend
Definition: CbmMQTsaMultiSamplerTof.h:88
CbmMQTsaMultiSamplerTof::SendData
bool SendData(const fles::StorableTimeslice &component)
CbmMQTsaMultiSamplerTof::fTSNumber
uint64_t fTSNumber
Definition: CbmMQTsaMultiSamplerTof.h:40
CbmMQTsaMultiSamplerTof::fInputFileList
std::vector< std::string > fInputFileList
List of input files.
Definition: CbmMQTsaMultiSamplerTof.h:34
CbmMQTsaMultiSamplerTof::fChannelsToSend
std::vector< std::vector< std::string > > fChannelsToSend
Definition: CbmMQTsaMultiSamplerTof.h:89
CbmMQTsaMultiSamplerTof::fAllowedChannels
std::vector< std::string > fAllowedChannels
Definition: CbmMQTsaMultiSamplerTof.h:80
CbmMQTsaMultiSamplerTof::~CbmMQTsaMultiSamplerTof
virtual ~CbmMQTsaMultiSamplerTof()
Definition: CbmMQTsaMultiSamplerTof.cxx:505
CbmMQTsaMultiSamplerTof::fSysId
std::vector< int > fSysId
Definition: CbmMQTsaMultiSamplerTof.h:85
CbmMQTsaMultiSamplerTof::SendTs
bool SendTs()
Definition: CbmMQTsaMultiSamplerTof.cxx:416
CbmMQTsaMultiSamplerTof::CalcRuntime
void CalcRuntime()
Definition: CbmMQTsaMultiSamplerTof.cxx:507
CbmMQTsaMultiSamplerTof::fTime
std::chrono::steady_clock::time_point fTime
Definition: CbmMQTsaMultiSamplerTof.h:66
CbmMQTsaMultiSamplerTof::IsChannelUp
bool IsChannelUp(std::string)
Definition: CbmMQTsaMultiSamplerTof.cxx:198
CbmMQTsaMultiSamplerTof::ConditionalRun
virtual bool ConditionalRun()
Definition: CbmMQTsaMultiSamplerTof.cxx:214
CbmMQTsaMultiSamplerTof::CreateAndCombineComponents
bool CreateAndCombineComponents(const fles::Timeslice &, int)
Definition: CbmMQTsaMultiSamplerTof.cxx:362
CbmMQTsaMultiSamplerTof::fMaxMemory
int fMaxMemory
Definition: CbmMQTsaMultiSamplerTof.h:44
CbmMQTsaMultiSamplerTof::fFileCounter
uint64_t fFileCounter
Definition: CbmMQTsaMultiSamplerTof.h:35