Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • le.koch/cbmroot
  • patrick.pfistner_AT_kit.edu/cbmroot
  • lena.rossel_AT_stud.uni-frankfurt.de/cbmroot
  • i.deppner/cbmroot
  • fweig/cbmroot
  • karpushkin_AT_inr.ru/cbmroot
  • v.akishina/cbmroot
  • rishat.sultanov_AT_cern.ch/cbmroot
  • l_fabe01_AT_uni-muenster.de/cbmroot
  • pwg-c2f/cbmroot
  • j.decuveland/cbmroot
  • a.toia/cbmroot
  • i.vassiliev/cbmroot
  • n.herrmann/cbmroot
  • o.lubynets/cbmroot
  • se.gorbunov/cbmroot
  • cornelius.riesen_AT_physik.uni-giessen.de/cbmroot
  • zhangqn17_AT_mails.tsinghua.edu.cn/cbmroot
  • bartosz.sobol/cbmroot
  • ajit.kumar/cbmroot
  • computing/cbmroot
  • a.agarwal_AT_vecc.gov.in/cbmroot
  • osingh/cbmroot
  • wielanek_AT_if.pw.edu.pl/cbmroot
  • malgorzata.karabowicz.stud_AT_pw.edu.pl/cbmroot
  • m.shiroya/cbmroot
  • s.roy/cbmroot
  • p.-a.loizeau/cbmroot
  • a.weber/cbmroot
  • ma.beyer/cbmroot
  • d.klein/cbmroot
  • d.smith/cbmroot
  • mvdsoft/cbmroot
  • d.spicker/cbmroot
  • y.h.leung/cbmroot
  • aksharma/cbmroot
  • m.deveaux/cbmroot
  • mkunold/cbmroot
  • h.darwish/cbmroot
  • pk.sharma_AT_vecc.gov.in/cbmroot
  • f_fido01_AT_uni-muenster.de/cbmroot
  • g.kozlov/cbmroot
  • d.emschermann/cbmroot
  • evgeny.lavrik/cbmroot
  • v.friese/cbmroot
  • f.uhlig/cbmroot
  • ebechtel_AT_ikf.uni-frankfurt.de/cbmroot
  • a.senger/cbmroot
  • praisig/cbmroot
  • s.lebedev/cbmroot
  • redelbach_AT_compeng.uni-frankfurt.de/cbmroot
  • p.subramani/cbmroot
  • a_meye37_AT_uni-muenster.de/cbmroot
  • om/cbmroot
  • o.golosov/cbmroot
  • l.chlad/cbmroot
  • a.bercuci/cbmroot
  • d.ramirez/cbmroot
  • v.singhal/cbmroot
  • h.schiller/cbmroot
  • apuntke/cbmroot
  • f.zorn/cbmroot
  • rubio_AT_physi.uni-heidelberg.de/cbmroot
  • p.chudoba/cbmroot
  • apuntke/mcbmroot
  • r.karabowicz/cbmroot
66 results
Show changes
Showing
with 1848 additions and 2874 deletions
/* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Florian Uhlig [committer] */
#ifndef CBMMQCHANNELS_H_ #ifndef CBMMQCHANNELS_H_
#define CBMMQCHANNELS_H_ #define CBMMQCHANNELS_H_
#include "FairMQDevice.h"
#include <string> #include <string>
#include <vector> #include <vector>
class FairMQDevice;
class CbmMQChannels { class CbmMQChannels {
public: public:
...@@ -14,9 +19,7 @@ public: ...@@ -14,9 +19,7 @@ public:
bool CheckChannels(FairMQDevice* device); bool CheckChannels(FairMQDevice* device);
std::vector<int> GetComponentsToSend() { return fComponentsToSend; } std::vector<int> GetComponentsToSend() { return fComponentsToSend; }
std::vector<std::vector<std::string>> GetChannelsToSend() { std::vector<std::vector<std::string>> GetChannelsToSend() { return fChannelsToSend; }
return fChannelsToSend;
}
private: private:
std::vector<std::string> fAllowedChannels {}; std::vector<std::string> fAllowedChannels {};
......
//#ifdef HAVE_FAIRMQSTATEMACHINE /* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
//#include "FairMQStateMachine.h" SPDX-License-Identifier: GPL-3.0-only
//#endif Authors: Florian Uhlig [committer] */
#include "FairMQDevice.h" #include "FairMQDevice.h"
namespace cbm { namespace cbm
namespace mq { {
enum class Transition : int { namespace mq
{
enum class Transition : int
{
Idle, Idle,
DeviceReady, DeviceReady,
Ready, Ready,
...@@ -14,69 +18,45 @@ namespace cbm { ...@@ -14,69 +18,45 @@ namespace cbm {
ErrorFound ErrorFound
}; };
enum class State : int { Running }; enum class State : int
{
Running
};
void ChangeState(FairMQDevice* device, cbm::mq::Transition transition) { void ChangeState(FairMQDevice* device, cbm::mq::Transition transition)
#ifdef HAVE_FAIRMQSTATEMACHINE {
if (transition == cbm::mq::Transition::ErrorFound) { if (transition == cbm::mq::Transition::ErrorFound) { device->ChangeState(fair::mq::Transition::ErrorFound); }
device->ChangeState(FairMQStateMachine::Event::ERROR_FOUND); else if (transition == cbm::mq::Transition::End) {
} else if (transition == cbm::mq::Transition::End) {
device->ChangeState(FairMQStateMachine::Event::END);
} else if (transition == cbm::mq::Transition::Ready) {
device->ChangeState(FairMQStateMachine::Event::internal_READY);
} else if (transition == cbm::mq::Transition::DeviceReady) {
device->ChangeState(FairMQStateMachine::Event::internal_DEVICE_READY);
} else if (transition == cbm::mq::Transition::Idle) {
device->ChangeState(FairMQStateMachine::Event::internal_IDLE);
} else {
LOG(fatal) << "State Change not yet implemented";
device->ChangeState(FairMQStateMachine::Event::ERROR_FOUND);
}
#else
if (transition == cbm::mq::Transition::ErrorFound) {
device->ChangeState(fair::mq::Transition::ErrorFound);
} else if (transition == cbm::mq::Transition::End) {
device->ChangeState(fair::mq::Transition::End); device->ChangeState(fair::mq::Transition::End);
} else if (transition == cbm::mq::Transition::Ready) { }
else if (transition == cbm::mq::Transition::Ready) {
device->ChangeState(fair::mq::Transition::ResetTask); device->ChangeState(fair::mq::Transition::ResetTask);
} else if (transition == cbm::mq::Transition::DeviceReady) { }
else if (transition == cbm::mq::Transition::DeviceReady) {
device->ChangeState(fair::mq::Transition::ResetDevice); device->ChangeState(fair::mq::Transition::ResetDevice);
} else if (transition == cbm::mq::Transition::Idle) { }
else if (transition == cbm::mq::Transition::Idle) {
device->ChangeState(fair::mq::Transition::Stop); device->ChangeState(fair::mq::Transition::Stop);
} else { }
else {
LOG(fatal) << "State Change not yet implemented"; LOG(fatal) << "State Change not yet implemented";
device->ChangeState(fair::mq::Transition::ErrorFound); device->ChangeState(fair::mq::Transition::ErrorFound);
} }
#endif
} }
void LogState(FairMQDevice* device) { void LogState(FairMQDevice* device)
#ifdef HAVE_FAIRMQSTATEMACHINE {
// LOG(info) << "Current State: " << FairMQStateMachine::GetCurrentStateName();
LOG(info) << "Current State: " << device->GetCurrentStateName();
#else
LOG(info) << "Current State: " << device->GetCurrentStateName(); LOG(info) << "Current State: " << device->GetCurrentStateName();
#endif
} }
bool CheckCurrentState(FairMQDevice* device, cbm::mq::State state) { bool CheckCurrentState(FairMQDevice* device, cbm::mq::State state)
#ifdef HAVE_FAIRMQSTATEMACHINE {
if (state == cbm::mq::State::Running) { if (state == cbm::mq::State::Running) { return !(device->NewStatePending()); }
return device->CheckCurrentState(FairMQStateMachine::State::RUNNING); else {
} else {
LOG(fatal) << "State not yet implemented";
device->ChangeState(FairMQStateMachine::Event::ERROR_FOUND);
return 0;
}
#else
if (state == cbm::mq::State::Running) {
return !(device->NewStatePending());
} else {
LOG(fatal) << "State not yet implemented"; LOG(fatal) << "State not yet implemented";
device->ChangeState(fair::mq::Transition::ErrorFound); device->ChangeState(fair::mq::Transition::ErrorFound);
return 0; return 0;
} }
#endif
} }
} // namespace mq } // namespace mq
} // namespace cbm } // namespace cbm
/* Copyright (C) 2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau [committer] */
#ifndef CBMMQTMESSAGE_H_
#define CBMMQTMESSAGE_H_
#include "TMessage.h"
// special class to expose protected TMessage constructor
class CbmMqTMessage : public TMessage {
public:
CbmMqTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMMQTMESSAGE_H_ */
...@@ -26,7 +26,7 @@ Set(SYSTEM_INCLUDE_DIRECTORIES ...@@ -26,7 +26,7 @@ Set(SYSTEM_INCLUDE_DIRECTORIES
${FAIRMQ_INCLUDE_DIR} ${FAIRMQ_INCLUDE_DIR}
${FAIRMQ_INCLUDE_DIR}/options ${FAIRMQ_INCLUDE_DIR}/options
${IPC_INCLUDE_DIRECTORY} ${FLES_IPC_INCLUDE_DIRECTORY}
${CBMROOT_SOURCE_DIR}/external/cppzmq ${CBMROOT_SOURCE_DIR}/external/cppzmq
) )
...@@ -66,13 +66,18 @@ If(FAIRLOGGER_FOUND) ...@@ -66,13 +66,18 @@ If(FAIRLOGGER_FOUND)
) )
EndIf() EndIf()
set(EXE_NAME EventBuilderEtofStar2019) # Dependencies common to all executables
set(SRCS CbmDeviceEventBuilderEtofStar2019.cxx runEventBuilderEtofStar2019.cxx) set(DEPENDENCIES_ALL
set(DEPENDENCIES
${DEPENDENCIES} ${DEPENDENCIES}
${FAIR_LIBS} ${FAIR_LIBS}
${BOOST_LIBS} ${BOOST_LIBS}
fles_ipc )
set(EXE_NAME EventBuilderEtofStar2019)
set(SRCS CbmDeviceEventBuilderEtofStar2019.cxx runEventBuilderEtofStar2019.cxx)
set(DEPENDENCIES
${DEPENDENCIES_ALL}
external::fles_ipc
CbmFlibStar2019 CbmFlibStar2019
CbmFlibMcbm2018 CbmFlibMcbm2018
CbmBase CbmBase
...@@ -94,10 +99,8 @@ Set(NO_DICT_SRCS ...@@ -94,10 +99,8 @@ Set(NO_DICT_SRCS
# Mask warning from file provided by STAR # Mask warning from file provided by STAR
SET_SOURCE_FILES_PROPERTIES(${CBMROOT_SOURCE_DIR}/fles/star2017/unpacker/star_rhicf.c PROPERTIES COMPILE_FLAGS -Wno-pointer-sign) SET_SOURCE_FILES_PROPERTIES(${CBMROOT_SOURCE_DIR}/fles/star2017/unpacker/star_rhicf.c PROPERTIES COMPILE_FLAGS -Wno-pointer-sign)
set(DEPENDENCIES set(DEPENDENCIES
${DEPENDENCIES} ${DEPENDENCIES_ALL}
${FAIR_LIBS} external::fles_ipc
${BOOST_LIBS}
fles_ipc
CbmFlibStar2019 CbmFlibStar2019
CbmFlibMcbm2018 CbmFlibMcbm2018
CbmBase CbmBase
......
/* Copyright (C) 2019-2021 PI-UHd, GSI
SPDX-License-Identifier: GPL-3.0-only
Authors: Norbert Herrmann [committer] */
/** /**
* CbmDeviceEventBuilderEtofStar2019.cxx * CbmDeviceEventBuilderEtofStar2019.cxx
*/ */
#include "CbmDeviceEventBuilderEtofStar2019.h" #include "CbmDeviceEventBuilderEtofStar2019.h"
#include "CbmMQDefs.h"
#include "CbmMQDefs.h"
#include "CbmStar2019EventBuilderEtofAlgo.h" #include "CbmStar2019EventBuilderEtofAlgo.h"
#include "CbmStar2019TofPar.h" #include "CbmStar2019TofPar.h"
...@@ -30,9 +34,8 @@ ...@@ -30,9 +34,8 @@
#include <array> #include <array>
#include <iomanip> #include <iomanip>
#include <string>
#include <stdexcept> #include <stdexcept>
#include <string>
struct InitTaskError : std::runtime_error { struct InitTaskError : std::runtime_error {
using std::runtime_error::runtime_error; using std::runtime_error::runtime_error;
}; };
...@@ -56,15 +59,15 @@ CbmDeviceEventBuilderEtofStar2019::CbmDeviceEventBuilderEtofStar2019() ...@@ -56,15 +59,15 @@ CbmDeviceEventBuilderEtofStar2019::CbmDeviceEventBuilderEtofStar2019()
, fEventBuilderAlgo(nullptr) , fEventBuilderAlgo(nullptr)
, fTimer() , fTimer()
, fUnpackPar(nullptr) , fUnpackPar(nullptr)
, fpBinDumpFile(nullptr) { , fpBinDumpFile(nullptr)
{
fEventBuilderAlgo = new CbmStar2019EventBuilderEtofAlgo(); fEventBuilderAlgo = new CbmStar2019EventBuilderEtofAlgo();
} }
CbmDeviceEventBuilderEtofStar2019::~CbmDeviceEventBuilderEtofStar2019() { CbmDeviceEventBuilderEtofStar2019::~CbmDeviceEventBuilderEtofStar2019() { delete fEventBuilderAlgo; }
delete fEventBuilderAlgo;
}
void CbmDeviceEventBuilderEtofStar2019::InitTask() try { void CbmDeviceEventBuilderEtofStar2019::InitTask()
try {
// Get the information about created channels from the device // Get the information about created channels from the device
// Check if the defined channels from the topology (by name) // Check if the defined channels from the topology (by name)
// are in the list of channels which are possible/allowed // are in the list of channels which are possible/allowed
...@@ -79,29 +82,28 @@ void CbmDeviceEventBuilderEtofStar2019::InitTask() try { ...@@ -79,29 +82,28 @@ void CbmDeviceEventBuilderEtofStar2019::InitTask() try {
LOG(info) << "Number of defined channels: " << noChannel; LOG(info) << "Number of defined channels: " << noChannel;
for (auto const& entry : fChannels) { for (auto const& entry : fChannels) {
LOG(info) << "Channel name: " << entry.first; LOG(info) << "Channel name: " << entry.first;
if (!IsChannelNameAllowed(entry.first)) if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match.");
throw InitTaskError("Channel name does not match.");
if (entry.first == "syscmd") { if (entry.first == "syscmd") {
OnData(entry.first, &CbmDeviceEventBuilderEtofStar2019::HandleMessage); OnData(entry.first, &CbmDeviceEventBuilderEtofStar2019::HandleMessage);
continue; continue;
} }
//if(entry.first != "etofevts") OnData(entry.first, &CbmDeviceEventBuilderEtofStar2019::HandleData); //if(entry.first != "etofevts") OnData(entry.first, &CbmDeviceEventBuilderEtofStar2019::HandleData);
if (entry.first != "etofevts") if (entry.first != "etofevts") OnData(entry.first, &CbmDeviceEventBuilderEtofStar2019::HandleParts);
OnData(entry.first, &CbmDeviceEventBuilderEtofStar2019::HandleParts);
else { else {
fChannelsToSend[0].push_back(entry.first); fChannelsToSend[0].push_back(entry.first);
LOG(info) << "Init to send data to channel " << fChannelsToSend[0][0]; LOG(info) << "Init to send data to channel " << fChannelsToSend[0][0];
} }
} }
InitContainers(); InitContainers();
} catch (InitTaskError& e) { }
catch (InitTaskError& e) {
LOG(error) << e.what(); LOG(error) << e.what();
// Wrapper defined in CbmMQDefs.h to support different FairMQ versions // Wrapper defined in CbmMQDefs.h to support different FairMQ versions
cbm::mq::ChangeState(this, cbm::mq::Transition::ErrorFound); cbm::mq::ChangeState(this, cbm::mq::Transition::ErrorFound);
} }
bool CbmDeviceEventBuilderEtofStar2019::IsChannelNameAllowed( bool CbmDeviceEventBuilderEtofStar2019::IsChannelNameAllowed(std::string channelName)
std::string channelName) { {
for (auto const& entry : fAllowedChannels) { for (auto const& entry : fAllowedChannels) {
LOG(info) << "Inspect " << entry; LOG(info) << "Inspect " << entry;
std::size_t pos1 = channelName.find(entry); std::size_t pos1 = channelName.find(entry);
...@@ -110,29 +112,24 @@ bool CbmDeviceEventBuilderEtofStar2019::IsChannelNameAllowed( ...@@ -110,29 +112,24 @@ bool CbmDeviceEventBuilderEtofStar2019::IsChannelNameAllowed(
std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry); std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry);
const vector<std::string>::size_type idx = pos - fAllowedChannels.begin(); const vector<std::string>::size_type idx = pos - fAllowedChannels.begin();
LOG(info) << "Found " << entry << " in " << channelName; LOG(info) << "Found " << entry << " in " << channelName;
LOG(info) << "Channel name " << channelName LOG(info) << "Channel name " << channelName << " found in list of allowed channel names at position " << idx;
<< " found in list of allowed channel names at position "
<< idx;
return true; return true;
} }
} }
LOG(info) << "Channel name " << channelName LOG(info) << "Channel name " << channelName << " not found in list of allowed channel names.";
<< " not found in list of allowed channel names.";
LOG(error) << "Stop device."; LOG(error) << "Stop device.";
return false; return false;
} }
Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers() { Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers()
LOG(info) {
<< "Init parameter containers for CbmDeviceEventBuilderEtofStar2019."; LOG(info) << "Init parameter containers for CbmDeviceEventBuilderEtofStar2019.";
// FairRuntimeDb* fRtdb = FairRuntimeDb::instance(); // FairRuntimeDb* fRtdb = FairRuntimeDb::instance();
// NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // 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 // Should only be used for small data because of the cost of an additional copy
std::string message {"CbmStar2019TofPar,111"}; std::string message {"CbmStar2019TofPar,111"};
LOG(info) LOG(info) << "Requesting parameter container CbmStar2019TofPar, sending message: " << message;
<< "Requesting parameter container CbmStar2019TofPar, sending message: "
<< message;
FairMQMessagePtr req(NewSimpleMessage("CbmStar2019TofPar,111")); FairMQMessagePtr req(NewSimpleMessage("CbmStar2019TofPar,111"));
FairMQMessagePtr rep(NewMessage()); FairMQMessagePtr rep(NewMessage());
...@@ -140,13 +137,12 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers() { ...@@ -140,13 +137,12 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers() {
if (Send(req, "parameters") > 0) { if (Send(req, "parameters") > 0) {
if (Receive(rep, "parameters") >= 0) { if (Receive(rep, "parameters") >= 0) {
if (rep->GetSize() != 0) { if (rep->GetSize() != 0) {
CbmMQTMessage tmsg(rep->GetData(), rep->GetSize()); CbmMqTMessage tmsg(rep->GetData(), rep->GetSize());
fUnpackPar = fUnpackPar = dynamic_cast<CbmStar2019TofPar*>(tmsg.ReadObject(tmsg.GetClass()));
dynamic_cast<CbmStar2019TofPar*>(tmsg.ReadObject(tmsg.GetClass())); LOG(info) << "Received unpack parameter from parmq server: " << fUnpackPar;
LOG(info) << "Received unpack parameter from parmq server: "
<< fUnpackPar;
fUnpackPar->Print(); fUnpackPar->Print();
} else { }
else {
LOG(error) << "Received empty reply. Parameter not available"; LOG(error) << "Received empty reply. Parameter not available";
} }
} }
...@@ -164,8 +160,7 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers() { ...@@ -164,8 +160,7 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers() {
initOK &= fEventBuilderAlgo->CreateHistograms(); initOK &= fEventBuilderAlgo->CreateHistograms();
/// Obtain vector of pointers on each histo from the algo (+ optionally desired folder) /// Obtain vector of pointers on each histo from the algo (+ optionally desired folder)
std::vector<std::pair<TNamed*, std::string>> vHistos = std::vector<std::pair<TNamed*, std::string>> vHistos = fEventBuilderAlgo->GetHistoVector();
fEventBuilderAlgo->GetHistoVector();
/* FIXME /* FIXME
/// Register the histos in the HTTP server /// Register the histos in the HTTP server
THttpServer* server = FairRunOnline::Instance()->GetHttpServer(); THttpServer* server = FairRunOnline::Instance()->GetHttpServer();
...@@ -182,13 +177,13 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers() { ...@@ -182,13 +177,13 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers() {
return initOK; return initOK;
} }
void CbmDeviceEventBuilderEtofStar2019::SetParContainers() { void CbmDeviceEventBuilderEtofStar2019::SetParContainers()
{
FairRuntimeDb* fRtdb = FairRuntimeDb::instance(); FairRuntimeDb* fRtdb = FairRuntimeDb::instance();
fParCList = fEventBuilderAlgo->GetParList(); fParCList = fEventBuilderAlgo->GetParList();
LOG(info) << "Setting parameter containers for " << fParCList->GetEntries() LOG(info) << "Setting parameter containers for " << fParCList->GetEntries() << " entries ";
<< " entries ";
for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) { for (Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC) {
FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC)); FairParGenericSet* tempObj = (FairParGenericSet*) (fParCList->At(iparC));
...@@ -196,13 +191,11 @@ void CbmDeviceEventBuilderEtofStar2019::SetParContainers() { ...@@ -196,13 +191,11 @@ void CbmDeviceEventBuilderEtofStar2019::SetParContainers() {
std::string sParamName {tempObj->GetName()}; std::string sParamName {tempObj->GetName()};
FairParGenericSet* newObj = FairParGenericSet* newObj = dynamic_cast<FairParGenericSet*>(fRtdb->getContainer(sParamName.data()));
dynamic_cast<FairParGenericSet*>(fRtdb->getContainer(sParamName.data()));
LOG(info) << " - Get " << sParamName.data() << " at " << newObj; LOG(info) << " - Get " << sParamName.data() << " at " << newObj;
if (nullptr == newObj) { if (nullptr == newObj) {
LOG(error) << "Failed to obtain parameter container " << sParamName LOG(error) << "Failed to obtain parameter container " << sParamName << ", for parameter index " << iparC;
<< ", for parameter index " << iparC;
return; return;
} // if( nullptr == newObj ) } // if( nullptr == newObj )
if (iparC == 0) { if (iparC == 0) {
...@@ -214,14 +207,13 @@ void CbmDeviceEventBuilderEtofStar2019::SetParContainers() { ...@@ -214,14 +207,13 @@ void CbmDeviceEventBuilderEtofStar2019::SetParContainers() {
} // for( Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC ) } // for( Int_t iparC = 0; iparC < fParCList->GetEntries(); ++iparC )
} }
void CbmDeviceEventBuilderEtofStar2019::AddMsComponentToList( void CbmDeviceEventBuilderEtofStar2019::AddMsComponentToList(size_t component, UShort_t usDetectorId)
size_t component, {
UShort_t usDetectorId) {
fEventBuilderAlgo->AddMsComponentToList(component, usDetectorId); fEventBuilderAlgo->AddMsComponentToList(component, usDetectorId);
} }
Bool_t CbmDeviceEventBuilderEtofStar2019::DoUnpack(const fles::Timeslice& ts, Bool_t CbmDeviceEventBuilderEtofStar2019::DoUnpack(const fles::Timeslice& ts, size_t /*component*/)
size_t /*component*/) { {
if (0 == fulTsCounter) { if (0 == fulTsCounter) {
LOG(info) << "FIXME ===> Jumping 1st TS as corrupted with current FW + " LOG(info) << "FIXME ===> Jumping 1st TS as corrupted with current FW + "
"FLESNET combination"; "FLESNET combination";
...@@ -229,13 +221,11 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::DoUnpack(const fles::Timeslice& ts, ...@@ -229,13 +221,11 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::DoUnpack(const fles::Timeslice& ts,
return kTRUE; return kTRUE;
} // if( 0 == fulTsCounter ) } // if( 0 == fulTsCounter )
if (kFALSE == fEventBuilderAlgo->ProcessTs(ts)) { if (kFALSE == fEventBuilderAlgo->ProcessTs(ts)) {
LOG(error) << "Failed processing TS " << ts.index() LOG(error) << "Failed processing TS " << ts.index() << " in event builder algorithm class";
<< " in event builder algorithm class";
return kTRUE; return kTRUE;
} // if( kFALSE == fEventBuilderAlgo->ProcessTs( ts ) ) } // if( kFALSE == fEventBuilderAlgo->ProcessTs( ts ) )
std::vector<CbmTofStarSubevent2019>& eventBuffer = std::vector<CbmTofStarSubevent2019>& eventBuffer = fEventBuilderAlgo->GetEventBuffer();
fEventBuilderAlgo->GetEventBuffer();
for (UInt_t uEvent = 0; uEvent < eventBuffer.size(); ++uEvent) { for (UInt_t uEvent = 0; uEvent < eventBuffer.size(); ++uEvent) {
/// Send the sub-event to the STAR systems /// Send the sub-event to the STAR systems
...@@ -256,16 +246,12 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::DoUnpack(const fles::Timeslice& ts, ...@@ -256,16 +246,12 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::DoUnpack(const fles::Timeslice& ts,
pDataBuff, iBuffSzByte ); pDataBuff, iBuffSzByte );
*/ */
SendSubevent(eventBuffer[uEvent].GetTrigger().GetStarTrigerWord(), SendSubevent(eventBuffer[uEvent].GetTrigger().GetStarTrigerWord(), (char*) pDataBuff, iBuffSzByte, 0);
(char*) pDataBuff,
iBuffSzByte,
0);
} // if( kFALSE == fbSandboxMode ) } // if( kFALSE == fbSandboxMode )
LOG(debug) << "Sent STAR event with size " << iBuffSzByte << " Bytes" LOG(debug) << "Sent STAR event with size " << iBuffSzByte << " Bytes"
<< " and token " << " and token " << eventBuffer[uEvent].GetTrigger().GetStarToken();
<< eventBuffer[uEvent].GetTrigger().GetStarToken();
} // if( NULL != pDataBuff ) } // if( NULL != pDataBuff )
else else
LOG(error) << "Invalid STAR SubEvent Output, can only happen if trigger " LOG(error) << "Invalid STAR SubEvent Output, can only happen if trigger "
...@@ -276,22 +262,21 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::DoUnpack(const fles::Timeslice& ts, ...@@ -276,22 +262,21 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::DoUnpack(const fles::Timeslice& ts,
} }
Bool_t CbmDeviceEventBuilderEtofStar2019::ReInitContainers() { Bool_t CbmDeviceEventBuilderEtofStar2019::ReInitContainers()
LOG(info) {
<< "ReInit parameter containers for CbmDeviceEventBuilderEtofStar2019"; LOG(info) << "ReInit parameter containers for CbmDeviceEventBuilderEtofStar2019";
Bool_t initOK = fEventBuilderAlgo->ReInitContainers(); Bool_t initOK = fEventBuilderAlgo->ReInitContainers();
return initOK; return initOK;
} }
// handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0)
bool CbmDeviceEventBuilderEtofStar2019::HandleData(FairMQMessagePtr& msg, bool CbmDeviceEventBuilderEtofStar2019::HandleData(FairMQMessagePtr& msg, int /*index*/)
int /*index*/) { {
// Don't do anything with the data // Don't do anything with the data
// Maybe add an message counter which counts the incomming messages and add // Maybe add an message counter which counts the incomming messages and add
// an output // an output
fNumMessages++; fNumMessages++;
LOG(debug) << "Received message number " << fNumMessages << " with size " LOG(debug) << "Received message number " << fNumMessages << " with size " << msg->GetSize();
<< msg->GetSize();
std::string msgStr(static_cast<char*>(msg->GetData()), msg->GetSize()); std::string msgStr(static_cast<char*>(msg->GetData()), msg->GetSize());
std::istringstream iss(msgStr); std::istringstream iss(msgStr);
...@@ -311,21 +296,19 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleData(FairMQMessagePtr& msg, ...@@ -311,21 +296,19 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleData(FairMQMessagePtr& msg,
static Double_t dctime = 0.; static Double_t dctime = 0.;
bool CbmDeviceEventBuilderEtofStar2019::HandleParts(FairMQParts& parts, bool CbmDeviceEventBuilderEtofStar2019::HandleParts(FairMQParts& parts, int /*index*/)
int /*index*/) { {
// Don't do anything with the data // Don't do anything with the data
// Maybe add an message counter which counts the incomming messages and add // Maybe add an message counter which counts the incomming messages and add
// an output // an output
fNumMessages++; fNumMessages++;
LOG(debug) << "Received message number " << fNumMessages << " with " LOG(debug) << "Received message number " << fNumMessages << " with " << parts.Size() << " parts";
<< parts.Size() << " parts";
fles::StorableTimeslice ts {0}; // rename ??? FIXME fles::StorableTimeslice ts {0}; // rename ??? FIXME
switch (fiSelectComponents) { switch (fiSelectComponents) {
case 0: { case 0: {
std::string msgStr(static_cast<char*>(parts.At(0)->GetData()), std::string msgStr(static_cast<char*>(parts.At(0)->GetData()), (parts.At(0))->GetSize());
(parts.At(0))->GetSize());
std::istringstream iss(msgStr); std::istringstream iss(msgStr);
boost::archive::binary_iarchive inputArchive(iss); boost::archive::binary_iarchive inputArchive(iss);
inputArchive >> ts; inputArchive >> ts;
...@@ -344,8 +327,7 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleParts(FairMQParts& parts, ...@@ -344,8 +327,7 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleParts(FairMQParts& parts,
uint ncomp = parts.Size(); uint ncomp = parts.Size();
for (uint i = 0; i < ncomp; i++) { for (uint i = 0; i < ncomp; i++) {
std::string msgStr(static_cast<char*>(parts.At(i)->GetData()), std::string msgStr(static_cast<char*>(parts.At(i)->GetData()), (parts.At(i))->GetSize());
(parts.At(i))->GetSize());
std::istringstream iss(msgStr); std::istringstream iss(msgStr);
boost::archive::binary_iarchive inputArchive(iss); boost::archive::binary_iarchive inputArchive(iss);
//fles::StorableTimeslice component{i}; //fles::StorableTimeslice component{i};
...@@ -353,23 +335,19 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleParts(FairMQParts& parts, ...@@ -353,23 +335,19 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleParts(FairMQParts& parts,
CheckTimeslice(component); CheckTimeslice(component);
fEventBuilderAlgo->AddMsComponentToList(i, 0x60); // TOF data fEventBuilderAlgo->AddMsComponentToList(i, 0x60); // TOF data
LOG(debug) << "HandleParts message " << fNumMessages << " with indx " LOG(debug) << "HandleParts message " << fNumMessages << " with indx " << component.index();
<< component.index();
} }
} break; } break;
default:; default:;
} }
if (kFALSE == fEventBuilderAlgo->ProcessTs(ts)) { if (kFALSE == fEventBuilderAlgo->ProcessTs(ts)) {
LOG(error) << "Failed processing TS " << ts.index() LOG(error) << "Failed processing TS " << ts.index() << " in event builder algorithm class";
<< " in event builder algorithm class";
return kTRUE; return kTRUE;
} // if( kFALSE == fEventBuilderAlgo->ProcessTs( ts ) ) } // if( kFALSE == fEventBuilderAlgo->ProcessTs( ts ) )
std::vector<CbmTofStarSubevent2019>& eventBuffer = std::vector<CbmTofStarSubevent2019>& eventBuffer = fEventBuilderAlgo->GetEventBuffer();
fEventBuilderAlgo->GetEventBuffer(); LOG(debug) << "Process time slice " << fNumMessages << " with " << eventBuffer.size() << " events";
LOG(debug) << "Process time slice " << fNumMessages << " with "
<< eventBuffer.size() << " events";
//if(fNumMessages%10000 == 0) LOG(info)<<"Processed "<<fNumMessages<<" time slices"; //if(fNumMessages%10000 == 0) LOG(info)<<"Processed "<<fNumMessages<<" time slices";
...@@ -392,31 +370,24 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleParts(FairMQParts& parts, ...@@ -392,31 +370,24 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleParts(FairMQParts& parts,
pDataBuff, iBuffSzByte ); pDataBuff, iBuffSzByte );
*/ */
} // if( kFALSE == fbSandboxMode ) } // if( kFALSE == fbSandboxMode )
SendSubevent(eventBuffer[uEvent].GetTrigger().GetStarTrigerWord(), SendSubevent(eventBuffer[uEvent].GetTrigger().GetStarTrigerWord(), (char*) pDataBuff, iBuffSzByte, 0);
(char*) pDataBuff,
iBuffSzByte, LOG(debug) << "Sent STAR event " << uEvent << " with size " << iBuffSzByte << " Bytes"
0); << ", token " << eventBuffer[uEvent].GetTrigger().GetStarToken() << ", TrigWord "
LOG(debug) << "Sent STAR event " << uEvent << " with size " << iBuffSzByte
<< " Bytes"
<< ", token "
<< eventBuffer[uEvent].GetTrigger().GetStarToken()
<< ", TrigWord "
<< eventBuffer[uEvent].GetTrigger().GetStarTrigerWord(); << eventBuffer[uEvent].GetTrigger().GetStarTrigerWord();
} }
} }
if (0 == fulTsCounter % 10000) { if (0 == fulTsCounter % 10000) {
LOG(info) << "Processed " << fulTsCounter LOG(info) << "Processed " << fulTsCounter << " TS, CPUtime: " << dctime / 10. << " ms/TS";
<< " TS, CPUtime: " << dctime / 10. << " ms/TS";
dctime = 0.; dctime = 0.;
} }
fulTsCounter++; fulTsCounter++;
return true; return true;
} }
bool CbmDeviceEventBuilderEtofStar2019::HandleMessage(FairMQMessagePtr& msg, bool CbmDeviceEventBuilderEtofStar2019::HandleMessage(FairMQMessagePtr& msg, int /*index*/)
int /*index*/) { {
const char* cmd = (char*) (msg->GetData()); const char* cmd = (char*) (msg->GetData());
const char cmda[4] = {*cmd}; const char cmda[4] = {*cmd};
LOG(info) << "Handle message " << cmd << ", " << cmd[0]; LOG(info) << "Handle message " << cmd << ", " << cmd[0];
...@@ -439,16 +410,15 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleMessage(FairMQMessagePtr& msg, ...@@ -439,16 +410,15 @@ bool CbmDeviceEventBuilderEtofStar2019::HandleMessage(FairMQMessagePtr& msg,
} }
bool CbmDeviceEventBuilderEtofStar2019::CheckTimeslice( bool CbmDeviceEventBuilderEtofStar2019::CheckTimeslice(const fles::Timeslice& ts)
const fles::Timeslice& ts) { {
if (0 == ts.num_components()) { if (0 == ts.num_components()) {
LOG(error) << "No Component in TS " << ts.index(); LOG(error) << "No Component in TS " << ts.index();
return 1; return 1;
} }
auto tsIndex = ts.index(); auto tsIndex = ts.index();
LOG(debug) << "Found " << ts.num_components() LOG(debug) << "Found " << ts.num_components() << " different components in timeslice " << tsIndex;
<< " different components in timeslice " << tsIndex;
/* /*
for (size_t c = 0; c < ts.num_components(); ++c) { for (size_t c = 0; c < ts.num_components(); ++c) {
...@@ -467,10 +437,9 @@ bool CbmDeviceEventBuilderEtofStar2019::CheckTimeslice( ...@@ -467,10 +437,9 @@ bool CbmDeviceEventBuilderEtofStar2019::CheckTimeslice(
return true; return true;
} }
bool CbmDeviceEventBuilderEtofStar2019::SendEvent(std::vector<Int_t> vdigi, bool CbmDeviceEventBuilderEtofStar2019::SendEvent(std::vector<Int_t> vdigi, int idx)
int idx) { {
LOG(debug) << "Send Data for event " << fNumEvt << " with size " LOG(debug) << "Send Data for event " << fNumEvt << " with size " << vdigi.size() << Form(" at %p ", &vdigi);
<< vdigi.size() << Form(" at %p ", &vdigi);
// LOG(debug) << "EventHeader: "<< fEventHeader[0] << " " << fEventHeader[1] << " " << fEventHeader[2] << " " << fEventHeader[3]; // LOG(debug) << "EventHeader: "<< fEventHeader[0] << " " << fEventHeader[1] << " " << fEventHeader[2] << " " << fEventHeader[3];
std::stringstream oss; std::stringstream oss;
...@@ -485,8 +454,7 @@ bool CbmDeviceEventBuilderEtofStar2019::SendEvent(std::vector<Int_t> vdigi, ...@@ -485,8 +454,7 @@ bool CbmDeviceEventBuilderEtofStar2019::SendEvent(std::vector<Int_t> vdigi,
[](void*, void* object) { delete static_cast<std::string*>(object); }, [](void*, void* object) { delete static_cast<std::string*>(object); },
strMsg)); // object that manages the data strMsg)); // object that manages the data
LOG(debug) << "Send data to channel " << idx << " " LOG(debug) << "Send data to channel " << idx << " " << fChannelsToSend[idx][0];
<< fChannelsToSend[idx][0];
// if (Send(msg, fChannelsToSend[idx][0]) < 0) { // if (Send(msg, fChannelsToSend[idx][0]) < 0) {
...@@ -499,13 +467,10 @@ bool CbmDeviceEventBuilderEtofStar2019::SendEvent(std::vector<Int_t> vdigi, ...@@ -499,13 +467,10 @@ bool CbmDeviceEventBuilderEtofStar2019::SendEvent(std::vector<Int_t> vdigi,
return true; return true;
} }
bool CbmDeviceEventBuilderEtofStar2019::SendSubevent(uint trig, bool CbmDeviceEventBuilderEtofStar2019::SendSubevent(uint trig, char* pData, int nData, int idx)
char* pData, {
int nData,
int idx) {
LOG(debug) << "SendSubevent " << fNumEvt << ", TrigWord " << trig LOG(debug) << "SendSubevent " << fNumEvt << ", TrigWord " << trig << " with size " << nData << Form(" at %p ", pData);
<< " with size " << nData << Form(" at %p ", pData);
std::stringstream ossE; std::stringstream ossE;
boost::archive::binary_oarchive oaE(ossE); boost::archive::binary_oarchive oaE(ossE);
...@@ -534,8 +499,7 @@ bool CbmDeviceEventBuilderEtofStar2019::SendSubevent(uint trig, ...@@ -534,8 +499,7 @@ bool CbmDeviceEventBuilderEtofStar2019::SendSubevent(uint trig,
[](void*, void* object) { delete static_cast<std::string*>(object); }, [](void*, void* object) { delete static_cast<std::string*>(object); },
strMsg)); // object that manages the data strMsg)); // object that manages the data
LOG(debug) << "Send data to channel " << idx << " " LOG(debug) << "Send data to channel " << idx << " " << fChannelsToSend[idx][0];
<< fChannelsToSend[idx][0];
// if (Send(msg, fChannelsToSend[idx][0]) < 0) { // if (Send(msg, fChannelsToSend[idx][0]) < 0) {
...@@ -550,7 +514,8 @@ bool CbmDeviceEventBuilderEtofStar2019::SendSubevent(uint trig, ...@@ -550,7 +514,8 @@ bool CbmDeviceEventBuilderEtofStar2019::SendSubevent(uint trig,
void CbmDeviceEventBuilderEtofStar2019::Reset() {} void CbmDeviceEventBuilderEtofStar2019::Reset() {}
void CbmDeviceEventBuilderEtofStar2019::Finish() { void CbmDeviceEventBuilderEtofStar2019::Finish()
{
if (NULL != fpBinDumpFile) { if (NULL != fpBinDumpFile) {
LOG(info) << "Closing binary file used for event dump."; LOG(info) << "Closing binary file used for event dump.";
fpBinDumpFile->close(); fpBinDumpFile->close();
...@@ -559,14 +524,15 @@ void CbmDeviceEventBuilderEtofStar2019::Finish() { ...@@ -559,14 +524,15 @@ void CbmDeviceEventBuilderEtofStar2019::Finish() {
/// If monitor mode enabled, trigger histos creation, obtain pointer on them and add them to the HTTP server /// If monitor mode enabled, trigger histos creation, obtain pointer on them and add them to the HTTP server
if (kTRUE == fbMonitorMode) { if (kTRUE == fbMonitorMode) {
/// Obtain vector of pointers on each histo from the algo (+ optionally desired folder) /// Obtain vector of pointers on each histo from the algo (+ optionally desired folder)
std::vector<std::pair<TNamed*, std::string>> vHistos = std::vector<std::pair<TNamed*, std::string>> vHistos = fEventBuilderAlgo->GetHistoVector();
fEventBuilderAlgo->GetHistoVector();
/// Save old global file and folder pointer to avoid messing with FairRoot
TFile* oldFile = gFile;
TDirectory* oldDir = gDirectory;
/// (Re-)Create ROOT file to store the histos /// (Re-)Create ROOT file to store the histos
TDirectory* oldDir = NULL; TFile* histoFile = nullptr;
TFile* histoFile = NULL;
// Store current directory position to allow restore later
oldDir = gDirectory;
// open separate histo file in recreate mode // open separate histo file in recreate mode
histoFile = new TFile("data/eventBuilderMonHist.root", "RECREATE"); histoFile = new TFile("data/eventBuilderMonHist.root", "RECREATE");
histoFile->cd(); histoFile->cd();
...@@ -583,8 +549,10 @@ void CbmDeviceEventBuilderEtofStar2019::Finish() { ...@@ -583,8 +549,10 @@ void CbmDeviceEventBuilderEtofStar2019::Finish() {
histoFile->cd(); histoFile->cd();
} // for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto ) } // for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto )
// Restore original directory position /// Restore old global file and folder pointer to avoid messing with FairRoot
oldDir->cd(); gFile = oldFile;
gDirectory = oldDir;
histoFile->Close(); histoFile->Close();
} // if( kTRUE == fbMonitorMode ) } // if( kTRUE == fbMonitorMode )
} }
/* Copyright (C) 2019 PI-UHd, GSI
SPDX-License-Identifier: GPL-3.0-only
Authors: Norbert Herrmann [committer] */
/** /**
* CbmDeviceEventBuilderEtofStar2019.h * CbmDeviceEventBuilderEtofStar2019.h
* *
...@@ -6,11 +10,13 @@ ...@@ -6,11 +10,13 @@
#ifndef CBMDEVICEEVENTBUILDERETOFSTAR2019_H_ #ifndef CBMDEVICEEVENTBUILDERETOFSTAR2019_H_
#define CBMDEVICEEVENTBUILDERETOFSTAR2019_H_ #define CBMDEVICEEVENTBUILDERETOFSTAR2019_H_
#include "FairMQDevice.h" #include "CbmMqTMessage.h"
#include "TMessage.h"
#include "Timeslice.hpp" #include "Timeslice.hpp"
#include "FairMQDevice.h"
#include "TMessage.h"
#include "TStopwatch.h" #include "TStopwatch.h"
class CbmStar2019EventBuilderEtofAlgo; class CbmStar2019EventBuilderEtofAlgo;
...@@ -31,19 +37,15 @@ public: ...@@ -31,19 +37,15 @@ public:
Bool_t ReInitContainers(); Bool_t ReInitContainers();
void SetSandboxMode(Bool_t bSandboxMode = kTRUE) { void SetSandboxMode(Bool_t bSandboxMode = kTRUE) { fbSandboxMode = bSandboxMode; }
fbSandboxMode = bSandboxMode;
}
void SetEventDumpEnable(Bool_t bDumpEna = kTRUE); void SetEventDumpEnable(Bool_t bDumpEna = kTRUE);
/// Temp until we change from CbmMcbmUnpack to something else /// Temp until we change from CbmMcbmUnpack to something else
void AddMsComponentToList(size_t component, UShort_t usDetectorId); void AddMsComponentToList(size_t component, UShort_t usDetectorId);
void SetNbMsInTs(size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/) {}; void SetNbMsInTs(size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/) {};
CbmDeviceEventBuilderEtofStar2019(const CbmDeviceEventBuilderEtofStar2019&) = CbmDeviceEventBuilderEtofStar2019(const CbmDeviceEventBuilderEtofStar2019&) = delete;
delete; CbmDeviceEventBuilderEtofStar2019 operator=(const CbmDeviceEventBuilderEtofStar2019&) = delete;
CbmDeviceEventBuilderEtofStar2019
operator=(const CbmDeviceEventBuilderEtofStar2019&) = delete;
protected: protected:
virtual void InitTask(); virtual void InitTask();
...@@ -56,13 +58,10 @@ protected: ...@@ -56,13 +58,10 @@ protected:
private: private:
uint64_t fNumMessages; uint64_t fNumMessages;
/// Control flags /// Control flags
Bool_t Bool_t fbMonitorMode; //! Switch ON the filling of a minimal set of histograms
fbMonitorMode; //! Switch ON the filling of a minimal set of histograms Bool_t fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms
Bool_t Bool_t fbSandboxMode; //! Switch OFF the emission of data toward the STAR DAQ
fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms Bool_t fbEventDumpEna; //! Switch ON the dumping of the events to a binary file
Bool_t fbSandboxMode; //! Switch OFF the emission of data toward the STAR DAQ
Bool_t
fbEventDumpEna; //! Switch ON the dumping of the events to a binary file
/// Parameters management /// Parameters management
TList* fParCList; TList* fParCList;
...@@ -74,10 +73,7 @@ private: ...@@ -74,10 +73,7 @@ private:
bool CheckTimeslice(const fles::Timeslice& ts); bool CheckTimeslice(const fles::Timeslice& ts);
bool IsChannelNameAllowed(std::string channelName); bool IsChannelNameAllowed(std::string channelName);
std::vector<std::string> fAllowedChannels = {"tofcomponent", std::vector<std::string> fAllowedChannels = {"tofcomponent", "parameters", "etofevts", "syscmd"};
"parameters",
"etofevts",
"syscmd"};
std::vector<std::vector<std::string>> fChannelsToSend = {{}, {}, {}}; std::vector<std::vector<std::string>> fChannelsToSend = {{}, {}, {}};
/// Processing algo /// Processing algo
...@@ -92,12 +88,4 @@ private: ...@@ -92,12 +88,4 @@ private:
const UInt_t kuBinDumpEndWord = 0xFAEBDEEF; const UInt_t kuBinDumpEndWord = 0xFAEBDEEF;
}; };
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) {
ResetBit(kIsOwner);
}
};
#endif /* CBMDEVICEEVENTBUILDERETOFSTAR2019_H_ */ #endif /* CBMDEVICEEVENTBUILDERETOFSTAR2019_H_ */
/* Copyright (C) 2019 PI-UHd, GSI
SPDX-License-Identifier: GPL-3.0-only
Authors: Norbert Herrmann [committer] */
/** /**
* CbmDeviceTriggerHandlerEtof.cxx * CbmDeviceTriggerHandlerEtof.cxx
* *
...@@ -6,6 +10,7 @@ ...@@ -6,6 +10,7 @@
*/ */
#include "CbmDeviceTriggerHandlerEtof.h" #include "CbmDeviceTriggerHandlerEtof.h"
#include "CbmMQDefs.h" #include "CbmMQDefs.h"
#include "FairEventHeader.h" #include "FairEventHeader.h"
...@@ -18,23 +23,22 @@ ...@@ -18,23 +23,22 @@
#include "FairRunOnline.h" #include "FairRunOnline.h"
#include "FairRuntimeDb.h" #include "FairRuntimeDb.h"
#include <thread> // this_thread::sleep_for
#include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/vector.hpp> #include <boost/serialization/vector.hpp>
#include <chrono> #include <chrono>
#include <iomanip> #include <iomanip>
#include <string>
#include <thread> // this_thread::sleep_for
#include <stdexcept> #include <stdexcept>
#include <string>
struct InitTaskError : std::runtime_error { struct InitTaskError : std::runtime_error {
using std::runtime_error::runtime_error; using std::runtime_error::runtime_error;
}; };
static std::chrono::steady_clock::time_point dctime = static std::chrono::steady_clock::time_point dctime = std::chrono::steady_clock::now();
std::chrono::steady_clock::now(); static double dSize = 0.;
static double dSize = 0.;
using namespace std; using namespace std;
...@@ -45,11 +49,14 @@ CbmDeviceTriggerHandlerEtof::CbmDeviceTriggerHandlerEtof() ...@@ -45,11 +49,14 @@ CbmDeviceTriggerHandlerEtof::CbmDeviceTriggerHandlerEtof()
, fbDebugMonitorMode(kFALSE) , fbDebugMonitorMode(kFALSE)
, fbSandboxMode(kFALSE) , fbSandboxMode(kFALSE)
, fbEventDumpEna(kFALSE) , fbEventDumpEna(kFALSE)
, fdEvent(0.) {} , fdEvent(0.)
{
}
CbmDeviceTriggerHandlerEtof::~CbmDeviceTriggerHandlerEtof() {} CbmDeviceTriggerHandlerEtof::~CbmDeviceTriggerHandlerEtof() {}
void CbmDeviceTriggerHandlerEtof::InitTask() try { void CbmDeviceTriggerHandlerEtof::InitTask()
try {
// Get the information about created channels from the device // Get the information about created channels from the device
// Check if the defined channels from the topology (by name) // Check if the defined channels from the topology (by name)
// are in the list of channels which are possible/allowed // are in the list of channels which are possible/allowed
...@@ -62,21 +69,20 @@ void CbmDeviceTriggerHandlerEtof::InitTask() try { ...@@ -62,21 +69,20 @@ void CbmDeviceTriggerHandlerEtof::InitTask() try {
LOG(info) << "Number of defined input channels: " << noChannel; LOG(info) << "Number of defined input channels: " << noChannel;
for (auto const& entry : fChannels) { for (auto const& entry : fChannels) {
LOG(info) << "Channel name: " << entry.first; LOG(info) << "Channel name: " << entry.first;
if (!IsChannelNameAllowed(entry.first)) if (!IsChannelNameAllowed(entry.first)) throw InitTaskError("Channel name does not match.");
throw InitTaskError("Channel name does not match."); if (entry.first != "syscmd") OnData(entry.first, &CbmDeviceTriggerHandlerEtof::HandleData);
if (entry.first != "syscmd")
OnData(entry.first, &CbmDeviceTriggerHandlerEtof::HandleData);
else else
OnData(entry.first, &CbmDeviceTriggerHandlerEtof::HandleMessage); OnData(entry.first, &CbmDeviceTriggerHandlerEtof::HandleMessage);
} }
InitWorkspace(); InitWorkspace();
} catch (InitTaskError& e) { }
catch (InitTaskError& e) {
LOG(error) << e.what(); LOG(error) << e.what();
cbm::mq::ChangeState(this, cbm::mq::Transition::ErrorFound); cbm::mq::ChangeState(this, cbm::mq::Transition::ErrorFound);
} }
bool CbmDeviceTriggerHandlerEtof::IsChannelNameAllowed( bool CbmDeviceTriggerHandlerEtof::IsChannelNameAllowed(std::string channelName)
std::string channelName) { {
for (auto const& entry : fAllowedChannels) { for (auto const& entry : fAllowedChannels) {
std::size_t pos1 = channelName.find(entry); std::size_t pos1 = channelName.find(entry);
if (pos1 != std::string::npos) { if (pos1 != std::string::npos) {
...@@ -84,19 +90,17 @@ bool CbmDeviceTriggerHandlerEtof::IsChannelNameAllowed( ...@@ -84,19 +90,17 @@ bool CbmDeviceTriggerHandlerEtof::IsChannelNameAllowed(
std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry); std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry);
const vector<std::string>::size_type idx = pos - fAllowedChannels.begin(); const vector<std::string>::size_type idx = pos - fAllowedChannels.begin();
LOG(info) << "Found " << entry << " in " << channelName; LOG(info) << "Found " << entry << " in " << channelName;
LOG(info) << "Channel name " << channelName LOG(info) << "Channel name " << channelName << " found in list of allowed channel names at position " << idx;
<< " found in list of allowed channel names at position "
<< idx;
return true; return true;
} }
} }
LOG(info) << "Channel name " << channelName LOG(info) << "Channel name " << channelName << " not found in list of allowed channel names.";
<< " not found in list of allowed channel names.";
LOG(error) << "Stop device."; LOG(error) << "Stop device.";
return false; return false;
} }
Bool_t CbmDeviceTriggerHandlerEtof::InitWorkspace() { Bool_t CbmDeviceTriggerHandlerEtof::InitWorkspace()
{
LOG(info) << "Init work space for CbmDeviceTriggerHandlerEtof."; LOG(info) << "Init work space for CbmDeviceTriggerHandlerEtof.";
// steering variables // steering variables
...@@ -107,19 +111,17 @@ Bool_t CbmDeviceTriggerHandlerEtof::InitWorkspace() { ...@@ -107,19 +111,17 @@ Bool_t CbmDeviceTriggerHandlerEtof::InitWorkspace() {
// handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) // handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0)
//bool CbmDeviceTriggerHandlerEtof::HandleData(FairMQMessagePtr& msg, int /*index*/) //bool CbmDeviceTriggerHandlerEtof::HandleData(FairMQMessagePtr& msg, int /*index*/)
bool CbmDeviceTriggerHandlerEtof::HandleData(FairMQParts& parts, bool CbmDeviceTriggerHandlerEtof::HandleData(FairMQParts& parts, int /*index*/)
int /*index*/) { {
// Don't do anything with the data // Don't do anything with the data
// Maybe add an message counter which counts the incomming messages and add // Maybe add an message counter which counts the incomming messages and add
// an output // an output
fNumMessages++; fNumMessages++;
LOG(debug) << "Received message " << fNumMessages << " with " << parts.Size() LOG(debug) << "Received message " << fNumMessages << " with " << parts.Size() << " parts"
<< " parts"
<< ", size0: " << parts.At(0)->GetSize(); << ", size0: " << parts.At(0)->GetSize();
uint TrigWord {0}; uint TrigWord {0};
std::string msgStrE(static_cast<char*>(parts.At(0)->GetData()), std::string msgStrE(static_cast<char*>(parts.At(0)->GetData()), (parts.At(0))->GetSize());
(parts.At(0))->GetSize());
std::istringstream issE(msgStrE); std::istringstream issE(msgStrE);
boost::archive::binary_iarchive inputArchiveE(issE); boost::archive::binary_iarchive inputArchiveE(issE);
inputArchiveE >> TrigWord; inputArchiveE >> TrigWord;
...@@ -128,17 +130,13 @@ bool CbmDeviceTriggerHandlerEtof::HandleData(FairMQParts& parts, ...@@ -128,17 +130,13 @@ bool CbmDeviceTriggerHandlerEtof::HandleData(FairMQParts& parts,
int iBuffSzByte = parts.At(1)->GetSize(); int iBuffSzByte = parts.At(1)->GetSize();
// Send Subevent to STAR // Send Subevent to STAR
LOG(debug) << "Send Data for event " << fdEvent << ", TrigWord " << TrigWord LOG(debug) << "Send Data for event " << fdEvent << ", TrigWord " << TrigWord << " with size " << iBuffSzByte
<< " with size " << iBuffSzByte << Form(" at %p ", pDataBuff); << Form(" at %p ", pDataBuff);
if (kFALSE == fbSandboxMode) { if (kFALSE == fbSandboxMode) { star_rhicf_write(TrigWord, pDataBuff, iBuffSzByte); }
star_rhicf_write(TrigWord, pDataBuff, iBuffSzByte);
}
dSize += iBuffSzByte; dSize += iBuffSzByte;
if (0 == (int) fdEvent % 10000) { if (0 == (int) fdEvent % 10000) {
std::chrono::duration<double> deltatime = std::chrono::duration<double> deltatime = std::chrono::steady_clock::now() - dctime;
std::chrono::steady_clock::now() - dctime; LOG(info) << "Processed " << fdEvent << " events, delta-time: " << deltatime.count()
LOG(info) << "Processed " << fdEvent
<< " events, delta-time: " << deltatime.count()
<< ", rate: " << dSize * 1.E-6 / deltatime.count() << "MB/s"; << ", rate: " << dSize * 1.E-6 / deltatime.count() << "MB/s";
dctime = std::chrono::steady_clock::now(); dctime = std::chrono::steady_clock::now();
dSize = 0.; dSize = 0.;
...@@ -150,8 +148,8 @@ bool CbmDeviceTriggerHandlerEtof::HandleData(FairMQParts& parts, ...@@ -150,8 +148,8 @@ bool CbmDeviceTriggerHandlerEtof::HandleData(FairMQParts& parts,
/************************************************************************************/ /************************************************************************************/
bool CbmDeviceTriggerHandlerEtof::HandleMessage(FairMQMessagePtr& msg, bool CbmDeviceTriggerHandlerEtof::HandleMessage(FairMQMessagePtr& msg, int /*index*/)
int /*index*/) { {
const char* cmd = (char*) (msg->GetData()); const char* cmd = (char*) (msg->GetData());
const char cmda[4] = {*cmd}; const char cmda[4] = {*cmd};
LOG(info) << "Handle message " << cmd << ", " << cmd[0]; LOG(info) << "Handle message " << cmd << ", " << cmd[0];
......
/* Copyright (C) 2019 PI-UHd, GSI
SPDX-License-Identifier: GPL-3.0-only
Authors: Norbert Herrmann [committer] */
/** /**
* CbmDeviceTriggerHandlerStar2019.h * CbmDeviceTriggerHandlerStar2019.h
* *
...@@ -8,20 +12,19 @@ ...@@ -8,20 +12,19 @@
#ifndef CBMDEVICETRIGGERHANDLERETOF_H_ #ifndef CBMDEVICETRIGGERHANDLERETOF_H_
#define CBMDEVICETRIGGERHANDLERETOF_H_ #define CBMDEVICETRIGGERHANDLERETOF_H_
#include "FairMQDevice.h" #include "CbmMqTMessage.h"
#include "CbmTofStarData2019.h"
#include "MicrosliceDescriptor.hpp" #include "MicrosliceDescriptor.hpp"
#include "Timeslice.hpp" #include "Timeslice.hpp"
#include "CbmTofStarData2019.h" #include "FairMQDevice.h"
#include "Rtypes.h" #include "Rtypes.h"
#include "TMessage.h"
#include <map> #include <map>
#include <vector> #include <vector>
class CbmMQTMessage;
// Relevant TOF classes // Relevant TOF classes
extern "C" int star_rhicf_write(unsigned int trg_word, void* dta, int bytes); extern "C" int star_rhicf_write(unsigned int trg_word, void* dta, int bytes);
...@@ -55,11 +58,7 @@ private: ...@@ -55,11 +58,7 @@ private:
Bool_t ReInitContainers(); Bool_t ReInitContainers();
uint64_t fNumMessages; uint64_t fNumMessages;
std::vector<std::string> fAllowedChannels = {"tofcomponent", std::vector<std::string> fAllowedChannels = {"tofcomponent", "parameters", "etofevts", "tofhits", "syscmd"};
"parameters",
"etofevts",
"tofhits",
"syscmd"};
// Input variables // Input variables
...@@ -68,25 +67,14 @@ private: ...@@ -68,25 +67,14 @@ private:
// Constants or setting parameters // Constants or setting parameters
Int_t fiMsgCnt; Int_t fiMsgCnt;
/// Control flags /// Control flags
Bool_t Bool_t fbMonitorMode; //! Switch ON the filling of a minimal set of histograms
fbMonitorMode; //! Switch ON the filling of a minimal set of histograms Bool_t fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms
Bool_t Bool_t fbSandboxMode; //! Switch OFF the emission of data toward the STAR DAQ
fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms Bool_t fbEventDumpEna; //! Switch ON the dumping of the events to a binary file
Bool_t fbSandboxMode; //! Switch OFF the emission of data toward the STAR DAQ
Bool_t
fbEventDumpEna; //! Switch ON the dumping of the events to a binary file
Double_t fdEvent; Double_t fdEvent;
// histograms // histograms
}; };
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) {
ResetBit(kIsOwner);
}
};
#endif /* CBMDEVICETRIGGERHANDLERETOF_H_ */ #endif /* CBMDEVICETRIGGERHANDLERETOF_H_ */
/* Copyright (C) 2019 PI-UHd, GSI
SPDX-License-Identifier: GPL-3.0-only
Authors: Norbert Herrmann [committer] */
#include "CbmDeviceEventBuilderEtofStar2019.h" #include "CbmDeviceEventBuilderEtofStar2019.h"
#include "runFairMQDevice.h"
#include <iomanip> #include <iomanip>
#include <string> #include <string>
#include "runFairMQDevice.h"
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
using namespace std; using namespace std;
void addCustomOptions(bpo::options_description& options) { ; } void addCustomOptions(bpo::options_description& options) { ; }
FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceEventBuilderEtofStar2019(); }
return new CbmDeviceEventBuilderEtofStar2019();
}
/* Copyright (C) 2019 PI-UHd, GSI
SPDX-License-Identifier: GPL-3.0-only
Authors: Norbert Herrmann [committer] */
#include "CbmDeviceTriggerHandlerEtof.h" #include "CbmDeviceTriggerHandlerEtof.h"
#include "runFairMQDevice.h"
#include <iomanip> #include <iomanip>
#include <string> #include <string>
#include "runFairMQDevice.h"
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
using namespace std; using namespace std;
void addCustomOptions(bpo::options_description& options) { void addCustomOptions(bpo::options_description& options)
options.add_options()( {
"SandboxMode", bpo::value<bool>()->default_value(1), "Test mode switch"); options.add_options()("SandboxMode", bpo::value<bool>()->default_value(1), "Test mode switch");
; ;
} }
FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceTriggerHandlerEtof(); }
return new CbmDeviceTriggerHandlerEtof();
}
#!/bin/bash #!/bin/bash
# Copyright (C) 2019 PI-UHd,GSI
# SPDX-License-Identifier: GPL-3.0-only
# First commited by Norbert Herrmann
# script to write cosmic data to file # script to write cosmic data to file
$FAIRROOTPATH/bin/shmmonitor --cleanup $FAIRROOTPATH/bin/shmmonitor --cleanup
......
...@@ -6,88 +6,49 @@ ...@@ -6,88 +6,49 @@
# copied verbatim in the file "LICENSE" # # copied verbatim in the file "LICENSE" #
################################################################################ ################################################################################
Set(INCLUDE_DIRECTORIES set(INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CBMROOT_SOURCE_DIR}/fles/flestools
) )
Set(SYSTEM_INCLUDE_DIRECTORIES
${SYSTEM_INCLUDE_DIRECTORIES}
${Boost_INCLUDE_DIR}
${FAIRROOT_INCLUDE_DIR}
${FAIRMQ_INCLUDE_DIR}
${FAIRMQ_INCLUDE_DIR}/options
)
Include_Directories(${INCLUDE_DIRECTORIES})
Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
Set(LINK_DIRECTORIES
${Boost_LIBRARY_DIRS}
${FAIRROOT_LIBRARY_DIR}
${ROOT_LIBRARY_DIR}
)
Link_Directories(${LINK_DIRECTORIES})
set(FAIR_LIBS
FairMQ
)
If(FAIRLOGGER_FOUND)
set(FAIR_LIBS
${FAIR_LIBS}
FairLogger
)
EndIf()
Set(BOOST_LIBS
${Boost_SYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
If(UNIX AND NOT APPLE) If(UNIX AND NOT APPLE)
List(APPEND BOOST_LIBS pthread) List(APPEND BOOST_LIBS pthread)
EndIf() EndIf()
If(FairRoot_VERSION VERSION_LESS 18.2.0) # Set the install path within the build directory
Add_Definitions(-DHAVE_RootDeserializer) set(EXECUTABLE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/MQ/histogramServer")
EndIf() # Set the install path within the installation directory
set(BIN_DESTINATION bin/MQ/histogramServer)
set(DEPENDENCIES_ALL set(PUBLIC_DEPS
${DEPENDENCIES} ROOT::Core
${FAIR_LIBS} ROOT::RHTTP
${BOOST_LIBS} )
)
set(PRIVATE_DEPS
CbmFlibFlesTools
FairRoot::Base
FairMQ::FairMQ
ROOT::Gpad
ROOT::Hist
ROOT::Net
ROOT::RIO
)
set(EXE_NAME HistoServer) set(EXE_NAME HistoServer)
set(SRCS CbmHistoServer.cxx runCbmHistoServer.cxx) set(SRCS CbmHistoServer.cxx runCbmHistoServer.cxx)
set(DEPENDENCIES
${DEPENDENCIES_ALL}
${FAIR_LIBS}
fles_ipc
Core
RIO
Net
Hist
RHTTP
)
GENERATE_EXECUTABLE()
set(EXECUTABLE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/MQ/histogramServer") set(PUBLIC_DEPENDENCIES ${PUBLIC_DEPS})
set(PRIVATE_DEPENDENCIES ${PRIVATE_DEPS})
set(INTERFACE_DEPENDENCIES ${INTERFACE_DEPS})
generate_cbm_executable()
set(EXE_NAME MqHistoServer) set(EXE_NAME MqHistoServer)
set(SRCS CbmMqHistoServer.cxx runCbmMqHistoServer.cxx) set(SRCS CbmMqHistoServer.cxx runCbmMqHistoServer.cxx)
set(DEPENDENCIES
${DEPENDENCIES_ALL} set(PUBLIC_DEPENDENCIES ${PUBLIC_DEPS})
${FAIR_LIBS} set(PRIVATE_DEPENDENCIES ${PRIVATE_DEPS})
CbmFlibFlesTools set(INTERFACE_DEPENDENCIES ${INTERFACE_DEPS})
Core
RIO generate_cbm_executable()
Net
Hist
Gpad
RHTTP
)
GENERATE_EXECUTABLE()
/******************************************************************************** /* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * SPDX-License-Identifier: GPL-3.0-only
* * Authors: Florian Uhlig [committer] */
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <mutex>
#include "CbmHistoServer.h" #include "CbmHistoServer.h"
#include <mutex>
//#include "CbmHistoCanvasDrawer.h" //#include "CbmHistoCanvasDrawer.h"
#include "FairLogger.h" #include <Logger.h>
#include "RootSerializer.h"
#include "TH1.h" #include "TH1.h"
#include "THttpServer.h" #include "THttpServer.h"
#include "TMessage.h" #include "TMessage.h"
#include "TObjArray.h" #include "TObjArray.h"
#include "RootSerializer.h"
std::mutex mtx; std::mutex mtx;
CbmHistoServer::CbmHistoServer() CbmHistoServer::CbmHistoServer()
...@@ -26,11 +24,14 @@ CbmHistoServer::CbmHistoServer() ...@@ -26,11 +24,14 @@ CbmHistoServer::CbmHistoServer()
, fNMessages(0) , fNMessages(0)
, fServer("http:8088") , fServer("http:8088")
// , fCanvasDrawer(nullptr) // , fCanvasDrawer(nullptr)
, fStopThread(false) {} , fStopThread(false)
{
}
CbmHistoServer::~CbmHistoServer() {} CbmHistoServer::~CbmHistoServer() {}
void CbmHistoServer::InitTask() { void CbmHistoServer::InitTask()
{
OnData(fInputChannelName, &CbmHistoServer::ReceiveData); OnData(fInputChannelName, &CbmHistoServer::ReceiveData);
/* /*
...@@ -41,13 +42,10 @@ void CbmHistoServer::InitTask() { ...@@ -41,13 +42,10 @@ void CbmHistoServer::InitTask() {
*/ */
} }
bool CbmHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) { bool CbmHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/)
{
TObject* tempObject = nullptr; TObject* tempObject = nullptr;
#ifdef HAVE_RootDeserializer RootSerializer().Deserialize(*msg, tempObject);
Deserialize<RootDeserializer>(*msg, tempObject);
#else
Deserialize<RootSerializer>(*msg, tempObject);
#endif
if (TString(tempObject->ClassName()).EqualTo("TObjArray")) { if (TString(tempObject->ClassName()).EqualTo("TObjArray")) {
std::lock_guard<std::mutex> lk(mtx); std::lock_guard<std::mutex> lk(mtx);
...@@ -62,7 +60,8 @@ bool CbmHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) { ...@@ -62,7 +60,8 @@ bool CbmHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) {
histogram_new = static_cast<TH1*>(histogram->Clone()); histogram_new = static_cast<TH1*>(histogram->Clone());
fArrayHisto.Add(histogram_new); fArrayHisto.Add(histogram_new);
fServer.Register("Histograms", histogram_new); fServer.Register("Histograms", histogram_new);
} else { }
else {
histogram_existing = static_cast<TH1*>(fArrayHisto.At(index1)); histogram_existing = static_cast<TH1*>(fArrayHisto.At(index1));
histogram_existing->Add(histogram); histogram_existing->Add(histogram);
} }
...@@ -78,12 +77,14 @@ bool CbmHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) { ...@@ -78,12 +77,14 @@ bool CbmHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) {
return true; return true;
} }
void CbmHistoServer::PreRun() { void CbmHistoServer::PreRun()
{
fStopThread = false; fStopThread = false;
fThread = std::thread(&CbmHistoServer::UpdateHttpServer, this); fThread = std::thread(&CbmHistoServer::UpdateHttpServer, this);
} }
void CbmHistoServer::UpdateHttpServer() { void CbmHistoServer::UpdateHttpServer()
{
while (!fStopThread) { while (!fStopThread) {
std::this_thread::sleep_for(std::chrono::milliseconds(10)); std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::lock_guard<std::mutex> lk(mtx); std::lock_guard<std::mutex> lk(mtx);
...@@ -99,12 +100,14 @@ void CbmHistoServer::UpdateHttpServer() { ...@@ -99,12 +100,14 @@ void CbmHistoServer::UpdateHttpServer() {
} }
} }
void CbmHistoServer::PostRun() { void CbmHistoServer::PostRun()
{
fStopThread = true; fStopThread = true;
fThread.join(); fThread.join();
} }
int CbmHistoServer::FindHistogram(const std::string& name) { int CbmHistoServer::FindHistogram(const std::string& name)
{
for (int i = 0; i < fArrayHisto.GetEntriesFast(); i++) { for (int i = 0; i < fArrayHisto.GetEntriesFast(); i++) {
TObject* obj = fArrayHisto.At(i); TObject* obj = fArrayHisto.At(i);
if (TString(obj->GetName()).EqualTo(name)) { return i; } if (TString(obj->GetName()).EqualTo(name)) { return i; }
......
/******************************************************************************** /* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * SPDX-License-Identifier: GPL-3.0-only
* * Authors: Florian Uhlig [committer] */
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIRMQEXHISTOSERVER #ifndef FAIRMQEXHISTOSERVER
#define FAIRMQEXHISTOSERVER #define FAIRMQEXHISTOSERVER
...@@ -12,10 +9,10 @@ ...@@ -12,10 +9,10 @@
#include "THttpServer.h" #include "THttpServer.h"
#include "TObjArray.h" #include "TObjArray.h"
#include <thread>
#include <memory> #include <memory>
#include <string> #include <string>
#include <thread>
//class FairMQExHistoCanvasDrawer; //class FairMQExHistoCanvasDrawer;
......
/******************************************************************************** /* Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * SPDX-License-Identifier: GPL-3.0-only
* * Authors: Pierre-Alain Loizeau [committer] */
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <mutex>
#include "CbmMqHistoServer.h" #include "CbmMqHistoServer.h"
#include "CbmFlesCanvasTools.h" #include "CbmFlesCanvasTools.h"
#include "BoostSerializer.h"
#include "FairLogger.h"
#include "FairMQProgOptions.h" // device->fConfig #include "FairMQProgOptions.h" // device->fConfig
#include "RootSerializer.h" #include <Logger.h>
#include "TCanvas.h" #include "TCanvas.h"
#include "TEnv.h"
#include "TFile.h" #include "TFile.h"
#include "TH1.h" #include "TH1.h"
#include "TH2.h" #include "TH2.h"
...@@ -25,33 +19,30 @@ ...@@ -25,33 +19,30 @@
#include "TObjArray.h" #include "TObjArray.h"
#include "TProfile.h" #include "TProfile.h"
#include "TRootSniffer.h" #include "TRootSniffer.h"
#include "TSystem.h"
#include "BoostSerializer.h"
#include <boost/serialization/utility.hpp> #include <boost/serialization/utility.hpp>
std::mutex mtx; #include <mutex>
#include "RootSerializer.h"
std::mutex mtx;
/*
Bool_t bMqHistoServerResetHistos = kFALSE; Bool_t bMqHistoServerResetHistos = kFALSE;
Bool_t bMqHistoServerSaveHistos = kFALSE; Bool_t bMqHistoServerSaveHistos = kFALSE;
*/
CbmMqHistoServer::CbmMqHistoServer() CbmMqHistoServer::CbmMqHistoServer()
: FairMQDevice() : FairMQDevice()
, fsChannelNameHistosInput("histogram-in")
, fsChannelNameHistosConfig("histo-conf")
, fsChannelNameCanvasConfig("canvas-conf")
, fsHistoFileName("HistosMonitorPulser.root")
, fuHttpServerPort(8098)
, fArrayHisto() , fArrayHisto()
, fvpsHistosFolder() {
, fvpsCanvasConfig() }
, fvHistos()
, fvCanvas()
, fNMessages(0)
, fServer(nullptr)
, fStopThread(false) {}
CbmMqHistoServer::~CbmMqHistoServer() {} CbmMqHistoServer::~CbmMqHistoServer() {}
void CbmMqHistoServer::InitTask() { void CbmMqHistoServer::InitTask()
{
/// Read options from executable /// Read options from executable
LOG(info) << "Init options for CbmMqHistoServer."; LOG(info) << "Init options for CbmMqHistoServer.";
fsChannelNameHistosInput = fConfig->GetValue<std::string>("ChNameIn"); fsChannelNameHistosInput = fConfig->GetValue<std::string>("ChNameIn");
...@@ -64,22 +55,31 @@ void CbmMqHistoServer::InitTask() { ...@@ -64,22 +55,31 @@ void CbmMqHistoServer::InitTask() {
OnData(fsChannelNameHistosInput, &CbmMqHistoServer::ReceiveData); OnData(fsChannelNameHistosInput, &CbmMqHistoServer::ReceiveData);
OnData(fsChannelNameHistosConfig, &CbmMqHistoServer::ReceiveHistoConfig); OnData(fsChannelNameHistosConfig, &CbmMqHistoServer::ReceiveHistoConfig);
OnData(fsChannelNameCanvasConfig, &CbmMqHistoServer::ReceiveCanvasConfig); OnData(fsChannelNameCanvasConfig, &CbmMqHistoServer::ReceiveCanvasConfig);
/// If multi-parts, go to method processing combined Config+Data
OnData(fsChannelNameHistosInput, &CbmMqHistoServer::ReceiveConfigAndData);
fServer = new THttpServer(Form("http:%u", fuHttpServerPort)); fServer = new THttpServer(Form("http:%u", fuHttpServerPort));
/// To avoid the server sucking all Histos from gROOT when no output file is used /// To avoid the server sucking all Histos from gROOT when no output file is used
fServer->GetSniffer()->SetScanGlobalDir(kFALSE); fServer->GetSniffer()->SetScanGlobalDir(kFALSE);
const char* jsrootsys = gSystem->Getenv("JSROOTSYS");
if (!jsrootsys) jsrootsys = gEnv->GetValue("HttpServ.JSRootPath", jsrootsys);
LOG(info) << "JSROOT location: " << jsrootsys;
fServer->RegisterCommand("/Reset_Hist", "bMqHistoServerResetHistos=kTRUE"); //fServer->RegisterCommand("/Reset_Hist", "bMqHistoServerResetHistos=kTRUE");
fServer->RegisterCommand("/Save_Hist", "bMqHistoServerSaveHistos=kTRUE"); //fServer->RegisterCommand("/Save_Hist", "bMqHistoServerSaveHistos=kTRUE");
fServer->Restrict("/Reset_Moni_Hist", "allow=admin"); //fServer->Restrict("/Reset_Hist", "allow=admin");
fServer->Restrict("/Save_Pulser_Hist", "allow=admin"); //fServer->Restrict("/Save_Hist", "allow=admin");
} }
bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) { bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/)
{
LOG(debug) << "CbmMqHistoServer::ReceiveData => Processing histograms update";
TObject* tempObject = nullptr; TObject* tempObject = nullptr;
Deserialize<RootSerializer>(*msg, tempObject); // Deserialize<RootSerializer>(*msg, tempObject);
RootSerializer().Deserialize(*msg, tempObject);
if (TString(tempObject->ClassName()).EqualTo("TObjArray")) { if (TString(tempObject->ClassName()).EqualTo("TObjArray")) {
std::lock_guard<std::mutex> lk(mtx); std::lock_guard<std::mutex> lk(mtx);
...@@ -88,8 +88,7 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) { ...@@ -88,8 +88,7 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) {
TObject* pObj = arrayHisto->At(i); TObject* pObj = arrayHisto->At(i);
if (nullptr != dynamic_cast<TProfile*>(pObj)) { if (nullptr != dynamic_cast<TProfile*>(pObj)) {
if (!ReadHistogram<TProfile>(dynamic_cast<TProfile*>(pObj))) if (!ReadHistogram<TProfile>(dynamic_cast<TProfile*>(pObj))) return false;
return false;
} // if( nullptr != dynamic_cast< TProfile *>( pObj ) ) } // if( nullptr != dynamic_cast< TProfile *>( pObj ) )
else if (nullptr != dynamic_cast<TH2*>(pObj)) { else if (nullptr != dynamic_cast<TH2*>(pObj)) {
if (!ReadHistogram<TH2>(dynamic_cast<TH2*>(pObj))) return false; if (!ReadHistogram<TH2>(dynamic_cast<TH2*>(pObj))) return false;
...@@ -101,12 +100,14 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) { ...@@ -101,12 +100,14 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) {
LOG(warning) << "Unsupported object type for " << pObj->GetName(); LOG(warning) << "Unsupported object type for " << pObj->GetName();
} // for (Int_t i = 0; i < arrayHisto->GetEntriesFast(); i++) } // for (Int_t i = 0; i < arrayHisto->GetEntriesFast(); i++)
LOG(debug) << "CbmMqHistoServer::ReceiveData => Deleting array";
/// Need to use Delete instead of Clear to avoid memory leak!!! /// Need to use Delete instead of Clear to avoid memory leak!!!
arrayHisto->Delete(); arrayHisto->Delete();
/// If new histos received, try to prepare as many canvases as possible /// If new histos received, try to prepare as many canvases as possible
/// Should be expensive on start and cheap afterward /// Should be expensive on start and cheap afterward
if (!fbAllCanvasReady) { if (!fbAllCanvasReady) {
LOG(debug) << "CbmMqHistoServer::ReceiveData => Checking for canvases updates";
for (uint32_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) { for (uint32_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv) {
/// Jump canvases already ready /// Jump canvases already ready
if (fvbCanvasReady[uCanv]) continue; if (fvbCanvasReady[uCanv]) continue;
...@@ -117,14 +118,12 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) { ...@@ -117,14 +118,12 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) {
} // if( !fbAllCanvasReady ) } // if( !fbAllCanvasReady )
} // if (TString(tempObject->ClassName()).EqualTo("TObjArray")) } // if (TString(tempObject->ClassName()).EqualTo("TObjArray"))
else else
LOG(fatal) LOG(fatal) << "CbmMqHistoServer::ReceiveData => Wrong object type at input: " << tempObject->ClassName();
<< "CbmMqHistoServer::ReceiveData => Wrong object type at input: "
<< tempObject->ClassName();
fNMessages += 1; fNMessages += 1;
if (nullptr != tempObject) delete tempObject; if (nullptr != tempObject) delete tempObject;
/*
/// TODO: control flags communication with histo server /// TODO: control flags communication with histo server
/// Idea: 1 req channel (per device or not mixup?), polling every N TS and/or M s /// Idea: 1 req channel (per device or not mixup?), polling every N TS and/or M s
if (bMqHistoServerResetHistos) { if (bMqHistoServerResetHistos) {
...@@ -140,19 +139,21 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) { ...@@ -140,19 +139,21 @@ bool CbmMqHistoServer::ReceiveData(FairMQMessagePtr& msg, int /*index*/) {
SaveHistograms(); SaveHistograms();
bMqHistoServerSaveHistos = kFALSE; bMqHistoServerSaveHistos = kFALSE;
} // if( bMqHistoServerSaveHistos ) } // if( bMqHistoServerSaveHistos )
*/
LOG(debug) << "CbmMqHistoServer::ReceiveData => Finished processing histograms update";
return true; return true;
} }
bool CbmMqHistoServer::ReceiveHistoConfig(FairMQMessagePtr& msg, bool CbmMqHistoServer::ReceiveHistoConfig(FairMQMessagePtr& msg, int /*index*/)
int /*index*/) { {
std::pair<std::string, std::string> tempObject; std::pair<std::string, std::string> tempObject;
Deserialize<BoostSerializer<std::pair<std::string, std::string>>>(*msg, // Deserialize<BoostSerializer<std::pair<std::string, std::string>>>(*msg, tempObject);
tempObject); BoostSerializer<std::pair<std::string, std::string>>().Deserialize(*msg, tempObject);
LOG(info) << " Received configuration for histo " << tempObject.first << " : "
<< tempObject.second; LOG(info) << " Received configuration for histo " << tempObject.first << " : " << tempObject.second;
/// Check if histo name already received in previous messages /// Check if histo name already received in previous messages
/// Linear search should be ok as config is shared only at startup /// Linear search should be ok as config is shared only at startup
...@@ -176,15 +177,14 @@ bool CbmMqHistoServer::ReceiveHistoConfig(FairMQMessagePtr& msg, ...@@ -176,15 +177,14 @@ bool CbmMqHistoServer::ReceiveHistoConfig(FairMQMessagePtr& msg,
return true; return true;
} }
bool CbmMqHistoServer::ReceiveCanvasConfig(FairMQMessagePtr& msg, bool CbmMqHistoServer::ReceiveCanvasConfig(FairMQMessagePtr& msg, int /*index*/)
int /*index*/) { {
std::pair<std::string, std::string> tempObject; std::pair<std::string, std::string> tempObject;
Deserialize<BoostSerializer<std::pair<std::string, std::string>>>(*msg, // Deserialize<BoostSerializer<std::pair<std::string, std::string>>>(*msg, tempObject);
tempObject); BoostSerializer<std::pair<std::string, std::string>>().Deserialize(*msg, tempObject);
LOG(info) << " Received configuration for canvas " << tempObject.first LOG(info) << " Received configuration for canvas " << tempObject.first << " : " << tempObject.second;
<< " : " << tempObject.second;
/// Check if canvas name already received in previous messages /// Check if canvas name already received in previous messages
/// Linear search should be ok as config is shared only at startup /// Linear search should be ok as config is shared only at startup
...@@ -194,7 +194,7 @@ bool CbmMqHistoServer::ReceiveCanvasConfig(FairMQMessagePtr& msg, ...@@ -194,7 +194,7 @@ bool CbmMqHistoServer::ReceiveCanvasConfig(FairMQMessagePtr& msg,
} // for( UInt_t uPrevCanv = 0; uPrevCanv < fvpsCanvasConfig.size(); ++uPrevCanv ) } // for( UInt_t uPrevCanv = 0; uPrevCanv < fvpsCanvasConfig.size(); ++uPrevCanv )
if (uPrevCanv < fvpsCanvasConfig.size()) { if (uPrevCanv < fvpsCanvasConfig.size()) {
LOG(warning) << " Ignored new configuration for histo " << tempObject.first LOG(warning) << " Ignored new configuration for Canvas " << tempObject.first
<< " due to previously received one: " << tempObject.second; << " due to previously received one: " << tempObject.second;
/// Not sure if we should return false here... /// Not sure if we should return false here...
} // if( uPrevCanv < fvpsCanvasConfig.size() ) } // if( uPrevCanv < fvpsCanvasConfig.size() )
...@@ -210,12 +210,82 @@ bool CbmMqHistoServer::ReceiveCanvasConfig(FairMQMessagePtr& msg, ...@@ -210,12 +210,82 @@ bool CbmMqHistoServer::ReceiveCanvasConfig(FairMQMessagePtr& msg,
return true; return true;
} }
void CbmMqHistoServer::PreRun() { bool CbmMqHistoServer::ReceiveConfigAndData(FairMQParts& 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
LOG(debug) << "CbmMqHistoServer::ReceiveConfigAndData => only 1 parts found in input, "
<< "assuming data only message routed to wrong method!";
return ReceiveData(parts.At(0), 0);
} // if( 1 == parts.Size() )
LOG(fatal) << "CbmMqHistoServer::ReceiveConfigAndData => Wrong number of parts: " << parts.Size()
<< " instead of at least 4 (Header + Histo Config + Canvas config + Data)!";
} // if( parts.Size() < 4 )
LOG(info) << "CbmMqHistoServer::ReceiveConfigAndData => Received composed message with " << parts.Size() << " parts";
/// Header contains a pair of
std::pair<uint32_t, uint32_t> pairHeader;
// Deserialize<BoostSerializer<std::pair<uint32_t, uint32_t>>>(*parts.At(0), pairHeader);
BoostSerializer<std::pair<uint32_t, uint32_t>>().Deserialize(*parts.At(0), pairHeader);
LOG(info) << "CbmMqHistoServer::ReceiveConfigAndData => Received configuration for " << pairHeader.first
<< " histos and " << pairHeader.second << " canvases";
uint32_t uOffsetHistoConfig = pairHeader.first;
if (0 == pairHeader.first) {
uOffsetHistoConfig = 1;
if (0 < (parts.At(uOffsetHistoConfig))->GetSize()) {
LOG(fatal) << "CbmMqHistoServer::ReceiveConfigAndData => No histo config expected but corresponding message is"
<< " not empty: " << (parts.At(uOffsetHistoConfig))->GetSize();
}
}
uint32_t uOffsetCanvasConfig = pairHeader.second;
if (0 == pairHeader.second) {
uOffsetCanvasConfig = 1;
if (0 < (parts.At(uOffsetHistoConfig + uOffsetCanvasConfig))->GetSize()) {
LOG(fatal) << "CbmMqHistoServer::ReceiveConfigAndData => No Canvas config expected but corresponding message is"
<< " not empty: " << (parts.At(uOffsetHistoConfig + uOffsetCanvasConfig))->GetSize();
}
}
if (static_cast<size_t>(parts.Size()) != 1 + uOffsetHistoConfig + uOffsetCanvasConfig + 1) {
LOG(fatal) << "CbmMqHistoServer::ReceiveConfigAndData => Number of parts not matching header: " << parts.Size()
<< " instead of " << 1 + uOffsetHistoConfig + uOffsetCanvasConfig + 1;
} // if( parts.Size() != 1 + pairHeader.first + pairHeader.second )
/// Decode parts for histograms configuration
for (uint32_t uHisto = 0; uHisto < pairHeader.first; ++uHisto) {
ReceiveHistoConfig(parts.At(1 + uHisto), 0);
} // for (UInt_t uHisto = 0; uHisto < pairHeader.first; ++uHisto)
/// Decode parts for histograms configuration
for (uint32_t uCanv = 0; uCanv < pairHeader.second; ++uCanv) {
ReceiveCanvasConfig(parts.At(1 + uOffsetHistoConfig + uCanv), 0);
} // for (UInt_t uCanv = 0; uCanv < pairHeader.second; ++uCanv)
/// Decode the histograms data now that the configuration is loaded
ReceiveData(parts.At(1 + uOffsetHistoConfig + uOffsetCanvasConfig), 0);
LOG(info) << "CbmMqHistoServer::ReceiveConfigAndData => Finished processing composed message with " << parts.Size()
<< " parts";
return true;
}
void CbmMqHistoServer::PreRun()
{
fStopThread = false; fStopThread = false;
fThread = std::thread(&CbmMqHistoServer::UpdateHttpServer, this); fThread = std::thread(&CbmMqHistoServer::UpdateHttpServer, this);
} }
void CbmMqHistoServer::UpdateHttpServer() { void CbmMqHistoServer::UpdateHttpServer()
{
while (!fStopThread) { while (!fStopThread) {
std::this_thread::sleep_for(std::chrono::milliseconds(10)); std::this_thread::sleep_for(std::chrono::milliseconds(10));
std::lock_guard<std::mutex> lk(mtx); std::lock_guard<std::mutex> lk(mtx);
...@@ -224,13 +294,17 @@ void CbmMqHistoServer::UpdateHttpServer() { ...@@ -224,13 +294,17 @@ void CbmMqHistoServer::UpdateHttpServer() {
} }
} }
void CbmMqHistoServer::PostRun() { void CbmMqHistoServer::PostRun()
{
SaveHistograms();
fStopThread = true; fStopThread = true;
fThread.join(); fThread.join();
SaveHistograms();
} }
template<class HistoT> template<class HistoT>
bool CbmMqHistoServer::ReadHistogram(HistoT* pHist) { bool CbmMqHistoServer::ReadHistogram(HistoT* pHist)
{
int index1 = FindHistogram(pHist->GetName()); int index1 = FindHistogram(pHist->GetName());
if (-1 == index1) { if (-1 == index1) {
HistoT* histogram_new = static_cast<HistoT*>(pHist->Clone()); HistoT* histogram_new = static_cast<HistoT*>(pHist->Clone());
...@@ -246,14 +320,12 @@ bool CbmMqHistoServer::ReadHistogram(HistoT* pHist) { ...@@ -246,14 +320,12 @@ bool CbmMqHistoServer::ReadHistogram(HistoT* pHist) {
/// Check if name matches one in config for others /// Check if name matches one in config for others
if (fvpsHistosFolder[uHist].first == histogram_new->GetName()) { if (fvpsHistosFolder[uHist].first == histogram_new->GetName()) {
fvHistos[uHist] = std::pair<TNamed*, std::string>( fvHistos[uHist] = std::pair<TNamed*, std::string>(histogram_new, fvpsHistosFolder[uHist].second);
histogram_new, fvpsHistosFolder[uHist].second); fServer->Register(Form("/%s", fvHistos[uHist].second.data()), fvHistos[uHist].first);
fServer->Register(Form("/%s", fvHistos[uHist].second.data()),
fvHistos[uHist].first);
fvbHistoRegistered[uHist] = true; fvbHistoRegistered[uHist] = true;
LOG(info) << "registered histo " << fvHistos[uHist].first->GetName() LOG(info) << "registered histo " << fvHistos[uHist].first->GetName() << " in folder "
<< " in folder " << fvHistos[uHist].second; << fvHistos[uHist].second;
/// Update flag telling whether all known histos are registered /// Update flag telling whether all known histos are registered
...@@ -263,19 +335,18 @@ bool CbmMqHistoServer::ReadHistogram(HistoT* pHist) { ...@@ -263,19 +335,18 @@ bool CbmMqHistoServer::ReadHistogram(HistoT* pHist) {
fbAllHistosRegistered = false; fbAllHistosRegistered = false;
break; break;
} // if( !fvbHistoRegistered[ uIdx ] ) } // if( !fvbHistoRegistered[ uIdx ] )
} // for( uint32_t uIdx = 0; uIdx < fvbHistoRegistered.size(); ++uIdx ) } // for( uint32_t uIdx = 0; uIdx < fvbHistoRegistered.size(); ++uIdx )
break; break;
} // if( fvpsHistosFolder[ uHist ].first == histogram_new->GetName() ) } // if( fvpsHistosFolder[ uHist ].first == histogram_new->GetName() )
} // for( uint32_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv ) } // for( uint32_t uCanv = 0; uCanv < fvpsCanvasConfig.size(); ++uCanv )
} // if( !fbAllCanvasReady ) } // if( !fbAllCanvasReady )
} // if (-1 == index1) } // if (-1 == index1)
else { else {
HistoT* histogram_existing = dynamic_cast<HistoT*>(fArrayHisto.At(index1)); HistoT* histogram_existing = dynamic_cast<HistoT*>(fArrayHisto.At(index1));
if (nullptr == histogram_existing) { if (nullptr == histogram_existing) {
LOG(error) << "CbmMqHistoServer::ReadHistogram => " LOG(error) << "CbmMqHistoServer::ReadHistogram => "
<< "Incompatible type found during update for histo " << "Incompatible type found during update for histo " << pHist->GetName();
<< pHist->GetName();
return false; return false;
} // if( nullptr == histogram_existing ) } // if( nullptr == histogram_existing )
...@@ -284,25 +355,26 @@ bool CbmMqHistoServer::ReadHistogram(HistoT* pHist) { ...@@ -284,25 +355,26 @@ bool CbmMqHistoServer::ReadHistogram(HistoT* pHist) {
return true; return true;
} }
int CbmMqHistoServer::FindHistogram(const std::string& name) { int CbmMqHistoServer::FindHistogram(const std::string& name)
{
for (int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist) { for (int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist) {
TObject* obj = fArrayHisto.At(iHist); TObject* obj = fArrayHisto.At(iHist);
if (TString(obj->GetName()).EqualTo(name)) { if (TString(obj->GetName()).EqualTo(name)) { return iHist; } // if( TString( obj->GetName() ).EqualTo( name ) )
return iHist; } // for( int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist )
} // if( TString( obj->GetName() ).EqualTo( name ) )
} // for( int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist )
return -1; return -1;
} }
bool CbmMqHistoServer::ResetHistograms() { bool CbmMqHistoServer::ResetHistograms()
{
for (int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist) { for (int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist) {
dynamic_cast<TH1*>(fArrayHisto.At(iHist))->Reset(); dynamic_cast<TH1*>(fArrayHisto.At(iHist))->Reset();
} // for( int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist ) } // for( int iHist = 0; iHist < fArrayHisto.GetEntriesFast(); ++iHist )
return true; return true;
} }
bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) { bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx)
CanvasConfig conf( {
ExtractCanvasConfigFromString(fvpsCanvasConfig[uCanvIdx].second)); LOG(debug) << " Extracting configuration for canvas index " << uCanvIdx;
CanvasConfig conf(ExtractCanvasConfigFromString(fvpsCanvasConfig[uCanvIdx].second));
/// First check if all objects to be drawn are present /// First check if all objects to be drawn are present
uint32_t uNbPads(conf.GetNbPads()); uint32_t uNbPads(conf.GetNbPads());
...@@ -319,9 +391,10 @@ bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) { ...@@ -319,9 +391,10 @@ bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) {
} // for( uint32_t uObjIdx = 0; uObjIdx < uNbObj; ++uObjIdx ) } // for( uint32_t uObjIdx = 0; uObjIdx < uNbObj; ++uObjIdx )
} // for( uint32_t uPadIdx = 0; uPadIdx < uNbPads; ++uPadIdx ) } // for( uint32_t uPadIdx = 0; uPadIdx < uNbPads; ++uPadIdx )
LOG(info) << " All histos found for canvas " << conf.GetName().data() << ", now preparing it";
/// Create new canvas and pads /// Create new canvas and pads
TCanvas* pNewCanv = TCanvas* pNewCanv = new TCanvas(conf.GetName().data(), conf.GetTitle().data());
new TCanvas(conf.GetName().data(), conf.GetTitle().data());
pNewCanv->Divide(conf.GetNbPadsX(), conf.GetNbPadsY()); pNewCanv->Divide(conf.GetNbPadsX(), conf.GetNbPadsY());
/// Loop on pads /// Loop on pads
...@@ -342,31 +415,29 @@ bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) { ...@@ -342,31 +415,29 @@ bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) {
TObject* pObj = fArrayHisto[FindHistogram(sName)]; TObject* pObj = fArrayHisto[FindHistogram(sName)];
if (nullptr != dynamic_cast<TProfile*>(pObj)) { if (nullptr != dynamic_cast<TProfile*>(pObj)) {
dynamic_cast<TProfile*>(pObj)->Draw( dynamic_cast<TProfile*>(pObj)->Draw(conf.GetOption(uPadIdx, uObjIdx).data());
conf.GetOption(uPadIdx, uObjIdx).data());
} // if( nullptr != dynamic_cast< TProfile *>( pObj ) ) } // if( nullptr != dynamic_cast< TProfile *>( pObj ) )
else if (nullptr != dynamic_cast<TH2*>(pObj)) { else if (nullptr != dynamic_cast<TH2*>(pObj)) {
dynamic_cast<TH2*>(pObj)->Draw( dynamic_cast<TH2*>(pObj)->Draw(conf.GetOption(uPadIdx, uObjIdx).data());
conf.GetOption(uPadIdx, uObjIdx).data());
} // if( nullptr != dynamic_cast< TH2 *>( pObj ) ) } // if( nullptr != dynamic_cast< TH2 *>( pObj ) )
else if (nullptr != dynamic_cast<TH1*>(pObj)) { else if (nullptr != dynamic_cast<TH1*>(pObj)) {
dynamic_cast<TH1*>(pObj)->Draw( dynamic_cast<TH1*>(pObj)->Draw(conf.GetOption(uPadIdx, uObjIdx).data());
conf.GetOption(uPadIdx, uObjIdx).data());
} // if( nullptr != dynamic_cast< TH1 *>( pObj ) ) } // if( nullptr != dynamic_cast< TH1 *>( pObj ) )
else else
LOG(warning) << "Unsupported object type for " << sName LOG(warning) << " Unsupported object type for " << sName << " when preparing canvas " << conf.GetName();
<< " when preparing canvas " << conf.GetName();
LOG(info) << " Configured histo " << sName << " on pad " << (1 + uPadIdx) << " for canvas "
<< conf.GetName().data();
} // if( "nullptr" != sName ) } // if( "nullptr" != sName )
} // for( uint32_t uObjIdx = 0; uObjIdx < uNbObj; ++uObjIdx ) } // for( uint32_t uObjIdx = 0; uObjIdx < uNbObj; ++uObjIdx )
} // for( uint32_t uPadIdx = 0; uPadIdx < uNbPads; ++uPadIdx ) } // for( uint32_t uPadIdx = 0; uPadIdx < uNbPads; ++uPadIdx )
fvCanvas[uCanvIdx] = std::pair<TCanvas*, std::string>(pNewCanv, "canvases"); fvCanvas[uCanvIdx] = std::pair<TCanvas*, std::string>(pNewCanv, "canvases");
fServer->Register(Form("/%s", fvCanvas[uCanvIdx].second.data()), fServer->Register(Form("/%s", fvCanvas[uCanvIdx].second.data()), fvCanvas[uCanvIdx].first);
fvCanvas[uCanvIdx].first);
fvbCanvasRegistered[uCanvIdx] = true; fvbCanvasRegistered[uCanvIdx] = true;
LOG(info) << "registered canvas " << fvCanvas[uCanvIdx].first->GetName() LOG(info) << " Registered canvas " << fvCanvas[uCanvIdx].first->GetName() << " in folder "
<< " in folder " << fvCanvas[uCanvIdx].second; << fvCanvas[uCanvIdx].second;
/// Update flag telling whether all known canvases are registered /// Update flag telling whether all known canvases are registered
fbAllCanvasRegistered = true; fbAllCanvasRegistered = true;
...@@ -380,15 +451,20 @@ bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) { ...@@ -380,15 +451,20 @@ bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) {
return true; return true;
} }
bool CbmMqHistoServer::SaveHistograms() { bool CbmMqHistoServer::SaveHistograms()
{
/// Save old global file and folder pointer to avoid messing with FairRoot
TFile* oldFile = gFile;
TDirectory* oldDir = gDirectory;
/// (Re-)Create ROOT file to store the histos /// (Re-)Create ROOT file to store the histos
TDirectory* oldDir = NULL; TFile* histoFile = nullptr;
TFile* histoFile = NULL;
// Store current directory position to allow restore later
oldDir = gDirectory;
// open separate histo file in recreate mode // open separate histo file in recreate mode
histoFile = new TFile(fsHistoFileName.data(), "RECREATE"); histoFile = new TFile(fsHistoFileName.data(), "RECREATE");
LOG(info) << "Save Histos in file " << fsHistoFileName.data();
if (nullptr == histoFile) return false; if (nullptr == histoFile) return false;
/// Register the histos in the HTTP server /// Register the histos in the HTTP server
...@@ -416,8 +492,10 @@ bool CbmMqHistoServer::SaveHistograms() { ...@@ -416,8 +492,10 @@ bool CbmMqHistoServer::SaveHistograms() {
histoFile->cd(); histoFile->cd();
} // for( UInt_t uHisto = 0; uHisto < fvCanvas.size(); ++uHisto ) } // for( UInt_t uHisto = 0; uHisto < fvCanvas.size(); ++uHisto )
// Restore original directory position /// Restore old global file and folder pointer to avoid messing with FairRoot
oldDir->cd(); gFile = oldFile;
gDirectory = oldDir;
histoFile->Close(); histoFile->Close();
return true; return true;
......
/******************************************************************************** /* Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * SPDX-License-Identifier: GPL-3.0-only
* * Authors: Pierre-Alain Loizeau [committer] */
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef CBMMQHISTOSERVER_H #ifndef CBMMQHISTOSERVER_H
#define CBMMQHISTOSERVER_H #define CBMMQHISTOSERVER_H
...@@ -12,10 +9,10 @@ ...@@ -12,10 +9,10 @@
#include "THttpServer.h" #include "THttpServer.h"
#include "TObjArray.h" #include "TObjArray.h"
#include <thread>
#include <memory> #include <memory>
#include <string> #include <string>
#include <thread>
class TNamed; class TNamed;
class TCanvas; class TCanvas;
...@@ -37,45 +34,45 @@ protected: ...@@ -37,45 +34,45 @@ protected:
bool ReceiveCanvasConfig(FairMQMessagePtr& msg, int index); bool ReceiveCanvasConfig(FairMQMessagePtr& msg, int index);
bool ReceiveConfigAndData(FairMQParts& msg, int index);
virtual void PreRun(); virtual void PreRun();
virtual void PostRun(); virtual void PostRun();
private: private:
/// Parameters /// Parameters
std::string fsChannelNameHistosInput; std::string fsChannelNameHistosInput = "histogram-in";
std::string fsChannelNameHistosConfig; std::string fsChannelNameHistosConfig = "histo-conf";
std::string fsChannelNameCanvasConfig; std::string fsChannelNameCanvasConfig = "canvas-conf";
std::string fsHistoFileName; std::string fsHistoFileName = "MqHistos.root";
uint32_t fuHttpServerPort; uint32_t fuHttpServerPort = 8098;
/// Array of histograms with unique names /// Array of histograms with unique names
TObjArray fArrayHisto; TObjArray fArrayHisto;
/// Vector of string with ( HistoName, FolderPath ) to send to the histogram server /// Vector of string with ( HistoName, FolderPath ) to send to the histogram server
std::vector<std::pair<std::string, std::string>> fvpsHistosFolder; std::vector<std::pair<std::string, std::string>> fvpsHistosFolder = {};
/// Vector of string pairs with ( CanvasName, CanvasConfig ) to send to the histogram server /// Vector of string pairs with ( CanvasName, CanvasConfig ) to send to the histogram server
/// Format of Can config is "Name;Title;NbPadX(U);NbPadY(U);ConfigPad1(s);....;ConfigPadXY(s)" /// Format of Can config is "Name;Title;NbPadX(U);NbPadY(U);ConfigPad1(s);....;ConfigPadXY(s)"
/// Format of Pad config is "GrixX(b),GridY(b),LogX(b),LogY(b),LogZ(b),HistoName(s),DrawOptions(s)" /// Format of Pad config is "GrixX(b),GridY(b),LogX(b),LogY(b),LogZ(b),HistoName(s),DrawOptions(s)"
std::vector<std::pair<std::string, std::string>> fvpsCanvasConfig; std::vector<std::pair<std::string, std::string>> fvpsCanvasConfig = {};
std::vector<bool> fvbCanvasReady; std::vector<bool> fvbCanvasReady = {};
bool fbAllCanvasReady; bool fbAllCanvasReady = false;
std::vector<std::pair<TNamed*, std::string>> std::vector<std::pair<TNamed*, std::string>> fvHistos = {}; //! Vector of Histos pointers and folder path
fvHistos; //! Vector of Histos pointers and folder path std::vector<bool> fvbHistoRegistered = {};
std::vector<bool> fvbHistoRegistered; bool fbAllHistosRegistered = false;
bool fbAllHistosRegistered; std::vector<std::pair<TCanvas*, std::string>> fvCanvas = {}; //! Vector of Canvas pointers and folder path
std::vector<std::pair<TCanvas*, std::string>> std::vector<bool> fvbCanvasRegistered = {};
fvCanvas; //! Vector of Canvas pointers and folder path bool fbAllCanvasRegistered = false;
std::vector<bool> fvbCanvasRegistered;
bool fbAllCanvasRegistered;
/// Internal status /// Internal status
int fNMessages; int fNMessages = 0;
THttpServer* fServer; THttpServer* fServer = nullptr;
std::thread fThread; std::thread fThread;
bool fStopThread; bool fStopThread = false;
template<class HistoT> template<class HistoT>
bool ReadHistogram(HistoT* pHist); bool ReadHistogram(HistoT* pHist);
......
/******************************************************************************** /* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * SPDX-License-Identifier: GPL-3.0-only
* * Authors: Florian Uhlig [committer] */
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * #include "CbmHistoServer.h"
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <memory> #include <memory>
#include "runFairMQDevice.h" #include "runFairMQDevice.h"
#include "CbmHistoServer.h"
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
void addCustomOptions(bpo::options_description& /*options*/) {} void addCustomOptions(bpo::options_description& /*options*/) {}
//std::unique_ptr<FairMQExHistoCanvasDrawer> getCanvasDrawer(); //std::unique_ptr<FairMQExHistoCanvasDrawer> getCanvasDrawer();
FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/)
{
CbmHistoServer* histoServer = new CbmHistoServer(); CbmHistoServer* histoServer = new CbmHistoServer();
// histoServer->SetCanvasDrawer(getCanvasDrawer()); // histoServer->SetCanvasDrawer(getCanvasDrawer());
......
/******************************************************************************** /* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * SPDX-License-Identifier: GPL-3.0-only
* * Authors: Pierre-Alain Loizeau [committer] */
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, * #include "CbmMqHistoServer.h"
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <memory> #include <memory>
#include "runFairMQDevice.h" #include "runFairMQDevice.h"
#include "CbmMqHistoServer.h"
namespace bpo = boost::program_options; namespace bpo = boost::program_options;
void addCustomOptions(bpo::options_description& options) { void addCustomOptions(bpo::options_description& options)
options.add_options()( {
"ChNameIn", options.add_options()("ChNameIn", bpo::value<std::string>()->default_value("histogram-in"),
bpo::value<std::string>()->default_value("histogram-in"), "MQ channel name for histos");
"MQ channel name for histos"); options.add_options()("ChNameHistCfg", bpo::value<std::string>()->default_value("histo-conf"),
options.add_options()("ChNameHistCfg",
bpo::value<std::string>()->default_value("histo-conf"),
"MQ channel name for histos config"); "MQ channel name for histos config");
options.add_options()("ChNameCanvCfg", options.add_options()("ChNameCanvCfg", bpo::value<std::string>()->default_value("canvas-conf"),
bpo::value<std::string>()->default_value("canvas-conf"),
"MQ channel name for canvases config"); "MQ channel name for canvases config");
options.add_options()( options.add_options()("HistoFileName", bpo::value<std::string>()->default_value("HistosMonitorPulser.root"),
"HistoFileName", ".root File name for histo saving");
bpo::value<std::string>()->default_value("HistosMonitorPulser.root"), options.add_options()("histport", bpo::value<uint32_t>()->default_value(8080), "port for histos http server");
".root File name for histo saving");
options.add_options()("histport",
bpo::value<uint32_t>()->default_value(8080),
"port for histos http server");
} }
FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/)
{
CbmMqHistoServer* histoServer = new CbmMqHistoServer(); CbmMqHistoServer* histoServer = new CbmMqHistoServer();
return histoServer; return histoServer;
......
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startMQSamplerUnpackerParserverHitBuilder.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startMQSamplerUnpackerParserverHitBuilder.sh) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startMQSamplerUnpackerParserverHitBuilder.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startMQSamplerUnpackerParserverHitBuilder.sh)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startMQ_Mcbm.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startMQ_Mcbm.sh) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startMQ_Mcbm.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startMQ_Mcbm.sh)
set(INCLUDE_DIRECTORIES set(INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CBMROOT_SOURCE_DIR}/fles/cern2016/param )
${CBMROOT_SOURCE_DIR}/fles/cern2016/unpacker
${CBMROOT_SOURCE_DIR}/beamtime/base
${CBMDATA_DIR}
${CBMDATA_DIR}/tof
${CBMBASE_DIR}
${CBMROOT_SOURCE_DIR}/tof/TofParam
${CBMROOT_SOURCE_DIR}/tof/TofTools
)
Set(SYSTEM_INCLUDE_DIRECTORIES
${SYSTEM_INCLUDE_DIRECTORIES}
${ZeroMQ_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${FAIRROOT_INCLUDE_DIR}
${FAIRMQ_INCLUDE_DIR}
${FAIRMQ_INCLUDE_DIR}/options
${IPC_INCLUDE_DIRECTORY}
${CBMROOT_SOURCE_DIR}/external/cppzmq
${CBMROOT_SOURCE_DIR}/tof/TofReco
)
include_directories(${INCLUDE_DIRECTORIES})
include_directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
set(LINK_DIRECTORIES
${ROOT_LIBRARY_DIR}
${FAIRROOT_LIBRARY_DIR}
${Boost_LIBRARY_DIRS}
)
link_directories(${LINK_DIRECTORIES})
# Set the install path within the build directory
set(EXECUTABLE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/MQ/hitbuilder") set(EXECUTABLE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/MQ/hitbuilder")
# Set the install path within the installation directory
set(BIN_DESTINATION bin/MQ/hitbuilder)
Set(BOOST_LIBS
${Boost_SYSTEM_LIBRARY}
${Boost_SERIALIZATION_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_LOG_LIBRARY}
)
If(UNIX AND NOT APPLE) If(UNIX AND NOT APPLE)
List(APPEND BOOST_LIBS pthread) List(APPEND BOOST_LIBS pthread)
EndIf() EndIf()
set(FAIR_LIBS
Base
ParBase
FairMQ
)
If(FAIRLOGGER_FOUND)
set(FAIR_LIBS
${FAIR_LIBS}
FairLogger
)
EndIf()
set(EXE_NAME HitBuilderTof) set(EXE_NAME HitBuilderTof)
set(SRCS CbmDeviceHitBuilderTof.cxx runHitBuilderTof.cxx) set(SRCS CbmDeviceHitBuilderTof.cxx runHitBuilderTof.cxx)
set(DEPENDENCIES set(PUBLIC_DEPENDENCIES
${DEPENDENCIES}
# FairMQ
${FAIR_LIBS}
${BOOST_LIBS}
# fles_ipc
CbmFlibCern2016
CbmBase
CbmData CbmData
CbmTof CbmTofBase
Geom CbmMQBase
Core FairRoot::Base
MathCore ROOT::Geom
Tree
Physics )
RIO
Net set(PRIVATE_DEPENDENCIES
Hist CbmBase
) CbmTofReco
GENERATE_EXECUTABLE() FairRoot::ParBase
FairRoot::Online
ROOT::Core
ROOT::Graf
ROOT::Hist
ROOT::MathCore
ROOT::Minuit
ROOT::Physics
)
set(INTERFACE_DEPENDENCIES
FairMQ::FairMQ
external::fles_ipc
ROOT::Net
ROOT::RIO
ROOT::Tree
)
generate_cbm_executable()
# Set the correct variables for the installation
set(VMCWORKDIR ${CMAKE_INSTALL_PREFIX}/share/cbmroot)
set(MY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CURRENT_SOURCE_DIR ${VMCWORKDIR}/input)
set(TMPDIR "${CMAKE_BINARY_DIR}")
set(CMAKE_BINARY_DIR ${CMAKE_INSTALL_PREFIX})
# Configure file for installation directory
configure_file(${MY_SOURCE_DIR}/startMQSamplerUnpackerParserverHitBuilder.sh.in ${TMPDIR}/bin/MQ/topologies/install/startMQSamplerUnpackerParserverHitBuilder.sh)
configure_file(${MY_SOURCE_DIR}/startMQ_Mcbm.sh.in ${TMPDIR}/bin/MQ/topologies/install/startMQ_Mcbm.sh)
install(PROGRAMS ${TMPDIR}/bin/MQ/topologies/install/startMQSamplerUnpackerParserverHitBuilder.sh
${TMPDIR}/bin/MQ/topologies/install/startMQ_Mcbm.sh
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/MQ/topologies
)
source diff could not be displayed: it is too large. Options to address this: view the blob.