CbmRoot
Loading...
Searching...
No Matches
CbmMQTsaSampler.h
Go to the documentation of this file.
1/* Copyright (C) 2017-2018 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
12#ifndef CBMMQTSASAMPLER_H_
13#define CBMMQTSASAMPLER_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 CbmMQTsaSampler : public FairMQDevice {
29public:
31 virtual ~CbmMQTsaSampler();
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 CreateAndSendComponent(const fles::Timeslice&, int);
62 bool SendData(const fles::StorableTimeslice&, int);
63
64 fles::TimesliceSource* fSource;
65 std::chrono::steady_clock::time_point fTime;
66
67
68 // The vector fAllowedChannels contain the list of defined channel names
69 // which are used for connecting the different devices. For the time
70 // being the correct connection are done checking the names. A connection
71 // using the name stscomponent will receive timeslices containing the
72 // sts component only. The corresponding system ids are defined in the
73 // vector fSysId. At startup it is checked which channels are defined
74 // in the startup script such that later on only timeslices whith the
75 // corresponding data are send to the correct channels.
76 // TODO: Up to now we have three disconnected vectors which is very
77 // error prone. Find a better solution
78
79 std::vector<std::string> fAllowedChannels = {"stscomponent", "trdcomponent", "tofcomponent"};
80 std::vector<int> fSysId = {16, 64, 96};
81
82
83 std::vector<int> fComponentsToSend = {0, 0, 0};
84 std::vector<std::vector<std::string>> fChannelsToSend = {{}, {}, {}};
85};
86
87#endif /* CBMMQTSASAMPLER_H_ */
uint64_t fMaxTimeslices
bool CreateAndSendComponent(const fles::Timeslice &, int)
bool SendData(const fles::StorableTimeslice &component)
fles::TimesliceSource * fSource
std::chrono::steady_clock::time_point fTime
uint64_t fMessageCounter
virtual void InitTask()
std::vector< std::vector< std::string > > fChannelsToSend
bool CheckTimeslice(const fles::Timeslice &ts)
std::string fHost
std::vector< std::string > fAllowedChannels
std::string fFileName
void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor &mdsc)
std::string fDirName
std::vector< std::string > fInputFileList
List of input files.
bool IsChannelNameAllowed(std::string)
std::vector< int > fComponentsToSend
virtual bool ConditionalRun()
std::vector< int > fSysId