CbmRoot
Loading...
Searching...
No Matches
CbmMQTsaSamplerTof.h
Go to the documentation of this file.
1/* Copyright (C) 2018 PI-UHd, GSI
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Norbert Herrmann [committer] */
4
12#ifndef CBMMQTSASAMPLERTOF_H_
13#define CBMMQTSASAMPLERTOF_H_
14
15
16#include "MicrosliceDescriptor.hpp"
17#include "StorableTimeslice.hpp"
18#include "Timeslice.hpp"
19#include "TimesliceSource.hpp"
20//#include "Message.hpp"
21
22#include "FairMQDevice.h"
23
24#include <ctime>
25#include <string>
26#include <vector>
27
28class CbmMQTsaSamplerTof : public FairMQDevice {
29public:
31 virtual ~CbmMQTsaSamplerTof();
32
33protected:
35
36 std::string fFileName;
37 std::string fDirName;
38
39 std::vector<std::string> fInputFileList;
40 uint64_t fFileCounter;
41 std::string fHost;
42 uint64_t fPort;
43
44 uint64_t fTSNumber;
45 uint64_t fTSCounter;
47
48 int fMaxMemory = 0;
49
50 virtual void InitTask();
51 virtual bool ConditionalRun();
52
53private:
54 bool OpenNextFile();
55
56 bool CheckTimeslice(const fles::Timeslice& ts);
57 void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor& mdsc);
58 bool SendData(const fles::StorableTimeslice& component);
59 void CalcRuntime();
60 bool IsChannelNameAllowed(std::string);
61 bool IsChannelUp(std::string);
62 bool CreateAndSendComponent(const fles::Timeslice&, int);
63 bool SendData(const fles::StorableTimeslice&, int);
64 bool CreateAndCombineComponents(const fles::Timeslice&, int);
65 bool AppendData(const fles::StorableTimeslice&, int);
66 bool SendTs();
67 void SendSysCmdStop();
68
69 fles::TimesliceSource* fSource;
70 std::chrono::steady_clock::time_point fTime;
71
72
73 // The vector fAllowedChannels contain the list of defined channel names
74 // which are used for connecting the different devices. For the time
75 // being the correct connection are done checking the names. A connection
76 // using the name stscomponent will receive timeslices containing the
77 // sts component only. The corresponding system ids are defined in the
78 // vector fSysId. At startup it is checked which channels are defined
79 // in the startup script such that later on only timeslices whith the
80 // corresponding data are send to the correct channels.
81 // TODO: Up to now we have three disconnected vectors which is very
82 // error prone. Find a better solution
83
84 std::vector<std::string> fAllowedChannels = {"stscomponent", "trdcomponent", "tofcomponent", "syscmd", "syscmdin"};
85 std::vector<int> fSysId = {16, 64, 96};
86
87 std::vector<int> fComponentsToSend = {0, 0, 0};
88 std::vector<std::vector<std::string>> fChannelsToSend = {{}, {}, {}};
89};
90
91#endif /* CBMMQTSASAMPLERTOF_H_ */
bool IsChannelUp(std::string)
bool AppendData(const fles::StorableTimeslice &, int)
std::vector< int > fComponentsToSend
std::vector< int > fSysId
virtual bool ConditionalRun()
fles::TimesliceSource * fSource
bool CreateAndCombineComponents(const fles::Timeslice &, int)
bool IsChannelNameAllowed(std::string)
std::vector< std::string > fAllowedChannels
bool CreateAndSendComponent(const fles::Timeslice &, int)
bool SendData(const fles::StorableTimeslice &component)
std::vector< std::string > fInputFileList
List of input files.
std::chrono::steady_clock::time_point fTime
void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor &mdsc)
bool CheckTimeslice(const fles::Timeslice &ts)
std::vector< std::vector< std::string > > fChannelsToSend