14 #include "StorableTimeslice.hpp"
16 #include "BoostSerializer.h"
17 #include "FairMQLogger.h"
18 #include "FairMQProgOptions.h"
19 #include "FairParGenericSet.h"
20 #include "RootSerializer.h"
32 #include <boost/archive/binary_iarchive.hpp>
33 #include <boost/serialization/utility.hpp>
37 using std::runtime_error::runtime_error;
49 LOG(info) <<
"Init options for CbmMqStarHistoServer.";
57 fiGdpbIndex = fConfig->GetValue<int32_t>(
"GdpbIdx");
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;
99 LOG(error) << e.what();
106 std::size_t pos1 = channelName.find(entry);
107 if (pos1 != std::string::npos) {
108 const vector<std::string>::const_iterator
pos =
110 const vector<std::string>::size_type idx =
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 CbmDeviceMonitorTof.";
130 for (
int iparC = 0; iparC <
fParCList->GetEntries(); iparC++) {
131 FairParGenericSet* tempObj = (FairParGenericSet*) (
fParCList->At(iparC));
133 std::string paramName {tempObj->GetName()};
138 std::string message = paramName +
",111";
139 LOG(info) <<
"Requesting parameter container " << paramName
140 <<
", sending message: " << message;
142 FairMQMessagePtr req(NewSimpleMessage(message));
143 FairMQMessagePtr rep(NewMessage());
145 FairParGenericSet* newObj =
nullptr;
147 if (Send(req,
"parameters") > 0) {
148 if (Receive(rep,
"parameters") >= 0) {
149 if (rep->GetSize() != 0) {
152 static_cast<FairParGenericSet*
>(tmsg.ReadObject(tmsg.GetClass()));
153 LOG(info) <<
"Received unpack parameter from the server:";
156 LOG(error) <<
"Received empty reply. Parameter not available";
181 std::vector<std::pair<TNamed*, std::string>> vHistos =
184 std::vector<std::pair<TCanvas*, std::string>> vCanvases =
191 for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
196 std::pair<std::string, std::string> psHistoConfig(
197 vHistos[uHisto].
first->GetName(), vHistos[uHisto].second);
201 FairMQMessagePtr messageHist(NewMessage());
202 Serialize<BoostSerializer<std::pair<std::string, std::string>>>(
203 *messageHist, psHistoConfig);
207 LOG(error) <<
"Problem sending histo config";
211 LOG(info) <<
"Config of hist " << psHistoConfig.first.data()
212 <<
" in folder " << psHistoConfig.second.data();
218 for (UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv) {
221 std::string sCanvName = (vCanvases[uCanv].first)->GetName();
224 std::pair<std::string, std::string> psCanvConfig(sCanvName, sCanvConf);
229 FairMQMessagePtr messageCan(NewMessage());
230 Serialize<BoostSerializer<std::pair<std::string, std::string>>>(
231 *messageCan, psCanvConfig);
235 LOG(error) <<
"Problem sending canvas config";
239 LOG(info) <<
"Config string of Canvas " << psCanvConfig.first.data()
240 <<
" is " << psCanvConfig.second.data();
250 LOG(debug) <<
"Received message number " <<
fulNumMessages <<
" with size "
256 std::string msgStr(
static_cast<char*
>(msg->GetData()), msg->GetSize());
257 std::istringstream iss(msgStr);
258 boost::archive::binary_iarchive inputArchive(iss);
261 fles::StorableTimeslice component {0};
262 inputArchive >> component;
270 std::chrono::system_clock::time_point currentTime =
271 std::chrono::system_clock::now();
272 std::chrono::duration<double_t> elapsedSeconds =
286 FairMQMessagePtr message(NewMessage());
309 LOG(error) <<
"Problem sending data";
328 for (uint32_t uCompIdx = 0; uCompIdx < ts.num_components(); ++uCompIdx) {
329 if (
kusSysIdTof == ts.descriptor(uCompIdx, 0).sys_id) {
332 else if (
kusSysIdT0 == ts.descriptor(uCompIdx, 0).sys_id) {
340 LOG(info) <<
"Reset TOF Monitor histos ";
346 LOG(error) <<
"Failed processing TS " << ts.index()
347 <<
" in unpacker algorithm class";
355 LOG(info) <<
"Processed " <<
fulTsCounter <<
" time slices";