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