16#include "FairEventHeader.h"
17#include "FairFileHeader.h"
18#include "FairGeoParSet.h"
19#include "FairMQLogger.h"
20#include "FairMQProgOptions.h"
21#include "FairRootFileSink.h"
22#include "FairRootManager.h"
23#include "FairRunOnline.h"
24#include "FairRuntimeDb.h"
28#include <boost/archive/binary_iarchive.hpp>
29#include <boost/archive/binary_oarchive.hpp>
30#include <boost/serialization/vector.hpp>
37 using std::runtime_error::runtime_error;
40static std::chrono::steady_clock::time_point
dctime = std::chrono::steady_clock::now();
68 int noChannel = fChannels.size();
69 LOG(info) <<
"Number of defined input channels: " << noChannel;
70 for (
auto const& entry : fChannels) {
71 LOG(info) <<
"Channel name: " << entry.first;
80 LOG(error) << e.what();
87 std::size_t pos1 = channelName.find(entry);
88 if (pos1 != std::string::npos) {
89 const vector<std::string>::const_iterator
pos =
92 LOG(info) <<
"Found " << entry <<
" in " << channelName;
93 LOG(info) <<
"Channel name " << channelName <<
" found in list of allowed channel names at position " << idx;
97 LOG(info) <<
"Channel name " << channelName <<
" not found in list of allowed channel names.";
98 LOG(error) <<
"Stop device.";
104 LOG(info) <<
"Init work space for CbmDeviceTriggerHandlerEtof.";
120 LOG(debug) <<
"Received message " <<
fNumMessages <<
" with " << parts.Size() <<
" parts"
121 <<
", size0: " << parts.At(0)->GetSize();
124 std::string msgStrE(
static_cast<char*
>(parts.At(0)->GetData()), (parts.At(0))->GetSize());
125 std::istringstream issE(msgStrE);
126 boost::archive::binary_iarchive inputArchiveE(issE);
127 inputArchiveE >> TrigWord;
129 char* pDataBuff =
static_cast<char*
>(parts.At(1)->GetData());
130 int iBuffSzByte = parts.At(1)->GetSize();
133 LOG(debug) <<
"Send Data for event " <<
fdEvent <<
", TrigWord " << TrigWord <<
" with size " << iBuffSzByte
134 << Form(
" at %p ", pDataBuff);
136 dSize += iBuffSzByte;
137 if (0 == (
int)
fdEvent % 10000) {
138 std::chrono::duration<double> deltatime = std::chrono::steady_clock::now() -
dctime;
139 LOG(info) <<
"Processed " <<
fdEvent <<
" events, delta-time: " << deltatime.count()
140 <<
", rate: " <<
dSize * 1.E-6 / deltatime.count() <<
"MB/s";
141 dctime = std::chrono::steady_clock::now();
153 const char* cmd = (
char*) (msg->GetData());
154 const char cmda[4] = {*cmd};
155 LOG(info) <<
"Handle message " << cmd <<
", " << cmd[0];
158 if (strcmp(cmda,
"STOP")) {
168 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
int star_rhicf_write(unsigned int trg_word, void *dta, int bytes)
CbmDeviceTriggerHandlerEtof()
bool HandleMessage(FairMQMessagePtr &, int)
Bool_t fbMonitorMode
Control flags.
std::vector< std::string > fAllowedChannels
Bool_t fbSandboxMode
Switch ON the filling of a additional set of histograms.
bool HandleData(FairMQParts &, int)
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
virtual ~CbmDeviceTriggerHandlerEtof()
Double_t fdEvent
Switch ON the dumping of the events to a binary file.
Bool_t fbEventDumpEna
Switch OFF the emission of data toward the STAR DAQ.
Bool_t IsChannelNameAllowed(std::string channelName)
void ChangeState(FairMQDevice *device, cbm::mq::Transition transition)
void LogState(FairMQDevice *device)