11 #include "FairEventHeader.h"
12 #include "FairFileHeader.h"
13 #include "FairGeoParSet.h"
14 #include "FairMQLogger.h"
15 #include "FairMQProgOptions.h"
16 #include "FairRootFileSink.h"
17 #include "FairRootManager.h"
18 #include "FairRunOnline.h"
19 #include "FairRuntimeDb.h"
21 #include <boost/archive/binary_iarchive.hpp>
22 #include <boost/archive/binary_oarchive.hpp>
23 #include <boost/serialization/vector.hpp>
32 using std::runtime_error::runtime_error;
35 static std::chrono::steady_clock::time_point
dctime =
36 std::chrono::steady_clock::now();
44 , fbMonitorMode(kFALSE)
45 , fbDebugMonitorMode(kFALSE)
46 , fbSandboxMode(kFALSE)
47 , fbEventDumpEna(kFALSE)
61 int noChannel = fChannels.size();
62 LOG(info) <<
"Number of defined input channels: " << noChannel;
63 for (
auto const& entry : fChannels) {
64 LOG(info) <<
"Channel name: " << entry.first;
67 if (entry.first !=
"syscmd")
74 LOG(error) << e.what();
79 std::string channelName) {
81 std::size_t pos1 = channelName.find(entry);
82 if (pos1 != std::string::npos) {
83 const vector<std::string>::const_iterator
pos =
86 LOG(info) <<
"Found " << entry <<
" in " << channelName;
87 LOG(info) <<
"Channel name " << channelName
88 <<
" found in list of allowed channel names at position "
93 LOG(info) <<
"Channel name " << channelName
94 <<
" not found in list of allowed channel names.";
95 LOG(error) <<
"Stop device.";
100 LOG(info) <<
"Init work space for CbmDeviceTriggerHandlerEtof.";
116 LOG(debug) <<
"Received message " <<
fNumMessages <<
" with " << parts.Size()
118 <<
", size0: " << parts.At(0)->GetSize();
121 std::string msgStrE(
static_cast<char*
>(parts.At(0)->GetData()),
122 (parts.At(0))->GetSize());
123 std::istringstream issE(msgStrE);
124 boost::archive::binary_iarchive inputArchiveE(issE);
125 inputArchiveE >> TrigWord;
127 char* pDataBuff =
static_cast<char*
>(parts.At(1)->GetData());
128 int iBuffSzByte = parts.At(1)->GetSize();
131 LOG(debug) <<
"Send Data for event " <<
fdEvent <<
", TrigWord " << TrigWord
132 <<
" with size " << iBuffSzByte << Form(
" at %p ", pDataBuff);
136 dSize += iBuffSzByte;
137 if (0 == (
int)
fdEvent % 10000) {
138 std::chrono::duration<double> deltatime =
139 std::chrono::steady_clock::now() -
dctime;
140 LOG(info) <<
"Processed " <<
fdEvent
141 <<
" events, delta-time: " << deltatime.count()
142 <<
", rate: " <<
dSize * 1.E-6 / deltatime.count() <<
"MB/s";
143 dctime = std::chrono::steady_clock::now();
155 const char* cmd = (
char*) (msg->GetData());
156 const char cmda[4] = {*cmd};
157 LOG(info) <<
"Handle message " << cmd <<
", " << cmd[0];
160 if (strcmp(cmda,
"STOP")) {
170 std::this_thread::sleep_for(std::chrono::milliseconds(1000));