16 #include "StorableTimeslice.hpp"
18 #include "BoostSerializer.h"
19 #include "FairMQLogger.h"
20 #include "FairMQProgOptions.h"
21 #include "FairParGenericSet.h"
22 #include "RootSerializer.h"
34 #include <boost/archive/binary_iarchive.hpp>
35 #include <boost/serialization/utility.hpp>
39 using std::runtime_error::runtime_error;
52 LOG(info) <<
"Init options for CbmMqStarHistoServer.";
54 fbDebugMonitorMode = fConfig->GetValue<
bool>(
"DebugMoni");
55 fuHistoryHistoSize = fConfig->GetValue<uint32_t>(
"HistEvoSz");
56 fuMinTotPulser = fConfig->GetValue<uint32_t>(
"PulsTotMin");
57 fuMaxTotPulser = fConfig->GetValue<uint32_t>(
"PulsTotMax");
59 fuPublishFreqTs = fConfig->GetValue<uint32_t>(
"PubFreqTs");
60 fdMinPublishTime = fConfig->GetValue<double_t>(
"PubTimeMin");
61 fdMaxPublishTime = fConfig->GetValue<double_t>(
"PubTimeMax");
62 fsChannelNameDataInput = fConfig->GetValue<std::string>(
"TsNameIn");
63 fsChannelNameHistosInput = fConfig->GetValue<std::string>(
"ChNameIn");
64 fsChannelNameHistosConfig = fConfig->GetValue<std::string>(
"ChNameHistCfg");
65 fsChannelNameCanvasConfig = fConfig->GetValue<std::string>(
"ChNameCanvCfg");
66 fsAllowedChannels[0] = fsChannelNameDataInput;
68 LOG(info) <<
"Histograms publication frequency in TS: " << fuPublishFreqTs;
69 LOG(info) <<
"Histograms publication min. interval in s: "
71 LOG(info) <<
"Histograms publication max. interval in s: "
87 int noChannel = fChannels.size();
88 LOG(info) <<
"Number of defined channels: " << noChannel;
89 for (
auto const& entry : fChannels) {
90 LOG(info) <<
"Channel name: " << entry.first;
91 if (std::string::npos != entry.first.find(fsChannelNameDataInput)) {
92 if (!IsChannelNameAllowed(entry.first))
99 LOG(error) << e.what();
105 for (
auto const& entry : fsAllowedChannels) {
106 std::size_t pos1 = channelName.find(entry);
107 if (pos1 != std::string::npos) {
108 const vector<std::string>::const_iterator
pos =
109 std::find(fsAllowedChannels.begin(), fsAllowedChannels.end(), entry);
110 const vector<std::string>::size_type idx =
111 pos - fsAllowedChannels.begin();
112 LOG(info) <<
"Found " << entry <<
" in " << channelName;
113 LOG(info) <<
"Channel name " << channelName
114 <<
" found in list of allowed channel names at position "
119 LOG(info) <<
"Channel name " << channelName
120 <<
" not found in list of allowed channel names.";
121 LOG(error) <<
"Stop device.";
126 LOG(info) <<
"Init parameter containers for CbmDeviceMcbmMonitorPulser.";
127 Bool_t initOK = kTRUE;
251 LOG(debug) <<
"Received message " << fulNumMessages <<
" with "
252 << parts.Size() <<
" parts"
253 <<
", size0: " << parts.At(0)->GetSize();
255 uint32_t uPartIdx = 0;
266 Deserialize<RootSerializer>(*parts.At(uPartIdx), fTsMetaData);
269 std::string msgStrT0(
static_cast<char*
>(parts.At(uPartIdx)->GetData()),
270 (parts.At(uPartIdx))->GetSize());
271 std::istringstream issT0(msgStrT0);
272 boost::archive::binary_iarchive inputArchiveT0(issT0);
273 inputArchiveT0 >> fvDigiT0;
276 std::string msgStrSts(
static_cast<char*
>(parts.At(uPartIdx)->GetData()),
277 (parts.At(uPartIdx))->GetSize());
278 std::istringstream issSts(msgStrSts);
279 boost::archive::binary_iarchive inputArchiveSts(issSts);
280 inputArchiveSts >> fvDigiSts;
283 std::string msgStrMuch(
static_cast<char*
>(parts.At(uPartIdx)->GetData()),
284 (parts.At(uPartIdx))->GetSize());
285 std::istringstream issMuch(msgStrMuch);
286 boost::archive::binary_iarchive inputArchiveMuch(issMuch);
287 inputArchiveMuch >> fvDigiMuch;
290 std::string msgStrTrd(
static_cast<char*
>(parts.At(uPartIdx)->GetData()),
291 (parts.At(uPartIdx))->GetSize());
292 std::istringstream issTrd(msgStrTrd);
293 boost::archive::binary_iarchive inputArchiveTrd(issTrd);
294 inputArchiveTrd >> fvDigiTrd;
297 std::string msgStrTof(
static_cast<char*
>(parts.At(uPartIdx)->GetData()),
298 (parts.At(uPartIdx))->GetSize());
299 std::istringstream issTof(msgStrTof);
300 boost::archive::binary_iarchive inputArchiveTof(issTof);
301 inputArchiveTof >> fvDigiTof;
304 std::string msgStrRich(
static_cast<char*
>(parts.At(uPartIdx)->GetData()),
305 (parts.At(uPartIdx))->GetSize());
306 std::istringstream issRich(msgStrRich);
307 boost::archive::binary_iarchive inputArchiveRich(issRich);
308 inputArchiveRich >> fvDigiRich;
311 std::string msgStrPsd(
static_cast<char*
>(parts.At(uPartIdx)->GetData()),
312 (parts.At(uPartIdx))->GetSize());
313 std::istringstream issPsd(msgStrPsd);
314 boost::archive::binary_iarchive inputArchivePsd(issPsd);
315 inputArchivePsd >> fvDigiPsd;
365 FairMQMessagePtr message(NewMessage());
366 Serialize<RootSerializer>(*message, &fArrayHisto);
387 if (Send(message, fsChannelNameHistosInput) < 0) {
388 LOG(error) <<
"Problem sending data";