CbmRoot
|
#include <CbmDeviceBmonMonitor.h>
Public Member Functions | |
CbmDeviceBmonMonitor () | |
virtual | ~CbmDeviceBmonMonitor () |
Protected Member Functions | |
virtual void | InitTask () |
bool | ConditionalRun () |
bool | HandleCommand (FairMQMessagePtr &, int) |
void | SetUnpackConfig (std::shared_ptr< CbmBmonUnpackConfig > config) |
Set the Bmon Unpack Config. | |
Private Member Functions | |
Bool_t | InitParameters (std::vector< std::pair< std::string, std::shared_ptr< FairParGenericSet > > > *reqparvec) |
Parameters management. | |
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) |
Get the Trd Spadic. | |
template<typename TVecobj > | |
std::enable_if< std::is_same< TVecobj, std::nullptr_t >::value==true, void >::type | timesort (std::vector< TVecobj > *) |
Sort a vector timewise vector type has to provide GetTime() | |
template<typename TVecobj > | |
std::enable_if<!std::is_member_function_pointer< decltype(&TVecobj::GetTime)>::value, void >::type | timesort (std::vector< TVecobj > *) |
template<typename TVecobj > | |
std::enable_if< std::is_member_function_pointer< decltype(&TVecobj::GetTime)>::value, void >::type | timesort (std::vector< TVecobj > *vec=nullptr) |
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) |
Template for the unpacking call of a given algorithm. | |
Private Attributes | |
Bool_t | fbIgnoreOverlapMs = false |
Control flags. | |
Bool_t | fbComponentsAddedToList = kFALSE |
Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice. | |
bool | fbStartTimeSet = false |
bool | fDoDebugPrints = false |
Flag if extended debug output is to be printed or not. | |
bool | fDoPerfProf = false |
Flag if performance profiling should be activated or not. | |
bool | fbOutputFullTimeSorting = false |
Flag to Enable/disable a full time sorting. If off, time sorting happens per link/FLIM source. | |
std::string | fsSetupName = "mcbm_beam_2021_07_surveyed" |
User settings parameters. | |
uint32_t | fuRunId = 1588 |
bool | fbUnpBmon = true |
---> for selective unpacking | |
std::string | fsChannelNameDataInput = "ts-request" |
message queues | |
std::string | fsChannelNameDataOutput = "unpts_0" |
std::string | fsChannelNameCommands = "commands" |
std::string | fsChannelNameHistosInput = "histogram-in" |
uint32_t | fuPublishFreqTs = 100 |
Histograms management. | |
double_t | fdMinPublishTime = 0.5 |
double_t | fdMaxPublishTime = 5.0 |
uint64_t | fulNumMessages = 0 |
Statistics & first TS rejection. | |
uint64_t | fulTsCounter = 0 |
std::chrono::system_clock::time_point | fLastPublishTime = std::chrono::system_clock::now() |
std::map< std::uint16_t, std::pair< std::string, size_t > > | fNameMap = {} |
Map to store a name for the unpackers and the processed amount of digis, key = fkFlesId. | |
std::map< std::uint16_t, std::pair< double, double > > | fTimeMap = {} |
Map to store the cpu and wall time, key = fkFlesId. | |
std::map< std::uint16_t, std::pair< double, double > > | fDataSizeMap = {} |
Map to store the in and out data amount, key = fkFlesId. | |
std::shared_ptr< CbmBmonUnpackConfig > | fBmonConfig = nullptr |
Configuration of the unpackers. Provides the configured algorithm. | |
CbmTsEventHeader * | fCbmTsEventHeader = nullptr |
Pointer to the Timeslice header conatining start time and index. | |
std::vector< std::string > | fvsSetTimeOffs = {} |
Time offsets. | |
size_t | fuNbCoreMsPerTs = 0 |
TS MetaData storage: stable so should be moved somehow to parameters handling (not transmitted with each TS. | |
size_t | fuNbOverMsPerTs = 0 |
Double_t | fdMsSizeInNs = 0 |
Double_t | fdTsCoreSizeInNs = -1.0 |
Size of a single MS, [nanoseconds]. | |
Double_t | fdTsOverSizeInNs = -1.0 |
Total size of the core MS in a TS, [nanoseconds]. | |
Double_t | fdTsFullSizeInNs = -1.0 |
Total size of the overlap MS in a TS, [nanoseconds]. | |
TimesliceMetaData * | fTsMetaData |
Total size of all MS in a TS, [nanoseconds]. | |
TObjArray | fArrayHisto = {} |
Array of histograms to send to the histogram server. | |
std::vector< std::pair< std::string, std::string > > | fvpsHistosFolder = {} |
Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server. | |
std::vector< std::pair< std::string, std::string > > | fvpsCanvasConfig = {} |
bool | fbConfigSent = false |
Flag indicating whether the histograms and canvases configurations were already published. | |
Static Private Attributes | |
static constexpr std::uint16_t | fkFlesBmon = static_cast<std::uint16_t>(fles::Subsystem::BMON) |
Constants. | |
Definition at line 37 of file CbmDeviceBmonMonitor.h.
CbmDeviceBmonMonitor::CbmDeviceBmonMonitor | ( | ) |
Definition at line 59 of file CbmDeviceBmonMonitor.cxx.
|
virtual |
Definition at line 552 of file CbmDeviceBmonMonitor.cxx.
References fBmonConfig.
|
protected |
First do Algo related Initialization steps if needed
If first TS of this device, ask for the start time (lead to skip of 1 TS for 1st request)
Request the start time
First request a new TS (full one)
Create an empty TS and fill it with the incoming message
On first TS, extract the TS parameters from header (by definition stable over time)
Update only the fields changing from TS to TS
Process the Timeslice
Send histograms each 100 time slices. Should be each ~1s Use also runtime checker to trigger sending after M s if processing too slow or delay sending if processing too fast
Definition at line 299 of file CbmDeviceBmonMonitor.cxx.
References DoUnpack(), fbConfigSent, fBmonConfig, fbStartTimeSet, fCbmTsEventHeader, fdMaxPublishTime, fdMinPublishTime, fdMsSizeInNs, fdTsCoreSizeInNs, fdTsFullSizeInNs, fdTsOverSizeInNs, fLastPublishTime, fsChannelNameDataInput, fTsMetaData, fulNumMessages, fuNbCoreMsPerTs, fuNbOverMsPerTs, fuPublishFreqTs, InitContainers(), InitHistograms(), CbmTsEventHeader::Reset(), SendHistoConfAndData(), SendHistograms(), TimesliceMetaData::SetIndex(), and TimesliceMetaData::SetStartTime().
|
private |
Definition at line 557 of file CbmDeviceBmonMonitor.cxx.
References CbmTsEventHeader::AddNDigisBmon(), fBmonConfig, fCbmTsEventHeader, fDoDebugPrints, fkFlesBmon, fulTsCounter, CbmTsEventHeader::SetTsIndex(), CbmTsEventHeader::SetTsStartTime(), and unpack().
Referenced by ConditionalRun().
|
private |
Definition at line 605 of file CbmDeviceBmonMonitor.cxx.
|
private |
Get the Trd Spadic.
Definition at line 596 of file CbmDeviceBmonMonitor.cxx.
|
protected |
|
private |
Prevent clang format single line if
Initialize the UnpackerConfigs objects and their "user options"
Enable Monitor plots
Enable full time sorting instead of time sorting per FLIM link
Load time offsets
Detector Enum Tag
Min number
Needed to change the Parameter file name before it is used!!!
Framework bound work = kept in this Device
Event header object
Definition at line 84 of file CbmDeviceBmonMonitor.cxx.
References fBmonConfig, fbUnpBmon, fCbmTsEventHeader, fuRunId, fvsSetTimeOffs, InitParameters(), CbmSetup::Instance(), CbmSetup::LoadStoredSetup(), and SetUnpackConfig().
Referenced by ConditionalRun().
|
private |
Histos creation and obtain pointer on them Trigger histo creation on all associated algos
Obtain vector of pointers on each histo from the algo (+ optionally desired folder)
Obtain vector of pointers on each canvas from the algo (+ optionally desired folder)
Add pointers to each histo in the histo array Create histo config vector ===> Use an std::vector< std::pair< std::string, std::string > > with < Histo name, Folder > and send it through a separate channel using the BoostSerializer
Create canvas config vector ===> Use an std::vector< std::pair< std::string, std::string > > with < Canvas name, config > and send it through a separate channel using the BoostSerializer
Definition at line 250 of file CbmDeviceBmonMonitor.cxx.
References fArrayHisto, fBmonConfig, first, fvpsCanvasConfig, fvpsHistosFolder, and GenerateCanvasConfigString().
Referenced by ConditionalRun().
|
private |
Parameters management.
Potentially unsafe reasignment of raw pointer to the shared pointer?
Definition at line 199 of file CbmDeviceBmonMonitor.cxx.
Referenced by InitContainers().
|
protectedvirtual |
Read options from executable
Definition at line 61 of file CbmDeviceBmonMonitor.cxx.
References fbIgnoreOverlapMs, fbOutputFullTimeSorting, fbUnpBmon, fdMaxPublishTime, fdMinPublishTime, fsChannelNameDataInput, fsChannelNameDataOutput, fsChannelNameHistosInput, fsSetupName, fuPublishFreqTs, fuRunId, and fvsSetTimeOffs.
|
private |
Prepare multiparts message and header
Serialize the vector of histo config into a single MQ message
Catch case where no histos are registered! => Add empty message
Serialize the vector of canvas config into a single MQ message
Catch case where no Canvases are registered! => Add empty message
Serialize the array of histos into a single MQ message
Send the multi-parts message to the common histogram messages queue
Reset the histograms after sending them (but do not reset the time)
Definition at line 470 of file CbmDeviceBmonMonitor.cxx.
References fArrayHisto, fBmonConfig, fsChannelNameHistosInput, fvpsCanvasConfig, and fvpsHistosFolder.
Referenced by ConditionalRun().
|
private |
Serialize the array of histos into a single MQ message
Send message to the common histogram messages queue
Reset the histograms after sending them (but do not reset the time)
Definition at line 532 of file CbmDeviceBmonMonitor.cxx.
References fArrayHisto, and fsChannelNameHistosInput.
Referenced by ConditionalRun().
|
private |
Prepare serialized versions of the TS Event header
Prepare serialized versions of the TS Meta FIXME: only for TS duration and overlap, should be sent to parameter service instead as stable values in run Index and start time are already included in the TsHeader object!
Definition at line 425 of file CbmDeviceBmonMonitor.cxx.
References fBmonConfig, fCbmTsEventHeader, fsChannelNameDataOutput, and fTsMetaData.
|
inlineprotected |
Set the Bmon Unpack Config.
config |
Definition at line 48 of file CbmDeviceBmonMonitor.h.
References fBmonConfig.
Referenced by InitContainers().
|
inlineprivate |
Sort a vector timewise vector type has to provide GetTime()
Definition at line 139 of file CbmDeviceBmonMonitor.h.
Referenced by unpack().
|
inlineprivate |
Definition at line 148 of file CbmDeviceBmonMonitor.h.
|
inlineprivate |
Definition at line 157 of file CbmDeviceBmonMonitor.h.
|
inlineprivate |
Template for the unpacking call of a given algorithm.
TAlgo | Algorithm to be called |
TOutput | Output element types |
TOptoutputs | Optional output element types |
ts | Timeslice |
icomp | Component number |
algo | Algorithm to be used for this component |
outtargetvec | Target vector for the output elements |
optoutputvecs | Target vectors for optional outputs |
Definition at line 178 of file CbmDeviceBmonMonitor.h.
References fbOutputFullTimeSorting, fDataSizeMap, fDoPerfProf, fNameMap, fTimeMap, and timesort().
Referenced by DoUnpack().
|
private |
Array of histograms to send to the histogram server.
Definition at line 116 of file CbmDeviceBmonMonitor.h.
Referenced by InitHistograms(), SendHistoConfAndData(), and SendHistograms().
|
private |
Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice.
Definition at line 57 of file CbmDeviceBmonMonitor.h.
|
private |
Flag indicating whether the histograms and canvases configurations were already published.
Definition at line 124 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
|
private |
Configuration of the unpackers. Provides the configured algorithm.
Definition at line 98 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun(), DoUnpack(), InitContainers(), InitHistograms(), SendHistoConfAndData(), SendUnpData(), SetUnpackConfig(), and ~CbmDeviceBmonMonitor().
|
private |
Flag to Enable/disable a full time sorting. If off, time sorting happens per link/FLIM source.
Definition at line 65 of file CbmDeviceBmonMonitor.h.
Referenced by InitTask(), and unpack().
|
private |
Definition at line 58 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
---> for selective unpacking
Definition at line 71 of file CbmDeviceBmonMonitor.h.
Referenced by InitContainers(), and InitTask().
|
private |
Pointer to the Timeslice header conatining start time and index.
Definition at line 101 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun(), DoUnpack(), InitContainers(), and SendUnpData().
|
private |
Map to store the in and out data amount, key = fkFlesId.
Definition at line 95 of file CbmDeviceBmonMonitor.h.
Referenced by unpack().
|
private |
Definition at line 80 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun(), and InitTask().
|
private |
Definition at line 79 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun(), and InitTask().
|
private |
Definition at line 109 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
Flag if extended debug output is to be printed or not.
Definition at line 61 of file CbmDeviceBmonMonitor.h.
Referenced by DoUnpack().
|
private |
Flag if performance profiling should be activated or not.
Definition at line 63 of file CbmDeviceBmonMonitor.h.
Referenced by unpack().
|
private |
Size of a single MS, [nanoseconds].
Definition at line 110 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
Total size of the overlap MS in a TS, [nanoseconds].
Definition at line 112 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
Total size of the core MS in a TS, [nanoseconds].
Definition at line 111 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
staticconstexprprivate |
|
private |
Definition at line 89 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
Map to store a name for the unpackers and the processed amount of digis, key = fkFlesId.
Definition at line 91 of file CbmDeviceBmonMonitor.h.
Referenced by unpack().
|
private |
Definition at line 75 of file CbmDeviceBmonMonitor.h.
|
private |
message queues
Definition at line 73 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun(), and InitTask().
|
private |
Definition at line 74 of file CbmDeviceBmonMonitor.h.
Referenced by InitTask(), and SendUnpData().
|
private |
Definition at line 76 of file CbmDeviceBmonMonitor.h.
Referenced by InitTask(), SendHistoConfAndData(), and SendHistograms().
|
private |
User settings parameters.
Definition at line 68 of file CbmDeviceBmonMonitor.h.
Referenced by InitTask().
|
private |
Map to store the cpu and wall time, key = fkFlesId.
Definition at line 93 of file CbmDeviceBmonMonitor.h.
Referenced by unpack().
|
private |
Total size of all MS in a TS, [nanoseconds].
Definition at line 113 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun(), and SendUnpData().
|
private |
Statistics & first TS rejection.
Definition at line 87 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
Definition at line 88 of file CbmDeviceBmonMonitor.h.
Referenced by DoUnpack().
|
private |
TS MetaData storage: stable so should be moved somehow to parameters handling (not transmitted with each TS.
Definition at line 107 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
Definition at line 108 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun().
|
private |
Histograms management.
Definition at line 78 of file CbmDeviceBmonMonitor.h.
Referenced by ConditionalRun(), and InitTask().
|
private |
Definition at line 69 of file CbmDeviceBmonMonitor.h.
Referenced by InitContainers(), and InitTask().
|
private |
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)"
Definition at line 122 of file CbmDeviceBmonMonitor.h.
Referenced by InitHistograms(), and SendHistoConfAndData().
|
private |
Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server.
Definition at line 118 of file CbmDeviceBmonMonitor.h.
Referenced by InitHistograms(), and SendHistoConfAndData().
|
private |
Time offsets.
Definition at line 104 of file CbmDeviceBmonMonitor.h.
Referenced by InitContainers(), and InitTask().