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 597 additions and 634 deletions
/* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Florian Uhlig [committer] */
#include "CbmMQChannels.h" #include "CbmMQChannels.h"
#include "FairMQDevice.h" #include "FairMQDevice.h"
CbmMQChannels::CbmMQChannels(std::vector<std::string> allowedChannels) CbmMQChannels::CbmMQChannels(std::vector<std::string> allowedChannels) : fAllowedChannels {allowedChannels}
: fAllowedChannels {allowedChannels} { {
fChannelsToSend.resize(fAllowedChannels.size()); fChannelsToSend.resize(fAllowedChannels.size());
for (auto& entry : fChannelsToSend) { for (auto& entry : fChannelsToSend) {
entry.push_back(""); entry.push_back("");
...@@ -10,32 +15,29 @@ CbmMQChannels::CbmMQChannels(std::vector<std::string> allowedChannels) ...@@ -10,32 +15,29 @@ CbmMQChannels::CbmMQChannels(std::vector<std::string> allowedChannels)
fComponentsToSend.resize(fAllowedChannels.size()); fComponentsToSend.resize(fAllowedChannels.size());
} }
bool CbmMQChannels::IsChannelNameAllowed(std::string channelName) { bool CbmMQChannels::IsChannelNameAllowed(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) {
const std::vector<std::string>::const_iterator pos = const std::vector<std::string>::const_iterator pos =
std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry); std::find(fAllowedChannels.begin(), fAllowedChannels.end(), entry);
const std::vector<std::string>::size_type idx = const std::vector<std::string>::size_type idx = pos - fAllowedChannels.begin();
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;
fComponentsToSend[idx]++; fComponentsToSend[idx]++;
// The array is initialized with one empty string. If the string has still teh value from initialization // The array is initialized with one empty string. If the string has still teh value from initialization
// exchnge the value by the new channel name. In any other case add one more entry to the vector // exchnge the value by the new channel name. In any other case add one more entry to the vector
if (fChannelsToSend[idx].size() == 1 if (fChannelsToSend[idx].size() == 1 && fChannelsToSend[idx].at(0).empty()) {
&& fChannelsToSend[idx].at(0).empty()) {
fChannelsToSend[idx].at(0) = channelName; fChannelsToSend[idx].at(0) = channelName;
} else { }
else {
fChannelsToSend[idx].push_back(channelName); fChannelsToSend[idx].push_back(channelName);
} }
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(info) << "The allowed channels are: "; LOG(info) << "The allowed channels are: ";
for (auto const& entry : fAllowedChannels) { for (auto const& entry : fAllowedChannels) {
LOG(info) << entry; LOG(info) << entry;
...@@ -44,7 +46,8 @@ bool CbmMQChannels::IsChannelNameAllowed(std::string channelName) { ...@@ -44,7 +46,8 @@ bool CbmMQChannels::IsChannelNameAllowed(std::string channelName) {
return false; return false;
} }
bool CbmMQChannels::CheckChannels(FairMQDevice* device) { bool CbmMQChannels::CheckChannels(FairMQDevice* device)
{
// 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
......
/* 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 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;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.