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
  • m.deveaux/cbmroot
  • mkunold/cbmroot
  • h.darwish/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
64 results
Show changes
Commits on Source (39)
Showing
with 3887 additions and 79 deletions
......@@ -334,8 +334,8 @@ FileLicenceCheck:
.macosx_12_variables: &macosx_12_variables
OS: "macOS_12"
FAIRSOFT_VERSION: "apr21p1"
FAIRROOT_VERSION: "v18.6.4"
FAIRSOFT_VERSION: "apr21p2"
FAIRROOT_VERSION: "v18.6.5"
BASE_PATH: "/opt"
SIMPATH: "$BASE_PATH/fairsoft/$FAIRSOFT_VERSION"
FAIRROOTPATH: "$BASE_PATH/fairroot/${FAIRROOT_VERSION}_${FAIRSOFT_VERSION}"
......
......@@ -42,7 +42,7 @@
/analysis/PWGCHA/ @i.selyuzhenkov
/analysis/PWGDIL/ @i.selyuzhenkov
/analysis/PWGDIL/dielectron/pi0eta/ @c.pauly
/analysis/PWGDIL/dielectron/papaframework/ @praisig @a_meye37_AT_uni-muenster.de
/analysis/PWGDIL/dielectron/papaframework/ @a_meye37_AT_uni-muenster.de
/analysis/PWGDIL/dielectron/lmvm/ @i.selyuzhenkov
/analysis/PWGDIL/dielectron/conversion/ @c.pauly
/analysis/PWGDIL/dimuon/ @i.selyuzhenkov
......@@ -50,12 +50,12 @@
## Detectors
# TRD
/core/data/trd/ @praisig
/core/data/test/trd/ @praisig
/core/detectors/trd/ @praisig
/macro/trd/ @praisig
/sim/detectors/trd/ @praisig
/reco/detectors/trd/ @praisig
/core/data/trd/ @a.bercuci @p.kaehler
/core/data/test/trd/ @a.bercuci @p.kaehler
/core/detectors/trd/ @a.bercuci @p.kaehler
/macro/trd/ @a.bercuci @p.kaehler
/sim/detectors/trd/ @a.bercuci @p.kaehler
/reco/detectors/trd/ @a.bercuci @p.kaehler
# PSD
/analysis/detectors/psd/ @karpushkin_AT_inr.ru
......
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startMQMcbmPulserMonitor2020.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startMQMcbmPulserMonitor2020.sh)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startMQMcbmEvtBuilderWin2020.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startMQMcbmEvtBuilderWin2020.sh)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startMQBuildRawEvents.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startMQBuildRawEvents.sh)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startBuildRawEvents2021.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startBuildRawEvents2021.sh)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startBuildRawEventsCosmics2021.sh.in ${CMAKE_BINARY_DIR}/bin/MQ/topologies/startBuildRawEventsCosmics2021.sh)
set(INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}
......@@ -12,8 +14,14 @@ set(INCLUDE_DIRECTORIES
${CBMROOT_SOURCE_DIR}/fles/mcbm2018/commonMQ
${CBMROOT_SOURCE_DIR}/fles/flestools
${CBMROOT_SOURCE_DIR}/reco/eventbuilder/digis
${CBMROOT_SOURCE_DIR}/reco/base/
${CBMROOT_SOURCE_DIR}/reco/detectors/psd/unpack
${CBMROOT_SOURCE_DIR}/reco/detectors/sts/unpack
${CBMROOT_SOURCE_DIR}/reco/detectors/tof/unpack
${CBMROOT_SOURCE_DIR}/reco/detectors/trd/unpack
${CBMROOT_SOURCE_DIR}/reco/detectors/trd/rawToDigiMethods
${CBMROOT_SOURCE_DIR}/reco/detectors/rich/unpack
${CBMDATA_DIR}
${CBMDATA_DIR}/global
${CBMDATA_DIR}/raw
${CBMDATA_DIR}/sts
${CBMDATA_DIR}/much
......@@ -22,9 +30,16 @@ set(INCLUDE_DIRECTORIES
${CBMDATA_DIR}/psd
${CBMDATA_DIR}/trd
${CBMDATA_DIR}/mvd # Feint to avoid crash of DigiManager due to missing source pointer
${CBMDATA_DIR}/base
${CBMDATA_DIR}/global
${CBMBASE_DIR}
${CBMROOT_SOURCE_DIR}/sim/transport/steer # For CbmSetup.h!
${CBMROOT_SOURCE_DIR}/sim/transport/geosetup # For CbmGeoSetupDbProvider.h, needed by CbmSetup
${CBMDETECTORBASE_DIR}/sts # required for parameter handling of the sts
${CBMDETECTORBASE_DIR}/trd # required for parameter handling of the trd
${CBMDETECTORBASE_DIR}/tof # required for parameter handling of the tof
${CBMDETECTORBASE_DIR}/rich # required for parameter handling of the rich
${CBMDETECTORBASE_DIR}/psd # required for fitting tools of the psd
)
......@@ -191,3 +206,81 @@ set(DEPENDENCIES
#GENERATE_LIBRARY()
GENERATE_EXECUTABLE()
set(EXE_NAME MqUnpack)
set(SRCS CbmDeviceUnpack.cxx runUnpack.cxx)
set(DEPENDENCIES
${DEPENDENCIES}
${FAIR_LIBS}
ParBase
${BOOST_LIBS}
fles_ipc
CbmFlibFlesTools
CbmBase
CbmRecoBase
CbmPsdReco
CbmRichReco
CbmRecoSts
CbmTofReco
CbmTrdReco
CbmData
CbmSimSteer # for CbmSetup!
Core
RIO
Net
Hist
RHTTP
)
GENERATE_EXECUTABLE()
set(EXE_NAME BuildDigiEvents)
set(SRCS CbmDeviceBuildDigiEvents.cxx runBuildDigiEvents.cxx)
set(DEPENDENCIES
${DEPENDENCIES}
${FAIR_LIBS}
${BOOST_LIBS}
CbmFlibFlesTools
CbmEventBuilder
KF
L1
CbmBase
CbmRecoBase
CbmData
CbmTofBase
Core
RIO
Net
Hist
RHTTP
)
GENERATE_EXECUTABLE()
#set(INCLUDE_DIRECTORIES
# ${CBMDATA_DIR}/base
# $INCLUDE_DIRECTORIES
# )
set(EXE_NAME DigiEventSink)
set(SRCS CbmDeviceDigiEventSink.cxx runDigiEventSink.cxx)
set(DEPENDENCIES
${DEPENDENCIES}
${FAIR_LIBS}
${BOOST_LIBS}
fles_ipc
CbmFlibMcbm2018
CbmFlibFlesTools
CbmBase
CbmData
Core
RIO
Tree
Net
Hist
RHTTP
)
#GENERATE_LIBRARY()
GENERATE_EXECUTABLE()
This diff is collapsed.
/* Copyright (C) 2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau[committer] */
/**
* CbmDeviceBuildRawEvents.h
*
* @since 2021-11-18
* @author P.-A. Loizeau
*/
#ifndef CBMDEVICEBUILDDIGIEVENTS_H_
#define CBMDEVICEBUILDDIGIEVENTS_H_
/// CBM headers
#include "CbmAlgoBuildRawEvents.h"
#include "CbmMuchDigi.h"
#include "CbmPsdDigi.h"
#include "CbmRichDigi.h"
#include "CbmStsDigi.h"
#include "CbmTofDigi.h"
#include "CbmTrdDigi.h"
/// FAIRROOT headers
#include "FairMQDevice.h"
/// FAIRSOFT headers (geant, boost, ...)
#include "Rtypes.h"
#include "TObjArray.h"
/// C/C++ headers
#include <chrono>
#include <map>
#include <vector>
class TList;
class TClonesArray;
class FairRunOnline;
class CbmTsEventHeader;
class CbmDeviceBuildDigiEvents : public FairMQDevice {
public:
CbmDeviceBuildDigiEvents();
virtual ~CbmDeviceBuildDigiEvents();
protected:
virtual void InitTask();
bool HandleData(FairMQParts&, int);
bool HandleCommand(FairMQMessagePtr&, int);
private:
/// Constants
/// Control flags
Bool_t fbIgnoreTsOverlap = kFALSE; //! Ignore data in Overlap part of the TS
Bool_t fbFillHistos = kTRUE; //! Switch ON/OFF filling of histograms
/// User settings parameters
/// Algo enum settings
std::string fsEvtOverMode = "NoOverlap";
std::string fsRefDet = "kT0";
std::vector<std::string> fvsAddDet = {};
std::vector<std::string> fvsDelDet = {};
std::vector<std::string> fvsSetTrigWin = {};
std::vector<std::string> fvsSetTrigMinNb = {};
/// message queues
std::string fsChannelNameDataInput = "unpts_0";
std::string fsChannelNameDataOutput = "events";
std::string fsChannelNameCommands = "commands";
std::string fsChannelNameHistosInput = "histogram-in";
/// Histograms management
uint32_t fuPublishFreqTs = 100;
double_t fdMinPublishTime = 0.5;
double_t fdMaxPublishTime = 5.0;
/// List of MQ channels names
std::vector<std::string> fsAllowedChannels = {fsChannelNameDataInput};
/// Statistics & first TS rejection
uint64_t fulNumMessages = 0;
uint64_t fulTsCounter = 0;
std::chrono::system_clock::time_point fLastPublishTime = std::chrono::system_clock::now();
/// Processing algos
CbmAlgoBuildRawEvents* fpAlgo = nullptr;
/// TS MetaData stable values storage
size_t fuNbCoreMsPerTs = 0; //!
size_t fuNbOverMsPerTs = 0; //!
Double_t fdMsSizeInNs = 1280000; //! Size of a single MS, [nanoseconds]
Double_t fdTsCoreSizeInNs = -1.0; //! Total size of the core MS in a TS, [nanoseconds]
Double_t fdTsOverSizeInNs = -1.0; //! Total size of the overlap MS in a TS, [nanoseconds]
Double_t fdTsFullSizeInNs = -1.0; //! Total size of all MS in a TS, [nanoseconds]
/// Data reception
/// TS information in header
CbmTsEventHeader* fCbmTsEventHeader = nullptr;
/// Digis storage
std::vector<CbmTofDigi>* fvDigiT0 = nullptr;
std::vector<CbmStsDigi>* fvDigiSts = nullptr;
std::vector<CbmMuchDigi>* fvDigiMuch = nullptr;
std::vector<CbmTrdDigi>* fvDigiTrd = nullptr;
std::vector<CbmTofDigi>* fvDigiTof = nullptr;
std::vector<CbmRichDigi>* fvDigiRich = nullptr;
std::vector<CbmPsdDigi>* fvDigiPsd = nullptr;
/// TS MetaData storage
TClonesArray* fTimeSliceMetaDataArray = nullptr; //!
TimesliceMetaData* fTsMetaData = nullptr;
/// Array of histograms to send to the histogram server
TObjArray fArrayHisto = {};
/// Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server
std::vector<std::pair<std::string, std::string>> fvpsHistosFolder = {};
/// Vector of string pairs with ( CanvasName, CanvasConfig ) to send to the histogram server
/// Format of Can config is "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)"
std::vector<std::pair<std::string, std::string>> fvpsCanvasConfig = {};
/// Flag indicating whether the histograms and canvases configurations were already published
bool fbConfigSent = false;
bool IsChannelNameAllowed(std::string channelName);
bool InitHistograms();
void Finish();
bool SendEvents(FairMQParts& partsIn);
bool SendHistoConfAndData();
bool SendHistograms();
};
#endif /* CBMDEVICEBUILDDIGIEVENTS_H_ */
This diff is collapsed.
/* Copyright (C) 2020-2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau [committer] */
/**
* CbmDeviceDigiEventSink.h
*
* @since 2020-05-04
* @author P.-A. Loizeau
*/
#ifndef CBMDEVICEDIGIEVTSINK_H_
#define CBMDEVICEDIGIEVTSINK_H_
/// CBM headers
#include "CbmDigiEvent.h"
#include "CbmEvent.h"
#include "CbmMqTMessage.h"
#include "CbmMuchDigi.h"
#include "CbmPsdDigi.h"
#include "CbmRichDigi.h"
#include "CbmStsDigi.h"
#include "CbmTofDigi.h"
#include "CbmTrdDigi.h"
#include "CbmTsEventHeader.h"
#include "TimesliceMetaData.h"
/// FAIRROOT headers
#include "FairMQDevice.h"
/// FAIRSOFT headers (geant, boost, ...)
#include "Rtypes.h"
#include "TClonesArray.h"
#include "TObjArray.h"
/// C/C++ headers
#include <chrono>
#include <map>
#include <vector>
class TFile;
class TList;
class TClonesArray;
//class TimesliceMetaData;
class FairRunOnline;
class FairRootManager;
class CbmEventTimeslice {
/// TODO: rename to CbmTsWithEvents
public:
CbmEventTimeslice(FairMQParts& parts);
~CbmEventTimeslice();
std::vector<CbmDigiEvent> GetSelectedData();
/// TS information in header
CbmTsEventHeader fCbmTsEventHeader;
std::vector<CbmTofDigi> fvDigiT0;
std::vector<CbmStsDigi> fvDigiSts;
std::vector<CbmMuchDigi> fvDigiMuch;
std::vector<CbmTrdDigi> fvDigiTrd;
std::vector<CbmTofDigi> fvDigiTof;
std::vector<CbmRichDigi> fvDigiRich;
std::vector<CbmPsdDigi> fvDigiPsd;
TimesliceMetaData fTsMetaData;
std::vector<CbmEvent> fvEvents;
};
class CbmDeviceDigiEventSink : public FairMQDevice {
public:
CbmDeviceDigiEventSink();
virtual ~CbmDeviceDigiEventSink();
protected:
virtual void InitTask();
bool HandleMissTsData(FairMQMessagePtr&, int);
bool HandleData(FairMQParts&, int);
bool HandleCommand(FairMQMessagePtr&, int);
private:
/// Constants
/// Control flags
Bool_t fbStoreFullTs = false; //! If true, store digis vectors with full TS in addition to selected events
Bool_t fbFillHistos = false; //! Switch ON/OFF filling of histograms
Bool_t fbFinishDone = false; //! Keep track of whether the Finish was already called
/// User settings parameters
/// Algo enum settings
std::string fsOutputFileName = "mcbm_digis_events.root";
/// message queues
std::string fsChannelNameMissedTs = "missedts";
std::string fsChannelNameDataInput = "events";
std::string fsChannelNameCommands = "commands";
std::string fsChannelNameHistosInput = "histogram-in";
/// Histograms management
uint32_t fuPublishFreqTs = 100;
double_t fdMinPublishTime = 0.5;
double_t fdMaxPublishTime = 5.0;
/// List of MQ channels names
std::vector<std::string> fsAllowedChannels = {fsChannelNameDataInput};
/// Parameters management
// TList* fParCList = nullptr;
// Bool_t InitParameters( TList* fParCList );
/// Statistics & missed TS detection
uint64_t fuPrevTsIndex = 0;
uint64_t fulNumMessages = 0;
uint64_t fulTsCounter = 0;
uint64_t fulMissedTsCounter = 0;
std::chrono::system_clock::time_point fLastPublishTime = std::chrono::system_clock::now();
/// Control Commands reception
bool fbReceivedEof = false;
uint64_t fuLastTsIndex = 0;
uint64_t fuTotalTsCount = 0;
/// Data reception
/// Event (TS) header
CbmTsEventHeader* fEvtHeader = nullptr;
/// TS MetaData storage
TClonesArray* fTimeSliceMetaDataArray = nullptr; //!
TimesliceMetaData* fTsMetaData = nullptr;
/// CbmEvents
std::vector<CbmDigiEvent>* fEventsSel = nullptr; //! output container of CbmEvents
/// Full TS Digis storage (optional usage, controlled by fbStoreFullTs!)
std::vector<CbmTofDigi>* fvDigiT0 = nullptr;
std::vector<CbmStsDigi>* fvDigiSts = nullptr;
std::vector<CbmMuchDigi>* fvDigiMuch = nullptr;
std::vector<CbmTrdDigi>* fvDigiTrd = nullptr;
std::vector<CbmTofDigi>* fvDigiTof = nullptr;
std::vector<CbmRichDigi>* fvDigiRich = nullptr;
std::vector<CbmPsdDigi>* fvDigiPsd = nullptr;
/// Storage for re-ordering
/// Missed TS vector
std::vector<uint64_t> fvulMissedTsIndices = {};
/// Buffered TS
std::map<uint64_t, CbmEventTimeslice> fmFullTsStorage = {};
/// Data storage
FairRunOnline* fpRun = nullptr;
FairRootManager* fpFairRootMgr = nullptr;
/// Array of histograms to send to the histogram server
TObjArray fArrayHisto = {};
/// Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server
std::vector<std::pair<std::string, std::string>> fvpsHistosFolder = {};
/// Vector of string pairs with ( CanvasName, CanvasConfig ) to send to the histogram server
/// Format of Can config is "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)"
std::vector<std::pair<std::string, std::string>> fvpsCanvasConfig = {};
/// Flag indicating whether the histograms and canvases configurations were already published
bool fbConfigSent = false;
/// Internal methods
bool IsChannelNameAllowed(std::string channelName);
bool InitHistograms();
void CheckTsQueues();
void PrepareTreeEntry(CbmEventTimeslice unpTs);
void DumpTreeEntry();
bool SendHistoConfAndData();
bool SendHistograms();
void Finish();
};
#endif /* CBMDEVICEDIGIEVTSINK_H_ */
......@@ -475,32 +475,32 @@ Bool_t CbmDeviceMcbmUnpack::DoUnpack(const fles::Timeslice& ts, size_t /*compone
if (kFALSE == fUnpAlgoSts->ProcessTs(ts)) {
LOG(error) << "Failed processing TS " << ts.index() << " in STS unpacker algorithm class";
return kTRUE;
return kFALSE;
} // if( kFALSE == fUnpAlgoSts->ProcessTs( ts ) )
if (kFALSE == fUnpAlgoMuch->ProcessTs(ts)) {
LOG(error) << "Failed processing TS " << ts.index() << " in MUCH unpacker algorithm class";
return kTRUE;
return kFALSE;
} // if( kFALSE == fUnpAlgoMuch->ProcessTs( ts ) )
if (kFALSE == fUnpAlgoTrd->ProcessTs(ts)) {
LOG(error) << "Failed processing TS " << ts.index() << " in TRD unpacker algorithm class";
return kTRUE;
return kFALSE;
} // if( kFALSE == fUnpAlgoTrd->ProcessTs( ts ) )
if (kFALSE == fUnpAlgoTof->ProcessTs(ts)) {
LOG(error) << "Failed processing TS " << ts.index() << " in TOF unpacker algorithm class";
return kTRUE;
return kFALSE;
} // if( kFALSE == fUnpAlgoTof->ProcessTs( ts ) )
if (kFALSE == fUnpAlgoRich->ProcessTs(ts)) {
LOG(error) << "Failed processing TS " << ts.index() << " in RICH unpacker algorithm class";
return kTRUE;
return kFALSE;
} // if( kFALSE == fUnpAlgoRich->ProcessTs( ts ) )
if (kFALSE == fUnpAlgoPsd->ProcessTs(ts)) {
LOG(error) << "Failed processing TS " << ts.index() << " in PSD unpacker algorithm class";
return kTRUE;
return kFALSE;
} // if( kFALSE == fUnpAlgoPsd->ProcessTs( ts ) )
......
This diff is collapsed.
/* Copyright (C) 2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau [committer] */
/**
* CbmDeviceUnpack.h
*
* @since 2020-05-04
* @author P.-A. Loizeau
*/
#ifndef CBMDEVICEUNPACK_H_
#define CBMDEVICEUNPACK_H_
#include "CbmMqTMessage.h"
#include "CbmTsEventHeader.h"
#include "Timeslice.hpp"
#include "FairMQDevice.h"
#include "FairParGenericSet.h"
#include "Rtypes.h"
#include "TObjArray.h"
#include <chrono>
#include <map>
#include <vector>
class TList;
class CbmPsdUnpackConfig;
class CbmRichUnpackConfig;
class CbmStsUnpackConfig;
class CbmTofUnpackConfig;
class CbmTrdUnpackConfigFasp2D;
class CbmTrdUnpackConfig;
class TimesliceMetaData;
class CbmTrdSpadic;
class CbmDeviceUnpack : public FairMQDevice {
public:
CbmDeviceUnpack();
virtual ~CbmDeviceUnpack();
protected:
virtual void InitTask();
bool ConditionalRun();
bool HandleCommand(FairMQMessagePtr&, int);
/** @brief Set the Sts Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmStsUnpackConfig> config) { fStsConfig = config; }
// /** @brief Set the Tof Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmTofUnpackConfig> config) { fTofConfig = config; }
/** @brief Set the Trd Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmTrdUnpackConfig> config) { fTrd1DConfig = config; }
/** @brief Set the Trd2D Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmTrdUnpackConfigFasp2D> config) { fTrd2DConfig = config; }
/** @brief Set the Rich Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmRichUnpackConfig> config) { fRichConfig = config; }
/** @brief Set the Psd Unpack Config @param config */
void SetUnpackConfig(std::shared_ptr<CbmPsdUnpackConfig> config) { fPsdConfig = config; }
private:
/// Constants
static const uint16_t kusSysIdSts = 0x10;
static const uint16_t kusSysIdMuch = 0x50;
static const uint16_t kusSysIdTrd = 0x40;
static const uint16_t kusSysIdTof = 0x60;
static const uint16_t kusSysIdT0 = 0x90;
static const uint16_t kusSysIdRich = 0x30;
static const uint16_t kusSysIdPsd = 0x80;
static constexpr std::uint16_t fkFlesMvd = static_cast<std::uint16_t>(fles::SubsystemIdentifier::MVD);
static constexpr std::uint16_t fkFlesSts = static_cast<std::uint16_t>(fles::SubsystemIdentifier::STS);
static constexpr std::uint16_t fkFlesMuch = static_cast<std::uint16_t>(fles::SubsystemIdentifier::MUCH);
static constexpr std::uint16_t fkFlesTrd = static_cast<std::uint16_t>(fles::SubsystemIdentifier::TRD);
static constexpr std::uint16_t fkFlesTrd2D = static_cast<std::uint16_t>(fles::SubsystemIdentifier::TRD2D);
static constexpr std::uint16_t fkFlesTof = static_cast<std::uint16_t>(fles::SubsystemIdentifier::RPC);
static constexpr std::uint16_t fkFlesRich = static_cast<std::uint16_t>(fles::SubsystemIdentifier::RICH);
static constexpr std::uint16_t fkFlesPsd = static_cast<std::uint16_t>(fles::SubsystemIdentifier::PSD);
/// Control flags
Bool_t fbIgnoreOverlapMs = false; //! Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice
Bool_t fbComponentsAddedToList = kFALSE;
/** @brief Flag if extended debug output is to be printed or not*/
bool fDoDebugPrints = false; //!
/** @brief Flag if performance profiling should be activated or not.*/
bool fDoPerfProf = false; //!
/** @brief Flag to Enable/disable a full time sorting. If off, time sorting happens per link/FLIM source */
bool fbOutputFullTimeSorting = false;
/// User settings parameters
std::string fsSetupName = "mcbm_beam_2021_07_surveyed";
uint32_t fuRunId = 1588;
/// message queues
std::string fsChannelNameDataInput = "ts-request";
std::string fsChannelNameDataOutput = "unpts_0";
std::string fsChannelNameCommands = "commands";
std::string fsChannelNameHistosInput = "histogram-in";
/// Histograms management
uint32_t fuPublishFreqTs = 100;
double_t fdMinPublishTime = 0.5;
double_t fdMaxPublishTime = 5.0;
/// Parameters management
// TList* fParCList = nullptr;
Bool_t InitParameters(std::vector<std::pair<std::string, std::shared_ptr<FairParGenericSet>>>* reqparvec);
/// Statistics & first TS rejection
uint64_t fulNumMessages = 0;
uint64_t fulTsCounter = 0;
std::chrono::system_clock::time_point fLastPublishTime = std::chrono::system_clock::now();
/** @brief Map to store a name for the unpackers and the processed amount of digis, key = fkFlesId*/
std::map<std::uint16_t, std::pair<std::string, size_t>> fNameMap = {}; //!
/** @brief Map to store the cpu and wall time, key = fkFlesId*/
std::map<std::uint16_t, std::pair<double, double>> fTimeMap = {}; //!
/** @brief Map to store the in and out data amount, key = fkFlesId*/
std::map<std::uint16_t, std::pair<double, double>> fDataSizeMap = {}; //!
/// Configuration of the unpackers. Provides the configured algorithm
std::shared_ptr<CbmStsUnpackConfig> fStsConfig = nullptr;
std::shared_ptr<CbmTrdUnpackConfigFasp2D> fTrd2DConfig = nullptr;
std::shared_ptr<CbmTrdUnpackConfig> fTrd1DConfig = nullptr;
std::shared_ptr<CbmTofUnpackConfig> fTofConfig = nullptr;
std::shared_ptr<CbmRichUnpackConfig> fRichConfig = nullptr;
std::shared_ptr<CbmPsdUnpackConfig> fPsdConfig = nullptr;
/// Pointer to the Timeslice header conatining start time and index
CbmTsEventHeader* fCbmTsEventHeader = nullptr;
/// Time offsets
std::vector<std::string> fvsSetTimeOffs = {};
/// TS MetaData storage: stable so should be moved somehow to parameters handling (not transmitted with each TS
size_t fuNbCoreMsPerTs = 0; //!
size_t fuNbOverMsPerTs = 0; //!
Double_t fdMsSizeInNs = 0; //! Size of a single MS, [nanoseconds]
Double_t fdTsCoreSizeInNs = -1.0; //! Total size of the core MS in a TS, [nanoseconds]
Double_t fdTsOverSizeInNs = -1.0; //! Total size of the overlap MS in a TS, [nanoseconds]
Double_t fdTsFullSizeInNs = -1.0; //! Total size of all MS in a TS, [nanoseconds]
TimesliceMetaData* fTsMetaData;
/// Array of histograms to send to the histogram server
TObjArray fArrayHisto = {};
/// Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server
std::vector<std::pair<std::string, std::string>> fvpsHistosFolder = {};
/// Vector of string pairs with ( CanvasName, CanvasConfig ) to send to the histogram server
/// Format of Can config is "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)"
std::vector<std::pair<std::string, std::string>> fvpsCanvasConfig = {};
/// Flag indicating whether the histograms and canvases configurations were already published
bool fbConfigSent = false;
Bool_t InitContainers();
bool InitHistograms();
Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
void Finish();
bool SendUnpData();
bool SendHistoConfAndData();
bool SendHistograms();
std::shared_ptr<CbmTrdSpadic> GetTrdSpadic(bool useAvgBaseline);
/** @brief Sort a vector timewise vector type has to provide GetTime() */
template<typename TVecobj>
typename std::enable_if<std::is_same<TVecobj, std::nullptr_t>::value == true, void>::type
timesort(std::vector<TVecobj>* /*vec = nullptr*/)
{
LOG(debug) << "CbmDeviceUnpack::timesort() got an object that has no member function GetTime(). Hence, we can and "
"will not timesort it!";
}
template<typename TVecobj>
typename std::enable_if<!std::is_member_function_pointer<decltype(&TVecobj::GetTime)>::value, void>::type
timesort(std::vector<TVecobj>* /*vec = nullptr*/)
{
LOG(debug) << "CbmDeviceUnpack::timesort() " << TVecobj::Class_Name()
<< "is an object that has no member function GetTime(). Hence, we can and "
"will not timesort it!";
}
template<typename TVecobj>
typename std::enable_if<std::is_member_function_pointer<decltype(&TVecobj::GetTime)>::value, void>::type
timesort(std::vector<TVecobj>* vec = nullptr)
{
if (vec == nullptr) return;
std::sort(vec->begin(), vec->end(),
[](const TVecobj& a, const TVecobj& b) -> bool { return a.GetTime() < b.GetTime(); });
}
/**
* @brief Template for the unpacking call of a given algorithm.
*
* @tparam TAlgo Algorithm to be called
* @tparam TOutput Output element types
* @tparam TOptoutputs Optional output element types
* @param ts Timeslice
* @param icomp Component number
* @param algo Algorithm to be used for this component
* @param outtargetvec Target vector for the output elements
* @param optoutputvecs Target vectors for optional outputs
* @return std::pair<ndigis, std::pair<cputime, walltime>>
*/
template<class TConfig, class TOptOutA = std::nullptr_t, class TOptOutB = std::nullptr_t>
size_t unpack(const std::uint16_t subsysid, const fles::Timeslice* ts, std::uint16_t icomp, TConfig config,
std::vector<TOptOutA>* optouttargetvecA = nullptr, std::vector<TOptOutB>* optouttargetvecB = nullptr)
{
auto wallstarttime = std::chrono::high_resolution_clock::now();
std::clock_t cpustarttime = std::clock();
auto algo = config->GetUnpacker();
std::vector<TOptOutA> optoutAvec = {};
std::vector<TOptOutB> optoutBvec = {};
if (optouttargetvecA) { algo->SetOptOutAVec(&optoutAvec); }
if (optouttargetvecB) { algo->SetOptOutBVec(&optoutBvec); }
// Set the start time of the current TS for this algorithm
algo->SetTsStartTime(ts->start_time());
// Run the actual unpacking
auto digivec = algo->Unpack(ts, icomp);
// Check if we want to write the output to somewhere (in pure online monitoring mode for example this can/would/should be skipped)
if (config->GetOutputVec()) {
// Lets do some time-sorting if we are not doing it later
if (!fbOutputFullTimeSorting) timesort(&digivec);
// Transfer the data from the timeslice vector to the target branch vector
// Digis/default output retrieved as offered by the algorithm
for (auto digi : digivec)
config->GetOutputVec()->emplace_back(digi);
}
if (optouttargetvecA) {
// Lets do some timesorting
if (!fbOutputFullTimeSorting) timesort(&optoutAvec);
// Transfer the data from the timeslice vector to the target branch vector
for (auto optoutA : optoutAvec)
optouttargetvecA->emplace_back(optoutA);
}
if (optouttargetvecB) {
// Second opt output is not time sorted to allow non GetTime data container.
// Lets do some timesorting
timesort(&optoutAvec);
// Transfer the data from the timeslice vector to the target branch vector
for (auto optoutB : optoutBvec)
optouttargetvecB->emplace_back(optoutB);
}
std::clock_t cpuendtime = std::clock();
auto wallendtime = std::chrono::high_resolution_clock::now();
// Cpu time in [µs]
auto cputime = 1e6 * (cpuendtime - cpustarttime) / CLOCKS_PER_SEC;
algo->AddCpuTime(cputime);
// Real time in [µs]
auto walltime = std::chrono::duration<double, std::micro>(wallendtime - wallstarttime).count();
algo->AddWallTime(walltime);
// Check some numbers from this timeslice
size_t nDigis = digivec.size();
LOG(debug) << "Component " << icomp << " connected to config " << config->GetName() << " n-Digis " << nDigis
<< " processed in walltime(cputime) = " << walltime << "(" << cputime << cputime << ") µs"
<< "this timeslice.";
if (fDoPerfProf) {
auto timeit = fTimeMap.find(subsysid);
timeit->second.first += cputime;
timeit->second.second += walltime;
auto datait = fDataSizeMap.find(subsysid);
datait->second.first += ts->size_component(icomp) / 1.0e6;
datait->second.second += nDigis * algo->GetOutputObjSize() / 1.0e6;
fNameMap.find(subsysid)->second.second += nDigis;
}
return nDigis;
}
};
#endif /* CBMDEVICEMCBMUNPACK_H_ */
Low priority
- Pub-Sub Queue from Sink to intermediate devices (unpackers, Event builders, ?calibrators?, ...) to signal that last TS was received and dumped and Transition
`Active -> Ready -> Stop -> End` can be done (e.g. through a Finish method)
- Empty/custom TsEventHeader and event vector when dumping missing TS in Sink (vector maybe already OK)
/* Copyright (C) 2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Dominik Smith [committer] */
#include "CbmDeviceBuildDigiEvents.h"
#include <iomanip>
#include <string>
#include "runFairMQDevice.h"
namespace bpo = boost::program_options;
using namespace std;
void addCustomOptions(bpo::options_description& options)
{
options.add_options()("FillHistos", bpo::value<bool>()->default_value(true),
"Fill histograms and send them to histo server if true");
options.add_options()("IgnTsOver", bpo::value<bool>()->default_value(false), "Ignore TS overlap if true");
options.add_options()("EvtOverMode", bpo::value<std::string>()->default_value("NoOverlap"),
"Set the event overlap mode, use string matching an EOverlapMode ");
options.add_options()("RefDet", bpo::value<std::string>()->default_value("kT0"),
"Set the reference (seed) detector, use string matching an ECbmModuleId ");
options.add_options()("AddDet", bpo::value<std::vector<std::string>>()->multitoken()->composing(),
"Add a detector for digis selection, use string matching an ECbmModuleId ");
options.add_options()("DelDet", bpo::value<std::vector<std::string>>()->multitoken()->composing(),
"Remove a detector for digis selection, use string matching an "
"ECbmModuleId ");
options.add_options()("SetTrigWin", bpo::value<std::vector<std::string>>()->multitoken()->composing(),
"Set trigger window for selected detector, use string matching "
"ECbmModuleId,dWinBeg,dWinEnd e.g. kSts,-10.5,100.0");
options.add_options()("SetTrigMinNb", bpo::value<std::vector<std::string>>()->multitoken()->composing(),
"Set minimum number of digis for selected detector, use string matching "
"ECbmModuleId,uMinNb e.g. kTof,10");
options.add_options()("TsNameIn", bpo::value<std::string>()->default_value("unpts_0"),
"MQ channel name for unpacked TS data");
options.add_options()("EvtNameOut", bpo::value<std::string>()->default_value("events"),
"MQ channel name for built events");
options.add_options()("ChNameIn", bpo::value<std::string>()->default_value("histogram-in"),
"MQ channel name for histos");
options.add_options()("ChNameHistCfg", bpo::value<std::string>()->default_value("histo-conf"),
"MQ channel name for histos config");
options.add_options()("ChNameCanvCfg", bpo::value<std::string>()->default_value("canvas-conf"),
"MQ channel name for canvases config");
options.add_options()("PubFreqTs", bpo::value<uint32_t>()->default_value(100), "Histo publishing frequency in TS");
options.add_options()("PubTimeMin", bpo::value<double_t>()->default_value(1.0),
"Minimal time between two publishing");
options.add_options()("PubTimeMax", bpo::value<double_t>()->default_value(10.0),
"Maximal time between two publishing");
}
FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceBuildDigiEvents(); }
/* Copyright (C) 2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau [committer] */
#include "CbmDeviceDigiEventSink.h"
#include <iomanip>
#include <string>
#include "runFairMQDevice.h"
namespace bpo = boost::program_options;
using namespace std;
void addCustomOptions(bpo::options_description& options)
{
options.add_options()("StoreFullTs", bpo::value<bool>()->default_value(false),
"Store digis vectors with full TS in addition to selected events if true");
options.add_options()("OutFileName", bpo::value<std::string>()->default_value("mcbm_digis_events.root"),
"Name (full or relative path) of the output .root file ");
options.add_options()("EvtNameIn", bpo::value<std::string>()->default_value("events"),
"MQ channel name for built events");
options.add_options()("FillHistos", bpo::value<bool>()->default_value(false),
"Fill histograms and send them to histo server if true");
options.add_options()("PubFreqTs", bpo::value<uint32_t>()->default_value(100), "Histo publishing frequency in TS");
options.add_options()("PubTimeMin", bpo::value<double_t>()->default_value(1.0),
"Minimal time between two publishing");
options.add_options()("PubTimeMax", bpo::value<double_t>()->default_value(10.0),
"Maximal time between two publishing");
options.add_options()("ChNameIn", bpo::value<std::string>()->default_value("histogram-in"),
"MQ channel name for histos");
}
FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceDigiEventSink(); }
/* Copyright (C) 2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau [committer] */
#include "CbmDeviceUnpack.h"
#include <iomanip>
#include <string>
#include "runFairMQDevice.h"
namespace bpo = boost::program_options;
using namespace std;
void addCustomOptions(bpo::options_description& options)
{
options.add_options()("Setup", bpo::value<std::string>()->default_value("mcbm_beam_2021_07_surveyed"),
"Name/tag of the geomatry setup");
options.add_options()("RunId", bpo::value<uint32_t>()->default_value(1588), "Run ID");
options.add_options()("IgnOverMs", bpo::value<bool>()->default_value(true), "Ignore overlap MS if true");
options.add_options()("FullTimeSort", bpo::value<bool>()->default_value(true),
"Full time sorting per detector before sending output array");
options.add_options()("SetTimeOffs", bpo::value<std::vector<std::string>>()->multitoken()->composing(),
"Set time offset in ns for selected detector, use string matching "
"ECbmModuleId,dOffs e.g. kTof,-35.2");
options.add_options()("TsNameIn", bpo::value<std::string>()->default_value("ts-request"),
"MQ channel name for raw TS data");
options.add_options()("TsNameOut", bpo::value<std::string>()->default_value("unpts_0"),
"MQ channel name for unpacked TS data");
options.add_options()("PubFreqTs", bpo::value<uint32_t>()->default_value(0), "Histo publishing frequency in TS");
options.add_options()("PubTimeMin", bpo::value<double_t>()->default_value(1.0),
"Minimal time between two publishing");
options.add_options()("PubTimeMax", bpo::value<double_t>()->default_value(10.0),
"Maximal time between two publishing");
options.add_options()("ChNameIn", bpo::value<std::string>()->default_value("histogram-in"),
"MQ channel name for histos");
}
FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new CbmDeviceUnpack(); }
#!/bin/bash
$SIMPATH/bin/fairmq-shmmonitor --cleanup
if [ $# -ge 1 ]; then
_nbmoni=$1
((_pubfreqts = $_nbmoni*100 ))
_pubminsec=1.0
_pubmaxsec=10.0
if [ $# -ge 4 ]; then
_filename=""
_dirname=""
_hostname=$4
if [ $# -ge 5 ]; then
_pubfreqts=$5
if [ $# -ge 6 ]; then
_pubminsec=$6
if [ $# -ge 7 ]; then
_pubmaxsec=$7
fi
fi
fi
elif [ $# -ge 2 ]; then
_filename=$2
_hostname=""
if [ $# -eq 3 ]; then
_dirname=$3
else
_dirname=""
fi
else
echo 'Starting connection to local stream'
echo ' for other usages, please supply at least a filename.'
echo 'Possible usages are:'
echo 'startMQMcbmPulserMonitor2020.sh'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> <full filename pattern list>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> <filename pattern> <folder_path>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s> <Max Hist pub. in s>'
_filename=""
_dirname=""
_hostname="localhost"
fi
else
echo 'Starting connection to local stream with 1 monitor process'
echo ' for other usages, please supply at least a filename.'
echo 'Possible usages are:'
echo 'startMQMcbmPulserMonitor2020.sh'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> <full filename pattern list>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> <filename pattern> <folder_path>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s> <Max Hist pub. in s>'
_filename=""
_dirname=""
_hostname="localhost"
_nbmoni=1
_pubfreqts=100
_pubminsec=1.0
_pubmaxsec=10.0
fi
_parfileSts=$VMCWORKDIR/macro/beamtime/mcbm2021/mStsPar.par
_parfileMuch=$VMCWORKDIR/macro/beamtime/mcbm2021/mMuchPar.par
_parfileTrdAsic=$VMCWORKDIR/parameters/trd/trd_v21b_mcbm.asic.par
_parfileTrdDigi=$VMCWORKDIR/parameters/trd/trd_v21b_mcbm.digi.par
_parfileTrdGas=$VMCWORKDIR/parameters/trd/trd_v21b_mcbm.gas.par
_parfileTrdGain=$VMCWORKDIR/parameters/trd/trd_v21b_mcbm.gain.par
_parfileTof=$VMCWORKDIR/macro/beamtime/mcbm2021/mTofCriPar.par
_parfileRich=$VMCWORKDIR/macro/beamtime/mcbm2021/mRichPar_70.par
_parfilePsd=$VMCWORKDIR/macro/beamtime/mcbm2021/mPsdPar.par
_setup_name=mcbm_beam_2021_07_surveyed
_run_id=1588
LOGFILETAG=`hostname`
LOGFILETAG+="_"
LOGFILETAG+=`date +%Y_%m_%d_%H_%M_%S`
LOGFILETAG+=".log"
(( _paraBuffSz=100 ))
(( _singBuffSz=_paraBuffSz*_nbmoni ))
echo "Buffer size for parallel devices $_paraBuffSz"
echo "Buffer size for singleton devices $_singBuffSz"
SAMPLER="RepReqTsSampler"
SAMPLER+=" --id sampler1"
#SAMPLER+=" --max-timeslices 0"
#SAMPLER+=" --max-timeslices 10"
#SAMPLER+=" --max-timeslices 100"
SAMPLER+=" --max-timeslices 300"
#SAMPLER+=" --max-timeslices 1000"
SAMPLER+=" --severity info"
#SAMPLER+=" --flib-port 10"
if [ "$_hostname" != "" ]; then
SAMPLER+=" --fles-host $_hostname"
elif [ "$_filename" != "" ]; then
SAMPLER+=" --filename $_filename"
if [ "$_dirname" != "" ]; then
SAMPLER+=" --dirname $_dirname"
fi
fi
SAMPLER+=" --high-water-mark 1000"
SAMPLER+=" --no-split-ts 1"
SAMPLER+=" --ChNameMissTs missedts"
SAMPLER+=" --ChNameCmds commands"
SAMPLER+=" --PubFreqTs $_pubfreqts"
SAMPLER+=" --PubTimeMin $_pubminsec"
SAMPLER+=" --PubTimeMax $_pubmaxsec"
SAMPLER+=" --channel-config name=ts-request,type=rep,method=bind,transport=zeromq,address=tcp://127.0.0.1:11555"
SAMPLER+=" --channel-config name=histogram-in,type=pub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11666"
SAMPLER+=" --channel-config name=missedts,type=pub,method=bind,address=tcp://127.0.0.1:11006"
SAMPLER+=" --channel-config name=commands,type=pub,method=bind,address=tcp://127.0.0.1:11007"
SAMPLER+=" --transport zeromq"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
SAMPLER_LOG="sampler1_$LOGFILETAG"
xterm -l -lf $SAMPLER_LOG -geometry 80x23+0+0 -hold -e ${VMCWORKDIR}/build/bin/MQ/source/$SAMPLER &
echo $SAMPLER
_iMoni=0
while (( _iMoni < _nbmoni )); do
(( _yOffset=200*_iMoni ))
(( _iMoni += 1 ))
(( _iPort = 11680 + _iMoni ))
UNPACKER="MqUnpack"
UNPACKER+=" --id unp$_iMoni"
UNPACKER+=" --severity info"
#UNPACKER+=" --severity debug"
UNPACKER+=" --Setup $_setup_name"
UNPACKER+=" --RunId $_run_id"
UNPACKER+=" --IgnOverMs 1"
UNPACKER+=" --SetTimeOffs kSTS,-2221"
UNPACKER+=" --SetTimeOffs kMUCH,-885"
UNPACKER+=" --SetTimeOffs kTRD,0"
UNPACKER+=" --SetTimeOffs kTRD2D,-1800"
UNPACKER+=" --SetTimeOffs kTOF,-1220"
UNPACKER+=" --SetTimeOffs kRICH,254800"
UNPACKER+=" --SetTimeOffs kPSD,0"
UNPACKER+=" --PubFreqTs $_pubfreqts"
UNPACKER+=" --PubTimeMin $_pubminsec"
UNPACKER+=" --PubTimeMax $_pubmaxsec"
UNPACKER+=" --TsNameOut unpts$_iMoni"
UNPACKER+=" --channel-config name=ts-request,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11555"
UNPACKER+=" --channel-config name=parameters,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11005,rateLogging=0"
UNPACKER+=" --channel-config name=unpts$_iMoni,type=push,method=bind,transport=zeromq,address=tcp://127.0.0.1:$_iPort"
# UNPACKER+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007"
UNPACKER+=" --channel-config name=histogram-in,type=pub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11666"
UNPACKER+=" --transport zeromq"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
UNPACKER_LOG="unp$_iMoni"
UNPACKER_LOG+="_$LOGFILETAG"
xterm -l -lf $UNPACKER_LOG -geometry 132x23+400+$_yOffset -hold -e ${VMCWORKDIR}/build/bin/MQ/mcbm/$UNPACKER &
EVTBUILDER="BuildDigiEvents"
EVTBUILDER+=" --id build$_iMoni"
EVTBUILDER+=" --severity info"
#EVTBUILDER+=" --severity debug"
EVTBUILDER+=" --PubFreqTs $_pubfreqts"
EVTBUILDER+=" --PubTimeMin $_pubminsec"
EVTBUILDER+=" --PubTimeMax $_pubmaxsec"
EVTBUILDER+=" --FillHistos true"
EVTBUILDER+=" --IgnTsOver false"
EVTBUILDER+=" --EvtOverMode AllowOverlap"
EVTBUILDER+=" --RefDet kTof"
EVTBUILDER+=" --DelDet kT0"
EVTBUILDER+=" --DelDet kMuch"
EVTBUILDER+=" --SetTrigWin kSts,-100,100"
EVTBUILDER+=" --SetTrigWin kTrd,-250,250"
EVTBUILDER+=" --SetTrigWin kTof,-150,150" # To get T0 Digis (seed + close-by digis) in the event
EVTBUILDER+=" --SetTrigWin kRich,-100,100"
EVTBUILDER+=" --SetTrigWin kPsd,-100,100"
EVTBUILDER+=" --SetTrigMinNb kSts,0"
EVTBUILDER+=" --SetTrigMinNb kTrd,0"
EVTBUILDER+=" --SetTrigMinNb kTof,6"
EVTBUILDER+=" --SetTrigMinNb kRich,0"
EVTBUILDER+=" --SetTrigMinNb kPsd,0"
EVTBUILDER+=" --TsNameIn unpts$_iMoni"
EVTBUILDER+=" --EvtNameOut events"
EVTBUILDER+=" --channel-config name=unpts$_iMoni,type=pull,method=connect,transport=zeromq,address=tcp://127.0.0.1:$_iPort"
EVTBUILDER+=" --channel-config name=events,type=push,method=connect,transport=zeromq,address=tcp://127.0.0.1:11556"
# EVTBUILDER+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007"
EVTBUILDER+=" --channel-config name=parameters,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11005,rateLogging=0"
EVTBUILDER+=" --channel-config name=histogram-in,type=pub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11666"
EVTBUILDER+=" --transport zeromq"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
EVTBUILDER_LOG="build$_iMoni"
EVTBUILDER_LOG+="_$LOGFILETAG"
xterm -l -lf $EVTBUILDER_LOG -geometry 80x23+800+$_yOffset -hold -e ${VMCWORKDIR}/build/bin/MQ/mcbm/$EVTBUILDER &
done
EVTSINK="DigiEventSink"
EVTSINK+=" --id evtsink1"
EVTSINK+=" --severity info"
#EVTSINK+=" --severity debug"
#EVTSINK+=" --StoreFullTs 1"
EVTSINK+=" --OutFileName mcbm_digis_events.root"
EVTSINK+=" --FillHistos false"
EVTSINK+=" --PubFreqTs $_pubfreqts"
EVTSINK+=" --PubTimeMin $_pubminsec"
EVTSINK+=" --PubTimeMax $_pubmaxsec"
EVTSINK+=" --EvtNameIn events"
EVTSINK+=" --channel-config name=events,type=pull,method=bind,transport=zeromq,address=tcp://127.0.0.1:11556"
EVTSINK+=" --channel-config name=missedts,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11006"
EVTSINK+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007"
EVTSINK+=" --channel-config name=histogram-in,type=sub,method=bind,transport=zeromq,address=tcp://127.0.0.1:11666"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
EVTSINK_LOG="evtsink1_$LOGFILETAG"
xterm -l -lf $EVTSINK_LOG -geometry 80x23+1200+0 -hold -e ${VMCWORKDIR}/build/bin/MQ/mcbm/$EVTSINK &
PARAMETERSERVER="parmq-server"
PARAMETERSERVER+=" --id parmq-server"
PARAMETERSERVER+=" --severity info"
PARAMETERSERVER+=" --channel-name parameters"
PARAMETERSERVER+=" --channel-config name=parameters,type=rep,method=bind,transport=zeromq,address=tcp://127.0.0.1:11005,rateLogging=0"
PARAMETERSERVER+=" --first-input-name $_parfileSts;$_parfileMuch;$_parfileTrdAsic;$_parfileTrdDigi;$_parfileTrdGas;$_parfileTrdGain;$_parfileTof;$_parfileRich;$_parfilePsd"
PARAMETERSERVER+=" --first-input-type ASCII"
PARAMETERSERVER+=" --libs-to-load=libCbmFlibMcbm2018" # doesn't work due to runtime problem
PARAMETERSERVER+=" --setup $_setup_name"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
PARAMSRV_LOG="parmq_$LOGFILETAG"
xterm -l -lf $PARAMSRV_LOG -geometry 80x23+1600+0 -hold -e ${VMCWORKDIR}/build/bin/MQ/parmq/$PARAMETERSERVER &
HISTSERVER="MqHistoServer"
HISTSERVER+=" --id server1"
HISTSERVER+=" --severity info"
HISTSERVER+=" --histport 8081"
HISTSERVER+=" --channel-config name=histogram-in,type=sub,method=bind,transport=zeromq,address=tcp://127.0.0.1:11666"
HISTSERVER+=" --channel-config name=histo-conf,type=sub,method=bind,transport=zeromq,address=tcp://127.0.0.1:11667,rateLogging=0"
HISTSERVER+=" --channel-config name=canvas-conf,type=sub,method=bind,transport=zeromq,address=tcp://127.0.0.1:11668,rateLogging=0"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
HISTSRV_LOG="server1_$LOGFILETAG"
xterm -l -lf $HISTSRV_LOG -geometry 80x23+2000+0 -hold -e ${VMCWORKDIR}/build/bin/MQ/histogramServer/$HISTSERVER &
#!/bin/bash
$SIMPATH/bin/fairmq-shmmonitor --cleanup
if [ $# -ge 1 ]; then
_nbmoni=$1
((_pubfreqts = $_nbmoni*100 ))
_pubminsec=1.0
_pubmaxsec=10.0
if [ $# -ge 4 ]; then
_filename=""
_dirname=""
_hostname=$4
if [ $# -ge 5 ]; then
_pubfreqts=$5
if [ $# -ge 6 ]; then
_pubminsec=$6
if [ $# -ge 7 ]; then
_pubmaxsec=$7
fi
fi
fi
elif [ $# -ge 2 ]; then
_filename=$2
_hostname=""
if [ $# -eq 3 ]; then
_dirname=$3
else
_dirname=""
fi
else
echo 'Starting connection to local stream'
echo ' for other usages, please supply at least a filename.'
echo 'Possible usages are:'
echo 'startMQMcbmPulserMonitor2020.sh'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> <full filename pattern list>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> <filename pattern> <folder_path>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s> <Max Hist pub. in s>'
_filename=""
_dirname=""
_hostname="localhost"
fi
else
echo 'Starting connection to local stream with 1 monitor process'
echo ' for other usages, please supply at least a filename.'
echo 'Possible usages are:'
echo 'startMQMcbmPulserMonitor2020.sh'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> <full filename pattern list>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> <filename pattern> <folder_path>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s>'
echo 'startMQMcbmPulserMonitor2020.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s> <Max Hist pub. in s>'
_filename=""
_dirname=""
_hostname="localhost"
_nbmoni=1
_pubfreqts=100
_pubminsec=1.0
_pubmaxsec=10.0
fi
_parfileSts=$VMCWORKDIR/macro/beamtime/mcbm2021/mStsPar.par
_parfileMuch=$VMCWORKDIR/macro/beamtime/mcbm2021/mMuchPar.par
_parfileTrdAsic=$VMCWORKDIR/macro/beamtime/mcbm2022/trd_v21b_mcbm.asic.par
_parfileTrdDigi=$VMCWORKDIR/parameters/trd/trd_v21b_mcbm.digi.par
_parfileTrdGas=$VMCWORKDIR/parameters/trd/trd_v21b_mcbm.gas.par
_parfileTrdGain=$VMCWORKDIR/parameters/trd/trd_v21b_mcbm.gain.par
_parfileTof=$VMCWORKDIR/macro/beamtime/mcbm2022/mTofCriPar.par
_parfileRich=$VMCWORKDIR/macro/beamtime/mcbm2021/mRichPar_70.par
_parfilePsd=$VMCWORKDIR/macro/beamtime/mcbm2021/mPsdPar.par
_setup_name=mcbm_beam_2021_07_surveyed
_run_id=1660
LOGFILETAG=`hostname`
LOGFILETAG+="_"
LOGFILETAG+=`date +%Y_%m_%d_%H_%M_%S`
LOGFILETAG+=".log"
(( _paraBuffSz=100 ))
(( _singBuffSz=_paraBuffSz*_nbmoni ))
echo "Buffer size for parallel devices $_paraBuffSz"
echo "Buffer size for singleton devices $_singBuffSz"
SAMPLER="RepReqTsSampler"
SAMPLER+=" --id sampler1"
#SAMPLER+=" --max-timeslices 0"
#SAMPLER+=" --max-timeslices 10"
#SAMPLER+=" --max-timeslices 100"
#SAMPLER+=" --max-timeslices 300"
#SAMPLER+=" --max-timeslices 1000"
SAMPLER+=" --severity info"
#SAMPLER+=" --flib-port 10"
if [ "$_hostname" != "" ]; then
SAMPLER+=" --fles-host $_hostname"
elif [ "$_filename" != "" ]; then
SAMPLER+=" --filename $_filename"
if [ "$_dirname" != "" ]; then
SAMPLER+=" --dirname $_dirname"
fi
fi
SAMPLER+=" --high-water-mark 1000"
SAMPLER+=" --no-split-ts 1"
SAMPLER+=" --ChNameMissTs missedts"
SAMPLER+=" --ChNameCmds commands"
SAMPLER+=" --PubFreqTs $_pubfreqts"
SAMPLER+=" --PubTimeMin $_pubminsec"
SAMPLER+=" --PubTimeMax $_pubmaxsec"
SAMPLER+=" --channel-config name=ts-request,type=rep,method=bind,transport=zeromq,address=tcp://127.0.0.1:11555"
SAMPLER+=" --channel-config name=histogram-in,type=pub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11666"
SAMPLER+=" --channel-config name=missedts,type=pub,method=bind,address=tcp://127.0.0.1:11006"
SAMPLER+=" --channel-config name=commands,type=pub,method=bind,address=tcp://127.0.0.1:11007"
SAMPLER+=" --transport zeromq"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
SAMPLER_LOG="sampler1_$LOGFILETAG"
xterm -l -lf $SAMPLER_LOG -geometry 80x23+0+0 -hold -e ${VMCWORKDIR}/build/bin/MQ/source/$SAMPLER &
echo $SAMPLER
_iMoni=0
while (( _iMoni < _nbmoni )); do
(( _yOffset=200*_iMoni ))
(( _iMoni += 1 ))
(( _iPort = 11680 + _iMoni ))
UNPACKER="MqUnpack"
UNPACKER+=" --id unp$_iMoni"
#UNPACKER+=" --severity error"
UNPACKER+=" --severity info"
#UNPACKER+=" --severity debug"
UNPACKER+=" --Setup $_setup_name"
UNPACKER+=" --RunId $_run_id"
UNPACKER+=" --IgnOverMs 1"
UNPACKER+=" --SetTimeOffs kSTS,-2221"
UNPACKER+=" --SetTimeOffs kMUCH,-885"
UNPACKER+=" --SetTimeOffs kTRD,0"
UNPACKER+=" --SetTimeOffs kTRD2D,-1800"
UNPACKER+=" --SetTimeOffs kTOF,-1220"
UNPACKER+=" --SetTimeOffs kRICH,254800"
UNPACKER+=" --SetTimeOffs kPSD,0"
UNPACKER+=" --PubFreqTs $_pubfreqts"
UNPACKER+=" --PubTimeMin $_pubminsec"
UNPACKER+=" --PubTimeMax $_pubmaxsec"
UNPACKER+=" --TsNameOut unpts$_iMoni"
UNPACKER+=" --channel-config name=ts-request,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11555"
UNPACKER+=" --channel-config name=parameters,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11005,rateLogging=0"
UNPACKER+=" --channel-config name=unpts$_iMoni,type=push,method=bind,transport=zeromq,address=tcp://127.0.0.1:$_iPort"
# UNPACKER+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007"
UNPACKER+=" --channel-config name=histogram-in,type=pub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11666"
UNPACKER+=" --transport zeromq"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
UNPACKER_LOG="unp$_iMoni"
UNPACKER_LOG+="_$LOGFILETAG"
xterm -l -lf $UNPACKER_LOG -geometry 132x23+400+$_yOffset -hold -e ${VMCWORKDIR}/build/bin/MQ/mcbm/$UNPACKER &
EVTBUILDER="BuildDigiEvents"
EVTBUILDER+=" --id build$_iMoni"
EVTBUILDER+=" --severity info"
#EVTBUILDER+=" --severity debug"
EVTBUILDER+=" --PubFreqTs $_pubfreqts"
EVTBUILDER+=" --PubTimeMin $_pubminsec"
EVTBUILDER+=" --PubTimeMax $_pubmaxsec"
EVTBUILDER+=" --FillHistos true"
EVTBUILDER+=" --IgnTsOver false"
EVTBUILDER+=" --EvtOverMode AllowOverlap"
EVTBUILDER+=" --RefDet kTof"
EVTBUILDER+=" --DelDet kT0"
EVTBUILDER+=" --DelDet kMuch"
EVTBUILDER+=" --SetTrigWin kSts,-100,100"
EVTBUILDER+=" --SetTrigWin kTrd,-250,250"
EVTBUILDER+=" --SetTrigWin kTof,-150,150" # To get T0 Digis (seed + close-by digis) in the event
EVTBUILDER+=" --SetTrigWin kRich,-100,100"
EVTBUILDER+=" --SetTrigWin kPsd,-100,100"
EVTBUILDER+=" --SetTrigMinNb kSts,0"
EVTBUILDER+=" --SetTrigMinNb kTrd,0"
EVTBUILDER+=" --SetTrigMinNb kTof,6"
EVTBUILDER+=" --SetTrigMinNb kRich,0"
EVTBUILDER+=" --SetTrigMinNb kPsd,0"
EVTBUILDER+=" --TsNameIn unpts$_iMoni"
EVTBUILDER+=" --EvtNameOut events"
EVTBUILDER+=" --channel-config name=unpts$_iMoni,type=pull,method=connect,transport=zeromq,address=tcp://127.0.0.1:$_iPort"
EVTBUILDER+=" --channel-config name=events,type=push,method=connect,transport=zeromq,address=tcp://127.0.0.1:11556"
# EVTBUILDER+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007"
EVTBUILDER+=" --channel-config name=parameters,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11005,rateLogging=0"
EVTBUILDER+=" --channel-config name=histogram-in,type=pub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11666"
EVTBUILDER+=" --transport zeromq"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
EVTBUILDER_LOG="build$_iMoni"
EVTBUILDER_LOG+="_$LOGFILETAG"
xterm -l -lf $EVTBUILDER_LOG -geometry 80x23+800+$_yOffset -hold -e ${VMCWORKDIR}/build/bin/MQ/mcbm/$EVTBUILDER &
done
EVTSINK="DigiEventSink"
EVTSINK+=" --id evtsink1"
EVTSINK+=" --severity info"
#EVTSINK+=" --severity debug"
#EVTSINK+=" --StoreFullTs 1"
EVTSINK+=" --OutFileName mcbm_digis_events.root"
EVTSINK+=" --FillHistos false"
EVTSINK+=" --PubFreqTs $_pubfreqts"
EVTSINK+=" --PubTimeMin $_pubminsec"
EVTSINK+=" --PubTimeMax $_pubmaxsec"
EVTSINK+=" --EvtNameIn events"
EVTSINK+=" --channel-config name=events,type=pull,method=bind,transport=zeromq,address=tcp://127.0.0.1:11556"
EVTSINK+=" --channel-config name=missedts,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11006"
EVTSINK+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007"
EVTSINK+=" --channel-config name=histogram-in,type=sub,method=bind,transport=zeromq,address=tcp://127.0.0.1:11666"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
EVTSINK_LOG="evtsink1_$LOGFILETAG"
xterm -l -lf $EVTSINK_LOG -geometry 80x23+1200+0 -hold -e ${VMCWORKDIR}/build/bin/MQ/mcbm/$EVTSINK &
PARAMETERSERVER="parmq-server"
PARAMETERSERVER+=" --id parmq-server"
PARAMETERSERVER+=" --severity info"
PARAMETERSERVER+=" --channel-name parameters"
PARAMETERSERVER+=" --channel-config name=parameters,type=rep,method=bind,transport=zeromq,address=tcp://127.0.0.1:11005,rateLogging=0"
PARAMETERSERVER+=" --first-input-name $_parfileSts;$_parfileMuch;$_parfileTrdAsic;$_parfileTrdDigi;$_parfileTrdGas;$_parfileTrdGain;$_parfileTof;$_parfileRich;$_parfilePsd"
PARAMETERSERVER+=" --first-input-type ASCII"
PARAMETERSERVER+=" --libs-to-load=libCbmFlibMcbm2018" # doesn't work due to runtime problem
PARAMETERSERVER+=" --setup $_setup_name"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
PARAMSRV_LOG="parmq_$LOGFILETAG"
xterm -l -lf $PARAMSRV_LOG -geometry 80x23+1600+0 -hold -e ${VMCWORKDIR}/build/bin/MQ/parmq/$PARAMETERSERVER &
HISTSERVER="MqHistoServer"
HISTSERVER+=" --id server1"
HISTSERVER+=" --severity info"
HISTSERVER+=" --histport 8081"
HISTSERVER+=" --channel-config name=histogram-in,type=sub,method=bind,transport=zeromq,address=tcp://127.0.0.1:11666"
HISTSERVER+=" --channel-config name=histo-conf,type=sub,method=bind,transport=zeromq,address=tcp://127.0.0.1:11667,rateLogging=0"
HISTSERVER+=" --channel-config name=canvas-conf,type=sub,method=bind,transport=zeromq,address=tcp://127.0.0.1:11668,rateLogging=0"
# Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX
# with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log
HISTSRV_LOG="server1_$LOGFILETAG"
xterm -l -lf $HISTSRV_LOG -geometry 80x23+2000+0 -hold -e ${VMCWORKDIR}/build/bin/MQ/histogramServer/$HISTSERVER &
Set(INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/MQ/base
${CBMDATA_DIR} # For CbmDefs, needed by CbmSetup
${CBMROOT_SOURCE_DIR}/sim/transport/steer # For CbmSetup.h!
${CBMROOT_SOURCE_DIR}/sim/transport/geosetup # For CbmGeoSetupDbProvider.h, needed by CbmSetup
)
Set(SYSTEM_INCLUDE_DIRECTORIES
......@@ -10,6 +13,7 @@ Set(SYSTEM_INCLUDE_DIRECTORIES
${FAIRMQ_INCLUDE_DIR}/options
${Boost_INCLUDE_DIR}
${ZeroMQ_INCLUDE_DIR}
${FAIRLOGGER_INCLUDE_DIR} # For CbmSetup.h!
)
Include_Directories(${INCLUDE_DIRECTORIES})
......@@ -51,8 +55,8 @@ If(FAIRLOGGER_FOUND)
EndIf()
Set(EXE_NAME parmq-server)
Set(SRCS
ParameterMQServer.cxx
Set(SRCS
ParameterMQServer.cxx
runParameterMQServer.cxx
# CbmMQTestContFact.cxx
)
......@@ -64,11 +68,14 @@ Set(DEPENDENCIES
Core
Net
Geom
CbmBase
CbmData
CbmField
CbmTofBase
CbmStsBase
CbmStsSim
CbmSimBase
CbmSimSteer # for CbmSetup!
CbmFlibMcbm2018
)
GENERATE_EXECUTABLE()
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
/**
......@@ -15,6 +15,7 @@
#include "ParameterMQServer.h"
#include "CbmMQDefs.h"
#include "CbmSetup.h"
#include "FairMQLogger.h"
#include "FairMQProgOptions.h"
......@@ -34,13 +35,6 @@ using namespace std;
ParameterMQServer::ParameterMQServer()
: fRtdb(FairRuntimeDb::instance())
, fFirstInputName("first_input.root")
, fFirstInputType("ROOT")
, fSecondInputName("")
, fSecondInputType("ROOT")
, fOutputName("")
, fOutputType("ROOT")
, fChannelName("data")
{
}
......@@ -75,6 +69,8 @@ void ParameterMQServer::InitTask()
fOutputType = fConfig->GetValue<string>("output-type");
fChannelName = fConfig->GetValue<string>("channel-name");
fsSetupName = fConfig->GetValue<std::string>("setup");
if (fRtdb != 0) {
// Set first input
if (fFirstInputType == "ROOT") {
......@@ -146,6 +142,13 @@ void ParameterMQServer::InitTask()
}
}
fRtdb->print();
// ----- CbmSetup -----------------------------------------------------
if ("" != fsSetupName) {
fSetup = CbmSetup::Instance();
fSetup->LoadSetup(fsSetupName.data());
}
// ------------------------------------------------------------------------
}
void ParameterMQServer::Run()
......@@ -160,45 +163,75 @@ void ParameterMQServer::Run()
string reqStr(static_cast<char*>(req->GetData()), req->GetSize());
LOG(info) << "Received parameter request from client: \"" << reqStr << "\"";
size_t pos = reqStr.rfind(",");
string newParameterName = reqStr.substr(0, pos);
int runId = stoi(reqStr.substr(pos + 1));
LOG(info) << "Parameter name: " << newParameterName;
LOG(info) << "Run ID: " << runId;
LOG(info) << "Retrieving parameter...";
// Check if the parameter name has changed to avoid getting same container repeatedly
if (newParameterName != parameterName) {
parameterName = newParameterName;
par = static_cast<FairParGenericSet*>(fRtdb->getContainer(parameterName.c_str()));
if ("setup" == reqStr) {
// TODO: support for multiple setups on Par Server? with request containing setup name?
if ("" != fsSetupName && fSetup) {
/// Prepare serialized versions of the CbmSetup
CbmSetupStorable exchangableSetup(fSetup);
TMessage* tmsg = new TMessage(kMESS_OBJECT);
tmsg->WriteObject(&exchangableSetup);
FairMQMessagePtr rep(NewMessage(
tmsg->Buffer(), tmsg->BufferSize(),
[](void* /*data*/, void* object) { delete static_cast<TMessage*>(object); }, tmsg));
if (Send(rep, fChannelName, 0) < 0) {
LOG(error) << "failed sending reply to Setup request";
break;
}
}
else {
LOG(error) << "CbmSetup uninitialized!";
// Send an empty message back to keep the REQ/REP cycle
FairMQMessagePtr rep(NewMessage());
if (Send(rep, fChannelName, 0) < 0) {
LOG(error) << "failed sending reply to Setup request";
break;
}
}
}
LOG(info) << "Retrieving parameter...Done";
else {
size_t pos = reqStr.rfind(",");
string newParameterName = reqStr.substr(0, pos);
int runId = stoi(reqStr.substr(pos + 1));
LOG(info) << "Parameter name: " << newParameterName;
LOG(info) << "Run ID: " << runId;
LOG(info) << "Retrieving parameter...";
// Check if the parameter name has changed to avoid getting same container repeatedly
if (newParameterName != parameterName) {
parameterName = newParameterName;
par = static_cast<FairParGenericSet*>(fRtdb->getContainer(parameterName.c_str()));
}
LOG(info) << "Retrieving parameter...Done";
if (-1 != runId) { fRtdb->initContainers(runId); }
if (-1 != runId) { fRtdb->initContainers(runId); }
LOG(info) << "Sending following parameter to the client:";
if (par) {
par->print();
LOG(info) << "Sending following parameter to the client:";
if (par) {
par->print();
TMessage* tmsg = new TMessage(kMESS_OBJECT);
tmsg->WriteObject(par);
TMessage* tmsg = new TMessage(kMESS_OBJECT);
tmsg->WriteObject(par);
FairMQMessagePtr rep(NewMessage(
tmsg->Buffer(), tmsg->BufferSize(),
[](void* /*data*/, void* object) { delete static_cast<TMessage*>(object); }, tmsg));
FairMQMessagePtr rep(NewMessage(
tmsg->Buffer(), tmsg->BufferSize(),
[](void* /*data*/, void* object) { delete static_cast<TMessage*>(object); }, tmsg));
if (Send(rep, fChannelName, 0) < 0) {
LOG(error) << "failed sending reply";
break;
if (Send(rep, fChannelName, 0) < 0) {
LOG(error) << "failed sending reply";
break;
}
}
}
else {
LOG(error) << "Parameter uninitialized!";
// Send an empty message back to keep the REQ/REP cycle
FairMQMessagePtr rep(NewMessage());
if (Send(rep, fChannelName, 0) < 0) {
LOG(error) << "failed sending reply";
break;
else {
LOG(error) << "Parameter uninitialized!";
// Send an empty message back to keep the REQ/REP cycle
FairMQMessagePtr rep(NewMessage());
if (Send(rep, fChannelName, 0) < 0) {
LOG(error) << "failed sending reply";
break;
}
}
}
}
......
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
/**
......@@ -20,6 +20,7 @@
#include <string>
class FairRuntimeDb;
class CbmSetup;
class ParameterMQServer : public FairMQDevice {
public:
......@@ -50,16 +51,19 @@ public:
std::string GetChannelName() { return fChannelName; }
private:
FairRuntimeDb* fRtdb;
FairRuntimeDb* fRtdb = nullptr;
CbmSetup* fSetup = nullptr;
std::string fFirstInputName;
std::string fFirstInputType;
std::string fSecondInputName;
std::string fSecondInputType;
std::string fOutputName;
std::string fOutputType;
std::string fFirstInputName = "first_input.root";
std::string fFirstInputType = "ROOT";
std::string fSecondInputName = "";
std::string fSecondInputType = "ROOT";
std::string fOutputName = "";
std::string fOutputType = "ROOT";
std::string fChannelName;
std::string fChannelName = "data";
std::string fsSetupName = "";
};
#endif /* PARAMETERMQSERVER_H_ */
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence version 3 (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
/**
......@@ -20,14 +20,22 @@ namespace bpo = boost::program_options;
void addCustomOptions(bpo::options_description& options)
{
options.add_options()("first-input-name", bpo::value<std::string>()->default_value("first_input.root"),
"First input file name")("first-input-type", bpo::value<std::string>()->default_value("ROOT"),
"First input file type (ROOT/ASCII)")(
"second-input-name", bpo::value<std::string>()->default_value(""), "Second input file name")(
"second-input-type", bpo::value<std::string>()->default_value("ROOT"), "Second input file type (ROOT/ASCII)")(
"libs-to-load", bpo::value<std::string>()->default_value(""),
"List of libraries to load")("output-name", bpo::value<std::string>()->default_value(""), "Output file name")(
"output-type", bpo::value<std::string>()->default_value("ROOT"),
"Output file type")("channel-name", bpo::value<std::string>()->default_value("data"), "Output channel name");
"First input file name");
options.add_options()("first-input-type", bpo::value<std::string>()->default_value("ROOT"),
"First input file type (ROOT/ASCII)");
options.add_options()("second-input-name", bpo::value<std::string>()->default_value(""), "Second input file name");
options.add_options()("second-input-type", bpo::value<std::string>()->default_value("ROOT"),
"Second input file type (ROOT/ASCII)");
options.add_options()("libs-to-load", bpo::value<std::string>()->default_value(""), "List of libraries to load");
options.add_options()("output-name", bpo::value<std::string>()->default_value(""), "Output file name");
options.add_options()("output-type", bpo::value<std::string>()->default_value("ROOT"), "Output file type");
options.add_options()("channel-name", bpo::value<std::string>()->default_value("data"), "Output channel name");
options.add_options()("setup", bpo::value<std::string>()->default_value(""), "Name/tag of the geomatry setup");
}
FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new ParameterMQServer(); }