From 3d5dbd96384965ddfca9c38fe791d508da92b305 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Tue, 17 Dec 2024 14:12:44 +0100 Subject: [PATCH 1/2] refactor: Remove usage of deprecated FairMQ classes Don't access channels from FairMQDevice directly but via the appropiate getter. Use fair::mq::Device instead of FairMQDevice. Use fair::mq::Parts instead of FairMQParts; Use fair::mq::ProgOptions instead of FairMQProgOptions. Use fair::mq::MessagePtr instead of FairMQMessagPtr. --- MQ/base/CbmMQChannels.cxx | 6 ++-- MQ/base/CbmMQChannels.h | 2 +- MQ/base/CbmMQDefs.h | 29 +++++++++++------ MQ/histoServer/CbmHistoServer.cxx | 2 +- MQ/histoServer/CbmHistoServer.h | 4 +-- MQ/histoServer/CbmMqHistoServer.cxx | 12 +++---- MQ/histoServer/CbmMqHistoServer.h | 10 +++--- MQ/histoServer/runCbmHistoServer.cxx | 2 +- MQ/histoServer/runCbmMqHistoServer.cxx | 2 +- MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx | 18 +++++----- MQ/hitbuilder/CbmDeviceHitBuilderTof.h | 8 ++--- MQ/hitbuilder/runHitBuilderTof.cxx | 2 +- MQ/mcbm/CbmDeviceBmonMonitor.cxx | 38 +++++++++++----------- MQ/mcbm/CbmDeviceBmonMonitor.h | 4 +-- MQ/mcbm/CbmDeviceBuildDigiEvents.cxx | 34 +++++++++---------- MQ/mcbm/CbmDeviceBuildDigiEvents.h | 10 +++--- MQ/mcbm/CbmDeviceBuildRawEvents.cxx | 18 +++++----- MQ/mcbm/CbmDeviceBuildRawEvents.h | 8 ++--- MQ/mcbm/CbmDeviceDigiEventSink.cxx | 30 ++++++++--------- MQ/mcbm/CbmDeviceDigiEventSink.h | 10 +++--- MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx | 26 +++++++-------- MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h | 8 ++--- MQ/mcbm/CbmDeviceMcbmEventSink.cxx | 24 +++++++------- MQ/mcbm/CbmDeviceMcbmEventSink.h | 10 +++--- MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx | 18 +++++----- MQ/mcbm/CbmDeviceMcbmMonitorPulser.h | 4 +-- MQ/mcbm/CbmDeviceMcbmUnpack.cxx | 16 ++++----- MQ/mcbm/CbmDeviceMcbmUnpack.h | 6 ++-- MQ/mcbm/CbmDeviceUnpack.cxx | 34 +++++++++---------- MQ/mcbm/CbmDeviceUnpack.h | 4 +-- MQ/mcbm/runBmonMonitor.cxx | 2 +- MQ/mcbm/runBuildDigiEvents.cxx | 2 +- MQ/mcbm/runBuildRawEvents.cxx | 2 +- MQ/mcbm/runDigiEventSink.cxx | 2 +- MQ/mcbm/runMcbmEventSink.cxx | 2 +- MQ/mcbm/runMcbmEvtBuilderWin.cxx | 2 +- MQ/mcbm/runMcbmMonitorPulser.cxx | 2 +- MQ/mcbm/runMcbmUnpack.cxx | 2 +- MQ/mcbm/runUnpack.cxx | 2 +- MQ/monitor/CbmDeviceMonitorBmon.cxx | 24 +++++++------- MQ/monitor/CbmDeviceMonitorBmon.h | 4 +-- MQ/monitor/CbmDeviceMonitorPsd.cxx | 18 +++++----- MQ/monitor/CbmDeviceMonitorPsd.h | 4 +-- MQ/monitor/CbmDeviceMonitorReqBmon.cxx | 20 ++++++------ MQ/monitor/CbmDeviceMonitorReqBmon.h | 2 +- MQ/monitor/CbmDeviceMonitorReqTof.cxx | 20 ++++++------ MQ/monitor/CbmDeviceMonitorReqTof.h | 2 +- MQ/monitor/CbmDeviceMonitorTof.cxx | 24 +++++++------- MQ/monitor/CbmDeviceMonitorTof.h | 4 +-- MQ/monitor/runMonitorBmon.cxx | 2 +- MQ/monitor/runMonitorPsd.cxx | 2 +- MQ/monitor/runMonitorReqBmon.cxx | 2 +- MQ/monitor/runMonitorReqTof.cxx | 2 +- MQ/monitor/runMonitorTof.cxx | 2 +- MQ/parmq/ParameterMQServer.cxx | 10 +++--- MQ/parmq/ParameterMQServer.h | 2 +- MQ/parmq/runParameterMQServer.cxx | 2 +- MQ/sink/CbmDevNullSink.cxx | 6 ++-- MQ/sink/CbmDevNullSink.h | 4 +-- MQ/sink/CbmTsaComponentSink.cxx | 6 ++-- MQ/sink/CbmTsaComponentSink.h | 4 +-- MQ/sink/runDevNullSink.cxx | 2 +- MQ/sink/runTsaComponentSink.cxx | 2 +- MQ/source/CbmMQTsSamplerRepReq.cxx | 30 ++++++++--------- MQ/source/CbmMQTsSamplerRepReq.h | 4 +-- MQ/source/CbmMQTsaInfo.cxx | 6 ++-- MQ/source/CbmMQTsaInfo.h | 2 +- MQ/source/CbmMQTsaMultiSampler.cxx | 21 ++++++------ MQ/source/CbmMQTsaMultiSampler.h | 2 +- MQ/source/CbmMQTsaMultiSamplerTof.cxx | 16 ++++----- MQ/source/CbmMQTsaMultiSamplerTof.h | 2 +- MQ/source/CbmMQTsaSampler.cxx | 9 ++--- MQ/source/CbmMQTsaSampler.h | 2 +- MQ/source/CbmMQTsaSamplerTof.cxx | 18 +++++----- MQ/source/CbmMQTsaSamplerTof.h | 2 +- MQ/source/CbmStsDigiSource.cxx | 6 ++-- MQ/source/CbmStsDigiSource.h | 2 +- MQ/source/CbmTsConsumerReqDevExample.cxx | 20 ++++++------ MQ/source/CbmTsConsumerReqDevExample.h | 2 +- MQ/source/runStsDigiSource.cxx | 2 +- MQ/source/runTsConsumerReqExample.cxx | 2 +- MQ/source/runTsSamplerRepReq.cxx | 2 +- MQ/source/runTsaInfo.cxx | 2 +- MQ/source/runTsaMultiSampler.cxx | 2 +- MQ/source/runTsaMultiSamplerTof.cxx | 2 +- MQ/source/runTsaSampler.cxx | 2 +- MQ/source/runTsaSamplerTof.cxx | 2 +- MQ/unpacker/CbmDeviceUnpackTofCri.cxx | 26 +++++++-------- MQ/unpacker/CbmDeviceUnpackTofCri.h | 8 ++--- MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx | 26 +++++++-------- MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h | 8 ++--- MQ/unpacker/runUnpackTofCri.cxx | 2 +- MQ/unpacker/runUnpackTofMcbm2018.cxx | 2 +- 93 files changed, 415 insertions(+), 404 deletions(-) diff --git a/MQ/base/CbmMQChannels.cxx b/MQ/base/CbmMQChannels.cxx index 3692854466..71543f240f 100644 --- a/MQ/base/CbmMQChannels.cxx +++ b/MQ/base/CbmMQChannels.cxx @@ -46,7 +46,7 @@ bool CbmMQChannels::IsChannelNameAllowed(std::string channelName) return false; } -bool CbmMQChannels::CheckChannels(FairMQDevice* device) +bool CbmMQChannels::CheckChannels(fair::mq::Device* device) { // Get the information about created channels from the device // Check if the defined channels from the topology (by name) @@ -56,9 +56,9 @@ bool CbmMQChannels::CheckChannels(FairMQDevice* device) // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = device->fChannels.size(); + int noChannel = device->GetChannels().size(); LOG(info) << "Number of defined output channels: " << noChannel; - for (auto const& entry : device->fChannels) { + for (auto const& entry : device->GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) return false; } diff --git a/MQ/base/CbmMQChannels.h b/MQ/base/CbmMQChannels.h index 18358e31ae..cc55b6c554 100644 --- a/MQ/base/CbmMQChannels.h +++ b/MQ/base/CbmMQChannels.h @@ -16,7 +16,7 @@ public: CbmMQChannels(std::vector<std::string>); bool IsChannelNameAllowed(std::string channelName); - bool CheckChannels(FairMQDevice* device); + bool CheckChannels(fair::mq::Device* device); std::vector<int> GetComponentsToSend() { return fComponentsToSend; } std::vector<std::vector<std::string>> GetChannelsToSend() { return fChannelsToSend; } diff --git a/MQ/base/CbmMQDefs.h b/MQ/base/CbmMQDefs.h index 03c4351683..9b3c9a58b1 100644 --- a/MQ/base/CbmMQDefs.h +++ b/MQ/base/CbmMQDefs.h @@ -23,38 +23,47 @@ namespace cbm Running }; - void ChangeState(FairMQDevice* device, cbm::mq::Transition transition) + void ChangeState(fair::mq::Device* device, cbm::mq::Transition transition) { - if (transition == cbm::mq::Transition::ErrorFound) { device->ChangeState(fair::mq::Transition::ErrorFound); } + bool success; + if (transition == cbm::mq::Transition::ErrorFound) { + success=device->ChangeState(fair::mq::Transition::ErrorFound); + } else if (transition == cbm::mq::Transition::End) { - device->ChangeState(fair::mq::Transition::End); + success=device->ChangeState(fair::mq::Transition::End); } else if (transition == cbm::mq::Transition::Ready) { - device->ChangeState(fair::mq::Transition::ResetTask); + success=device->ChangeState(fair::mq::Transition::ResetTask); } else if (transition == cbm::mq::Transition::DeviceReady) { - device->ChangeState(fair::mq::Transition::ResetDevice); + success=device->ChangeState(fair::mq::Transition::ResetDevice); } else if (transition == cbm::mq::Transition::Idle) { - device->ChangeState(fair::mq::Transition::Stop); + success=device->ChangeState(fair::mq::Transition::Stop); } else { LOG(fatal) << "State Change not yet implemented"; - device->ChangeState(fair::mq::Transition::ErrorFound); + success=device->ChangeState(fair::mq::Transition::ErrorFound); + } + if(!success) { + LOG(warn) << "The transition wasnt successful"; } } - void LogState(FairMQDevice* device) + void LogState(fair::mq::Device* device) { LOG(info) << "Current State: " << device->GetCurrentStateName(); } - bool CheckCurrentState(FairMQDevice* device, cbm::mq::State state) + bool CheckCurrentState(fair::mq::Device* device, cbm::mq::State state) { if (state == cbm::mq::State::Running) { return !(device->NewStatePending()); } else { LOG(fatal) << "State not yet implemented"; - device->ChangeState(fair::mq::Transition::ErrorFound); + bool success=device->ChangeState(fair::mq::Transition::ErrorFound); + if(!success) { + LOG(warn) << "The transition wasnt successful"; + } return 0; } } diff --git a/MQ/histoServer/CbmHistoServer.cxx b/MQ/histoServer/CbmHistoServer.cxx index dd083d2905..6dd6e6a362 100644 --- a/MQ/histoServer/CbmHistoServer.cxx +++ b/MQ/histoServer/CbmHistoServer.cxx @@ -42,7 +42,7 @@ void CbmHistoServer::InitTask() */ } -bool CbmHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) +bool CbmHistoServer::ReceiveData(fair::mq::MessagePtr& msg, int /*index*/) { TObject* tempObject = nullptr; RootSerializer().Deserialize(*msg, tempObject); diff --git a/MQ/histoServer/CbmHistoServer.h b/MQ/histoServer/CbmHistoServer.h index ac3c7fa99c..181a0b6ac1 100644 --- a/MQ/histoServer/CbmHistoServer.h +++ b/MQ/histoServer/CbmHistoServer.h @@ -16,7 +16,7 @@ //class FairMQExHistoCanvasDrawer; -class CbmHistoServer : public FairMQDevice { +class CbmHistoServer : public fair::mq::Device { public: CbmHistoServer(); @@ -35,7 +35,7 @@ public: protected: virtual void InitTask(); - bool ReceiveData(FairMQMessagePtr& msg, int index); + bool ReceiveData(fair::mq::MessagePtr& msg, int index); virtual void PreRun(); diff --git a/MQ/histoServer/CbmMqHistoServer.cxx b/MQ/histoServer/CbmMqHistoServer.cxx index 21009b9f89..5c169a1a96 100644 --- a/MQ/histoServer/CbmMqHistoServer.cxx +++ b/MQ/histoServer/CbmMqHistoServer.cxx @@ -73,7 +73,7 @@ void CbmMqHistoServer::InitTask() //fServer->Restrict("/Save_Hist", "allow=admin"); } -bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) +bool CbmMqHistoServer::ReceiveData(fair::mq::MessagePtr& msg, int /*index*/) { LOG(debug) << "CbmMqHistoServer::ReceiveData => Processing histograms update"; TObject* tempObject = nullptr; @@ -145,7 +145,7 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) return true; } -bool CbmMqHistoServer::ReceiveHistoConfig(FairMQMessagePtr& msg, int /*index*/) +bool CbmMqHistoServer::ReceiveHistoConfig(fair::mq::MessagePtr& msg, int /*index*/) { std::pair<std::string, std::string> tempObject; @@ -177,7 +177,7 @@ bool CbmMqHistoServer::ReceiveHistoConfig(FairMQMessagePtr& msg, int /*index*/) return true; } -bool CbmMqHistoServer::ReceiveCanvasConfig(FairMQMessagePtr& msg, int /*index*/) +bool CbmMqHistoServer::ReceiveCanvasConfig(fair::mq::MessagePtr& msg, int /*index*/) { std::pair<std::string, std::string> tempObject; @@ -210,14 +210,14 @@ bool CbmMqHistoServer::ReceiveCanvasConfig(FairMQMessagePtr& msg, int /*index*/) return true; } -bool CbmMqHistoServer::ReceiveConfigAndData(FairMQParts& parts, int /*index*/) +bool CbmMqHistoServer::ReceiveConfigAndData(fair::mq::Parts& parts, int /*index*/) { /// Reject anything but a at least Header + Histo Config + Canvas Config + Histo Data if (parts.Size() < 4) { if (1 == parts.Size()) { /// PAL, 09/04/2021, Debug message catching missed method overload/polymorphism: - /// contrary to my expectation, if 2 method bound to same channel, one with FairMQMessagePtr and one with - /// FairMQParts, all messages go to multipart version and FairMQMessagePtr is converted to size 1 FairMQParts + /// contrary to my expectation, if 2 method bound to same channel, one with fair::mq::MessagePtr and one with + /// fair::mq::Parts, all messages go to multipart version and fair::mq::MessagePtr is converted to size 1 fair::mq::Parts LOG(debug) << "CbmMqHistoServer::ReceiveConfigAndData => only 1 parts found in input, " << "assuming data only message routed to wrong method!"; return ReceiveData(parts.At(0), 0); diff --git a/MQ/histoServer/CbmMqHistoServer.h b/MQ/histoServer/CbmMqHistoServer.h index 5cbd8cdf08..258eb0e16c 100644 --- a/MQ/histoServer/CbmMqHistoServer.h +++ b/MQ/histoServer/CbmMqHistoServer.h @@ -17,7 +17,7 @@ class TNamed; class TCanvas; -class CbmMqHistoServer : public FairMQDevice { +class CbmMqHistoServer : public fair::mq::Device { public: CbmMqHistoServer(); @@ -28,13 +28,13 @@ public: protected: virtual void InitTask(); - bool ReceiveData(FairMQMessagePtr& msg, int index); + bool ReceiveData(fair::mq::MessagePtr& msg, int index); - bool ReceiveHistoConfig(FairMQMessagePtr& msg, int index); + bool ReceiveHistoConfig(fair::mq::MessagePtr& msg, int index); - bool ReceiveCanvasConfig(FairMQMessagePtr& msg, int index); + bool ReceiveCanvasConfig(fair::mq::MessagePtr& msg, int index); - bool ReceiveConfigAndData(FairMQParts& msg, int index); + bool ReceiveConfigAndData(fair::mq::Parts& msg, int index); virtual void PreRun(); diff --git a/MQ/histoServer/runCbmHistoServer.cxx b/MQ/histoServer/runCbmHistoServer.cxx index 6beb33723f..f29c76134e 100644 --- a/MQ/histoServer/runCbmHistoServer.cxx +++ b/MQ/histoServer/runCbmHistoServer.cxx @@ -14,7 +14,7 @@ void addCustomOptions(bpo::options_description& /*options*/) {} //std::unique_ptr<FairMQExHistoCanvasDrawer> getCanvasDrawer(); -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { CbmHistoServer* histoServer = new CbmHistoServer(); diff --git a/MQ/histoServer/runCbmMqHistoServer.cxx b/MQ/histoServer/runCbmMqHistoServer.cxx index 3836861741..640bab7e64 100644 --- a/MQ/histoServer/runCbmMqHistoServer.cxx +++ b/MQ/histoServer/runCbmMqHistoServer.cxx @@ -23,7 +23,7 @@ void addCustomOptions(bpo::options_description& options) options.add_options()("histport", bpo::value<uint32_t>()->default_value(8080), "port for histos http server"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { CbmMqHistoServer* histoServer = new CbmMqHistoServer(); diff --git a/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx b/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx index b7f333053f..2bb181eb50 100644 --- a/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx +++ b/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx @@ -255,9 +255,9 @@ try { // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined input channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); if (entry.first != "syscmd") OnData(entry.first, &CbmDeviceHitBuilderTof::HandleData); @@ -430,9 +430,9 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers() std::string message = parSet[iSet] + "," + to_string(fiRunId); LOG(info) << "Requesting parameter container, sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - //FairMQMessagePtr req(NewSimpleMessage( "CbmTofDigiBdfPar,111" )); //original format - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + //fair::mq::MessagePtr req(NewSimpleMessage( "CbmTofDigiBdfPar,111" )); //original format + fair::mq::MessagePtr rep(NewMessage()); CbmTofCreateDigiPar* tofDigiPar = NULL; if (Send(req, Channel) > 0) { @@ -540,8 +540,8 @@ Bool_t CbmDeviceHitBuilderTof::ReInitContainers() } // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -//bool CbmDeviceHitBuilderTof::HandleData(FairMQMessagePtr& msg, int /*index*/) -bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) +//bool CbmDeviceHitBuilderTof::HandleData(fair::mq::MessagePtr& msg, int /*index*/) +bool CbmDeviceHitBuilderTof::HandleData(fair::mq::Parts& parts, int /*index*/) { // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add @@ -722,7 +722,7 @@ bool CbmDeviceHitBuilderTof::HandleData(FairMQParts& parts, int /*index*/) /************************************************************************************/ -bool CbmDeviceHitBuilderTof::HandleMessage(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceHitBuilderTof::HandleMessage(fair::mq::MessagePtr& msg, int /*index*/) { const char* cmd = (char*) (msg->GetData()); const char cmda[4] = {*cmd}; @@ -3027,7 +3027,7 @@ Bool_t CbmDeviceHitBuilderTof::SendHits() oa << vhit; std::string* strMsg = new std::string(oss.str()); - FairMQParts parts; + fair::mq::Parts parts; parts.AddPart(NewMessage( const_cast<char*>(strMsgE->c_str()), // data strMsgE->length(), // size diff --git a/MQ/hitbuilder/CbmDeviceHitBuilderTof.h b/MQ/hitbuilder/CbmDeviceHitBuilderTof.h index 84b59dc31c..9e8c478f2d 100644 --- a/MQ/hitbuilder/CbmDeviceHitBuilderTof.h +++ b/MQ/hitbuilder/CbmDeviceHitBuilderTof.h @@ -58,16 +58,16 @@ class TString; #include <map> #include <vector> -class CbmDeviceHitBuilderTof : public FairMQDevice { +class CbmDeviceHitBuilderTof : public fair::mq::Device { public: CbmDeviceHitBuilderTof(); virtual ~CbmDeviceHitBuilderTof(); protected: virtual void InitTask(); - //bool HandleData(FairMQMessagePtr&, int); - bool HandleData(FairMQParts&, int); - bool HandleMessage(FairMQMessagePtr&, int); + //bool HandleData(fair::mq::MessagePtr&, int); + bool HandleData(fair::mq::Parts&, int); + bool HandleMessage(fair::mq::MessagePtr&, int); virtual void fit_ybox(const char* hname); // Fit virtual void fit_ybox(TH1* h, Double_t dy); // Fit diff --git a/MQ/hitbuilder/runHitBuilderTof.cxx b/MQ/hitbuilder/runHitBuilderTof.cxx index d59e7f9401..edfe7c8329 100644 --- a/MQ/hitbuilder/runHitBuilderTof.cxx +++ b/MQ/hitbuilder/runHitBuilderTof.cxx @@ -56,4 +56,4 @@ void addCustomOptions(bpo::options_description& options) options.add_options()("OutParFile", bpo::value<std::string>()->default_value(""), "parameter histogram file name"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceHitBuilderTof(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceHitBuilderTof(); } diff --git a/MQ/mcbm/CbmDeviceBmonMonitor.cxx b/MQ/mcbm/CbmDeviceBmonMonitor.cxx index 4a335b9fd0..06dc8aa234 100644 --- a/MQ/mcbm/CbmDeviceBmonMonitor.cxx +++ b/MQ/mcbm/CbmDeviceBmonMonitor.cxx @@ -92,8 +92,8 @@ Bool_t CbmDeviceBmonMonitor::InitContainers() // ----- CbmSetup ----------------------------------------------------- // TODO: support for multiple setups on Par Server? with request containing setup name? CbmSetup* cbmsetup = CbmSetup::Instance(); - FairMQMessagePtr req(NewSimpleMessage("setup")); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage("setup")); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, "parameters") > 0) { if (Receive(rep, "parameters") >= 0) { @@ -222,8 +222,8 @@ CbmDeviceBmonMonitor::InitParameters(std::vector<std::pair<std::string, std::sha std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -316,8 +316,8 @@ bool CbmDeviceBmonMonitor::ConditionalRun() /// Request the start time std::string message = "SendFirstTimesliceIndex"; LOG(debug) << "Requesting start time by sending message: SendFirstTimesliceIndex" << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, fsChannelNameDataInput) <= 0) { LOG(error) << "Failed to send the request! message was " << message; @@ -344,8 +344,8 @@ bool CbmDeviceBmonMonitor::ConditionalRun() /// First request a new TS (full one) std::string message = "full"; LOG(debug) << "Requesting new TS by sending message: full" << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, fsChannelNameDataInput) <= 0) { LOG(error) << "Failed to send the request! message was " << message; @@ -424,10 +424,10 @@ bool CbmDeviceBmonMonitor::ConditionalRun() bool CbmDeviceBmonMonitor::SendUnpData() { - FairMQParts parts; + fair::mq::Parts parts; /// Prepare serialized versions of the TS Event header - FairMQMessagePtr messTsHeader(NewMessage()); + fair::mq::MessagePtr messTsHeader(NewMessage()); // Serialize<RootSerializer>(*messTsHeader, fCbmTsEventHeader); RootSerializer().Serialize(*messTsHeader, fCbmTsEventHeader); @@ -453,7 +453,7 @@ bool CbmDeviceBmonMonitor::SendUnpData() /// Prepare serialized versions of the TS Meta /// FIXME: only for TS duration and overlap, should be sent to parameter service instead as stable values in run /// Index and start time are already included in the TsHeader object! - FairMQMessagePtr messTsMeta(NewMessage()); + fair::mq::MessagePtr messTsMeta(NewMessage()); // Serialize<RootSerializer>(*messTsMeta, fTsMetaData); RootSerializer().Serialize(*messTsMeta, fTsMetaData); parts.AddPart(std::move(messTsMeta)); @@ -471,15 +471,15 @@ bool CbmDeviceBmonMonitor::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); @@ -489,13 +489,13 @@ bool CbmDeviceBmonMonitor::SendHistoConfAndData() /// Catch case where no histos are registered! /// => Add empty message if (0 == fvpsHistosFolder.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); @@ -505,12 +505,12 @@ bool CbmDeviceBmonMonitor::SendHistoConfAndData() /// Catch case where no Canvases are registered! /// => Add empty message if (0 == fvpsCanvasConfig.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); partsOut.AddPart(std::move(msgHistos)); @@ -532,7 +532,7 @@ bool CbmDeviceBmonMonitor::SendHistoConfAndData() bool CbmDeviceBmonMonitor::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/mcbm/CbmDeviceBmonMonitor.h b/MQ/mcbm/CbmDeviceBmonMonitor.h index d9ea1bd0d9..8e8a8df526 100644 --- a/MQ/mcbm/CbmDeviceBmonMonitor.h +++ b/MQ/mcbm/CbmDeviceBmonMonitor.h @@ -34,7 +34,7 @@ class TimesliceMetaData; class CbmTrdSpadic; -class CbmDeviceBmonMonitor : public FairMQDevice { +class CbmDeviceBmonMonitor : public fair::mq::Device { public: CbmDeviceBmonMonitor(); virtual ~CbmDeviceBmonMonitor(); @@ -42,7 +42,7 @@ public: protected: virtual void InitTask(); bool ConditionalRun(); - bool HandleCommand(FairMQMessagePtr&, int); + bool HandleCommand(fair::mq::MessagePtr&, int); /** @brief Set the Bmon Unpack Config @param config */ void SetUnpackConfig(std::shared_ptr<CbmBmonUnpackConfig> config) { fBmonConfig = config; } diff --git a/MQ/mcbm/CbmDeviceBuildDigiEvents.cxx b/MQ/mcbm/CbmDeviceBuildDigiEvents.cxx index 16210f626b..6dbe211317 100644 --- a/MQ/mcbm/CbmDeviceBuildDigiEvents.cxx +++ b/MQ/mcbm/CbmDeviceBuildDigiEvents.cxx @@ -92,9 +92,9 @@ try { // nameing convention. It is not avoided that someone sends other // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); @@ -476,7 +476,7 @@ bool CbmDeviceBuildDigiEvents::InitHistograms() } // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceBuildDigiEvents::HandleData(FairMQParts& parts, int /*index*/) +bool CbmDeviceBuildDigiEvents::HandleData(fair::mq::Parts& parts, int /*index*/) { fulNumMessages++; LOG(debug) << "Received message number " << fulNumMessages << " with " << parts.Size() << " parts" @@ -626,7 +626,7 @@ bool CbmDeviceBuildDigiEvents::HandleData(FairMQParts& parts, int /*index*/) return true; } -bool CbmDeviceBuildDigiEvents::SendEvents(FairMQParts& partsIn) +bool CbmDeviceBuildDigiEvents::SendEvents(fair::mq::Parts& partsIn) { /// Get vector reference from algo std::vector<CbmEvent*> vEvents = fpAlgo->GetEventVector(); @@ -642,7 +642,7 @@ bool CbmDeviceBuildDigiEvents::SendEvents(FairMQParts& partsIn) /// Serialize the array of events into a single MQ message /// FIXME: Find out if possible to use only the boost serializer - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &(vOutEvents)); RootSerializer().Serialize(*message, &(vOutEvents)); /* @@ -654,7 +654,7 @@ bool CbmDeviceBuildDigiEvents::SendEvents(FairMQParts& partsIn) /// Add it at the end of the input composed message /// FIXME: Find out if possible to use only the boost serializer - FairMQParts partsOut(std::move(partsIn)); + fair::mq::Parts partsOut(std::move(partsIn)); partsOut.AddPart(std::move(message)); /* partsOut.AddPart(NewMessage( @@ -673,7 +673,7 @@ bool CbmDeviceBuildDigiEvents::SendEvents(FairMQParts& partsIn) return true; } -bool CbmDeviceBuildDigiEvents::SendDigiEvents(FairMQParts& partsIn) +bool CbmDeviceBuildDigiEvents::SendDigiEvents(fair::mq::Parts& partsIn) { /// Get vector reference from algo std::vector<CbmEvent*> vEvents = fpAlgo->GetEventVector(); @@ -771,7 +771,7 @@ bool CbmDeviceBuildDigiEvents::SendDigiEvents(FairMQParts& partsIn) boost::archive::binary_oarchive oaEvt(ossEvt); oaEvt << vOutEvents; std::string* strMsgEvt = new std::string(ossEvt.str()); - FairMQMessagePtr message(NewMessage( + fair::mq::MessagePtr message(NewMessage( const_cast<char*>(strMsgEvt->c_str()), // data strMsgEvt->length(), // size [](void*, void* object) { delete static_cast<std::string*>(object); }, @@ -780,7 +780,7 @@ bool CbmDeviceBuildDigiEvents::SendDigiEvents(FairMQParts& partsIn) /// Make a new composed messaged with TsHeader + vector of Digi Event + TsMetaData /// FIXME: Find out if possible to use only the boost serializer - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(partsIn.At(0))); // TsHeader partsOut.AddPart(std::move(partsIn.At(partsIn.Size() - 1))); // TsMetaData partsOut.AddPart(std::move(message)); // DigiEvent vector @@ -800,15 +800,15 @@ bool CbmDeviceBuildDigiEvents::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); partsOut.AddPart(std::move(messageHist)); @@ -817,13 +817,13 @@ bool CbmDeviceBuildDigiEvents::SendHistoConfAndData() /// Catch case where no histos are registered! /// => Add empty message if (0 == fvpsHistosFolder.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); partsOut.AddPart(std::move(messageCan)); @@ -832,12 +832,12 @@ bool CbmDeviceBuildDigiEvents::SendHistoConfAndData() /// Catch case where no Canvases are registered! /// => Add empty message if (0 == fvpsCanvasConfig.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); partsOut.AddPart(std::move(msgHistos)); @@ -857,7 +857,7 @@ bool CbmDeviceBuildDigiEvents::SendHistoConfAndData() bool CbmDeviceBuildDigiEvents::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); /// Send message to the common histogram messages queue diff --git a/MQ/mcbm/CbmDeviceBuildDigiEvents.h b/MQ/mcbm/CbmDeviceBuildDigiEvents.h index bbf2166c54..70b230693b 100644 --- a/MQ/mcbm/CbmDeviceBuildDigiEvents.h +++ b/MQ/mcbm/CbmDeviceBuildDigiEvents.h @@ -39,15 +39,15 @@ class TClonesArray; class FairRunOnline; class CbmTsEventHeader; -class CbmDeviceBuildDigiEvents : public FairMQDevice { +class CbmDeviceBuildDigiEvents : public fair::mq::Device { public: CbmDeviceBuildDigiEvents(); virtual ~CbmDeviceBuildDigiEvents(); protected: virtual void InitTask(); - bool HandleData(FairMQParts&, int); - bool HandleCommand(FairMQMessagePtr&, int); + bool HandleData(fair::mq::Parts&, int); + bool HandleCommand(fair::mq::MessagePtr&, int); private: /// Constants @@ -134,8 +134,8 @@ private: bool InitHistograms(); void Finish(); - bool SendEvents(FairMQParts& partsIn); - bool SendDigiEvents(FairMQParts& partsIn); + bool SendEvents(fair::mq::Parts& partsIn); + bool SendDigiEvents(fair::mq::Parts& partsIn); bool SendHistoConfAndData(); bool SendHistograms(); }; diff --git a/MQ/mcbm/CbmDeviceBuildRawEvents.cxx b/MQ/mcbm/CbmDeviceBuildRawEvents.cxx index 606d42d644..7fcd2bae07 100644 --- a/MQ/mcbm/CbmDeviceBuildRawEvents.cxx +++ b/MQ/mcbm/CbmDeviceBuildRawEvents.cxx @@ -87,9 +87,9 @@ try { // nameing convention. It is not avoided that someone sends other // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); @@ -318,7 +318,7 @@ try { fvpsHistosFolder.push_back(psHistoConfig); /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, psHistoConfig); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, psHistoConfig); @@ -341,7 +341,7 @@ try { fvpsCanvasConfig.push_back(psCanvConfig); /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, psCanvConfig); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, psCanvConfig); @@ -377,7 +377,7 @@ bool CbmDeviceBuildRawEvents::IsChannelNameAllowed(std::string channelName) } // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceBuildRawEvents::HandleData(FairMQParts& parts, int /*index*/) +bool CbmDeviceBuildRawEvents::HandleData(fair::mq::Parts& parts, int /*index*/) { fulNumMessages++; LOG(debug) << "Received message number " << fulNumMessages << " with " << parts.Size() << " parts" @@ -483,7 +483,7 @@ bool CbmDeviceBuildRawEvents::HandleData(FairMQParts& parts, int /*index*/) return true; } -bool CbmDeviceBuildRawEvents::SendEvents(FairMQParts& partsIn) +bool CbmDeviceBuildRawEvents::SendEvents(fair::mq::Parts& partsIn) { /// Clear events TClonesArray before usage. fEvents->Delete(); @@ -499,12 +499,12 @@ bool CbmDeviceBuildRawEvents::SendEvents(FairMQParts& partsIn) } /// Serialize the array of events into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, fEvents); RootSerializer().Serialize(*message, fEvents); /// Add it at the end of the input composed message - FairMQParts partsOut(std::move(partsIn)); + fair::mq::Parts partsOut(std::move(partsIn)); partsOut.AddPart(std::move(message)); if (Send(partsOut, fsChannelNameDataOutput) < 0) { @@ -518,7 +518,7 @@ bool CbmDeviceBuildRawEvents::SendEvents(FairMQParts& partsIn) bool CbmDeviceBuildRawEvents::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/mcbm/CbmDeviceBuildRawEvents.h b/MQ/mcbm/CbmDeviceBuildRawEvents.h index 5b79678f85..847bc84228 100644 --- a/MQ/mcbm/CbmDeviceBuildRawEvents.h +++ b/MQ/mcbm/CbmDeviceBuildRawEvents.h @@ -39,15 +39,15 @@ class TClonesArray; class FairRunOnline; class TimesliceMetaData; -class CbmDeviceBuildRawEvents : public FairMQDevice { +class CbmDeviceBuildRawEvents : public fair::mq::Device { public: CbmDeviceBuildRawEvents(); virtual ~CbmDeviceBuildRawEvents(); protected: virtual void InitTask(); - bool HandleData(FairMQParts&, int); - bool HandleCommand(FairMQMessagePtr&, int); + bool HandleData(fair::mq::Parts&, int); + bool HandleCommand(fair::mq::MessagePtr&, int); private: /// Constants @@ -125,7 +125,7 @@ private: bool IsChannelNameAllowed(std::string channelName); void Finish(); - bool SendEvents(FairMQParts& partsIn); + bool SendEvents(fair::mq::Parts& partsIn); bool SendHistograms(); }; diff --git a/MQ/mcbm/CbmDeviceDigiEventSink.cxx b/MQ/mcbm/CbmDeviceDigiEventSink.cxx index f370b9790d..5f29aa28dd 100644 --- a/MQ/mcbm/CbmDeviceDigiEventSink.cxx +++ b/MQ/mcbm/CbmDeviceDigiEventSink.cxx @@ -100,15 +100,15 @@ try { // nameing convention. It is not avoided that someone sends other // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmDeviceDigiEventSink::HandleData); } // if( entry.first.find( "ts" ) - } // for( auto const &entry : fChannels ) + } // for( auto const &entry : GetChannels() ) // InitContainers(); @@ -338,7 +338,7 @@ bool CbmDeviceDigiEventSink::ResetHistograms(bool bResetStartTime) //--------------------------------------------------------------------// // handler is called whenever a message arrives on fsChannelNameMissedTs, with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceDigiEventSink::HandleMissTsData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceDigiEventSink::HandleMissTsData(fair::mq::MessagePtr& msg, int /*index*/) { std::vector<uint64_t> vIndices; std::string msgStrMissTs(static_cast<char*>(msg->GetData()), msg->GetSize()); @@ -358,7 +358,7 @@ bool CbmDeviceDigiEventSink::HandleMissTsData(FairMQMessagePtr& msg, int /*index } //--------------------------------------------------------------------// // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceDigiEventSink::HandleData(FairMQParts& parts, int /*index*/) +bool CbmDeviceDigiEventSink::HandleData(fair::mq::Parts& parts, int /*index*/) { fulNumMessages++; LOG(debug) << "Received message number " << fulNumMessages << " with " << parts.Size() << " parts" @@ -474,7 +474,7 @@ bool CbmDeviceDigiEventSink::HandleData(FairMQParts& parts, int /*index*/) return true; } //--------------------------------------------------------------------// -bool CbmDeviceDigiEventSink::HandleCommand(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceDigiEventSink::HandleCommand(fair::mq::MessagePtr& msg, int /*index*/) { /* std::string sCommand( static_cast< char * >( msg->GetData() ), @@ -685,16 +685,16 @@ bool CbmDeviceDigiEventSink::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); @@ -704,13 +704,13 @@ bool CbmDeviceDigiEventSink::SendHistoConfAndData() /// Catch case where no histos are registered! /// => Add empty message if (0 == fvpsHistosFolder.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); @@ -720,12 +720,12 @@ bool CbmDeviceDigiEventSink::SendHistoConfAndData() /// Catch case where no Canvases are registered! /// => Add empty message if (0 == fvpsCanvasConfig.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); RootSerializer().Serialize(*msgHistos, &fArrayHisto); partsOut.AddPart(std::move(msgHistos)); @@ -745,7 +745,7 @@ bool CbmDeviceDigiEventSink::SendHistoConfAndData() bool CbmDeviceDigiEventSink::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); RootSerializer().Serialize(*message, &fArrayHisto); /// Send message to the common histogram messages queue @@ -809,7 +809,7 @@ void CbmDeviceDigiEventSink::Finish() } -CbmEventTimeslice::CbmEventTimeslice(FairMQParts& parts, bool bDigiEvtInput) +CbmEventTimeslice::CbmEventTimeslice(fair::mq::Parts& parts, bool bDigiEvtInput) { fbDigiEvtInput = bDigiEvtInput; diff --git a/MQ/mcbm/CbmDeviceDigiEventSink.h b/MQ/mcbm/CbmDeviceDigiEventSink.h index 3add315128..3111dd5c6c 100644 --- a/MQ/mcbm/CbmDeviceDigiEventSink.h +++ b/MQ/mcbm/CbmDeviceDigiEventSink.h @@ -53,7 +53,7 @@ class FairRootManager; class CbmEventTimeslice { /// TODO: rename to CbmTsWithEvents public: - CbmEventTimeslice(FairMQParts& parts, bool bDigiEvtInput = false); + CbmEventTimeslice(fair::mq::Parts& parts, bool bDigiEvtInput = false); ~CbmEventTimeslice(); void ExtractSelectedData(bool bExclusiveTrdExtract = true); @@ -83,16 +83,16 @@ public: std::vector<CbmDigiEvent> fvDigiEvents; }; -class CbmDeviceDigiEventSink : public FairMQDevice { +class CbmDeviceDigiEventSink : public fair::mq::Device { public: CbmDeviceDigiEventSink(); virtual ~CbmDeviceDigiEventSink(); protected: virtual void InitTask(); - bool HandleMissTsData(FairMQMessagePtr&, int); - bool HandleData(FairMQParts&, int); - bool HandleCommand(FairMQMessagePtr&, int); + bool HandleMissTsData(fair::mq::MessagePtr&, int); + bool HandleData(fair::mq::Parts&, int); + bool HandleCommand(fair::mq::MessagePtr&, int); virtual void PostRun(); private: diff --git a/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx b/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx index fde19fafdf..216959b9b5 100644 --- a/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx +++ b/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx @@ -90,15 +90,15 @@ try { // nameing convention. It is not avoided that someone sends other // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmDeviceMcbmEventBuilderWin::HandleData); } // if( entry.first.find( "ts" ) - } // for( auto const &entry : fChannels ) + } // for( auto const &entry : GetChannels() ) // InitContainers(); @@ -339,7 +339,7 @@ try { fvpsHistosFolder.push_back(psHistoConfig); /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, psHistoConfig); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, psHistoConfig); @@ -365,7 +365,7 @@ try { fvpsCanvasConfig.push_back(psCanvConfig); /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, psCanvConfig); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, psCanvConfig); @@ -433,8 +433,8 @@ Bool_t CbmDeviceMcbmEventBuilderWin::InitParameters( TList* fParCList ) std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req( NewSimpleMessage(message) ); - FairMQMessagePtr rep( NewMessage() ); + fair::mq::MessagePtr req( NewSimpleMessage(message) ); + fair::mq::MessagePtr rep( NewMessage() ); FairParGenericSet* newObj = nullptr; @@ -464,7 +464,7 @@ Bool_t CbmDeviceMcbmEventBuilderWin::InitParameters( TList* fParCList ) } */ // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceMcbmEventBuilderWin::HandleData(FairMQParts& parts, int /*index*/) +bool CbmDeviceMcbmEventBuilderWin::HandleData(fair::mq::Parts& parts, int /*index*/) { fulNumMessages++; LOG(debug) << "Received message number " << fulNumMessages << " with " << parts.Size() << " parts" @@ -582,7 +582,7 @@ bool CbmDeviceMcbmEventBuilderWin::HandleData(FairMQParts& parts, int /*index*/) return true; } -bool CbmDeviceMcbmEventBuilderWin::SendEvents(FairMQParts& partsIn) +bool CbmDeviceMcbmEventBuilderWin::SendEvents(fair::mq::Parts& partsIn) { /// Clear events TClonesArray before usage. fEvents->Delete(); @@ -600,13 +600,13 @@ bool CbmDeviceMcbmEventBuilderWin::SendEvents(FairMQParts& partsIn) } // for( CbmEvent* event: vEvents ) /// Serialize the array of events into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, fEvents); RootSerializer().Serialize(*message, fEvents); /// Add it at the end of the input composed message /// FIXME: use move or fix addition of new part to avoid full message copy - FairMQParts partsOut(std::move(partsIn)); + fair::mq::Parts partsOut(std::move(partsIn)); partsOut.AddPart(std::move(message)); // /// Get vector from algo @@ -619,7 +619,7 @@ bool CbmDeviceMcbmEventBuilderWin::SendEvents(FairMQParts& partsIn) // std::string* strMsgEvents = new std::string(ossEvents.str()); // // /// Create message - // FairMQMessagePtr msg( NewMessage( const_cast< char * >( strMsgEvents->c_str() ), // data + // fair::mq::MessagePtr msg( NewMessage( const_cast< char * >( strMsgEvents->c_str() ), // data // strMsgEvents->length(), // size // []( void * /*data*/, void* object ){ delete static_cast< std::string * >( object ); }, // strMsgEvents ) ); // object that manages the data @@ -637,7 +637,7 @@ bool CbmDeviceMcbmEventBuilderWin::SendEvents(FairMQParts& partsIn) bool CbmDeviceMcbmEventBuilderWin::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h b/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h index e3af2741ce..37471b3612 100644 --- a/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h +++ b/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h @@ -39,15 +39,15 @@ class TClonesArray; class FairRunOnline; class TimesliceMetaData; -class CbmDeviceMcbmEventBuilderWin : public FairMQDevice { +class CbmDeviceMcbmEventBuilderWin : public fair::mq::Device { public: CbmDeviceMcbmEventBuilderWin(); virtual ~CbmDeviceMcbmEventBuilderWin(); protected: virtual void InitTask(); - bool HandleData(FairMQParts&, int); - bool HandleCommand(FairMQMessagePtr&, int); + bool HandleData(fair::mq::Parts&, int); + bool HandleCommand(fair::mq::MessagePtr&, int); private: /// Constants @@ -130,7 +130,7 @@ private: bool IsChannelNameAllowed(std::string channelName); // Bool_t InitContainers(); void Finish(); - bool SendEvents(FairMQParts& partsIn); + bool SendEvents(fair::mq::Parts& partsIn); bool SendHistograms(); }; diff --git a/MQ/mcbm/CbmDeviceMcbmEventSink.cxx b/MQ/mcbm/CbmDeviceMcbmEventSink.cxx index aa62abde56..25fe284e15 100644 --- a/MQ/mcbm/CbmDeviceMcbmEventSink.cxx +++ b/MQ/mcbm/CbmDeviceMcbmEventSink.cxx @@ -92,15 +92,15 @@ try { // nameing convention. It is not avoided that someone sends other // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmDeviceMcbmEventSink::HandleData); } // if( entry.first.find( "ts" ) - } // for( auto const &entry : fChannels ) + } // for( auto const &entry : GetChannels() ) // InitContainers(); @@ -193,7 +193,7 @@ try { fvpsHistosFolder.push_back( psHistoConfig ); /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist( NewMessage() ); + fair::mq::MessagePtr messageHist( NewMessage() ); // Serialize< BoostSerializer < std::pair< std::string, std::string > > >( *messageHist, psHistoConfig ); BoostSerializer < std::pair< std::string, std::string > >.Serialize( *messageHist, psHistoConfig ); @@ -222,7 +222,7 @@ try { fvpsCanvasConfig.push_back( psCanvConfig ); /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan( NewMessage() ); + fair::mq::MessagePtr messageCan( NewMessage() ); // Serialize< BoostSerializer < std::pair< std::string, std::string > > >( *messageCan, psCanvConfig ); BoostSerializer < std::pair< std::string, std::string > >.Serialize( *messageCan, psCanvConfig ); @@ -293,8 +293,8 @@ Bool_t CbmDeviceMcbmEventSink::InitParameters( TList* fParCList ) std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req( NewSimpleMessage(message) ); - FairMQMessagePtr rep( NewMessage() ); + fair::mq::MessagePtr req( NewSimpleMessage(message) ); + fair::mq::MessagePtr rep( NewMessage() ); FairParGenericSet* newObj = nullptr; @@ -325,7 +325,7 @@ Bool_t CbmDeviceMcbmEventSink::InitParameters( TList* fParCList ) */ //--------------------------------------------------------------------// // handler is called whenever a message arrives on fsChannelNameMissedTs, with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceMcbmEventSink::HandleMissTsData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceMcbmEventSink::HandleMissTsData(fair::mq::MessagePtr& msg, int /*index*/) { std::vector<uint64_t> vIndices; std::string msgStrMissTs(static_cast<char*>(msg->GetData()), msg->GetSize()); @@ -342,7 +342,7 @@ bool CbmDeviceMcbmEventSink::HandleMissTsData(FairMQMessagePtr& msg, int /*index } //--------------------------------------------------------------------// // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceMcbmEventSink::HandleData(FairMQParts& parts, int /*index*/) +bool CbmDeviceMcbmEventSink::HandleData(fair::mq::Parts& parts, int /*index*/) { fulNumMessages++; LOG(debug) << "Received message number " << fulNumMessages << " with " << parts.Size() << " parts" @@ -410,7 +410,7 @@ bool CbmDeviceMcbmEventSink::HandleData(FairMQParts& parts, int /*index*/) return true; } //--------------------------------------------------------------------// -bool CbmDeviceMcbmEventSink::HandleCommand(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceMcbmEventSink::HandleCommand(fair::mq::MessagePtr& msg, int /*index*/) { /* std::string sCommand( static_cast< char * >( msg->GetData() ), @@ -615,7 +615,7 @@ void CbmDeviceMcbmEventSink::DumpTreeEntry() bool CbmDeviceMcbmEventSink::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); @@ -681,7 +681,7 @@ void CbmDeviceMcbmEventSink::Finish() fbFinishDone = kTRUE; } -CbmUnpackedTimeslice::CbmUnpackedTimeslice(FairMQParts& parts) : fEventsArray("CbmEvent", 500) +CbmUnpackedTimeslice::CbmUnpackedTimeslice(fair::mq::Parts& parts) : fEventsArray("CbmEvent", 500) { /// Extract unpacked data from input message uint32_t uPartIdx = 0; diff --git a/MQ/mcbm/CbmDeviceMcbmEventSink.h b/MQ/mcbm/CbmDeviceMcbmEventSink.h index cdac88dc83..a3f56a099c 100644 --- a/MQ/mcbm/CbmDeviceMcbmEventSink.h +++ b/MQ/mcbm/CbmDeviceMcbmEventSink.h @@ -47,7 +47,7 @@ class FairRootManager; class CbmUnpackedTimeslice { /// TODO: rename to CbmTsWithEvents public: - CbmUnpackedTimeslice(FairMQParts& parts); + CbmUnpackedTimeslice(fair::mq::Parts& parts); ~CbmUnpackedTimeslice(); TimesliceMetaData fTsMetaData; @@ -61,16 +61,16 @@ public: TClonesArray fEventsArray; }; -class CbmDeviceMcbmEventSink : public FairMQDevice { +class CbmDeviceMcbmEventSink : public fair::mq::Device { public: CbmDeviceMcbmEventSink(); virtual ~CbmDeviceMcbmEventSink(); protected: virtual void InitTask(); - bool HandleMissTsData(FairMQMessagePtr&, int); - bool HandleData(FairMQParts&, int); - bool HandleCommand(FairMQMessagePtr&, int); + bool HandleMissTsData(fair::mq::MessagePtr&, int); + bool HandleData(fair::mq::Parts&, int); + bool HandleCommand(fair::mq::MessagePtr&, int); private: /// Constants diff --git a/MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx b/MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx index 6b3eb7b0f8..c045f6afc8 100644 --- a/MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx +++ b/MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx @@ -89,15 +89,15 @@ try { // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmDeviceMcbmMonitorPulser::HandleData); } // if( std::string::npos != entry.first.find( fsChannelNameDataInput ) ) - } // for( auto const &entry : fChannels ) + } // for( auto const &entry : GetChannels() ) InitContainers(); } catch (InitTaskError& e) { @@ -142,8 +142,8 @@ Bool_t CbmDeviceMcbmMonitorPulser::InitContainers() std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req( NewSimpleMessage(message) ); - FairMQMessagePtr rep( NewMessage() ); + fair::mq::MessagePtr req( NewSimpleMessage(message) ); + fair::mq::MessagePtr rep( NewMessage() ); FairParGenericSet* newObj = nullptr; @@ -200,7 +200,7 @@ Bool_t CbmDeviceMcbmMonitorPulser::InitContainers() fvpsHistosFolder.push_back( psHistoConfig ); /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist( NewMessage() ); + fair::mq::MessagePtr messageHist( NewMessage() ); // Serialize< BoostSerializer < std::pair< std::string, std::string > > >( *messageHist, psHistoConfig ); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist,psHistoConfig); @@ -230,7 +230,7 @@ Bool_t CbmDeviceMcbmMonitorPulser::InitContainers() fvpsCanvasConfig.push_back( psCanvConfig ); /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan( NewMessage() ); + fair::mq::MessagePtr messageCan( NewMessage() ); // Serialize< BoostSerializer < std::pair< std::string, std::string > > >( *messageCan, psCanvConfig ); BoostSerializer < std::pair< std::string, std::string > >().Serialize( *messageCan, psCanvConfig ); @@ -250,7 +250,7 @@ Bool_t CbmDeviceMcbmMonitorPulser::InitContainers() // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceMcbmMonitorPulser::HandleData(FairMQParts& parts, int /*index*/) +bool CbmDeviceMcbmMonitorPulser::HandleData(fair::mq::Parts& parts, int /*index*/) { fulNumMessages++; @@ -362,7 +362,7 @@ bool CbmDeviceMcbmMonitorPulser::HandleData(FairMQParts& parts, int /*index*/) bool CbmDeviceMcbmMonitorPulser::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/mcbm/CbmDeviceMcbmMonitorPulser.h b/MQ/mcbm/CbmDeviceMcbmMonitorPulser.h index 181b3185f5..298e03732d 100644 --- a/MQ/mcbm/CbmDeviceMcbmMonitorPulser.h +++ b/MQ/mcbm/CbmDeviceMcbmMonitorPulser.h @@ -36,14 +36,14 @@ class TList; //class CbmMcbm2018MonitorAlgoTof; class TimesliceMetaData; -class CbmDeviceMcbmMonitorPulser : public FairMQDevice { +class CbmDeviceMcbmMonitorPulser : public fair::mq::Device { public: CbmDeviceMcbmMonitorPulser(); virtual ~CbmDeviceMcbmMonitorPulser(); protected: virtual void InitTask(); - bool HandleData(FairMQParts&, int); + bool HandleData(fair::mq::Parts&, int); private: /// Constants diff --git a/MQ/mcbm/CbmDeviceMcbmUnpack.cxx b/MQ/mcbm/CbmDeviceMcbmUnpack.cxx index 219e3bc9ba..fad5df8303 100644 --- a/MQ/mcbm/CbmDeviceMcbmUnpack.cxx +++ b/MQ/mcbm/CbmDeviceMcbmUnpack.cxx @@ -82,15 +82,15 @@ try { // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmDeviceMcbmUnpack::HandleData); } // if( entry.first.find( "ts" ) - } // for( auto const &entry : fChannels ) + } // for( auto const &entry : GetChannels() ) InitContainers(); } catch (InitTaskError& e) { @@ -211,8 +211,8 @@ Bool_t CbmDeviceMcbmUnpack::InitParameters(TList* fParCList) std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -238,7 +238,7 @@ Bool_t CbmDeviceMcbmUnpack::InitParameters(TList* fParCList) } // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceMcbmUnpack::HandleData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceMcbmUnpack::HandleData(fair::mq::MessagePtr& msg, int /*index*/) { fulNumMessages++; LOG(debug) << "Received message number " << fulNumMessages << " with size " << msg->GetSize(); @@ -304,7 +304,7 @@ bool CbmDeviceMcbmUnpack::SendUnpData() oaTsMeta << *(fTsMetaData); std::string* strMsgTsMetaE = new std::string(ossTsMeta.str()); */ - FairMQMessagePtr messTsMeta(NewMessage()); + fair::mq::MessagePtr messTsMeta(NewMessage()); // Serialize<RootSerializer>(*messTsMeta, fTsMetaData); RootSerializer().Serialize(*messTsMeta, fTsMetaData); @@ -359,7 +359,7 @@ bool CbmDeviceMcbmUnpack::SendUnpData() oaPsd << fUnpAlgoPsd->GetVector(); std::string* strMsgPsd = new std::string(ossPsd.str()); - FairMQParts parts; + fair::mq::Parts parts; parts.AddPart(std::move(messTsMeta)); /* diff --git a/MQ/mcbm/CbmDeviceMcbmUnpack.h b/MQ/mcbm/CbmDeviceMcbmUnpack.h index 0745a58040..0b66633adf 100644 --- a/MQ/mcbm/CbmDeviceMcbmUnpack.h +++ b/MQ/mcbm/CbmDeviceMcbmUnpack.h @@ -33,15 +33,15 @@ class CbmMcbm2018UnpackerAlgoRich; class CbmMcbm2018UnpackerAlgoPsd; class TimesliceMetaData; -class CbmDeviceMcbmUnpack : public FairMQDevice { +class CbmDeviceMcbmUnpack : public fair::mq::Device { public: CbmDeviceMcbmUnpack(); virtual ~CbmDeviceMcbmUnpack(); protected: virtual void InitTask(); - bool HandleData(FairMQMessagePtr&, int); - bool HandleCommand(FairMQMessagePtr&, int); + bool HandleData(fair::mq::MessagePtr&, int); + bool HandleCommand(fair::mq::MessagePtr&, int); private: /// Constants diff --git a/MQ/mcbm/CbmDeviceUnpack.cxx b/MQ/mcbm/CbmDeviceUnpack.cxx index 473bac0069..d5c38ead1d 100644 --- a/MQ/mcbm/CbmDeviceUnpack.cxx +++ b/MQ/mcbm/CbmDeviceUnpack.cxx @@ -98,8 +98,8 @@ Bool_t CbmDeviceUnpack::InitContainers() // ----- CbmSetup ----------------------------------------------------- // TODO: support for multiple setups on Par Server? with request containing setup name? CbmSetup* cbmsetup = CbmSetup::Instance(); - FairMQMessagePtr req(NewSimpleMessage("setup")); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage("setup")); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, "parameters") > 0) { if (Receive(rep, "parameters") >= 0) { @@ -629,8 +629,8 @@ CbmDeviceUnpack::InitParameters(std::vector<std::pair<std::string, std::shared_p std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -721,8 +721,8 @@ bool CbmDeviceUnpack::ConditionalRun() /// First request a new TS (full one) std::string message = "full"; LOG(debug) << "Requesting new TS by sending message: full" << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, fsChannelNameDataInput) <= 0) { LOG(error) << "Failed to send the request! message was " << message; @@ -820,10 +820,10 @@ bool CbmDeviceUnpack::ConditionalRun() bool CbmDeviceUnpack::SendUnpData() { - FairMQParts parts; + fair::mq::Parts parts; /// Prepare serialized versions of the TS Event header - FairMQMessagePtr messTsHeader(NewMessage()); + fair::mq::MessagePtr messTsHeader(NewMessage()); // Serialize<RootSerializer>(*messTsHeader, fCbmTsEventHeader); RootSerializer().Serialize(*messTsHeader, fCbmTsEventHeader); @@ -952,7 +952,7 @@ bool CbmDeviceUnpack::SendUnpData() /// Prepare serialized versions of the TS Meta /// FIXME: only for TS duration and overlap, should be sent to parameter service instead as stable values in run /// Index and start time are already included in the TsHeader object! - FairMQMessagePtr messTsMeta(NewMessage()); + fair::mq::MessagePtr messTsMeta(NewMessage()); // Serialize<RootSerializer>(*messTsMeta, fTsMetaData); RootSerializer().Serialize(*messTsMeta, fTsMetaData); parts.AddPart(std::move(messTsMeta)); @@ -970,15 +970,15 @@ bool CbmDeviceUnpack::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); @@ -988,13 +988,13 @@ bool CbmDeviceUnpack::SendHistoConfAndData() /// Catch case where no histos are registered! /// => Add empty message if (0 == fvpsHistosFolder.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); @@ -1004,12 +1004,12 @@ bool CbmDeviceUnpack::SendHistoConfAndData() /// Catch case where no Canvases are registered! /// => Add empty message if (0 == fvpsCanvasConfig.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); partsOut.AddPart(std::move(msgHistos)); @@ -1029,7 +1029,7 @@ bool CbmDeviceUnpack::SendHistoConfAndData() bool CbmDeviceUnpack::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/mcbm/CbmDeviceUnpack.h b/MQ/mcbm/CbmDeviceUnpack.h index acfdfdb719..b0165db5b6 100644 --- a/MQ/mcbm/CbmDeviceUnpack.h +++ b/MQ/mcbm/CbmDeviceUnpack.h @@ -41,7 +41,7 @@ class TimesliceMetaData; class CbmTrdSpadic; -class CbmDeviceUnpack : public FairMQDevice { +class CbmDeviceUnpack : public fair::mq::Device { public: CbmDeviceUnpack(); virtual ~CbmDeviceUnpack(); @@ -49,7 +49,7 @@ public: protected: virtual void InitTask(); bool ConditionalRun(); - bool HandleCommand(FairMQMessagePtr&, int); + bool HandleCommand(fair::mq::MessagePtr&, int); /** @brief Set the Bmon Unpack Config @param config */ void SetUnpackConfig(std::shared_ptr<CbmBmonUnpackConfig> config) { fBmonConfig = config; } diff --git a/MQ/mcbm/runBmonMonitor.cxx b/MQ/mcbm/runBmonMonitor.cxx index 43177e5238..0370f4c5d0 100644 --- a/MQ/mcbm/runBmonMonitor.cxx +++ b/MQ/mcbm/runBmonMonitor.cxx @@ -38,4 +38,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceBmonMonitor(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceBmonMonitor(); } diff --git a/MQ/mcbm/runBuildDigiEvents.cxx b/MQ/mcbm/runBuildDigiEvents.cxx index 770e1484bb..2b4750b75d 100644 --- a/MQ/mcbm/runBuildDigiEvents.cxx +++ b/MQ/mcbm/runBuildDigiEvents.cxx @@ -61,4 +61,4 @@ void addCustomOptions(bpo::options_description& options) "Maximal time between two publishing"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceBuildDigiEvents(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceBuildDigiEvents(); } diff --git a/MQ/mcbm/runBuildRawEvents.cxx b/MQ/mcbm/runBuildRawEvents.cxx index 4857f2fd4e..08706d4515 100644 --- a/MQ/mcbm/runBuildRawEvents.cxx +++ b/MQ/mcbm/runBuildRawEvents.cxx @@ -49,4 +49,4 @@ void addCustomOptions(bpo::options_description& options) "Maximal time between two publishing"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceBuildRawEvents(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceBuildRawEvents(); } diff --git a/MQ/mcbm/runDigiEventSink.cxx b/MQ/mcbm/runDigiEventSink.cxx index 450a156b7d..7694141a96 100644 --- a/MQ/mcbm/runDigiEventSink.cxx +++ b/MQ/mcbm/runDigiEventSink.cxx @@ -50,4 +50,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceDigiEventSink(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceDigiEventSink(); } diff --git a/MQ/mcbm/runMcbmEventSink.cxx b/MQ/mcbm/runMcbmEventSink.cxx index 1577c2491c..9d9d623e5c 100644 --- a/MQ/mcbm/runMcbmEventSink.cxx +++ b/MQ/mcbm/runMcbmEventSink.cxx @@ -33,4 +33,4 @@ void addCustomOptions(bpo::options_description& options) "Maximal time between two publishing"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMcbmEventSink(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMcbmEventSink(); } diff --git a/MQ/mcbm/runMcbmEvtBuilderWin.cxx b/MQ/mcbm/runMcbmEvtBuilderWin.cxx index 1ab51c9600..6c9c749cdb 100644 --- a/MQ/mcbm/runMcbmEvtBuilderWin.cxx +++ b/MQ/mcbm/runMcbmEvtBuilderWin.cxx @@ -49,4 +49,4 @@ void addCustomOptions(bpo::options_description& options) "Maximal time between two publishing"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMcbmEventBuilderWin(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMcbmEventBuilderWin(); } diff --git a/MQ/mcbm/runMcbmMonitorPulser.cxx b/MQ/mcbm/runMcbmMonitorPulser.cxx index 215a3a373f..c3572e759b 100644 --- a/MQ/mcbm/runMcbmMonitorPulser.cxx +++ b/MQ/mcbm/runMcbmMonitorPulser.cxx @@ -33,4 +33,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for canvases config"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMcbmMonitorPulser(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMcbmMonitorPulser(); } diff --git a/MQ/mcbm/runMcbmUnpack.cxx b/MQ/mcbm/runMcbmUnpack.cxx index 7b88b34d70..5557d2714e 100644 --- a/MQ/mcbm/runMcbmUnpack.cxx +++ b/MQ/mcbm/runMcbmUnpack.cxx @@ -24,4 +24,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for unpacked TS data"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMcbmUnpack(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMcbmUnpack(); } diff --git a/MQ/mcbm/runUnpack.cxx b/MQ/mcbm/runUnpack.cxx index 95332c7479..16c3bc33be 100644 --- a/MQ/mcbm/runUnpack.cxx +++ b/MQ/mcbm/runUnpack.cxx @@ -45,4 +45,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceUnpack(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceUnpack(); } diff --git a/MQ/monitor/CbmDeviceMonitorBmon.cxx b/MQ/monitor/CbmDeviceMonitorBmon.cxx index f87f44169a..2b9bb5650f 100644 --- a/MQ/monitor/CbmDeviceMonitorBmon.cxx +++ b/MQ/monitor/CbmDeviceMonitorBmon.cxx @@ -119,15 +119,15 @@ try { // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmDeviceMonitorBmon::HandleData); } // if( entry.first.find( "ts" ) - } // for( auto const &entry : fChannels ) + } // for( auto const &entry : GetChannels() ) } catch (InitTaskError& e) { LOG(error) << e.what(); @@ -169,8 +169,8 @@ bool CbmDeviceMonitorBmon::InitContainers() std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -256,7 +256,7 @@ bool CbmDeviceMonitorBmon::InitHistograms() // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceMonitorBmon::HandleData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceMonitorBmon::HandleData(fair::mq::MessagePtr& msg, int /*index*/) { if (0 == fulNumMessages) { @@ -311,16 +311,16 @@ bool CbmDeviceMonitorBmon::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); @@ -329,7 +329,7 @@ bool CbmDeviceMonitorBmon::SendHistoConfAndData() for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); @@ -337,7 +337,7 @@ bool CbmDeviceMonitorBmon::SendHistoConfAndData() } // for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); @@ -358,7 +358,7 @@ bool CbmDeviceMonitorBmon::SendHistoConfAndData() bool CbmDeviceMonitorBmon::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/monitor/CbmDeviceMonitorBmon.h b/MQ/monitor/CbmDeviceMonitorBmon.h index 70e23122e0..36c70ee4ae 100644 --- a/MQ/monitor/CbmDeviceMonitorBmon.h +++ b/MQ/monitor/CbmDeviceMonitorBmon.h @@ -28,14 +28,14 @@ class TList; class CbmMcbm2018MonitorAlgoBmon; -class CbmDeviceMonitorBmon : public FairMQDevice { +class CbmDeviceMonitorBmon : public fair::mq::Device { public: CbmDeviceMonitorBmon(); virtual ~CbmDeviceMonitorBmon(); protected: virtual void InitTask(); - bool HandleData(FairMQMessagePtr&, int); + bool HandleData(fair::mq::MessagePtr&, int); private: /// Constants diff --git a/MQ/monitor/CbmDeviceMonitorPsd.cxx b/MQ/monitor/CbmDeviceMonitorPsd.cxx index 9748da2d16..a4e0d7f1f4 100644 --- a/MQ/monitor/CbmDeviceMonitorPsd.cxx +++ b/MQ/monitor/CbmDeviceMonitorPsd.cxx @@ -105,15 +105,15 @@ try { // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmDeviceMonitorPsd::HandleData); } // if( entry.first.find( "ts" ) - } // for( auto const &entry : fChannels ) + } // for( auto const &entry : GetChannels() ) InitContainers(); } catch (InitTaskError& e) { @@ -157,8 +157,8 @@ Bool_t CbmDeviceMonitorPsd::InitContainers() std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -217,7 +217,7 @@ Bool_t CbmDeviceMonitorPsd::InitContainers() fvpsHistosFolder.push_back(psHistoConfig); /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, psHistoConfig); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, psHistoConfig); @@ -244,7 +244,7 @@ Bool_t CbmDeviceMonitorPsd::InitContainers() fvpsCanvasConfig.push_back(psCanvConfig); /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, psCanvConfig); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, psCanvConfig); @@ -262,7 +262,7 @@ Bool_t CbmDeviceMonitorPsd::InitContainers() // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceMonitorPsd::HandleData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceMonitorPsd::HandleData(fair::mq::MessagePtr& msg, int /*index*/) { fulNumMessages++; LOG(debug) << "Received message number " << fulNumMessages << " with size " << msg->GetSize(); @@ -297,7 +297,7 @@ bool CbmDeviceMonitorPsd::HandleData(FairMQMessagePtr& msg, int /*index*/) bool CbmDeviceMonitorPsd::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/monitor/CbmDeviceMonitorPsd.h b/MQ/monitor/CbmDeviceMonitorPsd.h index dc9e8413ca..32f2981bce 100644 --- a/MQ/monitor/CbmDeviceMonitorPsd.h +++ b/MQ/monitor/CbmDeviceMonitorPsd.h @@ -29,14 +29,14 @@ class TList; class CbmMcbm2018MonitorAlgoPsd; -class CbmDeviceMonitorPsd : public FairMQDevice { +class CbmDeviceMonitorPsd : public fair::mq::Device { public: CbmDeviceMonitorPsd(); virtual ~CbmDeviceMonitorPsd(); protected: virtual void InitTask(); - bool HandleData(FairMQMessagePtr&, int); + bool HandleData(fair::mq::MessagePtr&, int); private: /// Constants diff --git a/MQ/monitor/CbmDeviceMonitorReqBmon.cxx b/MQ/monitor/CbmDeviceMonitorReqBmon.cxx index 93aba473b5..5e52154664 100644 --- a/MQ/monitor/CbmDeviceMonitorReqBmon.cxx +++ b/MQ/monitor/CbmDeviceMonitorReqBmon.cxx @@ -104,8 +104,8 @@ bool CbmDeviceMonitorReqBmon::InitContainers() std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -196,8 +196,8 @@ bool CbmDeviceMonitorReqBmon::ConditionalRun() std::string message = fsTsBlockName; if ("" == message) message = std::to_string(kusSysId); LOG(debug) << "Requesting new TS by sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, fsChannelNameDataInput) <= 0) { LOG(error) << "Failed to send the request! message was " << message; @@ -265,16 +265,16 @@ bool CbmDeviceMonitorReqBmon::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); partsOut.AddPart(std::move(messageHist)); @@ -282,14 +282,14 @@ bool CbmDeviceMonitorReqBmon::SendHistoConfAndData() for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); partsOut.AddPart(std::move(messageCan)); } // for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); @@ -310,7 +310,7 @@ bool CbmDeviceMonitorReqBmon::SendHistoConfAndData() bool CbmDeviceMonitorReqBmon::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/monitor/CbmDeviceMonitorReqBmon.h b/MQ/monitor/CbmDeviceMonitorReqBmon.h index 24040b4319..69ece8b443 100644 --- a/MQ/monitor/CbmDeviceMonitorReqBmon.h +++ b/MQ/monitor/CbmDeviceMonitorReqBmon.h @@ -21,7 +21,7 @@ class TList; class CbmMcbm2018MonitorAlgoBmon; -class CbmDeviceMonitorReqBmon : public FairMQDevice { +class CbmDeviceMonitorReqBmon : public fair::mq::Device { public: CbmDeviceMonitorReqBmon(); virtual ~CbmDeviceMonitorReqBmon(); diff --git a/MQ/monitor/CbmDeviceMonitorReqTof.cxx b/MQ/monitor/CbmDeviceMonitorReqTof.cxx index 6a0863cda0..800567edbf 100644 --- a/MQ/monitor/CbmDeviceMonitorReqTof.cxx +++ b/MQ/monitor/CbmDeviceMonitorReqTof.cxx @@ -88,8 +88,8 @@ Bool_t CbmDeviceMonitorReqTof::InitContainers() std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -175,8 +175,8 @@ bool CbmDeviceMonitorReqTof::ConditionalRun() std::string message = fsTsBlockName; if ("" == message) message = std::to_string(kusSysIdTof); LOG(debug) << "Requesting new TS by sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, fsChannelNameDataInput) <= 0) { LOG(error) << "Failed to send the request! message was " << message; @@ -245,16 +245,16 @@ bool CbmDeviceMonitorReqTof::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); @@ -263,7 +263,7 @@ bool CbmDeviceMonitorReqTof::SendHistoConfAndData() for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); @@ -271,7 +271,7 @@ bool CbmDeviceMonitorReqTof::SendHistoConfAndData() } // for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); @@ -292,7 +292,7 @@ bool CbmDeviceMonitorReqTof::SendHistoConfAndData() bool CbmDeviceMonitorReqTof::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/monitor/CbmDeviceMonitorReqTof.h b/MQ/monitor/CbmDeviceMonitorReqTof.h index 9c9099074b..11025d5eb6 100644 --- a/MQ/monitor/CbmDeviceMonitorReqTof.h +++ b/MQ/monitor/CbmDeviceMonitorReqTof.h @@ -21,7 +21,7 @@ class TList; class CbmMcbm2018MonitorAlgoTof; -class CbmDeviceMonitorReqTof : public FairMQDevice { +class CbmDeviceMonitorReqTof : public fair::mq::Device { public: CbmDeviceMonitorReqTof(); virtual ~CbmDeviceMonitorReqTof(); diff --git a/MQ/monitor/CbmDeviceMonitorTof.cxx b/MQ/monitor/CbmDeviceMonitorTof.cxx index e087f7d5e6..450610b46d 100644 --- a/MQ/monitor/CbmDeviceMonitorTof.cxx +++ b/MQ/monitor/CbmDeviceMonitorTof.cxx @@ -82,15 +82,15 @@ try { // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (std::string::npos != entry.first.find(fsChannelNameDataInput)) { if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmDeviceMonitorTof::HandleData); } // if( std::string::npos != entry.first.find( fsChannelNameDataInput ) ) - } // for( auto const &entry : fChannels ) + } // for( auto const &entry : GetChannels() ) } catch (InitTaskError& e) { LOG(error) << e.what(); @@ -133,8 +133,8 @@ Bool_t CbmDeviceMonitorTof::InitContainers() std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -215,7 +215,7 @@ bool CbmDeviceMonitorTof::InitHistograms() // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceMonitorTof::HandleData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceMonitorTof::HandleData(fair::mq::MessagePtr& msg, int /*index*/) { if (0 == fulNumMessages) { try { @@ -269,16 +269,16 @@ bool CbmDeviceMonitorTof::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); @@ -287,7 +287,7 @@ bool CbmDeviceMonitorTof::SendHistoConfAndData() for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); @@ -295,7 +295,7 @@ bool CbmDeviceMonitorTof::SendHistoConfAndData() } // for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); @@ -316,7 +316,7 @@ bool CbmDeviceMonitorTof::SendHistoConfAndData() bool CbmDeviceMonitorTof::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/monitor/CbmDeviceMonitorTof.h b/MQ/monitor/CbmDeviceMonitorTof.h index 7a174c4d3b..804dda0942 100644 --- a/MQ/monitor/CbmDeviceMonitorTof.h +++ b/MQ/monitor/CbmDeviceMonitorTof.h @@ -28,14 +28,14 @@ class TList; class CbmMcbm2018MonitorAlgoTof; -class CbmDeviceMonitorTof : public FairMQDevice { +class CbmDeviceMonitorTof : public fair::mq::Device { public: CbmDeviceMonitorTof(); virtual ~CbmDeviceMonitorTof(); protected: virtual void InitTask(); - bool HandleData(FairMQMessagePtr&, int); + bool HandleData(fair::mq::MessagePtr&, int); private: /// Constants diff --git a/MQ/monitor/runMonitorBmon.cxx b/MQ/monitor/runMonitorBmon.cxx index 240419241d..01ae65c94e 100644 --- a/MQ/monitor/runMonitorBmon.cxx +++ b/MQ/monitor/runMonitorBmon.cxx @@ -37,4 +37,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMonitorBmon(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMonitorBmon(); } diff --git a/MQ/monitor/runMonitorPsd.cxx b/MQ/monitor/runMonitorPsd.cxx index cb07240ae6..70a21a4d34 100644 --- a/MQ/monitor/runMonitorPsd.cxx +++ b/MQ/monitor/runMonitorPsd.cxx @@ -39,4 +39,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for canvases config"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMonitorPsd(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMonitorPsd(); } diff --git a/MQ/monitor/runMonitorReqBmon.cxx b/MQ/monitor/runMonitorReqBmon.cxx index 7a1b6267d8..48069e08c9 100644 --- a/MQ/monitor/runMonitorReqBmon.cxx +++ b/MQ/monitor/runMonitorReqBmon.cxx @@ -39,4 +39,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMonitorReqBmon(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMonitorReqBmon(); } diff --git a/MQ/monitor/runMonitorReqTof.cxx b/MQ/monitor/runMonitorReqTof.cxx index cc0a5ed50a..2af5572d72 100644 --- a/MQ/monitor/runMonitorReqTof.cxx +++ b/MQ/monitor/runMonitorReqTof.cxx @@ -36,4 +36,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMonitorReqTof(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMonitorReqTof(); } diff --git a/MQ/monitor/runMonitorTof.cxx b/MQ/monitor/runMonitorTof.cxx index 985fbfff92..7771a455b8 100644 --- a/MQ/monitor/runMonitorTof.cxx +++ b/MQ/monitor/runMonitorTof.cxx @@ -34,4 +34,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceMonitorTof(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceMonitorTof(); } diff --git a/MQ/parmq/ParameterMQServer.cxx b/MQ/parmq/ParameterMQServer.cxx index 8703861ca1..751a14f225 100644 --- a/MQ/parmq/ParameterMQServer.cxx +++ b/MQ/parmq/ParameterMQServer.cxx @@ -159,7 +159,7 @@ void ParameterMQServer::Run() FairParGenericSet* par = nullptr; while (cbm::mq::CheckCurrentState(this, cbm::mq::State::Running)) { - FairMQMessagePtr req(NewMessage()); + fair::mq::MessagePtr req(NewMessage()); if (Receive(req, fChannelName, 0) > 0) { string reqStr(static_cast<char*>(req->GetData()), req->GetSize()); @@ -174,7 +174,7 @@ void ParameterMQServer::Run() TMessage* tmsg = new TMessage(kMESS_OBJECT); tmsg->WriteObject(&exchangableSetup); - FairMQMessagePtr rep(NewMessage( + fair::mq::MessagePtr rep(NewMessage( tmsg->Buffer(), tmsg->BufferSize(), [](void* /*data*/, void* object) { delete static_cast<TMessage*>(object); }, tmsg)); @@ -186,7 +186,7 @@ void ParameterMQServer::Run() else { LOG(error) << "CbmSetup uninitialized!"; // Send an empty message back to keep the REQ/REP cycle - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr rep(NewMessage()); if (Send(rep, fChannelName, 0) < 0) { LOG(error) << "failed sending reply to Setup request"; break; @@ -217,7 +217,7 @@ void ParameterMQServer::Run() TMessage* tmsg = new TMessage(kMESS_OBJECT); tmsg->WriteObject(par); - FairMQMessagePtr rep(NewMessage( + fair::mq::MessagePtr rep(NewMessage( tmsg->Buffer(), tmsg->BufferSize(), [](void* /*data*/, void* object) { delete static_cast<TMessage*>(object); }, tmsg)); @@ -229,7 +229,7 @@ void ParameterMQServer::Run() else { LOG(error) << "Parameter uninitialized!"; // Send an empty message back to keep the REQ/REP cycle - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr rep(NewMessage()); if (Send(rep, fChannelName, 0) < 0) { LOG(error) << "failed sending reply"; break; diff --git a/MQ/parmq/ParameterMQServer.h b/MQ/parmq/ParameterMQServer.h index 949b293e08..0c8c9d7eda 100644 --- a/MQ/parmq/ParameterMQServer.h +++ b/MQ/parmq/ParameterMQServer.h @@ -22,7 +22,7 @@ class FairRuntimeDb; class CbmSetup; -class ParameterMQServer : public FairMQDevice { +class ParameterMQServer : public fair::mq::Device { public: ParameterMQServer(); diff --git a/MQ/parmq/runParameterMQServer.cxx b/MQ/parmq/runParameterMQServer.cxx index e9d58b2a60..34a4329c83 100644 --- a/MQ/parmq/runParameterMQServer.cxx +++ b/MQ/parmq/runParameterMQServer.cxx @@ -38,4 +38,4 @@ void addCustomOptions(bpo::options_description& options) options.add_options()("setup", bpo::value<std::string>()->default_value(""), "Name/tag of the geomatry setup"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new ParameterMQServer(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new ParameterMQServer(); } diff --git a/MQ/sink/CbmDevNullSink.cxx b/MQ/sink/CbmDevNullSink.cxx index 35ece92be3..a43afd9f7e 100644 --- a/MQ/sink/CbmDevNullSink.cxx +++ b/MQ/sink/CbmDevNullSink.cxx @@ -23,16 +23,16 @@ void CbmDevNullSink::Init() {} void CbmDevNullSink::InitTask() { // register a handler for data arriving on any channel - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined input channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; OnData(entry.first, &CbmDevNullSink::HandleData); } } // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDevNullSink::HandleData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDevNullSink::HandleData(fair::mq::MessagePtr& msg, int /*index*/) { // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add diff --git a/MQ/sink/CbmDevNullSink.h b/MQ/sink/CbmDevNullSink.h index 9e8f0e9bdf..d2a5f498e2 100644 --- a/MQ/sink/CbmDevNullSink.h +++ b/MQ/sink/CbmDevNullSink.h @@ -14,7 +14,7 @@ #include "FairMQDevice.h" -class CbmDevNullSink : public FairMQDevice { +class CbmDevNullSink : public fair::mq::Device { public: CbmDevNullSink(); virtual ~CbmDevNullSink(); @@ -22,7 +22,7 @@ public: protected: virtual void InitTask(); virtual void Init(); - bool HandleData(FairMQMessagePtr&, int); + bool HandleData(fair::mq::MessagePtr&, int); private: uint64_t fNumMessages; diff --git a/MQ/sink/CbmTsaComponentSink.cxx b/MQ/sink/CbmTsaComponentSink.cxx index a05c0344b1..992ec2244a 100644 --- a/MQ/sink/CbmTsaComponentSink.cxx +++ b/MQ/sink/CbmTsaComponentSink.cxx @@ -40,9 +40,9 @@ try { // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined input channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); OnData(entry.first, &CbmTsaComponentSink::HandleData); @@ -75,7 +75,7 @@ bool CbmTsaComponentSink::IsChannelNameAllowed(std::string channelName) // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmTsaComponentSink::HandleData(FairMQMessagePtr& msg, int /*index*/) +bool CbmTsaComponentSink::HandleData(fair::mq::MessagePtr& msg, int /*index*/) { // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add diff --git a/MQ/sink/CbmTsaComponentSink.h b/MQ/sink/CbmTsaComponentSink.h index d7d0aa2a90..dfe293e371 100644 --- a/MQ/sink/CbmTsaComponentSink.h +++ b/MQ/sink/CbmTsaComponentSink.h @@ -17,14 +17,14 @@ #include "FairMQDevice.h" -class CbmTsaComponentSink : public FairMQDevice { +class CbmTsaComponentSink : public fair::mq::Device { public: CbmTsaComponentSink(); virtual ~CbmTsaComponentSink(); protected: virtual void InitTask(); - bool HandleData(FairMQMessagePtr&, int); + bool HandleData(fair::mq::MessagePtr&, int); private: uint64_t fNumMessages; diff --git a/MQ/sink/runDevNullSink.cxx b/MQ/sink/runDevNullSink.cxx index 6ef22271a5..225703abf7 100644 --- a/MQ/sink/runDevNullSink.cxx +++ b/MQ/sink/runDevNullSink.cxx @@ -14,4 +14,4 @@ void addCustomOptions(bpo::options_description& /*options*/) // ("max-iterations", bpo::value<uint64_t>()->default_value(0), "Maximum number of iterations of Run/ConditionalRun/OnData (0 - infinite)"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDevNullSink(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDevNullSink(); } diff --git a/MQ/sink/runTsaComponentSink.cxx b/MQ/sink/runTsaComponentSink.cxx index 43df1af2b1..199e87e120 100644 --- a/MQ/sink/runTsaComponentSink.cxx +++ b/MQ/sink/runTsaComponentSink.cxx @@ -10,4 +10,4 @@ namespace bpo = boost::program_options; void addCustomOptions(bpo::options_description& /*options*/) {} -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmTsaComponentSink(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmTsaComponentSink(); } diff --git a/MQ/source/CbmMQTsSamplerRepReq.cxx b/MQ/source/CbmMQTsSamplerRepReq.cxx index b8fa2f6a50..ecbe47c472 100644 --- a/MQ/source/CbmMQTsSamplerRepReq.cxx +++ b/MQ/source/CbmMQTsSamplerRepReq.cxx @@ -51,7 +51,7 @@ struct InitTaskError : std::runtime_error { }; CbmMQTsSamplerRepReq::CbmMQTsSamplerRepReq() - : FairMQDevice() + : fair::mq::Device() , fTime() , fLastPublishTime {std::chrono::system_clock::now()} { @@ -368,7 +368,7 @@ bool CbmMQTsSamplerRepReq::InitHistograms() return true; } -bool CbmMQTsSamplerRepReq::HandleRequest(FairMQMessagePtr& msgReq, int) +bool CbmMQTsSamplerRepReq::HandleRequest(fair::mq::MessagePtr& msgReq, int) { /// Initialize the histograms if (0 < fuPublishFreqTs && 0 == fulTsCounter) { InitHistograms(); } // if( 0 < fuPublishFreqTs ) @@ -864,7 +864,7 @@ bool CbmMQTsSamplerRepReq::SendFirstTsIndex() oa << sIndex; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, @@ -892,7 +892,7 @@ bool CbmMQTsSamplerRepReq::SendData(const fles::StorableTimeslice& component) oa << component; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, @@ -920,7 +920,7 @@ bool CbmMQTsSamplerRepReq::SendMissedTsIdx(std::vector<uint64_t> vIndices) oa << vIndices; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, @@ -946,13 +946,13 @@ bool CbmMQTsSamplerRepReq::SendCommand(std::string sCommand) oa << sCommand; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, strMsg)); // object that manages the data - // FairMQMessagePtr msg( NewMessage( const_cast<char*>( sCommand.c_str() ), // data + // fair::mq::MessagePtr msg( NewMessage( const_cast<char*>( sCommand.c_str() ), // data // sCommand.length(), // size // []( void* /*data*/, void* object ){ delete static_cast< std::string * >( object ); }, // &sCommand ) ); // object that manages the data @@ -973,16 +973,16 @@ bool CbmMQTsSamplerRepReq::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); @@ -992,13 +992,13 @@ bool CbmMQTsSamplerRepReq::SendHistoConfAndData() /// Catch case where no histos are registered! /// => Add empty message if (0 == fvpsHistosFolder.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); @@ -1008,12 +1008,12 @@ bool CbmMQTsSamplerRepReq::SendHistoConfAndData() /// Catch case where no Canvases are registered! /// => Add empty message if (0 == fvpsCanvasConfig.size()) { - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); partsOut.AddPart(std::move(messageHist)); } /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); @@ -1034,7 +1034,7 @@ bool CbmMQTsSamplerRepReq::SendHistoConfAndData() bool CbmMQTsSamplerRepReq::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/source/CbmMQTsSamplerRepReq.h b/MQ/source/CbmMQTsSamplerRepReq.h index 21d9426148..571fa93a2b 100644 --- a/MQ/source/CbmMQTsSamplerRepReq.h +++ b/MQ/source/CbmMQTsSamplerRepReq.h @@ -33,7 +33,7 @@ class TProfile; #include <utility> #include <vector> -class CbmMQTsSamplerRepReq : public FairMQDevice { +class CbmMQTsSamplerRepReq : public fair::mq::Device { public: CbmMQTsSamplerRepReq(); virtual ~CbmMQTsSamplerRepReq(); @@ -66,7 +66,7 @@ protected: uint64_t fulMessageCounter = 0; virtual void InitTask(); - bool HandleRequest(FairMQMessagePtr&, int); + bool HandleRequest(fair::mq::MessagePtr&, int); private: void CalcRuntime(); diff --git a/MQ/source/CbmMQTsaInfo.cxx b/MQ/source/CbmMQTsaInfo.cxx index f6271cc698..7159b8a7fb 100644 --- a/MQ/source/CbmMQTsaInfo.cxx +++ b/MQ/source/CbmMQTsaInfo.cxx @@ -39,7 +39,7 @@ struct InitTaskError : std::runtime_error { CbmMQTsaInfo::CbmMQTsaInfo() - : FairMQDevice() + : fair::mq::Device() , fMaxTimeslices(0) , fFileName("") , fInputFileList() @@ -76,9 +76,9 @@ try { // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined output channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); } diff --git a/MQ/source/CbmMQTsaInfo.h b/MQ/source/CbmMQTsaInfo.h index e87ffb419e..078aeba69f 100644 --- a/MQ/source/CbmMQTsaInfo.h +++ b/MQ/source/CbmMQTsaInfo.h @@ -25,7 +25,7 @@ #include <string> #include <vector> -class CbmMQTsaInfo : public FairMQDevice { +class CbmMQTsaInfo : public fair::mq::Device { public: CbmMQTsaInfo(); virtual ~CbmMQTsaInfo(); diff --git a/MQ/source/CbmMQTsaMultiSampler.cxx b/MQ/source/CbmMQTsaMultiSampler.cxx index d2c45e248b..0dbf23790b 100644 --- a/MQ/source/CbmMQTsaMultiSampler.cxx +++ b/MQ/source/CbmMQTsaMultiSampler.cxx @@ -15,6 +15,7 @@ #include "CbmFlesCanvasTools.h" #include "CbmFormatDecHexPrintout.h" +#include "TimesliceAutoSource.hpp" #include "TimesliceInputArchive.hpp" #include "TimesliceMultiInputArchive.hpp" #include "TimesliceMultiSubscriber.hpp" @@ -201,9 +202,9 @@ try { // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined output channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { /// Catches and ignores the channels for missing TS indices and commands /// Same for the histogram channels if (entry.first == fsChannelNameMissedTs || entry.first == fsChannelNameCommands @@ -391,7 +392,7 @@ bool CbmMQTsaMultiSampler::InitHistograms() fvpsHistosFolder.push_back(psHistoConfig); /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, psHistoConfig); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, psHistoConfig); @@ -417,7 +418,7 @@ bool CbmMQTsaMultiSampler::InitHistograms() fvpsCanvasConfig.push_back(psCanvConfig); /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, psCanvConfig); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, psCanvConfig); @@ -840,7 +841,7 @@ bool CbmMQTsaMultiSampler::SendData(const fles::StorableTimeslice& component, in oa << component; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, @@ -875,7 +876,7 @@ bool CbmMQTsaMultiSampler::SendData(const fles::StorableTimeslice& component, st oa << component; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, @@ -904,7 +905,7 @@ bool CbmMQTsaMultiSampler::SendMissedTsIdx(std::vector<uint64_t> vIndices) oa << vIndices; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, @@ -930,13 +931,13 @@ bool CbmMQTsaMultiSampler::SendCommand(std::string sCommand) oa << sCommand; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, strMsg)); // object that manages the data - // FairMQMessagePtr msg( NewMessage( const_cast<char*>( sCommand.c_str() ), // data + // fair::mq::MessagePtr msg( NewMessage( const_cast<char*>( sCommand.c_str() ), // data // sCommand.length(), // size // []( void* /*data*/, void* object ){ delete static_cast< std::string * >( object ); }, // &sCommand ) ); // object that manages the data @@ -957,7 +958,7 @@ bool CbmMQTsaMultiSampler::SendCommand(std::string sCommand) bool CbmMQTsaMultiSampler::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/source/CbmMQTsaMultiSampler.h b/MQ/source/CbmMQTsaMultiSampler.h index ca71268948..5b3ced131a 100644 --- a/MQ/source/CbmMQTsaMultiSampler.h +++ b/MQ/source/CbmMQTsaMultiSampler.h @@ -31,7 +31,7 @@ class TProfile; #include <utility> #include <vector> -class CbmMQTsaMultiSampler : public FairMQDevice { +class CbmMQTsaMultiSampler : public fair::mq::Device { public: CbmMQTsaMultiSampler(); virtual ~CbmMQTsaMultiSampler(); diff --git a/MQ/source/CbmMQTsaMultiSamplerTof.cxx b/MQ/source/CbmMQTsaMultiSamplerTof.cxx index 4a42a9dea0..dd4d4ef8c1 100644 --- a/MQ/source/CbmMQTsaMultiSamplerTof.cxx +++ b/MQ/source/CbmMQTsaMultiSamplerTof.cxx @@ -50,7 +50,7 @@ struct InitTaskError : std::runtime_error { }; CbmMQTsaMultiSamplerTof::CbmMQTsaMultiSamplerTof() - : FairMQDevice() + : fair::mq::Device() , fMaxTimeslices(0) , fFileName("") , fDirName("") @@ -130,9 +130,9 @@ try { // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined output channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); } @@ -206,7 +206,7 @@ bool CbmMQTsaMultiSamplerTof::IsChannelNameAllowed(std::string channelName) bool CbmMQTsaMultiSamplerTof::IsChannelUp(std::string channelName) { - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Inspect " << entry.first; std::size_t pos1 = channelName.find(entry.first); if (pos1 != std::string::npos) { @@ -242,7 +242,7 @@ bool CbmMQTsaMultiSamplerTof::ConditionalRun() } */ // keep components together - std::vector<FairMQParts> parts; + std::vector<fair::mq::Parts> parts; std::vector<bool> bparts; parts.resize(fComponentsToSend.size()); bparts.resize(parts.size()); @@ -458,7 +458,7 @@ bool CbmMQTsaMultiSamplerTof::SendData(const fles::StorableTimeslice& component, oa << component; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, @@ -549,12 +549,12 @@ void CbmMQTsaMultiSamplerTof::SendSysCmdStop() LOG(info) << "stop subscribers in 10 sec"; std::this_thread::sleep_for(std::chrono::milliseconds(10000)); - FairMQMessagePtr pub(NewSimpleMessage("STOP")); + fair::mq::MessagePtr pub(NewSimpleMessage("STOP")); if (Send(pub, "syscmd") < 0) { LOG(error) << "Sending STOP message failed"; } LOG(info) << "task reset subscribers in 1 sec"; std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - FairMQMessagePtr task_reset(NewSimpleMessage("TASK_RESET")); + fair::mq::MessagePtr task_reset(NewSimpleMessage("TASK_RESET")); if (Send(task_reset, "syscmd") < 0) { LOG(error) << "Sending Task_Reset message failed"; } } diff --git a/MQ/source/CbmMQTsaMultiSamplerTof.h b/MQ/source/CbmMQTsaMultiSamplerTof.h index d78897fc14..fd885288c4 100644 --- a/MQ/source/CbmMQTsaMultiSamplerTof.h +++ b/MQ/source/CbmMQTsaMultiSamplerTof.h @@ -24,7 +24,7 @@ #include <string> #include <vector> -class CbmMQTsaMultiSamplerTof : public FairMQDevice { +class CbmMQTsaMultiSamplerTof : public fair::mq::Device { public: CbmMQTsaMultiSamplerTof(); virtual ~CbmMQTsaMultiSamplerTof(); diff --git a/MQ/source/CbmMQTsaSampler.cxx b/MQ/source/CbmMQTsaSampler.cxx index f129557d5f..ccc69ebf99 100644 --- a/MQ/source/CbmMQTsaSampler.cxx +++ b/MQ/source/CbmMQTsaSampler.cxx @@ -119,7 +119,8 @@ try { // filename or directory name and convert it to a string to be // used in the regex:match boost::smatch what; - if (!boost::regex_match(x.path().leaf().string(), what, my_filter)) continue; +// if (!boost::regex_match(x.path().leaf().string(), what, my_filter)) continue; + if (!boost::regex_match(x.path().filename().string(), what, my_filter)) continue; v.push_back(x.path()); } @@ -161,9 +162,9 @@ try { // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined output channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); } @@ -326,7 +327,7 @@ bool CbmMQTsaSampler::SendData(const fles::StorableTimeslice& component, int idx oa << component; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, diff --git a/MQ/source/CbmMQTsaSampler.h b/MQ/source/CbmMQTsaSampler.h index 5c84b91229..e339e00d1e 100644 --- a/MQ/source/CbmMQTsaSampler.h +++ b/MQ/source/CbmMQTsaSampler.h @@ -25,7 +25,7 @@ #include <string> #include <vector> -class CbmMQTsaSampler : public FairMQDevice { +class CbmMQTsaSampler : public fair::mq::Device { public: CbmMQTsaSampler(); virtual ~CbmMQTsaSampler(); diff --git a/MQ/source/CbmMQTsaSamplerTof.cxx b/MQ/source/CbmMQTsaSamplerTof.cxx index 74af486b71..7f45af13ef 100644 --- a/MQ/source/CbmMQTsaSamplerTof.cxx +++ b/MQ/source/CbmMQTsaSamplerTof.cxx @@ -46,7 +46,7 @@ struct InitTaskError : std::runtime_error { CbmMQTsaSamplerTof::CbmMQTsaSamplerTof() - : FairMQDevice() + : fair::mq::Device() , fMaxTimeslices(0) , fFileName("") , fDirName("") @@ -120,7 +120,7 @@ try { // filename or directory name and convert it to a string to be // used in the regex:match boost::smatch what; - if (!boost::regex_match(x.path().leaf().string(), what, my_filter)) continue; + if (!boost::regex_match(x.path().filename().string(), what, my_filter)) continue; v.push_back(x.path()); } @@ -163,9 +163,9 @@ try { // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined output channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); } @@ -251,7 +251,7 @@ bool CbmMQTsaSamplerTof::IsChannelNameAllowed(std::string channelName) bool CbmMQTsaSamplerTof::IsChannelUp(std::string channelName) { - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Inspect " << entry.first; std::size_t pos1 = channelName.find(entry.first); if (pos1 != std::string::npos) { @@ -288,7 +288,7 @@ bool CbmMQTsaSamplerTof::ConditionalRun() } */ // keep components together - std::vector<FairMQParts> parts; + std::vector<fair::mq::Parts> parts; std::vector<bool> bparts; parts.resize(fComponentsToSend.size()); bparts.resize(parts.size()); @@ -483,7 +483,7 @@ bool CbmMQTsaSamplerTof::SendData(const fles::StorableTimeslice& component, int oa << component; std::string* strMsg = new std::string(oss.str()); - FairMQMessagePtr msg(NewMessage( + fair::mq::MessagePtr msg(NewMessage( const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* /*data*/, void* object) { delete static_cast<std::string*>(object); }, @@ -569,12 +569,12 @@ void CbmMQTsaSamplerTof::SendSysCmdStop() LOG(info) << "stop subscribers in 100 sec"; std::this_thread::sleep_for(std::chrono::milliseconds(100000)); - FairMQMessagePtr pub(NewSimpleMessage("STOP")); + fair::mq::MessagePtr pub(NewSimpleMessage("STOP")); if (Send(pub, "syscmd") < 0) { LOG(error) << "Sending STOP message failed"; } LOG(info) << "task reset subscribers in 1 sec"; std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - FairMQMessagePtr task_reset(NewSimpleMessage("TASK_RESET")); + fair::mq::MessagePtr task_reset(NewSimpleMessage("TASK_RESET")); if (Send(task_reset, "syscmd") < 0) { LOG(error) << "Sending Task_Reset message failed"; } } diff --git a/MQ/source/CbmMQTsaSamplerTof.h b/MQ/source/CbmMQTsaSamplerTof.h index ce72f84f89..bfffd2c379 100644 --- a/MQ/source/CbmMQTsaSamplerTof.h +++ b/MQ/source/CbmMQTsaSamplerTof.h @@ -25,7 +25,7 @@ #include <string> #include <vector> -class CbmMQTsaSamplerTof : public FairMQDevice { +class CbmMQTsaSamplerTof : public fair::mq::Device { public: CbmMQTsaSamplerTof(); virtual ~CbmMQTsaSamplerTof(); diff --git a/MQ/source/CbmStsDigiSource.cxx b/MQ/source/CbmStsDigiSource.cxx index 1986e448d5..9c52b60156 100644 --- a/MQ/source/CbmStsDigiSource.cxx +++ b/MQ/source/CbmStsDigiSource.cxx @@ -40,7 +40,7 @@ struct InitTaskError : std::runtime_error { CbmStsDigiSource::CbmStsDigiSource() - : FairMQDevice() + : fair::mq::Device() , fMaxEvents(0) , fFileName("") , fInputFileList() @@ -70,9 +70,9 @@ try { // properly connected. For the time beeing this is done with a // nameing convention. It is not avoided that someone sends other // data on this channel. - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined output channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); } diff --git a/MQ/source/CbmStsDigiSource.h b/MQ/source/CbmStsDigiSource.h index 4a80c8cff4..38d886981e 100644 --- a/MQ/source/CbmStsDigiSource.h +++ b/MQ/source/CbmStsDigiSource.h @@ -19,7 +19,7 @@ class CbmStsDigi; -class CbmStsDigiSource : public FairMQDevice { +class CbmStsDigiSource : public fair::mq::Device { public: CbmStsDigiSource(); virtual ~CbmStsDigiSource(); diff --git a/MQ/source/CbmTsConsumerReqDevExample.cxx b/MQ/source/CbmTsConsumerReqDevExample.cxx index 0488fcd46b..aa2d522bec 100644 --- a/MQ/source/CbmTsConsumerReqDevExample.cxx +++ b/MQ/source/CbmTsConsumerReqDevExample.cxx @@ -80,8 +80,8 @@ bool CbmTsConsumerReqDevExample::InitContainers() std::string message = paramName + ",111"; LOG(info) << "Requesting parameter container " << paramName << ", sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); FairParGenericSet* newObj = nullptr; @@ -168,8 +168,8 @@ bool CbmTsConsumerReqDevExample::ConditionalRun() std::string message = fsTsBlockName; if ("" == message) message = std::to_string(kusSysId); LOG(debug) << "Requesting new TS by sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage(message)); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage(message)); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, fsChannelNameDataInput) <= 0) { LOG(error) << "Failed to send the request! message was " << message; @@ -237,16 +237,16 @@ bool CbmTsConsumerReqDevExample::SendHistoConfAndData() { /// Prepare multiparts message and header std::pair<uint32_t, uint32_t> pairHeader(fvpsHistosFolder.size(), fvpsCanvasConfig.size()); - FairMQMessagePtr messageHeader(NewMessage()); + fair::mq::MessagePtr messageHeader(NewMessage()); // Serialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*messageHeader, pairHeader); BoostSerializer<std::pair<uint32_t, uint32_t>>().Serialize(*messageHeader, pairHeader); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(messageHeader)); for (UInt_t uHisto = 0; uHisto < fvpsHistosFolder.size(); ++uHisto) { /// Serialize the vector of histo config into a single MQ message - FairMQMessagePtr messageHist(NewMessage()); + fair::mq::MessagePtr messageHist(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageHist, fvpsHistosFolder[uHisto]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, fvpsHistosFolder[uHisto]); @@ -255,7 +255,7 @@ bool CbmTsConsumerReqDevExample::SendHistoConfAndData() for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { /// Serialize the vector of canvas config into a single MQ message - FairMQMessagePtr messageCan(NewMessage()); + fair::mq::MessagePtr messageCan(NewMessage()); // Serialize<BoostSerializer<std::pair<std::string, std::string>>>(*messageCan, fvpsCanvasConfig[uCanv]); BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, fvpsCanvasConfig[uCanv]); @@ -263,7 +263,7 @@ bool CbmTsConsumerReqDevExample::SendHistoConfAndData() } // for (UInt_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) /// Serialize the array of histos into a single MQ message - FairMQMessagePtr msgHistos(NewMessage()); + fair::mq::MessagePtr msgHistos(NewMessage()); // Serialize<RootSerializer>(*msgHistos, &fArrayHisto); RootSerializer().Serialize(*msgHistos, &fArrayHisto); @@ -284,7 +284,7 @@ bool CbmTsConsumerReqDevExample::SendHistoConfAndData() bool CbmTsConsumerReqDevExample::SendHistograms() { /// Serialize the array of histos into a single MQ message - FairMQMessagePtr message(NewMessage()); + fair::mq::MessagePtr message(NewMessage()); // Serialize<RootSerializer>(*message, &fArrayHisto); RootSerializer().Serialize(*message, &fArrayHisto); diff --git a/MQ/source/CbmTsConsumerReqDevExample.h b/MQ/source/CbmTsConsumerReqDevExample.h index e309f84b1d..52eb3c442b 100644 --- a/MQ/source/CbmTsConsumerReqDevExample.h +++ b/MQ/source/CbmTsConsumerReqDevExample.h @@ -20,7 +20,7 @@ class TList; -class CbmTsConsumerReqDevExample : public FairMQDevice { +class CbmTsConsumerReqDevExample : public fair::mq::Device { public: CbmTsConsumerReqDevExample(); virtual ~CbmTsConsumerReqDevExample(); diff --git a/MQ/source/runStsDigiSource.cxx b/MQ/source/runStsDigiSource.cxx index 9ce5c7b4df..2982c9a0a2 100644 --- a/MQ/source/runStsDigiSource.cxx +++ b/MQ/source/runStsDigiSource.cxx @@ -16,4 +16,4 @@ void addCustomOptions(bpo::options_description& options) "- infinite)"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmStsDigiSource(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmStsDigiSource(); } diff --git a/MQ/source/runTsConsumerReqExample.cxx b/MQ/source/runTsConsumerReqExample.cxx index 5732fa7384..a5d8e6d755 100644 --- a/MQ/source/runTsConsumerReqExample.cxx +++ b/MQ/source/runTsConsumerReqExample.cxx @@ -28,4 +28,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmTsConsumerReqDevExample(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmTsConsumerReqDevExample(); } diff --git a/MQ/source/runTsSamplerRepReq.cxx b/MQ/source/runTsSamplerRepReq.cxx index 69bb37c408..e5893b7e18 100644 --- a/MQ/source/runTsSamplerRepReq.cxx +++ b/MQ/source/runTsSamplerRepReq.cxx @@ -49,4 +49,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for histos"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmMQTsSamplerRepReq(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmMQTsSamplerRepReq(); } diff --git a/MQ/source/runTsaInfo.cxx b/MQ/source/runTsaInfo.cxx index 8fc2cb0b6b..befe52c5a2 100644 --- a/MQ/source/runTsaInfo.cxx +++ b/MQ/source/runTsaInfo.cxx @@ -17,4 +17,4 @@ void addCustomOptions(bpo::options_description& options) "- infinite)")("flib-port", bpo::value<uint64_t>()->default_value(0), "Port where the timeslice server is running"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmMQTsaInfo(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmMQTsaInfo(); } diff --git a/MQ/source/runTsaMultiSampler.cxx b/MQ/source/runTsaMultiSampler.cxx index 13caf762dc..b74f497cb7 100644 --- a/MQ/source/runTsaMultiSampler.cxx +++ b/MQ/source/runTsaMultiSampler.cxx @@ -43,4 +43,4 @@ void addCustomOptions(bpo::options_description& options) "MQ channel name for canvases config"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmMQTsaMultiSampler(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmMQTsaMultiSampler(); } diff --git a/MQ/source/runTsaMultiSamplerTof.cxx b/MQ/source/runTsaMultiSamplerTof.cxx index 441237d3d5..140e2365d9 100644 --- a/MQ/source/runTsaMultiSamplerTof.cxx +++ b/MQ/source/runTsaMultiSamplerTof.cxx @@ -19,4 +19,4 @@ void addCustomOptions(bpo::options_description& options) "SelectComponents", bpo::value<uint64_t>()->default_value(0), "Select components for transport"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmMQTsaMultiSamplerTof(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmMQTsaMultiSamplerTof(); } diff --git a/MQ/source/runTsaSampler.cxx b/MQ/source/runTsaSampler.cxx index 3cf6ac664c..a6b7852523 100644 --- a/MQ/source/runTsaSampler.cxx +++ b/MQ/source/runTsaSampler.cxx @@ -18,4 +18,4 @@ void addCustomOptions(bpo::options_description& options) "- infinite)")("flib-port", bpo::value<uint64_t>()->default_value(0), "Port where the timeslice server is running"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmMQTsaSampler(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmMQTsaSampler(); } diff --git a/MQ/source/runTsaSamplerTof.cxx b/MQ/source/runTsaSamplerTof.cxx index f48873b0b8..1353dd832e 100644 --- a/MQ/source/runTsaSamplerTof.cxx +++ b/MQ/source/runTsaSamplerTof.cxx @@ -18,4 +18,4 @@ void addCustomOptions(bpo::options_description& options) "- infinite)")("flib-port", bpo::value<uint64_t>()->default_value(0), "Port where the timeslice server is running"); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmMQTsaSamplerTof(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmMQTsaSamplerTof(); } diff --git a/MQ/unpacker/CbmDeviceUnpackTofCri.cxx b/MQ/unpacker/CbmDeviceUnpackTofCri.cxx index a04f0cd592..e90c753337 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofCri.cxx +++ b/MQ/unpacker/CbmDeviceUnpackTofCri.cxx @@ -144,9 +144,9 @@ try { // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); if (entry.first == "syscmd") { @@ -302,8 +302,8 @@ Bool_t CbmDeviceUnpackTofCri::InitContainers() std::string message {"CbmMcbm2018TofPar,111"}; LOG(info) << "Requesting parameter container CbmMcbm2018TofPar, sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111")); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111")); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, "parameters") > 0) { if (Receive(rep, "parameters") >= 0) { @@ -473,7 +473,7 @@ void CbmDeviceUnpackTofCri::CreateHistograms() } // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceUnpackTofCri::HandleData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceUnpackTofCri::HandleData(fair::mq::MessagePtr& msg, int /*index*/) { // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add @@ -499,7 +499,7 @@ bool CbmDeviceUnpackTofCri::HandleData(FairMQMessagePtr& msg, int /*index*/) return true; } -bool CbmDeviceUnpackTofCri::HandleParts(FairMQParts& parts, int /*index*/) +bool CbmDeviceUnpackTofCri::HandleParts(fair::mq::Parts& parts, int /*index*/) { // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add @@ -560,7 +560,7 @@ bool CbmDeviceUnpackTofCri::HandleParts(FairMQParts& parts, int /*index*/) return true; } -bool CbmDeviceUnpackTofCri::HandleMessage(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceUnpackTofCri::HandleMessage(fair::mq::MessagePtr& msg, int /*index*/) { const char* cmd = (char*) (msg->GetData()); const char cmda[4] = {*cmd}; @@ -901,7 +901,7 @@ bool CbmDeviceUnpackTofCri::SendDigis(std::vector<CbmTofDigi*> vdigi, int idx) oa << vdigi; std::string* strMsg = new std::string(oss.str()); - FairMQParts parts; + fair::mq::Parts parts; parts.AddPart(NewMessage( const_cast<char*>(strMsgE->c_str()), // data strMsgE->length(), // size @@ -924,7 +924,7 @@ bool CbmDeviceUnpackTofCri::SendDigis(std::vector<CbmTofDigi*> vdigi, int idx) vTofDigi[i] = digi; LOG(debug) << vTofDigi[i].ToString()<<" bits "<<Form("0x%08x",vTofDigi[i].TestBits(0xFFFF)); } - FairMQMessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data + fair::mq::MessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data NDigi*sizeof(CbmTofDigi), // size [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); } )); // object that manages the data @@ -938,7 +938,7 @@ bool CbmDeviceUnpackTofCri::SendDigis(std::vector<CbmTofDigi*> vdigi, int idx) aTofDigi[i] = *vdigi[i]; LOG(debug) << aTofDigi[i].ToString()<<" bits "<<Form("0x%08x",aTofDigi[i].TestBits(0xFFFF)); } - FairMQMessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (&aTofDigi[0]), // data + fair::mq::MessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (&aTofDigi[0]), // data NDigi*sizeof(CbmTofDigi), // size [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); } )); // object that manages the data @@ -954,13 +954,13 @@ bool CbmDeviceUnpackTofCri::SendDigis(std::vector<CbmTofDigi*> vdigi, int idx) std::string* strMsg = new std::string(oss.str()); LOG(debug) << "send strMsg with length " << strMsg->length()<<" "<<strMsg; - FairMQMessagePtr msg(NewMessage(const_cast<char*>(strMsg->c_str()), // data + fair::mq::MessagePtr msg(NewMessage(const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* , void* object){ delete static_cast<std::string*>(object); }, strMsg)); // object that manages the data */ /* - FairMQMessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (vTofDigi.data()), // data + fair::mq::MessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (vTofDigi.data()), // data vTofDigi.size()*sizeof(CbmTofDigi), // size [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); } )); // object that manages the data @@ -968,7 +968,7 @@ bool CbmDeviceUnpackTofCri::SendDigis(std::vector<CbmTofDigi*> vdigi, int idx) /* --------------------------------------- compiles but crashes .... --------------------------------------------------- const Int_t WSize=8; - FairMQMessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data + fair::mq::MessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data vTofDigi.size()*sizeof(CbmTofDigi)*WSize, // size, FIXME, numerical value in code! [](void* , void* object){ delete static_cast<std::vector<CbmTofDigi>*>(object); } )); // object that manages the data diff --git a/MQ/unpacker/CbmDeviceUnpackTofCri.h b/MQ/unpacker/CbmDeviceUnpackTofCri.h index d177f565d6..975aa9f75c 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofCri.h +++ b/MQ/unpacker/CbmDeviceUnpackTofCri.h @@ -38,16 +38,16 @@ class CbmTofDigi; class TH1; class TH2; -class CbmDeviceUnpackTofCri : public FairMQDevice { +class CbmDeviceUnpackTofCri : public fair::mq::Device { public: CbmDeviceUnpackTofCri(); virtual ~CbmDeviceUnpackTofCri(); protected: virtual void InitTask(); - bool HandleData(FairMQMessagePtr&, int); - bool HandleParts(FairMQParts&, int); - bool HandleMessage(FairMQMessagePtr&, int); + bool HandleData(fair::mq::MessagePtr&, int); + bool HandleParts(fair::mq::Parts&, int); + bool HandleMessage(fair::mq::MessagePtr&, int); virtual void BuildTint(uint64_t ulTsStartTime, int iMode = 0); virtual bool SendDigis(std::vector<CbmTofDigi*>, int); diff --git a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx index d0b32871b3..a268c8d8d2 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx +++ b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx @@ -139,9 +139,9 @@ try { // data on this channel. //logger::SetLogLevel("INFO"); - int noChannel = fChannels.size(); + int noChannel = GetChannels().size(); LOG(info) << "Number of defined channels: " << noChannel; - for (auto const& entry : fChannels) { + for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); if (entry.first == "syscmd") { @@ -278,8 +278,8 @@ Bool_t CbmDeviceUnpackTofMcbm2018::InitContainers() std::string message {"CbmMcbm2018TofPar,111"}; LOG(info) << "Requesting parameter container CbmMcbm2018TofPar, sending message: " << message; - FairMQMessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111")); - FairMQMessagePtr rep(NewMessage()); + fair::mq::MessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111")); + fair::mq::MessagePtr rep(NewMessage()); if (Send(req, "parameters") > 0) { if (Receive(rep, "parameters") >= 0) { @@ -769,7 +769,7 @@ void CbmDeviceUnpackTofMcbm2018::CreateHistograms() } // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) -bool CbmDeviceUnpackTofMcbm2018::HandleData(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceUnpackTofMcbm2018::HandleData(fair::mq::MessagePtr& msg, int /*index*/) { // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add @@ -795,7 +795,7 @@ bool CbmDeviceUnpackTofMcbm2018::HandleData(FairMQMessagePtr& msg, int /*index*/ return true; } -bool CbmDeviceUnpackTofMcbm2018::HandleParts(FairMQParts& parts, int /*index*/) +bool CbmDeviceUnpackTofMcbm2018::HandleParts(fair::mq::Parts& parts, int /*index*/) { // Don't do anything with the data // Maybe add an message counter which counts the incomming messages and add @@ -849,7 +849,7 @@ bool CbmDeviceUnpackTofMcbm2018::HandleParts(FairMQParts& parts, int /*index*/) return true; } -bool CbmDeviceUnpackTofMcbm2018::HandleMessage(FairMQMessagePtr& msg, int /*index*/) +bool CbmDeviceUnpackTofMcbm2018::HandleMessage(fair::mq::MessagePtr& msg, int /*index*/) { const char* cmd = (char*) (msg->GetData()); const char cmda[4] = {*cmd}; @@ -1157,7 +1157,7 @@ bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, int i oa << vdigi; std::string* strMsg = new std::string(oss.str()); - FairMQParts parts; + fair::mq::Parts parts; parts.AddPart(NewMessage( const_cast<char*>(strMsgE->c_str()), // data strMsgE->length(), // size @@ -1180,7 +1180,7 @@ bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, int i vTofDigi[i] = digi; LOG(debug) << vTofDigi[i].ToString()<<" bits "<<Form("0x%08x",vTofDigi[i].TestBits(0xFFFF)); } - FairMQMessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data + fair::mq::MessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data NDigi*sizeof(CbmTofDigi), // size [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); } )); // object that manages the data @@ -1194,7 +1194,7 @@ bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, int i aTofDigi[i] = *vdigi[i]; LOG(debug) << aTofDigi[i].ToString()<<" bits "<<Form("0x%08x",aTofDigi[i].TestBits(0xFFFF)); } - FairMQMessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (&aTofDigi[0]), // data + fair::mq::MessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (&aTofDigi[0]), // data NDigi*sizeof(CbmTofDigi), // size [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); } )); // object that manages the data @@ -1210,13 +1210,13 @@ bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, int i std::string* strMsg = new std::string(oss.str()); LOG(debug) << "send strMsg with length " << strMsg->length()<<" "<<strMsg; - FairMQMessagePtr msg(NewMessage(const_cast<char*>(strMsg->c_str()), // data + fair::mq::MessagePtr msg(NewMessage(const_cast<char*>(strMsg->c_str()), // data strMsg->length(), // size [](void* , void* object){ delete static_cast<std::string*>(object); }, strMsg)); // object that manages the data */ /* - FairMQMessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (vTofDigi.data()), // data + fair::mq::MessagePtr msg(NewMessage(static_cast<CbmTofDigi*> (vTofDigi.data()), // data vTofDigi.size()*sizeof(CbmTofDigi), // size [](void* , void* object){ delete static_cast<CbmTofDigi*>(object); } )); // object that manages the data @@ -1224,7 +1224,7 @@ bool CbmDeviceUnpackTofMcbm2018::SendDigis(std::vector<CbmTofDigi*> vdigi, int i /* --------------------------------------- compiles but crashes .... --------------------------------------------------- const Int_t WSize=8; - FairMQMessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data + fair::mq::MessagePtr msg(NewMessage(static_cast<std::vector<CbmTofDigi>*> (&vTofDigi), // data vTofDigi.size()*sizeof(CbmTofDigi)*WSize, // size, FIXME, numerical value in code! [](void* , void* object){ delete static_cast<std::vector<CbmTofDigi>*>(object); } )); // object that manages the data diff --git a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h index 58cc4fe8b3..1f3d1876c7 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h +++ b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h @@ -38,16 +38,16 @@ class CbmTofDigi; class TH1; class TH2; -class CbmDeviceUnpackTofMcbm2018 : public FairMQDevice { +class CbmDeviceUnpackTofMcbm2018 : public fair::mq::Device { public: CbmDeviceUnpackTofMcbm2018(); virtual ~CbmDeviceUnpackTofMcbm2018(); protected: virtual void InitTask(); - bool HandleData(FairMQMessagePtr&, int); - bool HandleParts(FairMQParts&, int); - bool HandleMessage(FairMQMessagePtr&, int); + bool HandleData(fair::mq::MessagePtr&, int); + bool HandleParts(fair::mq::Parts&, int); + bool HandleMessage(fair::mq::MessagePtr&, int); virtual void BuildTint(int); virtual bool SendDigis(std::vector<CbmTofDigi*>, int); diff --git a/MQ/unpacker/runUnpackTofCri.cxx b/MQ/unpacker/runUnpackTofCri.cxx index c01c29340d..c0e869b251 100644 --- a/MQ/unpacker/runUnpackTofCri.cxx +++ b/MQ/unpacker/runUnpackTofCri.cxx @@ -36,4 +36,4 @@ void addCustomOptions(bpo::options_description& options) options.add_options()(Form("ReqDet%d", i), bpo::value<uint64_t>()->default_value(0), Form("ReqDet%d", i)); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceUnpackTofCri(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceUnpackTofCri(); } diff --git a/MQ/unpacker/runUnpackTofMcbm2018.cxx b/MQ/unpacker/runUnpackTofMcbm2018.cxx index 533a0696a4..c132b7f72b 100644 --- a/MQ/unpacker/runUnpackTofMcbm2018.cxx +++ b/MQ/unpacker/runUnpackTofMcbm2018.cxx @@ -36,4 +36,4 @@ void addCustomOptions(bpo::options_description& options) options.add_options()(Form("ReqDet%d", i), bpo::value<uint64_t>()->default_value(0), Form("ReqDet%d", i)); } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceUnpackTofMcbm2018(); } +FairMQDevicePtr getDevice(const fair::mq::ProgOptions& /*config*/) { return new CbmDeviceUnpackTofMcbm2018(); } -- GitLab From 7773c6877a0209b5a80d7b83d6d3a33a671e3c48 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Wed, 26 Mar 2025 11:02:45 +0100 Subject: [PATCH 2/2] Apply clang-format --- MQ/base/CbmMQChannels.cxx | 2 +- MQ/base/CbmMQChannels.h | 10 +-- MQ/base/CbmMQDefs.h | 27 ++++--- MQ/histoServer/CbmHistoServer.cxx | 9 +-- MQ/histoServer/CbmHistoServer.h | 9 ++- MQ/histoServer/CbmMqHistoServer.cxx | 22 +++--- MQ/histoServer/CbmMqHistoServer.h | 9 ++- MQ/histoServer/runCbmHistoServer.cxx | 3 +- MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx | 66 ++++++++++++----- MQ/hitbuilder/CbmDeviceHitBuilderTof.h | 13 ++-- MQ/mcbm/CbmDeviceBmonMonitor.cxx | 16 ++--- MQ/mcbm/CbmDeviceBmonMonitor.h | 19 ++--- MQ/mcbm/CbmDeviceBuildDigiEvents.cxx | 17 +++-- MQ/mcbm/CbmDeviceBuildDigiEvents.h | 6 +- MQ/mcbm/CbmDeviceBuildRawEvents.cxx | 21 +++--- MQ/mcbm/CbmDeviceBuildRawEvents.h | 6 +- MQ/mcbm/CbmDeviceDigiEventSink.cxx | 13 ++-- MQ/mcbm/CbmDeviceDigiEventSink.h | 9 ++- MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx | 13 ++-- MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h | 6 +- MQ/mcbm/CbmDeviceMcbmEventSink.cxx | 8 +-- MQ/mcbm/CbmDeviceMcbmEventSink.h | 9 ++- MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx | 11 +-- MQ/mcbm/CbmDeviceMcbmMonitorPulser.h | 10 ++- MQ/mcbm/CbmDeviceMcbmUnpack.cxx | 22 +++--- MQ/mcbm/CbmDeviceMcbmUnpack.h | 11 ++- MQ/mcbm/CbmDeviceUnpack.cxx | 84 +++++++++++++++------- MQ/mcbm/CbmDeviceUnpack.h | 19 ++--- MQ/mcbm/runBmonMonitor.cxx | 3 +- MQ/mcbm/runBuildDigiEvents.cxx | 3 +- MQ/mcbm/runBuildRawEvents.cxx | 3 +- MQ/mcbm/runDigiEventSink.cxx | 3 +- MQ/mcbm/runMcbmEventSink.cxx | 3 +- MQ/mcbm/runMcbmEvtBuilderWin.cxx | 3 +- MQ/mcbm/runMcbmMonitorPulser.cxx | 3 +- MQ/mcbm/runMcbmUnpack.cxx | 3 +- MQ/mcbm/runUnpack.cxx | 3 +- MQ/monitor/CbmDeviceMonitorBmon.cxx | 58 +++++++-------- MQ/monitor/CbmDeviceMonitorBmon.h | 11 ++- MQ/monitor/CbmDeviceMonitorPsd.cxx | 50 ++++++------- MQ/monitor/CbmDeviceMonitorPsd.h | 11 ++- MQ/monitor/CbmDeviceMonitorReqBmon.cxx | 16 ++--- MQ/monitor/CbmDeviceMonitorReqBmon.h | 11 ++- MQ/monitor/CbmDeviceMonitorReqTof.cxx | 16 ++--- MQ/monitor/CbmDeviceMonitorReqTof.h | 13 ++-- MQ/monitor/CbmDeviceMonitorTof.cxx | 28 ++++---- MQ/monitor/CbmDeviceMonitorTof.h | 31 ++++---- MQ/monitor/runMonitorBmon.cxx | 3 +- MQ/monitor/runMonitorPsd.cxx | 3 +- MQ/monitor/runMonitorReqBmon.cxx | 3 +- MQ/monitor/runMonitorReqTof.cxx | 3 +- MQ/monitor/runMonitorTof.cxx | 3 +- MQ/parmq/ParameterMQServer.cxx | 11 ++- MQ/parmq/ParameterMQServer.h | 4 +- MQ/sink/CbmDevNullSink.cxx | 2 +- MQ/sink/CbmDevNullSink.h | 6 +- MQ/sink/CbmTsaComponentSink.cxx | 6 +- MQ/sink/CbmTsaComponentSink.h | 9 ++- MQ/sink/runDevNullSink.cxx | 1 - MQ/sink/runTsaComponentSink.cxx | 1 - MQ/source/CbmMQTsSamplerRepReq.cxx | 63 +++++++++------- MQ/source/CbmMQTsSamplerRepReq.h | 9 ++- MQ/source/CbmMQTsaInfo.cxx | 25 ++++--- MQ/source/CbmMQTsaInfo.h | 6 +- MQ/source/CbmMQTsaMultiSampler.cxx | 58 ++++++++------- MQ/source/CbmMQTsaMultiSampler.h | 9 ++- MQ/source/CbmMQTsaMultiSamplerTof.cxx | 33 +++++---- MQ/source/CbmMQTsaMultiSamplerTof.h | 9 ++- MQ/source/CbmMQTsaSampler.cxx | 35 +++++---- MQ/source/CbmMQTsaSampler.h | 6 +- MQ/source/CbmMQTsaSamplerTof.cxx | 43 ++++++----- MQ/source/CbmMQTsaSamplerTof.h | 6 +- MQ/source/CbmStsDigiSource.cxx | 24 ++++--- MQ/source/CbmStsDigiSource.h | 6 +- MQ/source/CbmTsConsumerReqDevExample.cxx | 16 ++--- MQ/source/CbmTsConsumerReqDevExample.h | 11 ++- MQ/source/runStsDigiSource.cxx | 1 - MQ/source/runTsConsumerReqExample.cxx | 3 +- MQ/source/runTsSamplerRepReq.cxx | 1 - MQ/source/runTsaInfo.cxx | 1 - MQ/source/runTsaMultiSampler.cxx | 1 - MQ/source/runTsaMultiSamplerTof.cxx | 1 - MQ/source/runTsaSampler.cxx | 1 - MQ/source/runTsaSamplerTof.cxx | 1 - MQ/unpacker/CbmDeviceUnpackTofCri.cxx | 38 ++++++---- MQ/unpacker/CbmDeviceUnpackTofCri.h | 20 +++--- MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx | 41 ++++++----- MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h | 18 ++--- MQ/unpacker/runUnpackTofCri.cxx | 3 +- MQ/unpacker/runUnpackTofMcbm2018.cxx | 3 +- 90 files changed, 657 insertions(+), 632 deletions(-) diff --git a/MQ/base/CbmMQChannels.cxx b/MQ/base/CbmMQChannels.cxx index 71543f240f..68b1f2f33f 100644 --- a/MQ/base/CbmMQChannels.cxx +++ b/MQ/base/CbmMQChannels.cxx @@ -6,7 +6,7 @@ #include "FairMQDevice.h" -CbmMQChannels::CbmMQChannels(std::vector<std::string> allowedChannels) : fAllowedChannels {allowedChannels} +CbmMQChannels::CbmMQChannels(std::vector<std::string> allowedChannels) : fAllowedChannels{allowedChannels} { fChannelsToSend.resize(fAllowedChannels.size()); for (auto& entry : fChannelsToSend) { diff --git a/MQ/base/CbmMQChannels.h b/MQ/base/CbmMQChannels.h index cc55b6c554..77ec51d25a 100644 --- a/MQ/base/CbmMQChannels.h +++ b/MQ/base/CbmMQChannels.h @@ -12,7 +12,7 @@ class CbmMQChannels { -public: + public: CbmMQChannels(std::vector<std::string>); bool IsChannelNameAllowed(std::string channelName); @@ -21,10 +21,10 @@ public: std::vector<int> GetComponentsToSend() { return fComponentsToSend; } std::vector<std::vector<std::string>> GetChannelsToSend() { return fChannelsToSend; } -private: - std::vector<std::string> fAllowedChannels {}; - std::vector<int> fComponentsToSend {}; - std::vector<std::vector<std::string>> fChannelsToSend {{}}; + private: + std::vector<std::string> fAllowedChannels{}; + std::vector<int> fComponentsToSend{}; + std::vector<std::vector<std::string>> fChannelsToSend{{}}; }; #endif diff --git a/MQ/base/CbmMQDefs.h b/MQ/base/CbmMQDefs.h index 9b3c9a58b1..6c6718f601 100644 --- a/MQ/base/CbmMQDefs.h +++ b/MQ/base/CbmMQDefs.h @@ -27,41 +27,40 @@ namespace cbm { bool success; if (transition == cbm::mq::Transition::ErrorFound) { - success=device->ChangeState(fair::mq::Transition::ErrorFound); + success = device->ChangeState(fair::mq::Transition::ErrorFound); } else if (transition == cbm::mq::Transition::End) { - success=device->ChangeState(fair::mq::Transition::End); + success = device->ChangeState(fair::mq::Transition::End); } else if (transition == cbm::mq::Transition::Ready) { - success=device->ChangeState(fair::mq::Transition::ResetTask); + success = device->ChangeState(fair::mq::Transition::ResetTask); } else if (transition == cbm::mq::Transition::DeviceReady) { - success=device->ChangeState(fair::mq::Transition::ResetDevice); + success = device->ChangeState(fair::mq::Transition::ResetDevice); } else if (transition == cbm::mq::Transition::Idle) { - success=device->ChangeState(fair::mq::Transition::Stop); + success = device->ChangeState(fair::mq::Transition::Stop); } else { LOG(fatal) << "State Change not yet implemented"; - success=device->ChangeState(fair::mq::Transition::ErrorFound); + success = device->ChangeState(fair::mq::Transition::ErrorFound); } - if(!success) { + if (!success) { LOG(warn) << "The transition wasnt successful"; } } - void LogState(fair::mq::Device* device) - { - LOG(info) << "Current State: " << device->GetCurrentStateName(); - } + void LogState(fair::mq::Device* device) { LOG(info) << "Current State: " << device->GetCurrentStateName(); } bool CheckCurrentState(fair::mq::Device* device, cbm::mq::State state) { - if (state == cbm::mq::State::Running) { return !(device->NewStatePending()); } + if (state == cbm::mq::State::Running) { + return !(device->NewStatePending()); + } else { LOG(fatal) << "State not yet implemented"; - bool success=device->ChangeState(fair::mq::Transition::ErrorFound); - if(!success) { + bool success = device->ChangeState(fair::mq::Transition::ErrorFound); + if (!success) { LOG(warn) << "The transition wasnt successful"; } return 0; diff --git a/MQ/histoServer/CbmHistoServer.cxx b/MQ/histoServer/CbmHistoServer.cxx index 6dd6e6a362..a03b5b434d 100644 --- a/MQ/histoServer/CbmHistoServer.cxx +++ b/MQ/histoServer/CbmHistoServer.cxx @@ -6,14 +6,13 @@ #include <mutex> //#include "CbmHistoCanvasDrawer.h" -#include <Logger.h> - +#include "RootSerializer.h" #include "TH1.h" #include "THttpServer.h" #include "TMessage.h" #include "TObjArray.h" -#include "RootSerializer.h" +#include <Logger.h> std::mutex mtx; @@ -110,7 +109,9 @@ int CbmHistoServer::FindHistogram(const std::string& name) { for (int i = 0; i < fArrayHisto.GetEntriesFast(); i++) { TObject* obj = fArrayHisto.At(i); - if (TString(obj->GetName()).EqualTo(name)) { return i; } + if (TString(obj->GetName()).EqualTo(name)) { + return i; + } } return -1; } diff --git a/MQ/histoServer/CbmHistoServer.h b/MQ/histoServer/CbmHistoServer.h index 181a0b6ac1..3b5c0a16a0 100644 --- a/MQ/histoServer/CbmHistoServer.h +++ b/MQ/histoServer/CbmHistoServer.h @@ -6,18 +6,17 @@ #define FAIRMQEXHISTOSERVER #include "FairMQDevice.h" - #include "THttpServer.h" #include "TObjArray.h" -#include <thread> #include <memory> #include <string> +#include <thread> //class FairMQExHistoCanvasDrawer; class CbmHistoServer : public fair::mq::Device { -public: + public: CbmHistoServer(); @@ -32,7 +31,7 @@ public: } */ -protected: + protected: virtual void InitTask(); bool ReceiveData(fair::mq::MessagePtr& msg, int index); @@ -41,7 +40,7 @@ protected: virtual void PostRun(); -private: + private: std::string fInputChannelName; TObjArray fArrayHisto; diff --git a/MQ/histoServer/CbmMqHistoServer.cxx b/MQ/histoServer/CbmMqHistoServer.cxx index 5c169a1a96..87b5ff9053 100644 --- a/MQ/histoServer/CbmMqHistoServer.cxx +++ b/MQ/histoServer/CbmMqHistoServer.cxx @@ -4,11 +4,10 @@ #include "CbmMqHistoServer.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" - #include "FairMQProgOptions.h" // device->fConfig -#include <Logger.h> - +#include "RootSerializer.h" #include "TCanvas.h" #include "TEnv.h" #include "TFile.h" @@ -21,23 +20,18 @@ #include "TRootSniffer.h" #include "TSystem.h" -#include "BoostSerializer.h" +#include <Logger.h> + #include <boost/serialization/utility.hpp> #include <mutex> -#include "RootSerializer.h" - std::mutex mtx; /* Bool_t bMqHistoServerResetHistos = kFALSE; Bool_t bMqHistoServerSaveHistos = kFALSE; */ -CbmMqHistoServer::CbmMqHistoServer() - : FairMQDevice() - , fArrayHisto() -{ -} +CbmMqHistoServer::CbmMqHistoServer() : FairMQDevice(), fArrayHisto() {} CbmMqHistoServer::~CbmMqHistoServer() {} @@ -359,8 +353,10 @@ int CbmMqHistoServer::FindHistogram(const std::string& name) { for (int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist) { TObject* obj = fArrayHisto.At(iHist); - if (TString(obj->GetName()).EqualTo(name)) { return iHist; } // if( TString( obj->GetName() ).EqualTo( name ) ) - } // for( int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist ) + if (TString(obj->GetName()).EqualTo(name)) { + return iHist; + } // if( TString( obj->GetName() ).EqualTo( name ) ) + } // for( int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist ) return -1; } diff --git a/MQ/histoServer/CbmMqHistoServer.h b/MQ/histoServer/CbmMqHistoServer.h index 258eb0e16c..729dc9f2a8 100644 --- a/MQ/histoServer/CbmMqHistoServer.h +++ b/MQ/histoServer/CbmMqHistoServer.h @@ -6,26 +6,25 @@ #define CBMMQHISTOSERVER_H #include "FairMQDevice.h" - #include "THttpServer.h" #include "TObjArray.h" -#include <thread> #include <memory> #include <string> +#include <thread> class TNamed; class TCanvas; class CbmMqHistoServer : public fair::mq::Device { -public: + public: CbmMqHistoServer(); virtual ~CbmMqHistoServer(); void UpdateHttpServer(); -protected: + protected: virtual void InitTask(); bool ReceiveData(fair::mq::MessagePtr& msg, int index); @@ -40,7 +39,7 @@ protected: virtual void PostRun(); -private: + private: /// Parameters std::string fsChannelNameHistosInput = "histogram-in"; std::string fsChannelNameHistosConfig = "histo-conf"; diff --git a/MQ/histoServer/runCbmHistoServer.cxx b/MQ/histoServer/runCbmHistoServer.cxx index f29c76134e..246276e858 100644 --- a/MQ/histoServer/runCbmHistoServer.cxx +++ b/MQ/histoServer/runCbmHistoServer.cxx @@ -3,11 +3,10 @@ Authors: Florian Uhlig [committer] */ #include "CbmHistoServer.h" +#include "runFairMQDevice.h" #include <memory> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; void addCustomOptions(bpo::options_description& /*options*/) {} diff --git a/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx b/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx index 2bb181eb50..22aaf904f9 100644 --- a/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx +++ b/MQ/hitbuilder/CbmDeviceHitBuilderTof.cxx @@ -29,7 +29,6 @@ #include "CbmTofGeoHandler.h" // in tof/TofTools #include "CbmTofHit.h" // in cbmdata/tof #include "CbmTofPoint.h" // in cbmdata/tof - #include "FairEventHeader.h" #include "FairFileHeader.h" #include "FairGeoParSet.h" @@ -260,7 +259,8 @@ try { for (auto const& entry : GetChannels()) { LOG(info) << "Channel name: " << entry.first; if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match."); - if (entry.first != "syscmd") OnData(entry.first, &CbmDeviceHitBuilderTof::HandleData); + if (entry.first != "syscmd") + OnData(entry.first, &CbmDeviceHitBuilderTof::HandleData); else OnData(entry.first, &CbmDeviceHitBuilderTof::HandleMessage); } @@ -372,7 +372,9 @@ Bool_t CbmDeviceHitBuilderTof::InitRootOutput() fEvtHeader->SetRunId(iRunId); rootMgr->Register("EventHeader.", "Event", fEvtHeader, kTRUE); auto source = rootMgr->GetSource(); - if (source) { source->FillEventHeader(fEvtHeader); } + if (source) { + source->FillEventHeader(fEvtHeader); + } // rootMgr->Register("CbmTofDigi", "Tof raw Digi", fTofCalDigisColl, kTRUE); // fOutRootFile->cd(); @@ -697,7 +699,9 @@ bool CbmDeviceHitBuilderTof::HandleData(fair::mq::Parts& parts, int /*index*/) if (NULL != fOutRootFile) { // CbmEvent output to root file fEvtHeader->SetEventTime((double) fEventHeader[4]); auto source = rootMgr->GetSource(); - if (source) { source->FillEventHeader(fEvtHeader); } + if (source) { + source->FillEventHeader(fEvtHeader); + } //LOG(info) << "Fill WriteOutBuffer with rootMgr at " << rootMgr; fOutRootFile->cd(); rootMgr->Fill(); @@ -904,7 +908,9 @@ Bool_t CbmDeviceHitBuilderTof::InitCalibParameter() for (Int_t iSide = 0; iSide < 2; iSide++) { Double_t TotMean = htempTot_Mean->GetBinContent(iCh * 2 + 1 + iSide); //nh +1 empirical(?) - if (0.001 < TotMean) { fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= fdTTotMean / TotMean; } + if (0.001 < TotMean) { + fvCPTotGain[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] *= fdTTotMean / TotMean; + } fvCPTotOff[iSmType][iSm * iNbRpc + iRpc][iCh][iSide] = htempTot_Off->GetBinContent(iCh * 2 + 1 + iSide); } @@ -1079,7 +1085,9 @@ void CbmDeviceHitBuilderTof::CreateHistograms() // Retrieve geometry information from the first module of a certain // module type that is found in the geometry file. - if (NULL != fChannelInfo) { break; } + if (NULL != fChannelInfo) { + break; + } } if (NULL == fChannelInfo) { @@ -1529,7 +1537,8 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() if (fiBeamRefAddr < 0 || iAddr == fiBeamRefAddr) { //LOG(debug) << Form("Ref digi found for 0x%08x, Mask 0x%08x ", fiBeamRefAddr, DetMask); - if (NULL == pRef) pRef = pDigi; + if (NULL == pRef) + pRef = pDigi; else { if (pDigi->GetTime() < pRef->GetTime()) pRef = pDigi; } @@ -1554,7 +1563,9 @@ Bool_t CbmDeviceHitBuilderTof::InspectRawDigis() // for (Int_t iDigI2 =iDigInd+1; iDigI2<iNbTofDigi;iDigI2++){ for (Int_t iDigI2 = 0; iDigI2 < iNbTofDigi; iDigI2++) { CbmTofDigi* pDigi2 = &fvDigiIn[iDigI2]; - if (pDigi != pDigi2) { fhDigiTdif->Fill(pDigi->GetTime() - pDigi2->GetTime()); } + if (pDigi != pDigi2) { + fhDigiTdif->Fill(pDigi->GetTime() - pDigi2->GetTime()); + } if (pDigi->GetAddress() != pDigi2->GetAddress()) if (pDigi->GetType() == 6 && pDigi2->GetType() == 6) fhBucDigiCor->Fill(pDigi->GetRpc() * 64 + pDigi->GetChannel() * 2 + pDigi->GetSide(), @@ -2058,11 +2069,13 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() CbmTofDigi* xDigiC = fStorDigi[iSmType][iSm * iNbRpc + iRpc][iCh][2]; Double_t dPosYN = 0.; Double_t dTimeDifN = 0; - if (xDigiC->GetSide() == xDigiA->GetSide()) dTimeDifN = xDigiC->GetTime() - xDigiB->GetTime(); + if (xDigiC->GetSide() == xDigiA->GetSide()) + dTimeDifN = xDigiC->GetTime() - xDigiB->GetTime(); else dTimeDifN = xDigiA->GetTime() - xDigiC->GetTime(); - if (1 == xDigiA->GetSide()) dPosYN = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDifN * 0.5; + if (1 == xDigiA->GetSide()) + dPosYN = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDifN * 0.5; else dPosYN = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDifN * 0.5; @@ -2240,7 +2253,9 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() // output hit new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(*pHit); // memorize hit - if (fdMemoryTime > 0.) { LH_store(iSmType, iSm, iRpc, iChm, pHit); } + if (fdMemoryTime > 0.) { + LH_store(iSmType, iSm, iRpc, iChm, pHit); + } else { pHit->Delete(); } @@ -2431,7 +2446,9 @@ Bool_t CbmDeviceHitBuilderTof::BuildHits() // output hit new ((*fTofHitsColl)[fiNbHits]) CbmTofHit(*pHit); // memorize hit - if (fdMemoryTime > 0.) { LH_store(iSmType, iSm, iRpc, iChm, pHit); } + if (fdMemoryTime > 0.) { + LH_store(iSmType, iSm, iRpc, iChm, pHit); + } else { pHit->Delete(); } @@ -2473,7 +2490,8 @@ Bool_t CbmDeviceHitBuilderTof::MergeClusters() { return kTRUE; } void CbmDeviceHitBuilderTof::LH_store(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iChm, CbmTofHit* pHit) { - if (fvLastHits[iSmType][iSm][iRpc][iChm].size() == 0) fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit); + if (fvLastHits[iSmType][iSm][iRpc][iChm].size() == 0) + fvLastHits[iSmType][iSm][iRpc][iChm].push_back(pHit); else { Double_t dLastTime = pHit->GetTime(); if (dLastTime >= fvLastHits[iSmType][iSm][iRpc][iChm].back()->GetTime()) { @@ -2627,7 +2645,8 @@ Bool_t CbmDeviceHitBuilderTof::AddNextChan(Int_t iSmType, Int_t iSm, Int_t iRpc, Double_t dTimeDif = xDigiA->GetTime() - xDigiB->GetTime(); Double_t dPosY = 0.; - if (1 == xDigiA->GetSide()) dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; + if (1 == xDigiA->GetSide()) + dPosY = fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; else dPosY = -fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc) * dTimeDif * 0.5; @@ -2752,7 +2771,9 @@ void CbmDeviceHitBuilderTof::fit_ybox(const char* hname) { TH1* h1; h1 = (TH1*) gROOT->FindObjectAny(hname); - if (NULL != h1) { fit_ybox(h1, 0.); } + if (NULL != h1) { + fit_ybox(h1, 0.); + } } void CbmDeviceHitBuilderTof::fit_ybox(TH1* h1, Double_t ysize) @@ -3200,7 +3221,9 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() if (TotSum > fhRpcCluTot[iIndexDut]->GetYaxis()->GetXmax()) continue; // ignore too large clusters fTRefHits = 1; - if (pHit->GetTime() < dTRef) { dTRef = pHit->GetTime(); } + if (pHit->GetTime() < dTRef) { + dTRef = pHit->GetTime(); + } iBeamRefMul++; } else { //additional reference type multiplicity @@ -3291,7 +3314,9 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() default: LOG(info) << "FillHistos: selection not implemented " << iSel; ; } // switch end - if (fTRefMode > 10) { dTTrig[iSel] = dTRef; } + if (fTRefMode > 10) { + dTTrig[iSel] = dTRef; + } } // iSel - loop end if (fSel2Id > 0) { // confirm selector by independent match @@ -3338,7 +3363,9 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() if (BSel[iSel]) { if (dTRef != 0. && fTRefHits > 0) { for (UInt_t uChannel = 0; uChannel < 16; uChannel++) { - if (uTriggerPattern & (0x1 << uChannel)) { fhSeldT[iSel]->Fill(dTTrig[iSel] - dTRef, uChannel); } + if (uTriggerPattern & (0x1 << uChannel)) { + fhSeldT[iSel]->Fill(dTTrig[iSel] - dTRef, uChannel); + } } } } @@ -3362,7 +3389,8 @@ Bool_t CbmDeviceHitBuilderTof::FillHistos() for (Int_t iSel = 0; iSel < iNSel; iSel++) if (BSel[iSel]) { Double_t w = fviClusterMul[iSmType][iSm][iRpc]; - if (w == 0.) w = 1.; + if (w == 0.) + w = 1.; else w = 1. / w; fhTRpcCluMul[iDetIndx][iSel]->Fill(fviClusterMul[iSmType][iSm][iRpc], w); diff --git a/MQ/hitbuilder/CbmDeviceHitBuilderTof.h b/MQ/hitbuilder/CbmDeviceHitBuilderTof.h index 9e8c478f2d..92bc6ebf14 100644 --- a/MQ/hitbuilder/CbmDeviceHitBuilderTof.h +++ b/MQ/hitbuilder/CbmDeviceHitBuilderTof.h @@ -15,18 +15,15 @@ #include "CbmMqTMessage.h" #include "CbmTofAddress.h" // in cbmdata/tof #include "CbmTofGeoHandler.h" // in tof/TofTools - -#include "MicrosliceDescriptor.hpp" -#include "Timeslice.hpp" - #include "FairEventHeader.h" #include "FairMQDevice.h" - +#include "MicrosliceDescriptor.hpp" #include "Rtypes.h" #include "TFile.h" #include "TGeoManager.h" #include "TMessage.h" #include "TTree.h" +#include "Timeslice.hpp" #include <map> #include <vector> @@ -59,11 +56,11 @@ class TString; #include <vector> class CbmDeviceHitBuilderTof : public fair::mq::Device { -public: + public: CbmDeviceHitBuilderTof(); virtual ~CbmDeviceHitBuilderTof(); -protected: + protected: virtual void InitTask(); //bool HandleData(fair::mq::MessagePtr&, int); bool HandleData(fair::mq::Parts&, int); @@ -79,7 +76,7 @@ protected: Double_t dLastTot); // needed for time based data virtual void LH_store(Int_t iSmType, Int_t iSm, Int_t iRpc, Int_t iChm, CbmTofHit* pHit); -private: + private: // Variables used for histo filling Bool_t IsChannelNameAllowed(std::string channelName); diff --git a/MQ/mcbm/CbmDeviceBmonMonitor.cxx b/MQ/mcbm/CbmDeviceBmonMonitor.cxx index 06dc8aa234..bc7f0406da 100644 --- a/MQ/mcbm/CbmDeviceBmonMonitor.cxx +++ b/MQ/mcbm/CbmDeviceBmonMonitor.cxx @@ -11,6 +11,7 @@ #include "CbmDeviceBmonMonitor.h" +#include "BoostSerializer.h" #include "CbmBmonUnpackConfig.h" #include "CbmFlesCanvasTools.h" #include "CbmMQDefs.h" @@ -23,21 +24,18 @@ #include "CbmTofUnpackMonitor.h" #include "CbmTrdUnpackConfig.h" #include "CbmTrdUnpackFaspConfig.h" - -#include "StorableTimeslice.hpp" -#include "TimesliceMetaData.h" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" +#include "TimesliceMetaData.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -46,8 +44,6 @@ #include <stdexcept> #include <string> #include <utility> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -214,7 +210,7 @@ CbmDeviceBmonMonitor::InitParameters(std::vector<std::pair<std::string, std::sha if (asciiInput.open(filepath.data())) { parset->init(&asciiInput); } } * */ - std::string paramName {pair.second->GetName()}; + std::string paramName{pair.second->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -370,7 +366,7 @@ bool CbmDeviceBmonMonitor::ConditionalRun() boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice ts {0}; + fles::StorableTimeslice ts{0}; inputArchive >> ts; /// On first TS, extract the TS parameters from header (by definition stable over time) diff --git a/MQ/mcbm/CbmDeviceBmonMonitor.h b/MQ/mcbm/CbmDeviceBmonMonitor.h index 8e8a8df526..a597906430 100644 --- a/MQ/mcbm/CbmDeviceBmonMonitor.h +++ b/MQ/mcbm/CbmDeviceBmonMonitor.h @@ -14,14 +14,11 @@ #include "CbmMqTMessage.h" #include "CbmTsEventHeader.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" #include "FairParGenericSet.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <chrono> #include <map> @@ -35,11 +32,11 @@ class TimesliceMetaData; class CbmTrdSpadic; class CbmDeviceBmonMonitor : public fair::mq::Device { -public: + public: CbmDeviceBmonMonitor(); virtual ~CbmDeviceBmonMonitor(); -protected: + protected: virtual void InitTask(); bool ConditionalRun(); bool HandleCommand(fair::mq::MessagePtr&, int); @@ -47,7 +44,7 @@ protected: /** @brief Set the Bmon Unpack Config @param config */ void SetUnpackConfig(std::shared_ptr<CbmBmonUnpackConfig> config) { fBmonConfig = config; } -private: + private: /// Constants static constexpr std::uint16_t fkFlesBmon = static_cast<std::uint16_t>(fles::Subsystem::BMON); @@ -185,8 +182,12 @@ private: auto algo = config->GetUnpacker(); std::vector<TOptOutA> optoutAvec = {}; std::vector<TOptOutB> optoutBvec = {}; - if (optouttargetvecA) { algo->SetOptOutAVec(&optoutAvec); } - if (optouttargetvecB) { algo->SetOptOutBVec(&optoutBvec); } + if (optouttargetvecA) { + algo->SetOptOutAVec(&optoutAvec); + } + if (optouttargetvecB) { + algo->SetOptOutBVec(&optoutBvec); + } // Set the start time of the current TS for this algorithm algo->SetTsStartTime(ts->start_time()); diff --git a/MQ/mcbm/CbmDeviceBuildDigiEvents.cxx b/MQ/mcbm/CbmDeviceBuildDigiEvents.cxx index 6dbe211317..9e7b859706 100644 --- a/MQ/mcbm/CbmDeviceBuildDigiEvents.cxx +++ b/MQ/mcbm/CbmDeviceBuildDigiEvents.cxx @@ -19,17 +19,14 @@ #include "CbmMatch.h" #include "CbmMvdDigi.h" #include "CbmTsEventHeader.h" - #include "TimesliceMetaData.h" /// FAIRROOT headers +#include "BoostSerializer.h" #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" #include "FairRunOnline.h" - -#include "BoostSerializer.h" - #include "RootSerializer.h" /// FAIRSOFT headers (geant, boost, ...) @@ -359,16 +356,22 @@ try { //std::vector<CbmMvdDigi>* pMvdDigi = new std::vector<CbmMvdDigi>(); fTimeSliceMetaDataArray = new TClonesArray("TimesliceMetaData", 1); - if (NULL == fTimeSliceMetaDataArray) { throw InitTaskError("Failed creating the TS meta data TClonesarray "); } + if (NULL == fTimeSliceMetaDataArray) { + throw InitTaskError("Failed creating the TS meta data TClonesarray "); + } fpAlgo->SetTimeSliceMetaDataArray(fTimeSliceMetaDataArray); /// Now that everything is set, initialize the Algorithm - if (kFALSE == fpAlgo->InitAlgo()) { throw InitTaskError("Failed to initialize the algorithm class."); } + if (kFALSE == fpAlgo->InitAlgo()) { + throw InitTaskError("Failed to initialize the algorithm class."); + } /// Histograms management if (kTRUE == fbFillHistos) { /// Comment to prevent clang format single lining - if (kFALSE == InitHistograms()) { throw InitTaskError("Failed to initialize the histograms."); } + if (kFALSE == InitHistograms()) { + throw InitTaskError("Failed to initialize the histograms."); + } } } catch (InitTaskError& e) { diff --git a/MQ/mcbm/CbmDeviceBuildDigiEvents.h b/MQ/mcbm/CbmDeviceBuildDigiEvents.h index 70b230693b..308b446407 100644 --- a/MQ/mcbm/CbmDeviceBuildDigiEvents.h +++ b/MQ/mcbm/CbmDeviceBuildDigiEvents.h @@ -40,16 +40,16 @@ class FairRunOnline; class CbmTsEventHeader; class CbmDeviceBuildDigiEvents : public fair::mq::Device { -public: + public: CbmDeviceBuildDigiEvents(); virtual ~CbmDeviceBuildDigiEvents(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::Parts&, int); bool HandleCommand(fair::mq::MessagePtr&, int); -private: + private: /// Constants /// Control flags diff --git a/MQ/mcbm/CbmDeviceBuildRawEvents.cxx b/MQ/mcbm/CbmDeviceBuildRawEvents.cxx index 7fcd2bae07..b0baa42155 100644 --- a/MQ/mcbm/CbmDeviceBuildRawEvents.cxx +++ b/MQ/mcbm/CbmDeviceBuildRawEvents.cxx @@ -17,17 +17,14 @@ #include "CbmMQDefs.h" #include "CbmMatch.h" #include "CbmMvdDigi.h" - #include "TimesliceMetaData.h" /// FAIRROOT headers +#include "BoostSerializer.h" #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" #include "FairRunOnline.h" - -#include "BoostSerializer.h" - #include "RootSerializer.h" /// FAIRSOFT headers (geant, boost, ...) @@ -277,7 +274,9 @@ try { fvDigiPsd = new std::vector<CbmPsdDigi>(); fTimeSliceMetaDataArray = new TClonesArray("TimesliceMetaData", 1); - if (NULL == fTimeSliceMetaDataArray) { throw InitTaskError("Failed creating the TS meta data TClonesarray "); } + if (NULL == fTimeSliceMetaDataArray) { + throw InitTaskError("Failed creating the TS meta data TClonesarray "); + } fpAlgo->SetTimeSliceMetaDataArray(fTimeSliceMetaDataArray); /// Digis storage @@ -296,7 +295,9 @@ try { fEvents = new TClonesArray("CbmEvent", 500); /// Now that everything is set, initialize the Algorithm - if (kFALSE == fpAlgo->InitAlgo()) { throw InitTaskError("Failed to initilize the algorithm class."); } + if (kFALSE == fpAlgo->InitAlgo()) { + throw InitTaskError("Failed to initilize the algorithm class."); + } /// Histograms management if (kTRUE == fbFillHistos) { @@ -323,7 +324,9 @@ try { BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageHist, psHistoConfig); /// Send message to the common histogram config messages queue - if (Send(messageHist, fsChannelNameHistosConfig) < 0) { throw InitTaskError("Problem sending histo config"); } + if (Send(messageHist, fsChannelNameHistosConfig) < 0) { + throw InitTaskError("Problem sending histo config"); + } LOG(info) << "Config of hist " << psHistoConfig.first.data() << " in folder " << psHistoConfig.second.data(); } @@ -346,7 +349,9 @@ try { BoostSerializer<std::pair<std::string, std::string>>().Serialize(*messageCan, psCanvConfig); /// Send message to the common canvas config messages queue - if (Send(messageCan, fsChannelNameCanvasConfig) < 0) { throw InitTaskError("Problem sending canvas config"); } + if (Send(messageCan, fsChannelNameCanvasConfig) < 0) { + throw InitTaskError("Problem sending canvas config"); + } LOG(info) << "Config string of Canvas " << psCanvConfig.first.data() << " is " << psCanvConfig.second.data(); } diff --git a/MQ/mcbm/CbmDeviceBuildRawEvents.h b/MQ/mcbm/CbmDeviceBuildRawEvents.h index 847bc84228..3335f98ff0 100644 --- a/MQ/mcbm/CbmDeviceBuildRawEvents.h +++ b/MQ/mcbm/CbmDeviceBuildRawEvents.h @@ -40,16 +40,16 @@ class FairRunOnline; class TimesliceMetaData; class CbmDeviceBuildRawEvents : public fair::mq::Device { -public: + public: CbmDeviceBuildRawEvents(); virtual ~CbmDeviceBuildRawEvents(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::Parts&, int); bool HandleCommand(fair::mq::MessagePtr&, int); -private: + private: /// Constants /// Control flags diff --git a/MQ/mcbm/CbmDeviceDigiEventSink.cxx b/MQ/mcbm/CbmDeviceDigiEventSink.cxx index 5f29aa28dd..c4e0094d4b 100644 --- a/MQ/mcbm/CbmDeviceDigiEventSink.cxx +++ b/MQ/mcbm/CbmDeviceDigiEventSink.cxx @@ -16,10 +16,10 @@ #include "CbmEvent.h" #include "CbmFlesCanvasTools.h" #include "CbmMQDefs.h" - #include "TimesliceMetaData.h" /// FAIRROOT headers +#include "BoostSerializer.h" #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" @@ -27,9 +27,6 @@ #include "FairRootManager.h" #include "FairRunOnline.h" #include "FairSource.h" - -#include "BoostSerializer.h" - #include "RootSerializer.h" /// FAIRSOFT headers (geant, boost, ...) @@ -180,7 +177,9 @@ try { /// Histograms management if (kTRUE == fbFillHistos) { /// Comment to prevent clang format single lining - if (kFALSE == InitHistograms()) { throw InitTaskError("Failed to initialize the histograms."); } + if (kFALSE == InitHistograms()) { + throw InitTaskError("Failed to initialize the histograms."); + } } // if( kTRUE == fbFillHistos ) fbInitDone = true; } @@ -657,7 +656,9 @@ void CbmDeviceDigiEventSink::DumpTreeEntry() /// FairRunOnline style fpFairRootMgr->StoreWriteoutBufferData(fpFairRootMgr->GetEventTime()); auto source = fpFairRootMgr->GetSource(); - if (source) { source->FillEventHeader(fEvtHeader); } + if (source) { + source->FillEventHeader(fEvtHeader); + } fpFairRootMgr->Fill(); fpFairRootMgr->DeleteOldWriteoutBufferData(); // fpFairRootMgr->Write(); diff --git a/MQ/mcbm/CbmDeviceDigiEventSink.h b/MQ/mcbm/CbmDeviceDigiEventSink.h index 3111dd5c6c..0b539fe96e 100644 --- a/MQ/mcbm/CbmDeviceDigiEventSink.h +++ b/MQ/mcbm/CbmDeviceDigiEventSink.h @@ -24,7 +24,6 @@ #include "CbmTofDigi.h" #include "CbmTrdDigi.h" #include "CbmTsEventHeader.h" - #include "TimesliceMetaData.h" /// FAIRROOT headers @@ -52,7 +51,7 @@ class FairRootManager; class CbmEventTimeslice { /// TODO: rename to CbmTsWithEvents -public: + public: CbmEventTimeslice(fair::mq::Parts& parts, bool bDigiEvtInput = false); ~CbmEventTimeslice(); @@ -84,18 +83,18 @@ public: }; class CbmDeviceDigiEventSink : public fair::mq::Device { -public: + public: CbmDeviceDigiEventSink(); virtual ~CbmDeviceDigiEventSink(); -protected: + protected: virtual void InitTask(); bool HandleMissTsData(fair::mq::MessagePtr&, int); bool HandleData(fair::mq::Parts&, int); bool HandleCommand(fair::mq::MessagePtr&, int); virtual void PostRun(); -private: + private: /// Constants /// Control flags diff --git a/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx b/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx index 216959b9b5..86ac52c265 100644 --- a/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx +++ b/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.cxx @@ -18,17 +18,14 @@ #include "CbmMQDefs.h" #include "CbmMatch.h" #include "CbmMvdDigi.h" - #include "TimesliceMetaData.h" /// FAIRROOT headers +#include "BoostSerializer.h" #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" #include "FairRunOnline.h" - -#include "BoostSerializer.h" - #include "RootSerializer.h" /// FAIRSOFT headers (geant, boost, ...) @@ -285,9 +282,13 @@ try { fpRun = new FairRunOnline(0); FairRootManager* ioman = nullptr; ioman = FairRootManager::Instance(); - if (NULL == ioman) { throw InitTaskError("No FairRootManager instance"); } + if (NULL == ioman) { + throw InitTaskError("No FairRootManager instance"); + } fTimeSliceMetaDataArray = new TClonesArray("TimesliceMetaData", 1); - if (NULL == fTimeSliceMetaDataArray) { throw InitTaskError("Failed creating the TS meta data TClonesarray "); } + if (NULL == fTimeSliceMetaDataArray) { + throw InitTaskError("Failed creating the TS meta data TClonesarray "); + } ioman->Register("TimesliceMetaData", "TS Meta Data", fTimeSliceMetaDataArray, kFALSE); /// Digis storage ioman->RegisterAny("BmonDigi", fvDigiBmon, kFALSE); diff --git a/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h b/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h index 37471b3612..348476f70d 100644 --- a/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h +++ b/MQ/mcbm/CbmDeviceMcbmEventBuilderWin.h @@ -40,16 +40,16 @@ class FairRunOnline; class TimesliceMetaData; class CbmDeviceMcbmEventBuilderWin : public fair::mq::Device { -public: + public: CbmDeviceMcbmEventBuilderWin(); virtual ~CbmDeviceMcbmEventBuilderWin(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::Parts&, int); bool HandleCommand(fair::mq::MessagePtr&, int); -private: + private: /// Constants /// Control flags diff --git a/MQ/mcbm/CbmDeviceMcbmEventSink.cxx b/MQ/mcbm/CbmDeviceMcbmEventSink.cxx index 25fe284e15..23697777b3 100644 --- a/MQ/mcbm/CbmDeviceMcbmEventSink.cxx +++ b/MQ/mcbm/CbmDeviceMcbmEventSink.cxx @@ -16,19 +16,16 @@ #include "CbmEvent.h" #include "CbmFlesCanvasTools.h" #include "CbmMQDefs.h" - #include "TimesliceMetaData.h" /// FAIRROOT headers +#include "BoostSerializer.h" #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" #include "FairRootFileSink.h" #include "FairRootManager.h" #include "FairRunOnline.h" - -#include "BoostSerializer.h" - #include "RootSerializer.h" /// FAIRSOFT headers (geant, boost, ...) @@ -42,12 +39,11 @@ #include <boost/serialization/utility.hpp> /// C/C++ headers -#include <thread> // this_thread::sleep_for - #include <array> #include <iomanip> #include <stdexcept> #include <string> +#include <thread> // this_thread::sleep_for struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; diff --git a/MQ/mcbm/CbmDeviceMcbmEventSink.h b/MQ/mcbm/CbmDeviceMcbmEventSink.h index a3f56a099c..05dfc3786a 100644 --- a/MQ/mcbm/CbmDeviceMcbmEventSink.h +++ b/MQ/mcbm/CbmDeviceMcbmEventSink.h @@ -21,7 +21,6 @@ #include "CbmStsDigi.h" #include "CbmTofDigi.h" #include "CbmTrdDigi.h" - #include "TimesliceMetaData.h" /// FAIRROOT headers @@ -46,7 +45,7 @@ class FairRootManager; class CbmUnpackedTimeslice { /// TODO: rename to CbmTsWithEvents -public: + public: CbmUnpackedTimeslice(fair::mq::Parts& parts); ~CbmUnpackedTimeslice(); @@ -62,17 +61,17 @@ public: }; class CbmDeviceMcbmEventSink : public fair::mq::Device { -public: + public: CbmDeviceMcbmEventSink(); virtual ~CbmDeviceMcbmEventSink(); -protected: + protected: virtual void InitTask(); bool HandleMissTsData(fair::mq::MessagePtr&, int); bool HandleData(fair::mq::Parts&, int); bool HandleCommand(fair::mq::MessagePtr&, int); -private: + private: /// Constants /// Control flags diff --git a/MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx b/MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx index c045f6afc8..48c5cbeb3a 100644 --- a/MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx +++ b/MQ/mcbm/CbmDeviceMcbmMonitorPulser.cxx @@ -12,25 +12,22 @@ #include "CbmDeviceMcbmMonitorPulser.h" #include "CbmMQDefs.h" - #include "TimesliceMetaData.h" //#include "CbmMcbm2018MonitorAlgoTof.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -38,8 +35,6 @@ #include <iomanip> #include <stdexcept> #include <string> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; diff --git a/MQ/mcbm/CbmDeviceMcbmMonitorPulser.h b/MQ/mcbm/CbmDeviceMcbmMonitorPulser.h index 298e03732d..2008ffad0d 100644 --- a/MQ/mcbm/CbmDeviceMcbmMonitorPulser.h +++ b/MQ/mcbm/CbmDeviceMcbmMonitorPulser.h @@ -19,9 +19,7 @@ #include "CbmStsDigi.h" #include "CbmTofDigi.h" #include "CbmTrdDigi.h" - #include "FairMQDevice.h" - #include "Rtypes.h" #include "TObjArray.h" @@ -37,15 +35,15 @@ class TList; class TimesliceMetaData; class CbmDeviceMcbmMonitorPulser : public fair::mq::Device { -public: + public: CbmDeviceMcbmMonitorPulser(); virtual ~CbmDeviceMcbmMonitorPulser(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::Parts&, int); -private: + private: /// Constants /*********************** SHOULD GO IN ALGO ****************************/ static const UInt_t kuNbChanSMX = 128; @@ -206,7 +204,7 @@ private: TH2* fBmonRichDiffEvoLong = nullptr; TH2* fBmonPsdDiffEvoLong = nullptr; - Double_t fdStartTime = -1; + Double_t fdStartTime = -1; TProfile* fBmonStsMeanEvo = nullptr; TProfile* fBmonMuchMeanEvo = nullptr; TProfile* fBmonTrdMeanEvo = nullptr; diff --git a/MQ/mcbm/CbmDeviceMcbmUnpack.cxx b/MQ/mcbm/CbmDeviceMcbmUnpack.cxx index fad5df8303..076c6132aa 100644 --- a/MQ/mcbm/CbmDeviceMcbmUnpack.cxx +++ b/MQ/mcbm/CbmDeviceMcbmUnpack.cxx @@ -11,6 +11,7 @@ #include "CbmDeviceMcbmUnpack.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" #include "CbmMQDefs.h" #include "CbmMcbm2018UnpackerAlgoMuch.h" @@ -19,21 +20,18 @@ #include "CbmMcbm2018UnpackerAlgoSts.h" #include "CbmMcbm2018UnpackerAlgoTof.h" #include "CbmMcbm2018UnpackerAlgoTrdR.h" - -#include "StorableTimeslice.hpp" -#include "TimesliceMetaData.h" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" +#include "TimesliceMetaData.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -41,8 +39,6 @@ #include <iomanip> #include <stdexcept> #include <string> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -152,7 +148,9 @@ Bool_t CbmDeviceMcbmUnpack::InitContainers() charPosDel++; Double_t dOffset = std::stod((*itStrOffs).substr(charPosDel)); - if ("kSTS" == sSelDet) { fUnpAlgoSts->SetTimeOffsetNs(dOffset); } // if( "kSTS" == sSelDet ) + if ("kSTS" == sSelDet) { + fUnpAlgoSts->SetTimeOffsetNs(dOffset); + } // if( "kSTS" == sSelDet ) else if ("kMUCH" == sSelDet) { fUnpAlgoMuch->SetTimeOffsetNs(dOffset); } // else if( "kMUCH" == sSelDet ) @@ -203,7 +201,7 @@ Bool_t CbmDeviceMcbmUnpack::InitParameters(TList* fParCList) for (int iparC = 0; iparC < fParCList->GetEntries(); iparC++) { FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); fParCList->Remove(tempObj); - std::string paramName {tempObj->GetName()}; + std::string paramName{tempObj->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -250,7 +248,7 @@ bool CbmDeviceMcbmUnpack::HandleData(fair::mq::MessagePtr& msg, int /*index*/) boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice ts {0}; + fles::StorableTimeslice ts{0}; inputArchive >> ts; /// On first TS, extract the TS parameters from header (by definition stable over time) @@ -325,7 +323,7 @@ bool CbmDeviceMcbmUnpack::SendUnpData() /// Split TOF vector in TOF and Bmon std::vector<CbmTofDigi>& vDigiTofBmon = fUnpAlgoTof->GetVector(); - std::vector<CbmTofDigi> vDigiTof = {}; + std::vector<CbmTofDigi> vDigiTof = {}; std::vector<CbmTofDigi> vDigiBmon = {}; for (auto digi : vDigiTofBmon) { diff --git a/MQ/mcbm/CbmDeviceMcbmUnpack.h b/MQ/mcbm/CbmDeviceMcbmUnpack.h index 0b66633adf..08609f847b 100644 --- a/MQ/mcbm/CbmDeviceMcbmUnpack.h +++ b/MQ/mcbm/CbmDeviceMcbmUnpack.h @@ -13,13 +13,10 @@ #define CBMDEVICEMCBMUNPACK_H_ #include "CbmMqTMessage.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <map> #include <vector> @@ -34,16 +31,16 @@ class CbmMcbm2018UnpackerAlgoPsd; class TimesliceMetaData; class CbmDeviceMcbmUnpack : public fair::mq::Device { -public: + public: CbmDeviceMcbmUnpack(); virtual ~CbmDeviceMcbmUnpack(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::MessagePtr&, int); bool HandleCommand(fair::mq::MessagePtr&, int); -private: + private: /// Constants static const uint16_t kusSysIdSts = 0x10; static const uint16_t kusSysIdMuch = 0x50; diff --git a/MQ/mcbm/CbmDeviceUnpack.cxx b/MQ/mcbm/CbmDeviceUnpack.cxx index d5c38ead1d..6dce2b2524 100644 --- a/MQ/mcbm/CbmDeviceUnpack.cxx +++ b/MQ/mcbm/CbmDeviceUnpack.cxx @@ -11,6 +11,7 @@ #include "CbmDeviceUnpack.h" +#include "BoostSerializer.h" #include "CbmBmonUnpackConfig.h" #include "CbmFlesCanvasTools.h" #include "CbmMQDefs.h" @@ -22,21 +23,18 @@ #include "CbmTofUnpackConfig.h" #include "CbmTrdUnpackConfig.h" #include "CbmTrdUnpackFaspConfig.h" - -#include "StorableTimeslice.hpp" -#include "TimesliceMetaData.h" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" +#include "TimesliceMetaData.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -45,8 +43,6 @@ #include <stdexcept> #include <string> #include <utility> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -220,7 +216,9 @@ Bool_t CbmDeviceUnpack::InitContainers() std::cout << Form("Setting time-walk parametersfor: module %x, ASIC %u\n", sensor, asic); parAsic->SetWalkCoef({p0, p1, p2, p3}); - if (walkMap.find(sensor) == walkMap.end()) { walkMap[sensor] = CbmStsParModule(*parMod); } + if (walkMap.find(sensor) == walkMap.end()) { + walkMap[sensor] = CbmStsParModule(*parMod); + } walkMap[sensor].SetAsic(asic, *parAsic); } @@ -621,7 +619,7 @@ CbmDeviceUnpack::InitParameters(std::vector<std::pair<std::string, std::shared_p if (asciiInput.open(filepath.data())) { parset->init(&asciiInput); } } * */ - std::string paramName {pair.second->GetName()}; + std::string paramName{pair.second->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -747,7 +745,7 @@ bool CbmDeviceUnpack::ConditionalRun() boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice ts {0}; + fles::StorableTimeslice ts{0}; inputArchive >> ts; /// On first TS, extract the TS parameters from header (by definition stable over time) @@ -1140,24 +1138,56 @@ Bool_t CbmDeviceUnpack::DoUnpack(const fles::Timeslice& ts, size_t /*component*/ if (fbOutputFullTimeSorting) { /// Time sort the output vectors of all unpackers present - if (fBmonConfig && fBmonConfig->GetOutputVec()) { timesort(fBmonConfig->GetOutputVec()); } - if (fStsConfig && fStsConfig->GetOutputVec()) { timesort(fStsConfig->GetOutputVec()); } - if (fMuchConfig && fMuchConfig->GetOutputVec()) { timesort(fMuchConfig->GetOutputVec()); } - if (fTrd1DConfig && fTrd1DConfig->GetOutputVec()) { timesort(fTrd1DConfig->GetOutputVec()); } - if (fTrd2DConfig && fTrd2DConfig->GetOutputVec()) { timesort(fTrd2DConfig->GetOutputVec()); } - if (fTofConfig && fTofConfig->GetOutputVec()) { timesort(fTofConfig->GetOutputVec()); } - if (fRichConfig && fRichConfig->GetOutputVec()) { timesort(fRichConfig->GetOutputVec()); } - if (fPsdConfig && fPsdConfig->GetOutputVec()) { timesort(fPsdConfig->GetOutputVec()); } + if (fBmonConfig && fBmonConfig->GetOutputVec()) { + timesort(fBmonConfig->GetOutputVec()); + } + if (fStsConfig && fStsConfig->GetOutputVec()) { + timesort(fStsConfig->GetOutputVec()); + } + if (fMuchConfig && fMuchConfig->GetOutputVec()) { + timesort(fMuchConfig->GetOutputVec()); + } + if (fTrd1DConfig && fTrd1DConfig->GetOutputVec()) { + timesort(fTrd1DConfig->GetOutputVec()); + } + if (fTrd2DConfig && fTrd2DConfig->GetOutputVec()) { + timesort(fTrd2DConfig->GetOutputVec()); + } + if (fTofConfig && fTofConfig->GetOutputVec()) { + timesort(fTofConfig->GetOutputVec()); + } + if (fRichConfig && fRichConfig->GetOutputVec()) { + timesort(fRichConfig->GetOutputVec()); + } + if (fPsdConfig && fPsdConfig->GetOutputVec()) { + timesort(fPsdConfig->GetOutputVec()); + } /// Time sort the output vectors of all unpackers present - if (fBmonConfig && fBmonConfig->GetOptOutAVec()) { timesort(fBmonConfig->GetOptOutAVec()); } - if (fStsConfig && fStsConfig->GetOptOutAVec()) { timesort(fStsConfig->GetOptOutAVec()); } - if (fMuchConfig && fMuchConfig->GetOptOutAVec()) { timesort(fMuchConfig->GetOptOutAVec()); } - if (fTrd1DConfig && fTrd1DConfig->GetOptOutAVec()) { timesort(fTrd1DConfig->GetOptOutAVec()); } - if (fTrd2DConfig && fTrd2DConfig->GetOptOutAVec()) { timesort(fTrd2DConfig->GetOptOutAVec()); } - if (fTofConfig && fTofConfig->GetOptOutAVec()) { timesort(fTofConfig->GetOptOutAVec()); } - if (fRichConfig && fRichConfig->GetOptOutAVec()) { timesort(fRichConfig->GetOptOutAVec()); } - if (fPsdConfig && fPsdConfig->GetOptOutAVec()) { timesort(fPsdConfig->GetOptOutAVec()); } + if (fBmonConfig && fBmonConfig->GetOptOutAVec()) { + timesort(fBmonConfig->GetOptOutAVec()); + } + if (fStsConfig && fStsConfig->GetOptOutAVec()) { + timesort(fStsConfig->GetOptOutAVec()); + } + if (fMuchConfig && fMuchConfig->GetOptOutAVec()) { + timesort(fMuchConfig->GetOptOutAVec()); + } + if (fTrd1DConfig && fTrd1DConfig->GetOptOutAVec()) { + timesort(fTrd1DConfig->GetOptOutAVec()); + } + if (fTrd2DConfig && fTrd2DConfig->GetOptOutAVec()) { + timesort(fTrd2DConfig->GetOptOutAVec()); + } + if (fTofConfig && fTofConfig->GetOptOutAVec()) { + timesort(fTofConfig->GetOptOutAVec()); + } + if (fRichConfig && fRichConfig->GetOptOutAVec()) { + timesort(fRichConfig->GetOptOutAVec()); + } + if (fPsdConfig && fPsdConfig->GetOptOutAVec()) { + timesort(fPsdConfig->GetOptOutAVec()); + } } if (0 == fulTsCounter % 10000) LOG(info) << "Processed " << fulTsCounter << " time slices"; diff --git a/MQ/mcbm/CbmDeviceUnpack.h b/MQ/mcbm/CbmDeviceUnpack.h index b0165db5b6..a0b7f7131f 100644 --- a/MQ/mcbm/CbmDeviceUnpack.h +++ b/MQ/mcbm/CbmDeviceUnpack.h @@ -14,14 +14,11 @@ #include "CbmMqTMessage.h" #include "CbmTsEventHeader.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" #include "FairParGenericSet.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <chrono> #include <map> @@ -42,11 +39,11 @@ class TimesliceMetaData; class CbmTrdSpadic; class CbmDeviceUnpack : public fair::mq::Device { -public: + public: CbmDeviceUnpack(); virtual ~CbmDeviceUnpack(); -protected: + protected: virtual void InitTask(); bool ConditionalRun(); bool HandleCommand(fair::mq::MessagePtr&, int); @@ -75,7 +72,7 @@ protected: /** @brief Set the Psd Unpack Config @param config */ void SetUnpackConfig(std::shared_ptr<CbmPsdUnpackConfig> config) { fPsdConfig = config; } -private: + private: /// Constants static constexpr std::uint16_t fkFlesBmon = static_cast<std::uint16_t>(fles::Subsystem::BMON); static constexpr std::uint16_t fkFlesMvd = static_cast<std::uint16_t>(fles::Subsystem::MVD); @@ -233,8 +230,12 @@ private: auto algo = config->GetUnpacker(); std::vector<TOptOutA> optoutAvec = {}; std::vector<TOptOutB> optoutBvec = {}; - if (optouttargetvecA) { algo->SetOptOutAVec(&optoutAvec); } - if (optouttargetvecB) { algo->SetOptOutBVec(&optoutBvec); } + if (optouttargetvecA) { + algo->SetOptOutAVec(&optoutAvec); + } + if (optouttargetvecB) { + algo->SetOptOutBVec(&optoutBvec); + } // Set the start time of the current TS for this algorithm algo->SetTsStartTime(ts->start_time()); diff --git a/MQ/mcbm/runBmonMonitor.cxx b/MQ/mcbm/runBmonMonitor.cxx index 0370f4c5d0..f6bcdb2eed 100644 --- a/MQ/mcbm/runBmonMonitor.cxx +++ b/MQ/mcbm/runBmonMonitor.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceBmonMonitor.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/mcbm/runBuildDigiEvents.cxx b/MQ/mcbm/runBuildDigiEvents.cxx index 2b4750b75d..b1c38d3bf7 100644 --- a/MQ/mcbm/runBuildDigiEvents.cxx +++ b/MQ/mcbm/runBuildDigiEvents.cxx @@ -3,12 +3,11 @@ Authors: Dominik Smith [committer] */ #include "CbmDeviceBuildDigiEvents.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/mcbm/runBuildRawEvents.cxx b/MQ/mcbm/runBuildRawEvents.cxx index 08706d4515..325776fdce 100644 --- a/MQ/mcbm/runBuildRawEvents.cxx +++ b/MQ/mcbm/runBuildRawEvents.cxx @@ -3,12 +3,11 @@ Authors: Dominik Smith [committer] */ #include "CbmDeviceBuildRawEvents.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/mcbm/runDigiEventSink.cxx b/MQ/mcbm/runDigiEventSink.cxx index 7694141a96..77c5f39d3e 100644 --- a/MQ/mcbm/runDigiEventSink.cxx +++ b/MQ/mcbm/runDigiEventSink.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceDigiEventSink.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/mcbm/runMcbmEventSink.cxx b/MQ/mcbm/runMcbmEventSink.cxx index 9d9d623e5c..26669a1f03 100644 --- a/MQ/mcbm/runMcbmEventSink.cxx +++ b/MQ/mcbm/runMcbmEventSink.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceMcbmEventSink.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/mcbm/runMcbmEvtBuilderWin.cxx b/MQ/mcbm/runMcbmEvtBuilderWin.cxx index 6c9c749cdb..a2ac42a758 100644 --- a/MQ/mcbm/runMcbmEvtBuilderWin.cxx +++ b/MQ/mcbm/runMcbmEvtBuilderWin.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceMcbmEventBuilderWin.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/mcbm/runMcbmMonitorPulser.cxx b/MQ/mcbm/runMcbmMonitorPulser.cxx index c3572e759b..f864dc1869 100644 --- a/MQ/mcbm/runMcbmMonitorPulser.cxx +++ b/MQ/mcbm/runMcbmMonitorPulser.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceMcbmMonitorPulser.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/mcbm/runMcbmUnpack.cxx b/MQ/mcbm/runMcbmUnpack.cxx index 5557d2714e..29d0288f58 100644 --- a/MQ/mcbm/runMcbmUnpack.cxx +++ b/MQ/mcbm/runMcbmUnpack.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceMcbmUnpack.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/mcbm/runUnpack.cxx b/MQ/mcbm/runUnpack.cxx index 16c3bc33be..3865593447 100644 --- a/MQ/mcbm/runUnpack.cxx +++ b/MQ/mcbm/runUnpack.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceUnpack.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/monitor/CbmDeviceMonitorBmon.cxx b/MQ/monitor/CbmDeviceMonitorBmon.cxx index 2b9bb5650f..14ec250b22 100644 --- a/MQ/monitor/CbmDeviceMonitorBmon.cxx +++ b/MQ/monitor/CbmDeviceMonitorBmon.cxx @@ -11,22 +11,20 @@ #include "CbmDeviceMonitorBmon.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" #include "CbmMcbm2018MonitorAlgoBmon.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -34,8 +32,6 @@ #include <iomanip> #include <stdexcept> #include <string> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -44,28 +40,28 @@ using namespace std; CbmDeviceMonitorBmon::CbmDeviceMonitorBmon() - : fbIgnoreOverlapMs {false} - , fsChannelNameDataInput {"t0component"} - , fsChannelNameHistosInput {"histogram-in"} - , fuHistoryHistoSize {3600} - , fuMinTotPulser {185} - , fuMaxTotPulser {195} - , fuOffSpillCountLimit {25} - , fuOffSpillCountLimitNonPulser {10} - , fdSpillCheckInterval {0.0128} - , fvuChanMap {0, 1, 2, 3, 4, 5, 6, 7} - , fuPublishFreqTs {100} - , fdMinPublishTime {0.5} - , fdMaxPublishTime {5.0} - , fsAllowedChannels {fsChannelNameDataInput} - , fParCList {nullptr} - , fulNumMessages {0} - , fulTsCounter {0} - , fLastPublishTime {std::chrono::system_clock::now()} - , fMonitorAlgo {new CbmMcbm2018MonitorAlgoBmon()} - , fArrayHisto {} - , fvpsHistosFolder {} - , fvpsCanvasConfig {} + : fbIgnoreOverlapMs{false} + , fsChannelNameDataInput{"t0component"} + , fsChannelNameHistosInput{"histogram-in"} + , fuHistoryHistoSize{3600} + , fuMinTotPulser{185} + , fuMaxTotPulser{195} + , fuOffSpillCountLimit{25} + , fuOffSpillCountLimitNonPulser{10} + , fdSpillCheckInterval{0.0128} + , fvuChanMap{0, 1, 2, 3, 4, 5, 6, 7} + , fuPublishFreqTs{100} + , fdMinPublishTime{0.5} + , fdMaxPublishTime{5.0} + , fsAllowedChannels{fsChannelNameDataInput} + , fParCList{nullptr} + , fulNumMessages{0} + , fulTsCounter{0} + , fLastPublishTime{std::chrono::system_clock::now()} + , fMonitorAlgo{new CbmMcbm2018MonitorAlgoBmon()} + , fArrayHisto{} + , fvpsHistosFolder{} + , fvpsCanvasConfig{} { } @@ -161,7 +157,7 @@ bool CbmDeviceMonitorBmon::InitContainers() for (int iparC = 0; iparC < fParCList->GetEntries(); iparC++) { FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); fParCList->Remove(tempObj); - std::string paramName {tempObj->GetName()}; + std::string paramName{tempObj->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -281,7 +277,7 @@ bool CbmDeviceMonitorBmon::HandleData(fair::mq::MessagePtr& msg, int /*index*/) boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; /// Process the Timeslice diff --git a/MQ/monitor/CbmDeviceMonitorBmon.h b/MQ/monitor/CbmDeviceMonitorBmon.h index 36c70ee4ae..48a988b546 100644 --- a/MQ/monitor/CbmDeviceMonitorBmon.h +++ b/MQ/monitor/CbmDeviceMonitorBmon.h @@ -13,13 +13,10 @@ #define CBMDEVICEMONITORBmon_H_ #include "CbmMqTMessage.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <chrono> #include <map> @@ -29,15 +26,15 @@ class TList; class CbmMcbm2018MonitorAlgoBmon; class CbmDeviceMonitorBmon : public fair::mq::Device { -public: + public: CbmDeviceMonitorBmon(); virtual ~CbmDeviceMonitorBmon(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::MessagePtr&, int); -private: + private: /// Constants static const uint16_t kusSysId = 0x90; diff --git a/MQ/monitor/CbmDeviceMonitorPsd.cxx b/MQ/monitor/CbmDeviceMonitorPsd.cxx index a4e0d7f1f4..a78f8e22e1 100644 --- a/MQ/monitor/CbmDeviceMonitorPsd.cxx +++ b/MQ/monitor/CbmDeviceMonitorPsd.cxx @@ -12,23 +12,21 @@ #include "CbmDeviceMonitorPsd.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" #include "CbmMQDefs.h" #include "CbmMcbm2018MonitorAlgoPsd.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -36,8 +34,6 @@ #include <iomanip> #include <stdexcept> #include <string> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -45,27 +41,27 @@ struct InitTaskError : std::runtime_error { using namespace std; CbmDeviceMonitorPsd::CbmDeviceMonitorPsd() - : fbIgnoreOverlapMs {false} - , fsChannelNameDataInput {"psdcomponent"} - , fsChannelNameHistosInput {"histogram-in"} - , fsChannelNameHistosConfig {"histo-conf"} - , fsChannelNameCanvasConfig {"canvas-conf"} - , fuPublishFreqTs {100} - , fdMinPublishTime {0.5} - , fdMaxPublishTime {5.0} - , fuHistoryHistoSize {3600} + : fbIgnoreOverlapMs{false} + , fsChannelNameDataInput{"psdcomponent"} + , fsChannelNameHistosInput{"histogram-in"} + , fsChannelNameHistosConfig{"histo-conf"} + , fsChannelNameCanvasConfig{"canvas-conf"} + , fuPublishFreqTs{100} + , fdMinPublishTime{0.5} + , fdMaxPublishTime{5.0} + , fuHistoryHistoSize{3600} , fviHistoChargeArgs(3, 0) , fviHistoAmplArgs(3, 0) , fviHistoZLArgs(3, 0) - , fsAllowedChannels {fsChannelNameDataInput} - , fParCList {nullptr} - , fulNumMessages {0} - , fulTsCounter {0} - , fLastPublishTime {std::chrono::system_clock::now()} - , fMonitorAlgo {new CbmMcbm2018MonitorAlgoPsd()} - , fArrayHisto {} - , fvpsHistosFolder {} - , fvpsCanvasConfig {} + , fsAllowedChannels{fsChannelNameDataInput} + , fParCList{nullptr} + , fulNumMessages{0} + , fulTsCounter{0} + , fLastPublishTime{std::chrono::system_clock::now()} + , fMonitorAlgo{new CbmMcbm2018MonitorAlgoPsd()} + , fArrayHisto{} + , fvpsHistosFolder{} + , fvpsCanvasConfig{} { } @@ -149,7 +145,7 @@ Bool_t CbmDeviceMonitorPsd::InitContainers() for (int iparC = 0; iparC < fParCList->GetEntries(); iparC++) { FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); fParCList->Remove(tempObj); - std::string paramName {tempObj->GetName()}; + std::string paramName{tempObj->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -274,7 +270,7 @@ bool CbmDeviceMonitorPsd::HandleData(fair::mq::MessagePtr& msg, int /*index*/) boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; /// Process the Timeslice diff --git a/MQ/monitor/CbmDeviceMonitorPsd.h b/MQ/monitor/CbmDeviceMonitorPsd.h index 32f2981bce..c54d48c98a 100644 --- a/MQ/monitor/CbmDeviceMonitorPsd.h +++ b/MQ/monitor/CbmDeviceMonitorPsd.h @@ -14,13 +14,10 @@ #define CBMDEVICEMONITORPSD_H_ #include "CbmMqTMessage.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <chrono> #include <map> @@ -30,15 +27,15 @@ class TList; class CbmMcbm2018MonitorAlgoPsd; class CbmDeviceMonitorPsd : public fair::mq::Device { -public: + public: CbmDeviceMonitorPsd(); virtual ~CbmDeviceMonitorPsd(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::MessagePtr&, int); -private: + private: /// Constants static const uint16_t kusSysId = 0x80; Bool_t fbComponentsAddedToList = kFALSE; diff --git a/MQ/monitor/CbmDeviceMonitorReqBmon.cxx b/MQ/monitor/CbmDeviceMonitorReqBmon.cxx index 5e52154664..be2ebfb060 100644 --- a/MQ/monitor/CbmDeviceMonitorReqBmon.cxx +++ b/MQ/monitor/CbmDeviceMonitorReqBmon.cxx @@ -4,22 +4,20 @@ #include "CbmDeviceMonitorReqBmon.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" #include "CbmMcbm2018MonitorAlgoBmon.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -27,8 +25,6 @@ #include <iomanip> #include <stdexcept> #include <string> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -36,7 +32,7 @@ struct InitTaskError : std::runtime_error { using namespace std; -CbmDeviceMonitorReqBmon::CbmDeviceMonitorReqBmon() : fMonitorAlgo {new CbmMcbm2018MonitorAlgoBmon()} {} +CbmDeviceMonitorReqBmon::CbmDeviceMonitorReqBmon() : fMonitorAlgo{new CbmMcbm2018MonitorAlgoBmon()} {} void CbmDeviceMonitorReqBmon::InitTask() try { @@ -96,7 +92,7 @@ bool CbmDeviceMonitorReqBmon::InitContainers() for (int iparC = 0; iparC < fParCList->GetEntries(); iparC++) { FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); fParCList->Remove(tempObj); - std::string paramName {tempObj->GetName()}; + std::string paramName{tempObj->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -235,7 +231,7 @@ bool CbmDeviceMonitorReqBmon::ConditionalRun() boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; /// Process the Timeslice diff --git a/MQ/monitor/CbmDeviceMonitorReqBmon.h b/MQ/monitor/CbmDeviceMonitorReqBmon.h index 69ece8b443..2cad03b30b 100644 --- a/MQ/monitor/CbmDeviceMonitorReqBmon.h +++ b/MQ/monitor/CbmDeviceMonitorReqBmon.h @@ -6,13 +6,10 @@ #define CBMDEVICEMONITORREQBmon_H_ #include "CbmMqTMessage.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <chrono> #include <map> @@ -22,15 +19,15 @@ class TList; class CbmMcbm2018MonitorAlgoBmon; class CbmDeviceMonitorReqBmon : public fair::mq::Device { -public: + public: CbmDeviceMonitorReqBmon(); virtual ~CbmDeviceMonitorReqBmon(); -protected: + protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: /// Constants static const uint16_t kusSysId = 0x90; diff --git a/MQ/monitor/CbmDeviceMonitorReqTof.cxx b/MQ/monitor/CbmDeviceMonitorReqTof.cxx index 800567edbf..5b1d89b4ad 100644 --- a/MQ/monitor/CbmDeviceMonitorReqTof.cxx +++ b/MQ/monitor/CbmDeviceMonitorReqTof.cxx @@ -4,23 +4,21 @@ #include "CbmDeviceMonitorReqTof.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" #include "CbmMQDefs.h" #include "CbmMcbm2018MonitorAlgoTof.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -28,15 +26,13 @@ #include <iomanip> #include <stdexcept> #include <string> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; using namespace std; -CbmDeviceMonitorReqTof::CbmDeviceMonitorReqTof() : fMonitorAlgo {new CbmMcbm2018MonitorAlgoTof()} {} +CbmDeviceMonitorReqTof::CbmDeviceMonitorReqTof() : fMonitorAlgo{new CbmMcbm2018MonitorAlgoTof()} {} void CbmDeviceMonitorReqTof::InitTask() try { @@ -80,7 +76,7 @@ Bool_t CbmDeviceMonitorReqTof::InitContainers() for (int iparC = 0; iparC < fParCList->GetEntries(); iparC++) { FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); fParCList->Remove(tempObj); - std::string paramName {tempObj->GetName()}; + std::string paramName{tempObj->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -215,7 +211,7 @@ bool CbmDeviceMonitorReqTof::ConditionalRun() boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; /// Process the Timeslice diff --git a/MQ/monitor/CbmDeviceMonitorReqTof.h b/MQ/monitor/CbmDeviceMonitorReqTof.h index 11025d5eb6..857bab38ad 100644 --- a/MQ/monitor/CbmDeviceMonitorReqTof.h +++ b/MQ/monitor/CbmDeviceMonitorReqTof.h @@ -6,13 +6,10 @@ #define CBMDEVICEMONITORREQTOF_H_ #include "CbmMqTMessage.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <chrono> #include <map> @@ -22,17 +19,17 @@ class TList; class CbmMcbm2018MonitorAlgoTof; class CbmDeviceMonitorReqTof : public fair::mq::Device { -public: + public: CbmDeviceMonitorReqTof(); virtual ~CbmDeviceMonitorReqTof(); -protected: + protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: /// Constants - static const uint16_t kusSysIdTof = 0x60; + static const uint16_t kusSysIdTof = 0x60; static const uint16_t kusSysIdBmon = 0x90; /// Control flags diff --git a/MQ/monitor/CbmDeviceMonitorTof.cxx b/MQ/monitor/CbmDeviceMonitorTof.cxx index 450610b46d..0dddec4172 100644 --- a/MQ/monitor/CbmDeviceMonitorTof.cxx +++ b/MQ/monitor/CbmDeviceMonitorTof.cxx @@ -11,23 +11,21 @@ #include "CbmDeviceMonitorTof.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" #include "CbmMQDefs.h" #include "CbmMcbm2018MonitorAlgoTof.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -35,15 +33,13 @@ #include <iomanip> #include <stdexcept> #include <string> - -#include "RootSerializer.h" struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; using namespace std; -CbmDeviceMonitorTof::CbmDeviceMonitorTof() : fMonitorAlgo {new CbmMcbm2018MonitorAlgoTof()} {} +CbmDeviceMonitorTof::CbmDeviceMonitorTof() : fMonitorAlgo{new CbmMcbm2018MonitorAlgoTof()} {} void CbmDeviceMonitorTof::InitTask() try { @@ -58,12 +54,12 @@ try { fuMaxTotPulser = fConfig->GetValue<uint32_t>("PulsTotMax"); fiGdpbIndex = fConfig->GetValue<int32_t>("GdpbIdx"); - fuPublishFreqTs = fConfig->GetValue<uint32_t>("PubFreqTs"); - fdMinPublishTime = fConfig->GetValue<double_t>("PubTimeMin"); - fdMaxPublishTime = fConfig->GetValue<double_t>("PubTimeMax"); - fsChannelNameDataInput = fConfig->GetValue<std::string>("TsNameIn"); - fsChannelNameHistosInput = fConfig->GetValue<std::string>("ChNameIn"); - fsAllowedChannels[0] = fsChannelNameDataInput; + fuPublishFreqTs = fConfig->GetValue<uint32_t>("PubFreqTs"); + fdMinPublishTime = fConfig->GetValue<double_t>("PubTimeMin"); + fdMaxPublishTime = fConfig->GetValue<double_t>("PubTimeMax"); + fsChannelNameDataInput = fConfig->GetValue<std::string>("TsNameIn"); + fsChannelNameHistosInput = fConfig->GetValue<std::string>("ChNameIn"); + fsAllowedChannels[0] = fsChannelNameDataInput; LOG(info) << "Histograms publication frequency in TS: " << fuPublishFreqTs; LOG(info) << "Histograms publication min. interval in s: " << fdMinPublishTime; @@ -125,7 +121,7 @@ Bool_t CbmDeviceMonitorTof::InitContainers() for (int iparC = 0; iparC < fParCList->GetEntries(); iparC++) { FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); fParCList->Remove(tempObj); - std::string paramName {tempObj->GetName()}; + std::string paramName{tempObj->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -239,7 +235,7 @@ bool CbmDeviceMonitorTof::HandleData(fair::mq::MessagePtr& msg, int /*index*/) boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; /// Process the Timeslice diff --git a/MQ/monitor/CbmDeviceMonitorTof.h b/MQ/monitor/CbmDeviceMonitorTof.h index 804dda0942..d4f28539f3 100644 --- a/MQ/monitor/CbmDeviceMonitorTof.h +++ b/MQ/monitor/CbmDeviceMonitorTof.h @@ -13,13 +13,10 @@ #define CBMDEVICEMONITORTOF_H_ #include "CbmMqTMessage.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <chrono> #include <map> @@ -29,17 +26,17 @@ class TList; class CbmMcbm2018MonitorAlgoTof; class CbmDeviceMonitorTof : public fair::mq::Device { -public: + public: CbmDeviceMonitorTof(); virtual ~CbmDeviceMonitorTof(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::MessagePtr&, int); -private: + private: /// Constants - static const uint16_t kusSysIdTof = 0x60; + static const uint16_t kusSysIdTof = 0x60; static const uint16_t kusSysIdBmon = 0x90; /// Control flags @@ -49,15 +46,15 @@ private: Bool_t fbComponentsAddedToList = kFALSE; /// User settings parameters - std::string fsChannelNameDataInput = "tofcomponent"; - std::string fsChannelNameHistosInput = "histogram-in"; - uint32_t fuHistoryHistoSize = 3600; - uint32_t fuMinTotPulser = 185; - uint32_t fuMaxTotPulser = 195; - int32_t fiGdpbIndex = -1; - uint32_t fuPublishFreqTs = 100; - double_t fdMinPublishTime = 0.5; - double_t fdMaxPublishTime = 5.0; + std::string fsChannelNameDataInput = "tofcomponent"; + std::string fsChannelNameHistosInput = "histogram-in"; + uint32_t fuHistoryHistoSize = 3600; + uint32_t fuMinTotPulser = 185; + uint32_t fuMaxTotPulser = 195; + int32_t fiGdpbIndex = -1; + uint32_t fuPublishFreqTs = 100; + double_t fdMinPublishTime = 0.5; + double_t fdMaxPublishTime = 5.0; /// List of MQ channels names std::vector<std::string> fsAllowedChannels = {fsChannelNameDataInput}; diff --git a/MQ/monitor/runMonitorBmon.cxx b/MQ/monitor/runMonitorBmon.cxx index 01ae65c94e..77f004857b 100644 --- a/MQ/monitor/runMonitorBmon.cxx +++ b/MQ/monitor/runMonitorBmon.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau, Florian Uhlig [committer] */ #include "CbmDeviceMonitorBmon.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/monitor/runMonitorPsd.cxx b/MQ/monitor/runMonitorPsd.cxx index 70a21a4d34..e50cb0e22a 100644 --- a/MQ/monitor/runMonitorPsd.cxx +++ b/MQ/monitor/runMonitorPsd.cxx @@ -3,12 +3,11 @@ Authors: Nikolay Karpushkin [committer] */ #include "CbmDeviceMonitorPsd.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/monitor/runMonitorReqBmon.cxx b/MQ/monitor/runMonitorReqBmon.cxx index 48069e08c9..3dc356924f 100644 --- a/MQ/monitor/runMonitorReqBmon.cxx +++ b/MQ/monitor/runMonitorReqBmon.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceMonitorReqBmon.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/monitor/runMonitorReqTof.cxx b/MQ/monitor/runMonitorReqTof.cxx index 2af5572d72..c91c4bf07e 100644 --- a/MQ/monitor/runMonitorReqTof.cxx +++ b/MQ/monitor/runMonitorReqTof.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceMonitorReqTof.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/monitor/runMonitorTof.cxx b/MQ/monitor/runMonitorTof.cxx index 7771a455b8..e6e942fb5a 100644 --- a/MQ/monitor/runMonitorTof.cxx +++ b/MQ/monitor/runMonitorTof.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmDeviceMonitorTof.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/parmq/ParameterMQServer.cxx b/MQ/parmq/ParameterMQServer.cxx index 751a14f225..78e3e86232 100644 --- a/MQ/parmq/ParameterMQServer.cxx +++ b/MQ/parmq/ParameterMQServer.cxx @@ -16,14 +16,12 @@ #include "CbmMQDefs.h" #include "CbmSetup.h" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" #include "FairParAsciiFileIo.h" #include "FairParGenericSet.h" #include "FairParRootFileIo.h" #include "FairRuntimeDb.h" - #include "Rtypes.h" #include "TGeoManager.h" #include "TList.h" @@ -33,10 +31,7 @@ using namespace std; -ParameterMQServer::ParameterMQServer() - : fRtdb(FairRuntimeDb::instance()) -{ -} +ParameterMQServer::ParameterMQServer() : fRtdb(FairRuntimeDb::instance()) {} void ParameterMQServer::InitTask() { @@ -208,7 +203,9 @@ void ParameterMQServer::Run() } LOG(info) << "Retrieving parameter...Done"; - if (-1 != runId) { fRtdb->initContainers(runId); } + if (-1 != runId) { + fRtdb->initContainers(runId); + } LOG(info) << "Sending following parameter to the client:"; if (par) { diff --git a/MQ/parmq/ParameterMQServer.h b/MQ/parmq/ParameterMQServer.h index 0c8c9d7eda..b7aeabce49 100644 --- a/MQ/parmq/ParameterMQServer.h +++ b/MQ/parmq/ParameterMQServer.h @@ -23,7 +23,7 @@ class FairRuntimeDb; class CbmSetup; class ParameterMQServer : public fair::mq::Device { -public: + public: ParameterMQServer(); ParameterMQServer(const ParameterMQServer&) = delete; @@ -50,7 +50,7 @@ public: void SetChannelName(const std::string& channelName) { fChannelName = channelName; } std::string GetChannelName() { return fChannelName; } -private: + private: FairRuntimeDb* fRtdb = nullptr; CbmSetup* fSetup = nullptr; diff --git a/MQ/sink/CbmDevNullSink.cxx b/MQ/sink/CbmDevNullSink.cxx index a43afd9f7e..904cb16b08 100644 --- a/MQ/sink/CbmDevNullSink.cxx +++ b/MQ/sink/CbmDevNullSink.cxx @@ -16,7 +16,7 @@ using namespace std; -CbmDevNullSink::CbmDevNullSink() : FairMQDevice {}, fNumMessages {0} {} +CbmDevNullSink::CbmDevNullSink() : FairMQDevice{}, fNumMessages{0} {} void CbmDevNullSink::Init() {} diff --git a/MQ/sink/CbmDevNullSink.h b/MQ/sink/CbmDevNullSink.h index d2a5f498e2..aceda587a0 100644 --- a/MQ/sink/CbmDevNullSink.h +++ b/MQ/sink/CbmDevNullSink.h @@ -15,16 +15,16 @@ #include "FairMQDevice.h" class CbmDevNullSink : public fair::mq::Device { -public: + public: CbmDevNullSink(); virtual ~CbmDevNullSink(); -protected: + protected: virtual void InitTask(); virtual void Init(); bool HandleData(fair::mq::MessagePtr&, int); -private: + private: uint64_t fNumMessages; }; diff --git a/MQ/sink/CbmTsaComponentSink.cxx b/MQ/sink/CbmTsaComponentSink.cxx index 992ec2244a..a05e2b1624 100644 --- a/MQ/sink/CbmTsaComponentSink.cxx +++ b/MQ/sink/CbmTsaComponentSink.cxx @@ -12,11 +12,9 @@ #include "CbmTsaComponentSink.h" #include "CbmMQDefs.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig +#include "StorableTimeslice.hpp" #include <boost/archive/binary_iarchive.hpp> @@ -87,7 +85,7 @@ bool CbmTsaComponentSink::HandleData(fair::mq::MessagePtr& msg, int /*index*/) std::istringstream iss(msgStr); boost::archive::binary_iarchive inputArchive(iss); - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; CheckTimeslice(component); diff --git a/MQ/sink/CbmTsaComponentSink.h b/MQ/sink/CbmTsaComponentSink.h index dfe293e371..93d026b608 100644 --- a/MQ/sink/CbmTsaComponentSink.h +++ b/MQ/sink/CbmTsaComponentSink.h @@ -12,21 +12,20 @@ #ifndef CBMTSACOMPONENTSINK_H_ #define CBMTSACOMPONENTSINK_H_ +#include "FairMQDevice.h" #include "MicrosliceDescriptor.hpp" #include "Timeslice.hpp" -#include "FairMQDevice.h" - class CbmTsaComponentSink : public fair::mq::Device { -public: + public: CbmTsaComponentSink(); virtual ~CbmTsaComponentSink(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::MessagePtr&, int); -private: + private: uint64_t fNumMessages; std::vector<std::string> fAllowedChannels = {"stscomponent", "tofcomponent", "trdcomponent"}; diff --git a/MQ/sink/runDevNullSink.cxx b/MQ/sink/runDevNullSink.cxx index 225703abf7..199aa7b9c6 100644 --- a/MQ/sink/runDevNullSink.cxx +++ b/MQ/sink/runDevNullSink.cxx @@ -3,7 +3,6 @@ Authors: Florian Uhlig [committer] */ #include "CbmDevNullSink.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/sink/runTsaComponentSink.cxx b/MQ/sink/runTsaComponentSink.cxx index 199e87e120..a93011889a 100644 --- a/MQ/sink/runTsaComponentSink.cxx +++ b/MQ/sink/runTsaComponentSink.cxx @@ -3,7 +3,6 @@ Authors: Florian Uhlig [committer] */ #include "CbmTsaComponentSink.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/source/CbmMQTsSamplerRepReq.cxx b/MQ/source/CbmMQTsSamplerRepReq.cxx index ecbe47c472..c81ec85c2f 100644 --- a/MQ/source/CbmMQTsSamplerRepReq.cxx +++ b/MQ/source/CbmMQTsSamplerRepReq.cxx @@ -4,41 +4,38 @@ #include "CbmMQTsSamplerRepReq.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" #include "CbmFormatDecHexPrintout.h" - +#include "FairMQLogger.h" +#include "FairMQProgOptions.h" // device->fConfig #include "TimesliceInputArchive.hpp" #include "TimesliceMultiInputArchive.hpp" #include "TimesliceMultiSubscriber.hpp" #include "TimesliceSubscriber.hpp" -#include "FairMQLogger.h" -#include "FairMQProgOptions.h" // device->fConfig - #include <TCanvas.h> #include <TH1F.h> #include <TH1I.h> #include <TProfile.h> -#include "BoostSerializer.h" #include <boost/algorithm/string.hpp> #include <boost/archive/binary_oarchive.hpp> //#include <boost/filesystem.hpp> +#include "RootSerializer.h" + #include <boost/regex.hpp> #include <boost/serialization/utility.hpp> -#include "RootSerializer.h" - //namespace filesys = boost::filesystem; -#include <thread> // this_thread::sleep_for - #include <algorithm> #include <chrono> #include <ctime> #include <iomanip> #include <sstream> #include <string> +#include <thread> // this_thread::sleep_for #include <stdio.h> @@ -53,7 +50,7 @@ struct InitTaskError : std::runtime_error { CbmMQTsSamplerRepReq::CbmMQTsSamplerRepReq() : fair::mq::Device() , fTime() - , fLastPublishTime {std::chrono::system_clock::now()} + , fLastPublishTime{std::chrono::system_clock::now()} { } @@ -128,7 +125,8 @@ try { std::string sSysId = vSysIdBlockPairs[uPair].substr(sep + 1); const size_t hexPos = sSysId.find("0x"); uint16_t usSysId; - if (string::npos == hexPos) usSysId = std::stoi(sSysId); + if (string::npos == hexPos) + usSysId = std::stoi(sSysId); else usSysId = std::stoi(sSysId.substr(hexPos + 2), nullptr, 16); @@ -137,8 +135,11 @@ try { /// Check if SysId already in use uint32_t uSysIdIdx = 0; - for (; uSysIdIdx < fSysId.size() && fSysId[uSysIdIdx] != usSysId; ++uSysIdIdx) {} - if (uSysIdIdx == fSysId.size()) { throw InitTaskError("Unknown System ID for " + vSysIdBlockPairs[uPair]); } + for (; uSysIdIdx < fSysId.size() && fSysId[uSysIdIdx] != usSysId; ++uSysIdIdx) { + } + if (uSysIdIdx == fSysId.size()) { + throw InitTaskError("Unknown System ID for " + vSysIdBlockPairs[uPair]); + } else if (true == fComponentActive[uSysIdIdx]) { throw InitTaskError("System ID already in use by another block for " + vSysIdBlockPairs[uPair]); } @@ -170,7 +171,7 @@ try { // filename && ! dirname : single file // filename with wildcards && dirname : all files with filename regex in the directory // host && port : connect to the flesnet server - bool isGoodInputCombi {false}; + bool isGoodInputCombi{false}; if (0 != fsFileName.size() && 0 == fsDirName.size() && 0 == fsHost.size() && 0 == fusPort) { isGoodInputCombi = true; fvsInputFileList.push_back(fsFileName); @@ -213,7 +214,7 @@ try { } else { // Create a ";" separated string with all file names - std::string fileList {""}; + std::string fileList{""}; for (const auto& obj : fvsInputFileList) { std::string fileName = obj; fileList += fileName; @@ -222,12 +223,16 @@ try { fileList.pop_back(); // Remove the last ; LOG(info) << "Input File String: " << fileList; fSource = new fles::TimesliceMultiInputArchive(fileList, fsDirName); - if (!fSource) { throw InitTaskError("Could open files from file list."); } + if (!fSource) { + throw InitTaskError("Could open files from file list."); + } } LOG(info) << "High-Water Mark: " << fulHighWaterMark; LOG(info) << "Max. Timeslices: " << fulMaxTimeslices; - if (fbNoSplitTs) { LOG(info) << "Sending TS copies in no-split mode"; } // if( fbNoSplitTs ) + if (fbNoSplitTs) { + LOG(info) << "Sending TS copies in no-split mode"; + } // if( fbNoSplitTs ) else if (fbSendTsPerSysId) { LOG(info) << "Sending components in separate TS per SysId"; } // else if( fbSendTsPerSysId ) of if( fbNoSplitTs ) @@ -371,7 +376,9 @@ bool CbmMQTsSamplerRepReq::InitHistograms() bool CbmMQTsSamplerRepReq::HandleRequest(fair::mq::MessagePtr& msgReq, int) { /// Initialize the histograms - if (0 < fuPublishFreqTs && 0 == fulTsCounter) { InitHistograms(); } // if( 0 < fuPublishFreqTs ) + if (0 < fuPublishFreqTs && 0 == fulTsCounter) { + InitHistograms(); + } // if( 0 < fuPublishFreqTs ) if (fbEofFound) { /// Ignore all requests if EOS reached @@ -551,7 +558,9 @@ std::unique_ptr<fles::Timeslice> CbmMQTsSamplerRepReq::GetNewTs() fulTsCounter++; fulPrevTsIndex = uTsIndex; - if (fulTsCounter % 10000 == 0) { LOG(info) << "Received TS " << fulTsCounter << " with index " << uTsIndex; } + if (fulTsCounter % 10000 == 0) { + LOG(info) << "Received TS " << fulTsCounter << " with index " << uTsIndex; + } LOG(debug) << "Found " << ts.num_components() << " different components in timeslice"; return timeslice; @@ -574,7 +583,7 @@ std::unique_ptr<fles::Timeslice> CbmMQTsSamplerRepReq::GetNewTs() return nullptr; } // else of if (fulTsCounter < fulMaxTimeslices) - } // if (timeslice) + } // if (timeslice) else { CalcRuntime(); @@ -612,7 +621,9 @@ bool CbmMQTsSamplerRepReq::AddNewTsInBuffer() /// Now that we got the TS, we can add the corresponding list of "Sent" flags, /// with the proper dimension - if (fbSendTsPerBlock) { fdbCompSentFlags.push_back(std::vector<bool>(fvBlocksToSend.size(), false)); } + if (fbSendTsPerBlock) { + fdbCompSentFlags.push_back(std::vector<bool>(fvBlocksToSend.size(), false)); + } else { fdbCompSentFlags.push_back(std::vector<bool>(fComponentActive.size(), false)); } @@ -625,7 +636,7 @@ bool CbmMQTsSamplerRepReq::CreateAndSendFullTs() if (timeslice) { /// Send full TS as response to the request const fles::Timeslice& ts = *timeslice; - fles::StorableTimeslice fullTs {ts}; + fles::StorableTimeslice fullTs{ts}; if (!SendData(fullTs)) { /// If command channel defined, send command to all "slaves" if ("" != fsChannelNameCommands) { @@ -735,8 +746,8 @@ bool CbmMQTsSamplerRepReq::CreateCombinedComponentsPerSysId(uint uCompIndex) } // if( fdpTimesliceBuffer.size() == uTsIndex ) /// Prepare the custom TS and send it - fles::StorableTimeslice component {static_cast<uint32_t>(fdpTimesliceBuffer[uTsIndex]->num_core_microslices()), - fdpTimesliceBuffer[uTsIndex]->index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(fdpTimesliceBuffer[uTsIndex]->num_core_microslices()), + fdpTimesliceBuffer[uTsIndex]->index()}; for (uint32_t uComp = 0; uComp < fvvCompPerSysId[uCompIndex].size(); ++uComp) { uint32_t uNumMsInComp = fdpTimesliceBuffer[uTsIndex]->num_microslices(fvvCompPerSysId[uCompIndex][uComp]); @@ -822,8 +833,8 @@ bool CbmMQTsSamplerRepReq::CreateCombinedComponentsPerBlock(std::string sBlockNa } // if( fdpTimesliceBuffer.size() == uTsIndex ) /// Prepare the custom TS and send it - fles::StorableTimeslice component {static_cast<uint32_t>(fdpTimesliceBuffer[uTsIndex]->num_core_microslices()), - fdpTimesliceBuffer[uTsIndex]->index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(fdpTimesliceBuffer[uTsIndex]->num_core_microslices()), + fdpTimesliceBuffer[uTsIndex]->index()}; for (uint32_t uComp = 0; uComp < fvvCompPerBlock[uBlockIdx].size(); ++uComp) { uint32_t uNumMsInComp = fdpTimesliceBuffer[uTsIndex]->num_microslices(fvvCompPerBlock[uBlockIdx][uComp]); diff --git a/MQ/source/CbmMQTsSamplerRepReq.h b/MQ/source/CbmMQTsSamplerRepReq.h index 571fa93a2b..7cfaeae425 100644 --- a/MQ/source/CbmMQTsSamplerRepReq.h +++ b/MQ/source/CbmMQTsSamplerRepReq.h @@ -14,13 +14,12 @@ #define CBMMQTSSAMPLERREPREQ_H_ +#include "FairMQDevice.h" #include "MicrosliceDescriptor.hpp" #include "StorableTimeslice.hpp" #include "Timeslice.hpp" #include "TimesliceSource.hpp" -#include "FairMQDevice.h" - class TCanvas; class TH1F; class TH1I; @@ -34,11 +33,11 @@ class TProfile; #include <vector> class CbmMQTsSamplerRepReq : public fair::mq::Device { -public: + public: CbmMQTsSamplerRepReq(); virtual ~CbmMQTsSamplerRepReq(); -protected: + protected: uint64_t fulMaxTimeslices; std::string fsFileName = ""; @@ -68,7 +67,7 @@ protected: virtual void InitTask(); bool HandleRequest(fair::mq::MessagePtr&, int); -private: + private: void CalcRuntime(); bool IsChannelNameAllowed(std::string); diff --git a/MQ/source/CbmMQTsaInfo.cxx b/MQ/source/CbmMQTsaInfo.cxx index 7159b8a7fb..b6ad8c9b35 100644 --- a/MQ/source/CbmMQTsaInfo.cxx +++ b/MQ/source/CbmMQTsaInfo.cxx @@ -13,19 +13,16 @@ #include "CbmMQTsaInfo.h" #include "CbmMQDefs.h" - -#include "TimesliceInputArchive.hpp" -#include "TimesliceSubscriber.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig - -#include <thread> // this_thread::sleep_for +#include "TimesliceInputArchive.hpp" +#include "TimesliceSubscriber.hpp" #include <boost/archive/binary_oarchive.hpp> #include <chrono> #include <ctime> +#include <thread> // this_thread::sleep_for #include <stdio.h> @@ -87,16 +84,22 @@ try { std::string connector = "tcp://" + fHost + ":" + std::to_string(fPort); LOG(info) << "Open TSPublisher at " << connector; fSource = new fles::TimesliceSubscriber(connector, 1); - if (!fSource) { throw InitTaskError("Could not connect to publisher."); } + if (!fSource) { + throw InitTaskError("Could not connect to publisher."); + } } else { LOG(info) << "Open the Flib input file " << fFileName; // Check if the input file exist FILE* inputFile = fopen(fFileName.c_str(), "r"); - if (!inputFile) { throw InitTaskError("Input file doesn't exist."); } + if (!inputFile) { + throw InitTaskError("Input file doesn't exist."); + } fclose(inputFile); fSource = new fles::TimesliceInputArchive(fFileName); - if (!fSource) { throw InitTaskError("Could not open input file."); } + if (!fSource) { + throw InitTaskError("Could not open input file."); + } } fTime = std::chrono::steady_clock::now(); } @@ -137,7 +140,9 @@ bool CbmMQTsaInfo::ConditionalRun() CheckTimeslice(ts); - if (fTSCounter < fMaxTimeslices) { return true; } + if (fTSCounter < fMaxTimeslices) { + return true; + } else { CalcRuntime(); return false; diff --git a/MQ/source/CbmMQTsaInfo.h b/MQ/source/CbmMQTsaInfo.h index 078aeba69f..b2bb8e0230 100644 --- a/MQ/source/CbmMQTsaInfo.h +++ b/MQ/source/CbmMQTsaInfo.h @@ -26,11 +26,11 @@ #include <vector> class CbmMQTsaInfo : public fair::mq::Device { -public: + public: CbmMQTsaInfo(); virtual ~CbmMQTsaInfo(); -protected: + protected: uint64_t fMaxTimeslices; std::string fFileName; @@ -48,7 +48,7 @@ protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: bool CheckTimeslice(const fles::Timeslice& ts); void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor& mdsc); bool SendData(const fles::StorableTimeslice& component); diff --git a/MQ/source/CbmMQTsaMultiSampler.cxx b/MQ/source/CbmMQTsaMultiSampler.cxx index 0dbf23790b..cbc6b57b6e 100644 --- a/MQ/source/CbmMQTsaMultiSampler.cxx +++ b/MQ/source/CbmMQTsaMultiSampler.cxx @@ -12,42 +12,38 @@ #include "CbmMQTsaMultiSampler.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" #include "CbmFormatDecHexPrintout.h" - +#include "FairMQLogger.h" +#include "FairMQProgOptions.h" // device->fConfig +#include "RootSerializer.h" #include "TimesliceAutoSource.hpp" #include "TimesliceInputArchive.hpp" #include "TimesliceMultiInputArchive.hpp" #include "TimesliceMultiSubscriber.hpp" #include "TimesliceSubscriber.hpp" -#include "FairMQLogger.h" -#include "FairMQProgOptions.h" // device->fConfig - #include <TCanvas.h> #include <TH1F.h> #include <TH1I.h> #include <TProfile.h> -#include "BoostSerializer.h" #include <boost/algorithm/string.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/filesystem.hpp> #include <boost/regex.hpp> #include <boost/serialization/utility.hpp> -#include "RootSerializer.h" - namespace filesys = boost::filesystem; -#include <thread> // this_thread::sleep_for - #include <algorithm> #include <chrono> #include <ctime> #include <iomanip> #include <sstream> #include <string> +#include <thread> // this_thread::sleep_for #include <stdio.h> @@ -73,7 +69,7 @@ CbmMQTsaMultiSampler::CbmMQTsaMultiSampler() , fMessageCounter(0) , fSource(nullptr) , fTime() - , fLastPublishTime {std::chrono::system_clock::now()} + , fLastPublishTime{std::chrono::system_clock::now()} { } @@ -132,7 +128,8 @@ try { std::string sSysId = vSysIdChanPairs[uPair].substr(0, sep); const size_t hexPos = sSysId.find("0x"); int iSysId; - if (string::npos == hexPos) iSysId = std::stoi(sSysId); + if (string::npos == hexPos) + iSysId = std::stoi(sSysId); else iSysId = std::stoi(sSysId.substr(hexPos + 2), nullptr, 16); @@ -163,7 +160,7 @@ try { // filename with wildcards && diranme : all files with filename regex in the directory // host && port : connect to the flim server - bool isGoodInputCombi {false}; + bool isGoodInputCombi{false}; if (0 != fFileName.size() && 0 == fDirName.size() && 0 == fHost.size() && 0 == fPort) { isGoodInputCombi = true; fInputFileList.push_back(fFileName); @@ -241,7 +238,7 @@ try { } else { // Create a ";" separated string with all file names - std::string fileList {""}; + std::string fileList{""}; for (const auto& obj : fInputFileList) { std::string fileName = obj; fileList += fileName; @@ -250,12 +247,16 @@ try { fileList.pop_back(); // Remove the last ; LOG(info) << "Input File String: " << fileList; fSource = new fles::TimesliceMultiInputArchive(fileList, fDirName); - if (!fSource) { throw InitTaskError("Could open files from file list."); } + if (!fSource) { + throw InitTaskError("Could open files from file list."); + } } LOG(info) << "High-Water Mark: " << fHighWaterMark; LOG(info) << "Max. Timeslices: " << fMaxTimeslices; - if (fbNoSplitTs) { LOG(info) << "Sending TS copies in no-split mode"; } // if( fbNoSplitTs ) + if (fbNoSplitTs) { + LOG(info) << "Sending TS copies in no-split mode"; + } // if( fbNoSplitTs ) else if (fbSendTsPerSysId) { LOG(info) << "Sending components in separate TS per SysId"; } // else if( fbSendTsPerSysId && fbSendTsPerSysId ) of if( fbNoSplitTs @@ -298,7 +299,8 @@ bool CbmMQTsaMultiSampler::IsChannelNameAllowed(std::string channelName) fChannelsToSend[idx].push_back(channelName); /// If sending per channel, do not stop the loop as we allow more than 1 comp type per channel - if (fbSendTsPerChannel) bFoundMatch = true; + if (fbSendTsPerChannel) + bFoundMatch = true; else return true; } // if (pos1!=std::string::npos) @@ -435,7 +437,9 @@ bool CbmMQTsaMultiSampler::InitHistograms() bool CbmMQTsaMultiSampler::ConditionalRun() { - if (0 < fuPublishFreqTs && 0 == fTSCounter) { InitHistograms(); } // if( 0 < fuPublishFreqTs ) + if (0 < fuPublishFreqTs && 0 == fTSCounter) { + InitHistograms(); + } // if( 0 < fuPublishFreqTs ) /// initialize the source (connect to emitter, ...) if (0 == fTSCounter && nullptr != dynamic_cast<fles::TimesliceMultiSubscriber*>(fSource)) { @@ -452,7 +456,9 @@ bool CbmMQTsaMultiSampler::ConditionalRun() if (0 < fuPublishFreqTs) { uint64_t uTsTime = ts.descriptor(0, 0).idx; - if (0 == fuStartTime) { fuStartTime = uTsTime; } // if( 0 == fuStartTime ) + if (0 == fuStartTime) { + fuStartTime = uTsTime; + } // if( 0 == fuStartTime ) fdTimeToStart = static_cast<double_t>(uTsTime - fuStartTime) / 1e9; uint64_t uSizeMb = 0; @@ -517,7 +523,9 @@ bool CbmMQTsaMultiSampler::ConditionalRun() fuPrevTsIndex = uTsIndex; - if (fTSCounter % 10000 == 0) { LOG(info) << "Received TS " << fTSCounter << " with index " << uTsIndex; } + if (fTSCounter % 10000 == 0) { + LOG(info) << "Received TS " << fTSCounter << " with index " << uTsIndex; + } LOG(debug) << "Found " << ts.num_components() << " different components in timeslice"; @@ -646,7 +654,7 @@ bool CbmMQTsaMultiSampler::CreateAndSendComponent(const fles::Timeslice& ts, int if (fComponentsToSend[idx] > 0) { LOG(debug) << "Create timeslice component for link " << nrComp; - fles::StorableTimeslice component {static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; component.append_component(ts.num_microslices(0)); for (size_t m = 0; m < ts.num_microslices(nrComp); ++m) { @@ -700,7 +708,7 @@ bool CbmMQTsaMultiSampler::CreateAndCombineComponentsPerSysId(const fles::Timesl LOG(debug) << "Create timeslice with components for SysId " << std::hex << fSysId[uSysIdx] << std::dec; if (0 < fvvCompPerSysId[uSysIdx].size()) { - fles::StorableTimeslice component {static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; for (uint32_t uComp = 0; uComp < fvvCompPerSysId[uSysIdx].size(); ++uComp) { uint32_t uNumMsInComp = ts.num_microslices(fvvCompPerSysId[uSysIdx][uComp]); @@ -793,7 +801,7 @@ bool CbmMQTsaMultiSampler::CreateAndCombineComponentsPerChannel(const fles::Time LOG(debug) << "Create timeslice with components for channel " << fvChannelsToSend[uChanIdx]; if (0 < fvvCompPerChannel[uChanIdx].size()) { - fles::StorableTimeslice component {static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; for (uint32_t uComp = 0; uComp < fvvCompPerChannel[uChanIdx].size(); ++uComp) { uint32_t uNumMsInComp = ts.num_microslices(fvvCompPerChannel[uChanIdx][uComp]); @@ -826,7 +834,7 @@ bool CbmMQTsaMultiSampler::CreateAndSendFullTs(const fles::Timeslice& ts) if (0 < fComponentsToSend[uChanIdx]) { LOG(debug) << "Copy timeslice component for channel " << fChannelsToSend[uChanIdx][0]; - fles::StorableTimeslice fullTs {ts}; + fles::StorableTimeslice fullTs{ts}; if (!SendData(fullTs, uChanIdx)) return false; } // if( 0 < fComponentsToSend[ uChanIdx ] ) } // for( uint32_t uChanIdx = 0; uChanIdx < fChannelsToSend.size(); ++uChanIdx ) @@ -849,7 +857,9 @@ bool CbmMQTsaMultiSampler::SendData(const fles::StorableTimeslice& component, in // TODO: Implement sending same data to more than one channel // Need to create new message (copy message??) - if (fComponentsToSend[idx] > 1) { LOG(info) << "Need to copy FairMessage"; } + if (fComponentsToSend[idx] > 1) { + LOG(info) << "Need to copy FairMessage"; + } // in case of error or transfer interruption, // return false to go to IDLE state diff --git a/MQ/source/CbmMQTsaMultiSampler.h b/MQ/source/CbmMQTsaMultiSampler.h index 5b3ced131a..54edbea44d 100644 --- a/MQ/source/CbmMQTsaMultiSampler.h +++ b/MQ/source/CbmMQTsaMultiSampler.h @@ -13,13 +13,12 @@ #define CBMMQTSAMULTISAMPLER_H_ +#include "FairMQDevice.h" #include "MicrosliceDescriptor.hpp" #include "StorableTimeslice.hpp" #include "Timeslice.hpp" #include "TimesliceSource.hpp" -#include "FairMQDevice.h" - class TCanvas; class TH1F; class TH1I; @@ -32,11 +31,11 @@ class TProfile; #include <vector> class CbmMQTsaMultiSampler : public fair::mq::Device { -public: + public: CbmMQTsaMultiSampler(); virtual ~CbmMQTsaMultiSampler(); -protected: + protected: uint64_t fMaxTimeslices; std::string fFileName; @@ -68,7 +67,7 @@ protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: bool InitHistograms(); bool CheckTimeslice(const fles::Timeslice& ts); void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor& mdsc); diff --git a/MQ/source/CbmMQTsaMultiSamplerTof.cxx b/MQ/source/CbmMQTsaMultiSamplerTof.cxx index dd4d4ef8c1..e64c40d598 100644 --- a/MQ/source/CbmMQTsaMultiSamplerTof.cxx +++ b/MQ/source/CbmMQTsaMultiSamplerTof.cxx @@ -13,16 +13,14 @@ #include "CbmMQTsaMultiSamplerTof.h" #include "CbmMQDefs.h" - +#include "FairMQLogger.h" +#include "FairMQProgOptions.h" // device->fConfig #include "StorableTimeslice.hpp" #include "TimesliceInputArchive.hpp" #include "TimesliceMultiInputArchive.hpp" #include "TimesliceMultiSubscriber.hpp" #include "TimesliceSubscriber.hpp" -#include "FairMQLogger.h" -#include "FairMQProgOptions.h" // device->fConfig - #include <boost/algorithm/string.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/filesystem.hpp> @@ -30,12 +28,11 @@ namespace filesys = boost::filesystem; -#include <thread> // this_thread::sleep_for - #include <algorithm> #include <chrono> #include <ctime> #include <string> +#include <thread> // this_thread::sleep_for #include <stdio.h> @@ -87,7 +84,7 @@ try { // filename with wildcards && diranme : all files with filename regex in the directory // host && port : connect to the flim server - bool isGoodInputCombi {false}; + bool isGoodInputCombi{false}; if (0 != fFileName.size() && 0 == fDirName.size() && 0 == fHost.size() && 0 == fPort) { isGoodInputCombi = true; fInputFileList.push_back(fFileName); @@ -160,7 +157,7 @@ try { } else { // Create a ";" separated string with all file names - std::string fileList {""}; + std::string fileList{""}; for (const auto& obj : fInputFileList) { std::string fileName = obj; fileList += fileName; @@ -169,7 +166,9 @@ try { fileList.pop_back(); // Remove the last ; LOG(info) << "Input File String: " << fileList; fSource = new fles::TimesliceMultiInputArchive(fileList, fDirName); - if (!fSource) { throw InitTaskError("Could open files from file list."); } + if (!fSource) { + throw InitTaskError("Could open files from file list."); + } } fTime = std::chrono::steady_clock::now(); @@ -290,7 +289,7 @@ bool CbmMQTsaMultiSamplerTof::ConditionalRun() if (fComponentsToSend[idx] > 0) { LOG(debug) << "Append timeslice component of link " << nrComp << " to idx " << idx; - fles::StorableTimeslice component {static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; component.append_component(ts.num_microslices(0)); for (size_t m = 0; m < ts.num_microslices(nrComp); ++m) { @@ -437,7 +436,7 @@ bool CbmMQTsaMultiSamplerTof::CreateAndSendComponent(const fles::Timeslice& ts, if (fComponentsToSend[idx] > 0) { LOG(debug) << "Create timeslice component for link " << nrComp; - fles::StorableTimeslice component {static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; component.append_component(ts.num_microslices(nrComp)); for (size_t m = 0; m < ts.num_microslices(nrComp); ++m) { @@ -466,7 +465,9 @@ bool CbmMQTsaMultiSamplerTof::SendData(const fles::StorableTimeslice& component, // TODO: Implement sending same data to more than one channel // Need to create new message (copy message??) - if (fComponentsToSend[idx] > 1) { LOG(debug) << "Need to copy FairMessage"; } + if (fComponentsToSend[idx] > 1) { + LOG(debug) << "Need to copy FairMessage"; + } // in case of error or transfer interruption, // return false to go to IDLE state @@ -550,13 +551,17 @@ void CbmMQTsaMultiSamplerTof::SendSysCmdStop() std::this_thread::sleep_for(std::chrono::milliseconds(10000)); fair::mq::MessagePtr pub(NewSimpleMessage("STOP")); - if (Send(pub, "syscmd") < 0) { LOG(error) << "Sending STOP message failed"; } + if (Send(pub, "syscmd") < 0) { + LOG(error) << "Sending STOP message failed"; + } LOG(info) << "task reset subscribers in 1 sec"; std::this_thread::sleep_for(std::chrono::milliseconds(1000)); fair::mq::MessagePtr task_reset(NewSimpleMessage("TASK_RESET")); - if (Send(task_reset, "syscmd") < 0) { LOG(error) << "Sending Task_Reset message failed"; } + if (Send(task_reset, "syscmd") < 0) { + LOG(error) << "Sending Task_Reset message failed"; + } } // FairMQStateMachine::ChangeState(STOP); } diff --git a/MQ/source/CbmMQTsaMultiSamplerTof.h b/MQ/source/CbmMQTsaMultiSamplerTof.h index fd885288c4..a0a25dd377 100644 --- a/MQ/source/CbmMQTsaMultiSamplerTof.h +++ b/MQ/source/CbmMQTsaMultiSamplerTof.h @@ -13,23 +13,22 @@ #define CBMMQTSAMULTISAMPLERTOF_H_ +#include "FairMQDevice.h" #include "MicrosliceDescriptor.hpp" #include "StorableTimeslice.hpp" #include "Timeslice.hpp" #include "TimesliceSource.hpp" -#include "FairMQDevice.h" - #include <ctime> #include <string> #include <vector> class CbmMQTsaMultiSamplerTof : public fair::mq::Device { -public: + public: CbmMQTsaMultiSamplerTof(); virtual ~CbmMQTsaMultiSamplerTof(); -protected: + protected: uint64_t fMaxTimeslices; std::string fFileName; @@ -50,7 +49,7 @@ protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: bool OpenNextFile(); bool CheckTimeslice(const fles::Timeslice& ts); diff --git a/MQ/source/CbmMQTsaSampler.cxx b/MQ/source/CbmMQTsaSampler.cxx index ccc69ebf99..a7bf13419b 100644 --- a/MQ/source/CbmMQTsaSampler.cxx +++ b/MQ/source/CbmMQTsaSampler.cxx @@ -13,12 +13,10 @@ #include "CbmMQTsaSampler.h" #include "CbmMQDefs.h" - -#include "TimesliceInputArchive.hpp" -#include "TimesliceSubscriber.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig +#include "TimesliceInputArchive.hpp" +#include "TimesliceSubscriber.hpp" #include <boost/algorithm/string.hpp> #include <boost/archive/binary_oarchive.hpp> @@ -27,12 +25,11 @@ namespace filesys = boost::filesystem; -#include <thread> // this_thread::sleep_for - #include <algorithm> #include <chrono> #include <ctime> #include <string> +#include <thread> // this_thread::sleep_for #include <stdio.h> @@ -76,23 +73,29 @@ try { // filename with wildcards && diranme : all files with filename regex in the directory // host && port : connect to the flim server - bool isGoodInputCombi {false}; + bool isGoodInputCombi{false}; if (0 != fFileName.size() && 0 == fDirName.size() && 0 == fHost.size() && 0 == fPort) { isGoodInputCombi = true; // Create a Path object from given path string filesys::path pathObj(fFileName); - if (!filesys::is_regular_file(pathObj)) { throw InitTaskError("Passed file name is no valid file"); } + if (!filesys::is_regular_file(pathObj)) { + throw InitTaskError("Passed file name is no valid file"); + } fInputFileList.push_back(fFileName); LOG(info) << "Filename: " << fFileName; } else if (0 != fFileName.size() && 0 != fDirName.size() && 0 == fHost.size() && 0 == fPort) { isGoodInputCombi = true; filesys::path pathObj = fDirName; - if (!filesys::is_directory(pathObj)) { throw InitTaskError("Passed directory name is no valid directory"); } + if (!filesys::is_directory(pathObj)) { + throw InitTaskError("Passed directory name is no valid directory"); + } if (fFileName.find("*") == std::string::npos) { // Normal file without wildcards pathObj += fFileName; - if (!filesys::is_regular_file(pathObj)) { throw InitTaskError("Passed file name is no valid file"); } + if (!filesys::is_regular_file(pathObj)) { + throw InitTaskError("Passed file name is no valid file"); + } fInputFileList.push_back(pathObj.string()); LOG(info) << "Filename: " << fInputFileList[0]; } @@ -119,7 +122,7 @@ try { // filename or directory name and convert it to a string to be // used in the regex:match boost::smatch what; -// if (!boost::regex_match(x.path().leaf().string(), what, my_filter)) continue; + // if (!boost::regex_match(x.path().leaf().string(), what, my_filter)) continue; if (!boost::regex_match(x.path().filename().string(), what, my_filter)) continue; v.push_back(x.path()); @@ -181,7 +184,9 @@ try { std::string connector = "tcp://" + fHost + ":" + std::to_string(fPort); LOG(info) << "Open TSPublisher at " << connector; fSource = new fles::TimesliceSubscriber(connector, 1); - if (!fSource) { throw InitTaskError("Could not connect to publisher."); } + if (!fSource) { + throw InitTaskError("Could not connect to publisher."); + } } else { if (false == OpenNextFile()) { @@ -306,7 +311,7 @@ bool CbmMQTsaSampler::CreateAndSendComponent(const fles::Timeslice& ts, int nrCo if (fComponentsToSend[idx] > 0) { LOG(info) << "Create timeslice component for link " << nrComp; - fles::StorableTimeslice component {static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; component.append_component(ts.num_microslices(0)); for (size_t m = 0; m < ts.num_microslices(nrComp); ++m) { @@ -335,7 +340,9 @@ bool CbmMQTsaSampler::SendData(const fles::StorableTimeslice& component, int idx // TODO: Implement sending same data to more than one channel // Need to create new message (copy message??) - if (fComponentsToSend[idx] > 1) { LOG(info) << "Need to copy FairMessage"; } + if (fComponentsToSend[idx] > 1) { + LOG(info) << "Need to copy FairMessage"; + } // in case of error or transfer interruption, // return false to go to IDLE state diff --git a/MQ/source/CbmMQTsaSampler.h b/MQ/source/CbmMQTsaSampler.h index e339e00d1e..2e0a420a99 100644 --- a/MQ/source/CbmMQTsaSampler.h +++ b/MQ/source/CbmMQTsaSampler.h @@ -26,11 +26,11 @@ #include <vector> class CbmMQTsaSampler : public fair::mq::Device { -public: + public: CbmMQTsaSampler(); virtual ~CbmMQTsaSampler(); -protected: + protected: uint64_t fMaxTimeslices; std::string fFileName; @@ -50,7 +50,7 @@ protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: bool OpenNextFile(); bool CheckTimeslice(const fles::Timeslice& ts); diff --git a/MQ/source/CbmMQTsaSamplerTof.cxx b/MQ/source/CbmMQTsaSamplerTof.cxx index 7f45af13ef..0bc2856caa 100644 --- a/MQ/source/CbmMQTsaSamplerTof.cxx +++ b/MQ/source/CbmMQTsaSamplerTof.cxx @@ -13,12 +13,10 @@ #include "CbmMQTsaSamplerTof.h" #include "CbmMQDefs.h" - -#include "TimesliceInputArchive.hpp" -#include "TimesliceSubscriber.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig +#include "TimesliceInputArchive.hpp" +#include "TimesliceSubscriber.hpp" #include <boost/algorithm/string.hpp> #include <boost/archive/binary_oarchive.hpp> @@ -27,12 +25,11 @@ namespace filesys = boost::filesystem; -#include <thread> // this_thread::sleep_for - #include <algorithm> #include <chrono> #include <ctime> #include <string> +#include <thread> // this_thread::sleep_for #include <stdio.h> @@ -77,23 +74,29 @@ try { // filename with wildcards && diranme : all files with filename regex in the directory // host && port : connect to the flim server - bool isGoodInputCombi {false}; + bool isGoodInputCombi{false}; if (0 != fFileName.size() && 0 == fDirName.size() && 0 == fHost.size() && 0 == fPort) { isGoodInputCombi = true; // Create a Path object from given path string filesys::path pathObj(fFileName); - if (!filesys::is_regular_file(pathObj)) { throw InitTaskError("Passed file name is no valid file"); } + if (!filesys::is_regular_file(pathObj)) { + throw InitTaskError("Passed file name is no valid file"); + } fInputFileList.push_back(fFileName); LOG(info) << "Filename: " << fFileName; } else if (0 != fFileName.size() && 0 != fDirName.size() && 0 == fHost.size() && 0 == fPort) { isGoodInputCombi = true; filesys::path pathObj = fDirName; - if (!filesys::is_directory(pathObj)) { throw InitTaskError("Passed directory name is no valid directory"); } + if (!filesys::is_directory(pathObj)) { + throw InitTaskError("Passed directory name is no valid directory"); + } if (fFileName.find("*") == std::string::npos) { // Normal file without wildcards pathObj += fFileName; - if (!filesys::is_regular_file(pathObj)) { throw InitTaskError("Passed file name is no valid file"); } + if (!filesys::is_regular_file(pathObj)) { + throw InitTaskError("Passed file name is no valid file"); + } fInputFileList.push_back(pathObj.string()); LOG(info) << "Filename: " << fInputFileList[0]; } @@ -182,7 +185,9 @@ try { std::string connector = "tcp://" + fHost + ":" + std::to_string(fPort); LOG(info) << "Open TSPublisher at " << connector; fSource = new fles::TimesliceSubscriber(connector, 1); - if (!fSource) { throw InitTaskError("Could not connect to publisher."); } + if (!fSource) { + throw InitTaskError("Could not connect to publisher."); + } } else { if (false == OpenNextFile()) { @@ -306,7 +311,7 @@ bool CbmMQTsaSamplerTof::ConditionalRun() if (fComponentsToSend[idx] > 0) { LOG(debug) << "Append timeslice component of link " << nrComp << " to idx " << idx; - fles::StorableTimeslice component {static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; component.append_component(ts.num_microslices(0)); for (size_t m = 0; m < ts.num_microslices(nrComp); ++m) { @@ -462,7 +467,7 @@ bool CbmMQTsaSamplerTof::CreateAndSendComponent(const fles::Timeslice& ts, int n if (fComponentsToSend[idx] > 0) { LOG(debug) << "Create timeslice component for link " << nrComp; - fles::StorableTimeslice component {static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; + fles::StorableTimeslice component{static_cast<uint32_t>(ts.num_core_microslices()), ts.index()}; component.append_component(ts.num_microslices(0)); for (size_t m = 0; m < ts.num_microslices(nrComp); ++m) { @@ -491,7 +496,9 @@ bool CbmMQTsaSamplerTof::SendData(const fles::StorableTimeslice& component, int // TODO: Implement sending same data to more than one channel // Need to create new message (copy message??) - if (fComponentsToSend[idx] > 1) { LOG(debug) << "Need to copy FairMessage"; } + if (fComponentsToSend[idx] > 1) { + LOG(debug) << "Need to copy FairMessage"; + } // in case of error or transfer interruption, // return false to go to IDLE state @@ -570,13 +577,17 @@ void CbmMQTsaSamplerTof::SendSysCmdStop() std::this_thread::sleep_for(std::chrono::milliseconds(100000)); fair::mq::MessagePtr pub(NewSimpleMessage("STOP")); - if (Send(pub, "syscmd") < 0) { LOG(error) << "Sending STOP message failed"; } + if (Send(pub, "syscmd") < 0) { + LOG(error) << "Sending STOP message failed"; + } LOG(info) << "task reset subscribers in 1 sec"; std::this_thread::sleep_for(std::chrono::milliseconds(1000)); fair::mq::MessagePtr task_reset(NewSimpleMessage("TASK_RESET")); - if (Send(task_reset, "syscmd") < 0) { LOG(error) << "Sending Task_Reset message failed"; } + if (Send(task_reset, "syscmd") < 0) { + LOG(error) << "Sending Task_Reset message failed"; + } } // FairMQStateMachine::ChangeState(STOP); } diff --git a/MQ/source/CbmMQTsaSamplerTof.h b/MQ/source/CbmMQTsaSamplerTof.h index bfffd2c379..41ff1c340e 100644 --- a/MQ/source/CbmMQTsaSamplerTof.h +++ b/MQ/source/CbmMQTsaSamplerTof.h @@ -26,11 +26,11 @@ #include <vector> class CbmMQTsaSamplerTof : public fair::mq::Device { -public: + public: CbmMQTsaSamplerTof(); virtual ~CbmMQTsaSamplerTof(); -protected: + protected: uint64_t fMaxTimeslices; std::string fFileName; @@ -50,7 +50,7 @@ protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: bool OpenNextFile(); bool CheckTimeslice(const fles::Timeslice& ts); diff --git a/MQ/source/CbmStsDigiSource.cxx b/MQ/source/CbmStsDigiSource.cxx index 9c52b60156..b1576bfa84 100644 --- a/MQ/source/CbmStsDigiSource.cxx +++ b/MQ/source/CbmStsDigiSource.cxx @@ -15,20 +15,18 @@ #include "CbmDigiManager.h" #include "CbmMQDefs.h" #include "CbmStsDigi.h" - #include "FairFileSource.h" #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairRootManager.h" #include "FairRunAna.h" -#include <thread> // this_thread::sleep_for - #include <boost/archive/binary_oarchive.hpp> #include <chrono> #include <ctime> #include <stdexcept> +#include <thread> // this_thread::sleep_for #include <stdio.h> @@ -84,15 +82,21 @@ try { LOG(info) << "Open the ROOT input file " << fFileName; // Check if the input file exist FILE* inputFile = fopen(fFileName.c_str(), "r"); - if (!inputFile) { throw InitTaskError("Input file doesn't exist."); } + if (!inputFile) { + throw InitTaskError("Input file doesn't exist."); + } fclose(inputFile); FairFileSource* source = new FairFileSource(fFileName); - if (!source) { throw InitTaskError("Could not open input file."); } + if (!source) { + throw InitTaskError("Could not open input file."); + } rootman->SetSource(source); rootman->InitSource(); CbmDigiManager* digiMan = CbmDigiManager::Instance(); digiMan->Init(); - if (!digiMan->IsPresent(ECbmModuleId::kSts)) { throw InitTaskError("No StsDigi branch in input!"); } + if (!digiMan->IsPresent(ECbmModuleId::kSts)) { + throw InitTaskError("No StsDigi branch in input!"); + } } else { throw InitTaskError("No input file specified"); @@ -101,7 +105,9 @@ try { Int_t MaxAllowed = FairRootManager::Instance()->CheckMaxEventNo(fMaxEvents); if (MaxAllowed != -1) { - if (fMaxEvents == 0) { fMaxEvents = MaxAllowed; } + if (fMaxEvents == 0) { + fMaxEvents = MaxAllowed; + } else { if (static_cast<Int_t>(fMaxEvents) > MaxAllowed) { LOG(warn) << "-------------------Warning---------------------------"; @@ -165,7 +171,9 @@ bool CbmStsDigiSource::ConditionalRun() LOG(info) << "Counter: " << fEventCounter << " Events: " << fMaxEvents; - if (fEventCounter < fMaxEvents) { return true; } + if (fEventCounter < fMaxEvents) { + return true; + } else { CalcRuntime(); return false; diff --git a/MQ/source/CbmStsDigiSource.h b/MQ/source/CbmStsDigiSource.h index 38d886981e..90ee5e4b72 100644 --- a/MQ/source/CbmStsDigiSource.h +++ b/MQ/source/CbmStsDigiSource.h @@ -20,11 +20,11 @@ class CbmStsDigi; class CbmStsDigiSource : public fair::mq::Device { -public: + public: CbmStsDigiSource(); virtual ~CbmStsDigiSource(); -protected: + protected: uint64_t fMaxEvents; std::string fFileName; @@ -40,7 +40,7 @@ protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: void PrintStsDigi(const CbmStsDigi*); bool SendData(); void CalcRuntime(); diff --git a/MQ/source/CbmTsConsumerReqDevExample.cxx b/MQ/source/CbmTsConsumerReqDevExample.cxx index aa2d522bec..4e06d565ca 100644 --- a/MQ/source/CbmTsConsumerReqDevExample.cxx +++ b/MQ/source/CbmTsConsumerReqDevExample.cxx @@ -4,22 +4,19 @@ #include "CbmTsConsumerReqDevExample.h" +#include "BoostSerializer.h" #include "CbmFlesCanvasTools.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" - +#include "RootSerializer.h" +#include "StorableTimeslice.hpp" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TList.h" #include "TNamed.h" -#include <thread> -#include "BoostSerializer.h" #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/utility.hpp> @@ -27,8 +24,7 @@ #include <iomanip> #include <stdexcept> #include <string> - -#include "RootSerializer.h" +#include <thread> struct InitTaskError : std::runtime_error { using std::runtime_error::runtime_error; }; @@ -72,7 +68,7 @@ bool CbmTsConsumerReqDevExample::InitContainers() for (int iparC = 0; iparC < fParCList->GetEntries(); iparC++) { FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); fParCList->Remove(tempObj); - std::string paramName {tempObj->GetName()}; + std::string paramName{tempObj->GetName()}; // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy @@ -207,7 +203,7 @@ bool CbmTsConsumerReqDevExample::ConditionalRun() boost::archive::binary_iarchive inputArchive(iss); /// Create an empty TS and fill it with the incoming message - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; /// Process the Timeslice diff --git a/MQ/source/CbmTsConsumerReqDevExample.h b/MQ/source/CbmTsConsumerReqDevExample.h index 52eb3c442b..dd7755ca1c 100644 --- a/MQ/source/CbmTsConsumerReqDevExample.h +++ b/MQ/source/CbmTsConsumerReqDevExample.h @@ -6,13 +6,10 @@ #define CBMTSCONSUMERREQDEVEXPL_H_ #include "CbmMqTMessage.h" - -#include "Timeslice.hpp" - #include "FairMQDevice.h" - #include "Rtypes.h" #include "TObjArray.h" +#include "Timeslice.hpp" #include <chrono> #include <map> @@ -21,15 +18,15 @@ class TList; class CbmTsConsumerReqDevExample : public fair::mq::Device { -public: + public: CbmTsConsumerReqDevExample(); virtual ~CbmTsConsumerReqDevExample(); -protected: + protected: virtual void InitTask(); virtual bool ConditionalRun(); -private: + private: /// Constants static const uint16_t kusSysId = 0xFF; diff --git a/MQ/source/runStsDigiSource.cxx b/MQ/source/runStsDigiSource.cxx index 2982c9a0a2..ce7172fc3d 100644 --- a/MQ/source/runStsDigiSource.cxx +++ b/MQ/source/runStsDigiSource.cxx @@ -3,7 +3,6 @@ Authors: Florian Uhlig [committer] */ #include "CbmStsDigiSource.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/source/runTsConsumerReqExample.cxx b/MQ/source/runTsConsumerReqExample.cxx index a5d8e6d755..c43711b475 100644 --- a/MQ/source/runTsConsumerReqExample.cxx +++ b/MQ/source/runTsConsumerReqExample.cxx @@ -3,12 +3,11 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmTsConsumerReqDevExample.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/source/runTsSamplerRepReq.cxx b/MQ/source/runTsSamplerRepReq.cxx index e5893b7e18..c3105c1517 100644 --- a/MQ/source/runTsSamplerRepReq.cxx +++ b/MQ/source/runTsSamplerRepReq.cxx @@ -3,7 +3,6 @@ Authors: Pierre-Alain Loizeau [committer] */ #include "CbmMQTsSamplerRepReq.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/source/runTsaInfo.cxx b/MQ/source/runTsaInfo.cxx index befe52c5a2..3590f2f9b2 100644 --- a/MQ/source/runTsaInfo.cxx +++ b/MQ/source/runTsaInfo.cxx @@ -3,7 +3,6 @@ Authors: Florian Uhlig [committer] */ #include "CbmMQTsaInfo.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/source/runTsaMultiSampler.cxx b/MQ/source/runTsaMultiSampler.cxx index b74f497cb7..491dc6e9a4 100644 --- a/MQ/source/runTsaMultiSampler.cxx +++ b/MQ/source/runTsaMultiSampler.cxx @@ -3,7 +3,6 @@ Authors: Florian Uhlig [committer], Pierre-Alain Loizeau */ #include "CbmMQTsaMultiSampler.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/source/runTsaMultiSamplerTof.cxx b/MQ/source/runTsaMultiSamplerTof.cxx index 140e2365d9..d3e8e5f4f0 100644 --- a/MQ/source/runTsaMultiSamplerTof.cxx +++ b/MQ/source/runTsaMultiSamplerTof.cxx @@ -3,7 +3,6 @@ Authors: Norbert Herrmann [committer] */ #include "CbmMQTsaMultiSamplerTof.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/source/runTsaSampler.cxx b/MQ/source/runTsaSampler.cxx index a6b7852523..701c4b0c32 100644 --- a/MQ/source/runTsaSampler.cxx +++ b/MQ/source/runTsaSampler.cxx @@ -3,7 +3,6 @@ Authors: Florian Uhlig [committer] */ #include "CbmMQTsaSampler.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/source/runTsaSamplerTof.cxx b/MQ/source/runTsaSamplerTof.cxx index 1353dd832e..63a707fa01 100644 --- a/MQ/source/runTsaSamplerTof.cxx +++ b/MQ/source/runTsaSamplerTof.cxx @@ -3,7 +3,6 @@ Authors: Norbert Herrmann [committer] */ #include "CbmMQTsaSamplerTof.h" - #include "runFairMQDevice.h" namespace bpo = boost::program_options; diff --git a/MQ/unpacker/CbmDeviceUnpackTofCri.cxx b/MQ/unpacker/CbmDeviceUnpackTofCri.cxx index e90c753337..32b2e8be29 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofCri.cxx +++ b/MQ/unpacker/CbmDeviceUnpackTofCri.cxx @@ -24,13 +24,11 @@ #include "CbmTofDigi.h" //#include "CbmRawEvent.h" -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" #include "FairRuntimeDb.h" - +#include "StorableTimeslice.hpp" #include "TH1.h" #include "TH2.h" @@ -154,7 +152,8 @@ try { continue; } //if(entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofCri::HandleData); - if (entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofCri::HandleParts); + if (entry.first != "tofdigis") + OnData(entry.first, &CbmDeviceUnpackTofCri::HandleParts); else { fChannelsToSend[0].push_back(entry.first); LOG(info) << "Init to send data to channel " << fChannelsToSend[0][0]; @@ -299,7 +298,7 @@ Bool_t CbmDeviceUnpackTofCri::InitContainers() // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy - std::string message {"CbmMcbm2018TofPar,111"}; + std::string message{"CbmMcbm2018TofPar,111"}; LOG(info) << "Requesting parameter container CbmMcbm2018TofPar, sending message: " << message; fair::mq::MessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111")); @@ -485,7 +484,7 @@ bool CbmDeviceUnpackTofCri::HandleData(fair::mq::MessagePtr& msg, int /*index*/) std::istringstream iss(msgStr); boost::archive::binary_iarchive inputArchive(iss); - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; // CheckTimeslice(component); @@ -507,7 +506,7 @@ bool CbmDeviceUnpackTofCri::HandleParts(fair::mq::Parts& parts, int /*index*/) fNumMessages++; LOG(debug) << "Received message number " << fNumMessages << " with " << parts.Size() << " parts"; - fles::StorableTimeslice ts {0}; + fles::StorableTimeslice ts{0}; uint64_t ulTsStartTime = 0; switch (fiSelectComponents) { @@ -517,7 +516,7 @@ bool CbmDeviceUnpackTofCri::HandleParts(fair::mq::Parts& parts, int /*index*/) boost::archive::binary_iarchive inputArchive(iss); inputArchive >> ts; //CheckTimeslice(ts); - for (size_t c {0}; c < ts.num_components(); c++) { + for (size_t c{0}; c < ts.num_components(); c++) { auto systemID = static_cast<int>(ts.descriptor(c, 0).sys_id); if (1 == fNumMessages) { LOG(info) << "Found systemID: " << std::hex << systemID << std::dec; @@ -531,7 +530,7 @@ bool CbmDeviceUnpackTofCri::HandleParts(fair::mq::Parts& parts, int /*index*/) ulTsStartTime = ts.start_time(); } break; case 1: { - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; uint ncomp = parts.Size(); for (uint i = 0; i < ncomp; i++) { @@ -779,7 +778,8 @@ void CbmDeviceUnpackTofCri::BuildTint(uint64_t ulTsStartTime, int iMode) } //if(bOut) LOG(info)<<Form("Found 0x%08x, Req 0x%08x ", digi->GetAddress(), fiReqDigiAddr); if (dTEnd - digi->GetTime() < fdMaxDeltaT * 0.5) { - if (digi->GetTime() + fdMaxDeltaT * 0.5 < dTEndMax) dTEnd = digi->GetTime() + fdMaxDeltaT * 0.5; + if (digi->GetTime() + fdMaxDeltaT * 0.5 < dTEndMax) + dTEnd = digi->GetTime() + fdMaxDeltaT * 0.5; else dTEnd = dTEndMax; }; @@ -796,11 +796,13 @@ void CbmDeviceUnpackTofCri::BuildTint(uint64_t ulTsStartTime, int iMode) << Form("T %15.3f, Tot %5.1f", vdigi[iDigi]->GetTime(), vdigi[iDigi]->GetTot()); UInt_t iDetMul = 0; - if (fiReqDigiAddr.size() == 0) bOut = kTRUE; // output everything + if (fiReqDigiAddr.size() == 0) + bOut = kTRUE; // output everything else { if (fiReqMode == 0) { // check for presence of requested detectors for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) - if (bDet[i][0] == kFALSE || bDet[i][1] == kFALSE) break; + if (bDet[i][0] == kFALSE || bDet[i][1] == kFALSE) + break; else if (i == fiReqDigiAddr.size() - 1) { bOut = kTRUE; iDetMul = i; @@ -808,8 +810,12 @@ void CbmDeviceUnpackTofCri::BuildTint(uint64_t ulTsStartTime, int iMode) } else { // check for presence of any known detector for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) - if (bDet[i][0] == kTRUE && bDet[i][1] == kTRUE) { iDetMul++; } - if (iDetMul >= fiReqMode) { bOut = kTRUE; } + if (bDet[i][0] == kTRUE && bDet[i][1] == kTRUE) { + iDetMul++; + } + if (iDetMul >= fiReqMode) { + bOut = kTRUE; + } } } @@ -834,7 +840,9 @@ void CbmDeviceUnpackTofCri::BuildTint(uint64_t ulTsStartTime, int iMode) fEventHeader[0]++; if ((Int_t) fiReqBeam > -1) { - if (bBeam) { LOG(debug) << "Beam counter is present "; } + if (bBeam) { + LOG(debug) << "Beam counter is present "; + } else { LOG(debug) << "Beam counter is not present"; bOut = kFALSE; // request beam counter for event diff --git a/MQ/unpacker/CbmDeviceUnpackTofCri.h b/MQ/unpacker/CbmDeviceUnpackTofCri.h index 975aa9f75c..7366df4d14 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofCri.h +++ b/MQ/unpacker/CbmDeviceUnpackTofCri.h @@ -16,20 +16,16 @@ #define CBMDEVICEUNPACKTOFCri_H_ #include "CbmMcbm2018TofPar.h" - -#include "MicrosliceDescriptor.hpp" -#include "Timeslice.hpp" - #include "FairMQDevice.h" - +#include "MicrosliceDescriptor.hpp" #include "Rtypes.h" #include "TMessage.h" +#include "Timeslice.hpp" +#include "gDpbMessv100.h" #include <map> #include <vector> -#include "gDpbMessv100.h" - class CbmTofUnpackAlgo; class CbmMcbm2018TofPar; class CbmTbDaqBuffer; @@ -39,11 +35,11 @@ class TH1; class TH2; class CbmDeviceUnpackTofCri : public fair::mq::Device { -public: + public: CbmDeviceUnpackTofCri(); virtual ~CbmDeviceUnpackTofCri(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::MessagePtr&, int); bool HandleParts(fair::mq::Parts&, int); @@ -51,7 +47,7 @@ protected: virtual void BuildTint(uint64_t ulTsStartTime, int iMode = 0); virtual bool SendDigis(std::vector<CbmTofDigi*>, int); -private: + private: uint64_t fNumMessages; uint64_t fiSelectComponents; uint64_t fNumTint; @@ -178,7 +174,7 @@ private: /// Temp until we change from CbmMcbmUnpack to something else void AddMsComponentToList(size_t component, UShort_t usDetectorId); - void SetNbMsInTs(size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/) {}; + void SetNbMsInTs(size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/){}; /// Algo settings setters void SetIgnoreOverlapMs(Bool_t bFlagIn = kTRUE); @@ -199,7 +195,7 @@ private: // special class to expose protected TMessage constructor class CbmMQTMessage : public TMessage { -public: + public: CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); } }; diff --git a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx index a268c8d8d2..fd37e30a68 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx +++ b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.cxx @@ -20,14 +20,11 @@ #include "CbmTofAddress.h" #include "CbmTofDetectorId_v21a.h" // in cbmdata/tof #include "CbmTofDigi.h" - -#include "StorableTimeslice.hpp" - #include "FairMQLogger.h" #include "FairMQProgOptions.h" // device->fConfig #include "FairParGenericSet.h" #include "FairRuntimeDb.h" - +#include "StorableTimeslice.hpp" #include "TH1.h" #include "TH2.h" @@ -149,7 +146,8 @@ try { continue; } //if(entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleData); - if (entry.first != "tofdigis") OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleParts); + if (entry.first != "tofdigis") + OnData(entry.first, &CbmDeviceUnpackTofMcbm2018::HandleParts); else { fChannelsToSend[0].push_back(entry.first); LOG(info) << "Init to send data to channel " << fChannelsToSend[0][0]; @@ -275,7 +273,7 @@ Bool_t CbmDeviceUnpackTofMcbm2018::InitContainers() // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy - std::string message {"CbmMcbm2018TofPar,111"}; + std::string message{"CbmMcbm2018TofPar,111"}; LOG(info) << "Requesting parameter container CbmMcbm2018TofPar, sending message: " << message; fair::mq::MessagePtr req(NewSimpleMessage("CbmMcbm2018TofPar,111")); @@ -331,7 +329,7 @@ void CbmDeviceUnpackTofMcbm2018::SetParContainers() FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); fParCList->Remove(tempObj); - std::string sParamName {tempObj->GetName()}; + std::string sParamName{tempObj->GetName()}; FairParGenericSet* newObj = dynamic_cast<FairParGenericSet*>(fRtdb->getContainer(sParamName.data())); LOG(info) << " - Get " << sParamName.data() << " at " << newObj; @@ -781,7 +779,7 @@ bool CbmDeviceUnpackTofMcbm2018::HandleData(fair::mq::MessagePtr& msg, int /*ind std::istringstream iss(msgStr); boost::archive::binary_iarchive inputArchive(iss); - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; inputArchive >> component; // CheckTimeslice(component); @@ -803,7 +801,7 @@ bool CbmDeviceUnpackTofMcbm2018::HandleParts(fair::mq::Parts& parts, int /*index fNumMessages++; LOG(debug) << "Received message number " << fNumMessages << " with " << parts.Size() << " parts"; - fles::StorableTimeslice ts {0}; + fles::StorableTimeslice ts{0}; switch (fiSelectComponents) { case 0: { @@ -814,7 +812,7 @@ bool CbmDeviceUnpackTofMcbm2018::HandleParts(fair::mq::Parts& parts, int /*index //CheckTimeslice(ts); if (1 == fNumMessages) { LOG(info) << "Initialize TS components list to " << ts.num_components(); - for (size_t c {0}; c < ts.num_components(); c++) { + for (size_t c{0}; c < ts.num_components(); c++) { auto systemID = static_cast<int>(ts.descriptor(c, 0).sys_id); LOG(info) << "Found systemID: " << std::hex << systemID << std::dec; fUnpackerAlgo->AddMsComponentToList(c, systemID); // TOF data @@ -823,7 +821,7 @@ bool CbmDeviceUnpackTofMcbm2018::HandleParts(fair::mq::Parts& parts, int /*index DoUnpack(ts, 0); } break; case 1: { - fles::StorableTimeslice component {0}; + fles::StorableTimeslice component{0}; uint ncomp = parts.Size(); for (uint i = 0; i < ncomp; i++) { @@ -1051,7 +1049,8 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) } //if(bOut) LOG(info)<<Form("Found 0x%08x, Req 0x%08x ", digi->GetAddress(), fiReqDigiAddr); if (dTEnd - digi->GetTime() < fdMaxDeltaT * 0.5) { - if (digi->GetTime() + fdMaxDeltaT * 0.5 < dTEndMax) dTEnd = digi->GetTime() + fdMaxDeltaT * 0.5; + if (digi->GetTime() + fdMaxDeltaT * 0.5 < dTEndMax) + dTEnd = digi->GetTime() + fdMaxDeltaT * 0.5; else dTEnd = dTEndMax; }; @@ -1065,11 +1064,13 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) LOG(debug) << vdigi[iDigi]->ToString(); UInt_t iDetMul = 0; - if (fiReqDigiAddr.size() == 0) bOut = kTRUE; // output everything + if (fiReqDigiAddr.size() == 0) + bOut = kTRUE; // output everything else { if (fiReqMode == 0) { // check for presence of requested detectors for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) - if (bDet[i][0] == kFALSE || bDet[i][1] == kFALSE) break; + if (bDet[i][0] == kFALSE || bDet[i][1] == kFALSE) + break; else if (i == fiReqDigiAddr.size() - 1) { bOut = kTRUE; iDetMul = i; @@ -1077,8 +1078,12 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) } else { // check for presence of any known detector for (UInt_t i = 0; i < fiReqDigiAddr.size(); i++) - if (bDet[i][0] == kTRUE && bDet[i][1] == kTRUE) { iDetMul++; } - if (iDetMul >= fiReqMode) { bOut = kTRUE; } + if (bDet[i][0] == kTRUE && bDet[i][1] == kTRUE) { + iDetMul++; + } + if (iDetMul >= fiReqMode) { + bOut = kTRUE; + } } } @@ -1102,7 +1107,9 @@ void CbmDeviceUnpackTofMcbm2018::BuildTint(int iMode = 0) fEventHeader[0]++; if ((Int_t) fiReqBeam > -1) { - if (bBeam) { LOG(debug) << "Beam counter is present "; } + if (bBeam) { + LOG(debug) << "Beam counter is present "; + } else { LOG(debug) << "Beam counter is not present"; bOut = kFALSE; // request beam counter for event diff --git a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h index 1f3d1876c7..5fa372d2af 100644 --- a/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h +++ b/MQ/unpacker/CbmDeviceUnpackTofMcbm2018.h @@ -17,19 +17,15 @@ #include "CbmMcbm2018TofPar.h" #include "CbmMqTMessage.h" - -#include "MicrosliceDescriptor.hpp" -#include "Timeslice.hpp" - #include "FairMQDevice.h" - +#include "MicrosliceDescriptor.hpp" #include "Rtypes.h" +#include "Timeslice.hpp" +#include "gDpbMessv100.h" #include <map> #include <vector> -#include "gDpbMessv100.h" - class CbmMcbm2018UnpackerAlgoTof; class CbmMcbm2018TofPar; class CbmTbDaqBuffer; @@ -39,11 +35,11 @@ class TH1; class TH2; class CbmDeviceUnpackTofMcbm2018 : public fair::mq::Device { -public: + public: CbmDeviceUnpackTofMcbm2018(); virtual ~CbmDeviceUnpackTofMcbm2018(); -protected: + protected: virtual void InitTask(); bool HandleData(fair::mq::MessagePtr&, int); bool HandleParts(fair::mq::Parts&, int); @@ -51,7 +47,7 @@ protected: virtual void BuildTint(int); virtual bool SendDigis(std::vector<CbmTofDigi*>, int); -private: + private: uint64_t fNumMessages; uint64_t fiSelectComponents; uint64_t fNumTint; @@ -178,7 +174,7 @@ private: /// Temp until we change from CbmMcbmUnpack to something else void AddMsComponentToList(size_t component, UShort_t usDetectorId); - void SetNbMsInTs(size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/) {}; + void SetNbMsInTs(size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/){}; /// Algo settings setters void SetIgnoreOverlapMs(Bool_t bFlagIn = kTRUE); diff --git a/MQ/unpacker/runUnpackTofCri.cxx b/MQ/unpacker/runUnpackTofCri.cxx index c0e869b251..37f933c97c 100644 --- a/MQ/unpacker/runUnpackTofCri.cxx +++ b/MQ/unpacker/runUnpackTofCri.cxx @@ -3,12 +3,11 @@ Authors: Norbert Herrmann [committer] */ #include "CbmDeviceUnpackTofCri.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; diff --git a/MQ/unpacker/runUnpackTofMcbm2018.cxx b/MQ/unpacker/runUnpackTofMcbm2018.cxx index c132b7f72b..75708381fb 100644 --- a/MQ/unpacker/runUnpackTofMcbm2018.cxx +++ b/MQ/unpacker/runUnpackTofMcbm2018.cxx @@ -3,12 +3,11 @@ Authors: Norbert Herrmann [committer] */ #include "CbmDeviceUnpackTofMcbm2018.h" +#include "runFairMQDevice.h" #include <iomanip> #include <string> -#include "runFairMQDevice.h" - namespace bpo = boost::program_options; using namespace std; -- GitLab