CbmRoot
|
#include <CbmMQTsSamplerRepReq.h>
Public Member Functions | |
CbmMQTsSamplerRepReq () | |
virtual | ~CbmMQTsSamplerRepReq () |
Protected Member Functions | |
virtual void | InitTask () |
bool | HandleRequest (FairMQMessagePtr &, int) |
Protected Attributes | |
uint64_t | fulMaxTimeslices |
std::string | fsFileName = "" |
std::string | fsDirName = "" |
std::vector< std::string > | fvsInputFileList = {} |
List of input files. | |
std::string | fsHost = "" |
uint16_t | fusPort = 0 |
uint64_t | fulHighWaterMark = 10 |
std::string | fsChannelNameTsRequest = "ts-request" |
bool | fbNoSplitTs = true |
bool | fbSendTsPerSysId = false |
bool | fbSendTsPerBlock = false |
std::string | fsChannelNameHistosInput = "histogram-in" |
uint32_t | fuPublishFreqTs = 0 |
double_t | fdMinPublishTime = 0.5 |
double_t | fdMaxPublishTime = 5 |
std::string | fsHistosSuffix = "" |
uint64_t | fulFirstTsIndex = 0 |
uint64_t | fulPrevTsIndex = 0 |
uint64_t | fulTsCounter = 0 |
uint64_t | fulMessageCounter = 0 |
Private Member Functions | |
void | CalcRuntime () |
bool | IsChannelNameAllowed (std::string) |
std::unique_ptr< fles::Timeslice > | GetNewTs () |
bool | AddNewTsInBuffer () |
bool | CreateAndSendFullTs () |
bool | PrepareCompListPerSysId () |
bool | CreateCombinedComponentsPerSysId (std::string sSystemName) |
bool | CreateCombinedComponentsPerSysId (int iSysId) |
bool | CreateCombinedComponentsPerSysId (uint uCompIndex) |
bool | PrepareCompListPerBlock () |
bool | CreateCombinedComponentsPerBlock (std::string sBlockName) |
bool | SendFirstTsIndex () |
bool | SendData (const fles::StorableTimeslice &component) |
bool | SendMissedTsIdx (std::vector< uint64_t > vIndices) |
bool | SendCommand (std::string sCommand) |
bool | InitHistograms () |
bool | SendHistoConfAndData () |
bool | SendHistograms () |
bool | ResetHistograms () |
Private Attributes | |
fles::TimesliceSource * | fSource = nullptr |
std::chrono::steady_clock::time_point | fTime |
std::chrono::system_clock::time_point | fLastPublishTime |
std::vector< std::string > | fComponents |
std::vector< int > | fSysId = {0x20, 0x10, 0x30, 0x50, 0x40, 0x60, 0x80, 0x90} |
std::vector< bool > | fComponentActive = {false, false, false, false, false, false, false, false} |
bool | fbListCompPerSysIdReady = false |
std::vector< std::vector< uint32_t > > | fvvCompPerSysId = {{}, {}, {}, {}, {}, {}, {}, {}} |
bool | fbListCompPerBlockReady = false |
std::vector< std::pair< std::string, std::set< uint16_t > > > | fvBlocksToSend = {} |
std::vector< std::vector< uint32_t > > | fvvCompPerBlock = {} |
std::deque< std::unique_ptr< fles::Timeslice > > | fdpTimesliceBuffer = {} |
Buffering of partially sent timeslices, limited by fulHighWaterMark. | |
std::deque< std::vector< bool > > | fdbCompSentFlags = {} |
bool | fbEofFound = false |
Flag indicating the EOF was reached to avoid sending an emergency STOP. | |
std::string | fsChannelNameMissedTs = "" |
std::string | fsChannelNameCommands = "" |
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. | |
TH1I * | fhTsRate = nullptr |
Histograms. | |
TH1I * | fhTsSize = nullptr |
TProfile * | fhTsSizeEvo = nullptr |
TH1F * | fhTsMaxSizeEvo = nullptr |
TH1I * | fhMissedTS = nullptr |
TProfile * | fhMissedTSEvo = nullptr |
TCanvas * | fcSummary = nullptr |
uint64_t | fuStartTime = 0 |
double_t | fdTimeToStart = 0. |
double_t | fdLastMaxTime = 0. |
double_t | fdTsMaxSize = 0. |
Definition at line 36 of file CbmMQTsSamplerRepReq.h.
CbmMQTsSamplerRepReq::CbmMQTsSamplerRepReq | ( | ) |
Definition at line 53 of file CbmMQTsSamplerRepReq.cxx.
|
virtual |
Definition at line 1065 of file CbmMQTsSamplerRepReq.cxx.
|
private |
Remove the first TS(s) in buffer if we reached the HighWater mark
Add a new TS and "fail" if we did not get it
Now that we got the TS, we can add the corresponding list of "Sent" flags, with the proper dimension
Definition at line 598 of file CbmMQTsSamplerRepReq.cxx.
References fbSendTsPerBlock, fComponentActive, fdbCompSentFlags, fdpTimesliceBuffer, fulHighWaterMark, fvBlocksToSend, and GetNewTs().
Referenced by CreateCombinedComponentsPerBlock(), CreateCombinedComponentsPerSysId(), and PrepareCompListPerSysId().
|
private |
Definition at line 1067 of file CbmMQTsSamplerRepReq.cxx.
References fTime.
Referenced by GetNewTs().
|
private |
Send full TS as response to the request
If command channel defined, send command to all "slaves"
Wait 1 s before sending a STOP to let all slaves finish processing previous data
Definition at line 622 of file CbmMQTsSamplerRepReq.cxx.
References fsChannelNameCommands, GetNewTs(), SendCommand(), and SendData().
Referenced by HandleRequest().
|
private |
Check if the requested Block is in the list of known blocks 1) First build the list of components for each block if it was not already done
2) Search for requested block is in the list of known blocks, get its index and then send the TS
Search if TS in buffer where all components for this system where not sent yet
If all TS in buffer have sent this one, get a new TS
Prepare the custom TS and send it
Should reach here only if the block name was not found in the list!
Definition at line 801 of file CbmMQTsSamplerRepReq.cxx.
References AddNewTsInBuffer(), fdbCompSentFlags, fdpTimesliceBuffer, fvBlocksToSend, fvvCompPerBlock, PrepareCompListPerBlock(), and SendData().
Referenced by HandleRequest().
|
private |
Check if the requested System ID is in the list of known components 1) First build the list of components for each SysId if it was not already done
2) Search for requested System ID is in the list of known components, get its index and then send the TS
Definition at line 702 of file CbmMQTsSamplerRepReq.cxx.
References CreateCombinedComponentsPerSysId(), fSysId, pos, and PrepareCompListPerSysId().
|
private |
Check if the requested System name is in the list of known components 1) First build the list of components for each SysId if it was not already done
2) Search for requested System name is in the list of known components, get its index and then send the TS
Definition at line 685 of file CbmMQTsSamplerRepReq.cxx.
References CreateCombinedComponentsPerSysId(), fComponents, pos, and PrepareCompListPerSysId().
Referenced by CreateCombinedComponentsPerSysId(), CreateCombinedComponentsPerSysId(), and HandleRequest().
|
private |
Then loop on all possible SysId and send TS with their respective components if needed
Search if TS in buffer where all components for this system where not sent yet
If all TS in buffer have sent this one, get a new TS
Prepare the custom TS and send it
Definition at line 719 of file CbmMQTsSamplerRepReq.cxx.
References AddNewTsInBuffer(), fdbCompSentFlags, fdpTimesliceBuffer, fSysId, fvvCompPerSysId, SendData(), and size().
|
private |
Initialize the source (connect to emitter, ...)
Fill max size per s (assumes the histo binning is 1 second!)
Missed TS detection (only if output channel name defined by user)
Add missing TS indices to a vector and send it in appropriate channel
Catch case where we do not start with the first TS but in the middle of a run
Standard cases starting with first TS after the last transmitted one
If command channel defined, send command to all "slaves"
Wait 1 s before sending a STOP to let all slaves finish processing previous data
If command channel defined, send command to all "slaves"
Wait 1 s before sending an EOF to let all slaves finish processing previous data
If command channel defined, send command to all "slaves"
Wait 1 s before sending an EOF to let all slaves finish processing previous data
Definition at line 461 of file CbmMQTsSamplerRepReq.cxx.
References CalcRuntime(), fbEofFound, fdLastMaxTime, fdTimeToStart, fdTsMaxSize, fhMissedTS, fhMissedTSEvo, fhTsMaxSizeEvo, fhTsRate, fhTsSize, fhTsSizeEvo, FormatDecPrintout(), fsChannelNameCommands, fsChannelNameMissedTs, fSource, fulFirstTsIndex, fulMaxTimeslices, fulPrevTsIndex, fulTsCounter, fuPublishFreqTs, fuStartTime, SendCommand(), and SendMissedTsIdx().
Referenced by AddNewTsInBuffer(), CreateAndSendFullTs(), and HandleRequest().
|
protected |
Initialize the histograms
Ignore all requests if EOS reached
TODO: add support for alternative request with "system name" instead of "system ID"
If command channel defined, send command to all "slaves"
Wait 1 s before sending a STOP to let all slaves finish processing previous data
TODO: add support for alternative request with "system name" instead of "system ID"
This assumes that the order of the components does NOT change after the first TS That should be the case as the component index correspond to a physical link idx
If command channel defined, send command to all "slaves"
Wait 1 s before sending a STOP to let all slaves finish processing previous data
This assumes that the order of the components does NOT change after the first TS That should be the case as the component index correspond to a physical link idx
If command channel defined, send command to all "slaves"
Wait 1 s before sending a STOP to let all slaves finish processing previous data
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 371 of file CbmMQTsSamplerRepReq.cxx.
References CreateAndSendFullTs(), CreateCombinedComponentsPerBlock(), CreateCombinedComponentsPerSysId(), fbConfigSent, fbEofFound, fbNoSplitTs, fbSendTsPerBlock, fbSendTsPerSysId, fdMaxPublishTime, fdMinPublishTime, fLastPublishTime, fsChannelNameCommands, fulFirstTsIndex, fulMessageCounter, fulTsCounter, fuPublishFreqTs, GetNewTs(), InitHistograms(), SendCommand(), SendFirstTsIndex(), SendHistoConfAndData(), and SendHistograms().
Referenced by InitTask().
|
private |
Vector of pointers on each histo (+ optionally desired folder)
Vector of pointers on each canvas (+ optionally desired folder)
Histos creation and obtain pointer on them
Add histo pointers to the histo vector
Canvases creation
Add canvas pointers to the canvas vector
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 251 of file CbmMQTsSamplerRepReq.cxx.
References fArrayHisto, fcSummary, fdMaxPublishTime, fdMinPublishTime, fhMissedTS, fhMissedTSEvo, fhTsMaxSizeEvo, fhTsRate, fhTsSize, fhTsSizeEvo, first, fsHistosSuffix, fuPublishFreqTs, fvpsCanvasConfig, fvpsHistosFolder, and GenerateCanvasConfigString().
Referenced by HandleRequest().
|
protectedvirtual |
Extract SysId and channel information if provided in the binary options
Extract Block name
Extract SysId TODO: or component name
Check if SysId already in use
Look if Block is already defined
Block already there, add the SysId to its list
Block unknown yet, add both Block and First SysId
Definition at line 60 of file CbmMQTsSamplerRepReq.cxx.
References fbNoSplitTs, fbSendTsPerBlock, fbSendTsPerSysId, fComponentActive, fdMaxPublishTime, fdMinPublishTime, fsChannelNameCommands, fsChannelNameHistosInput, fsChannelNameMissedTs, fsChannelNameTsRequest, fsDirName, fsFileName, fsHistosSuffix, fsHost, fSource, fSysId, fTime, fulHighWaterMark, fulMaxTimeslices, fuPublishFreqTs, fusPort, fvBlocksToSend, fvsInputFileList, fvvCompPerBlock, HandleRequest(), and size().
|
private |
|
private |
1) First build the list of components for each SysId if it was not already done
2) Build the list of components for each block, based on its list of system IDs
Check if this system ID is existing
Add all components to the list
Definition at line 766 of file CbmMQTsSamplerRepReq.cxx.
References fbListCompPerBlockReady, fSysId, fvBlocksToSend, fvvCompPerBlock, fvvCompPerSysId, pos, and PrepareCompListPerSysId().
Referenced by CreateCombinedComponentsPerBlock().
|
private |
Check if already at least one TS in the buffer (should not be the case => if not, add one
Definition at line 646 of file CbmMQTsSamplerRepReq.cxx.
References AddNewTsInBuffer(), fbListCompPerSysIdReady, fComponents, fdpTimesliceBuffer, fSysId, fvvCompPerSysId, and pos.
Referenced by CreateCombinedComponentsPerSysId(), CreateCombinedComponentsPerSysId(), and PrepareCompListPerBlock().
|
private |
Definition at line 1053 of file CbmMQTsSamplerRepReq.cxx.
References fhMissedTS, fhMissedTSEvo, fhTsMaxSizeEvo, fhTsRate, fhTsSize, and fhTsSizeEvo.
Referenced by SendHistoConfAndData(), and SendHistograms().
|
private |
Definition at line 941 of file CbmMQTsSamplerRepReq.cxx.
References fsChannelNameCommands.
Referenced by CreateAndSendFullTs(), GetNewTs(), and HandleRequest().
|
private |
Definition at line 887 of file CbmMQTsSamplerRepReq.cxx.
References fsChannelNameTsRequest, and fulMessageCounter.
Referenced by CreateAndSendFullTs(), CreateCombinedComponentsPerBlock(), and CreateCombinedComponentsPerSysId().
|
private |
Definition at line 857 of file CbmMQTsSamplerRepReq.cxx.
References FormatDecPrintout(), fsChannelNameTsRequest, fulFirstTsIndex, and fulMessageCounter.
Referenced by HandleRequest().
|
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 972 of file CbmMQTsSamplerRepReq.cxx.
References fArrayHisto, fsChannelNameHistosInput, fvpsCanvasConfig, fvpsHistosFolder, and ResetHistograms().
Referenced by HandleRequest().
|
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 1034 of file CbmMQTsSamplerRepReq.cxx.
References fArrayHisto, fsChannelNameHistosInput, and ResetHistograms().
Referenced by HandleRequest().
|
private |
Definition at line 915 of file CbmMQTsSamplerRepReq.cxx.
References fsChannelNameMissedTs.
Referenced by GetNewTs().
|
private |
Array of histograms to send to the histogram server.
Definition at line 132 of file CbmMQTsSamplerRepReq.h.
Referenced by InitHistograms(), SendHistoConfAndData(), and SendHistograms().
|
private |
Flag indicating whether the histograms and canvases configurations were already published.
Definition at line 140 of file CbmMQTsSamplerRepReq.h.
Referenced by HandleRequest().
|
private |
Flag indicating the EOF was reached to avoid sending an emergency STOP.
Definition at line 126 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), and HandleRequest().
|
private |
Definition at line 117 of file CbmMQTsSamplerRepReq.h.
Referenced by PrepareCompListPerBlock().
|
private |
Definition at line 114 of file CbmMQTsSamplerRepReq.h.
Referenced by PrepareCompListPerSysId().
|
protected |
Definition at line 53 of file CbmMQTsSamplerRepReq.h.
Referenced by HandleRequest(), and InitTask().
|
protected |
Definition at line 55 of file CbmMQTsSamplerRepReq.h.
Referenced by AddNewTsInBuffer(), HandleRequest(), and InitTask().
|
protected |
Definition at line 54 of file CbmMQTsSamplerRepReq.h.
Referenced by HandleRequest(), and InitTask().
|
private |
Definition at line 112 of file CbmMQTsSamplerRepReq.h.
Referenced by AddNewTsInBuffer(), and InitTask().
|
private |
Definition at line 109 of file CbmMQTsSamplerRepReq.h.
Referenced by CreateCombinedComponentsPerSysId(), and PrepareCompListPerSysId().
|
private |
Definition at line 149 of file CbmMQTsSamplerRepReq.h.
Referenced by InitHistograms().
|
private |
Definition at line 123 of file CbmMQTsSamplerRepReq.h.
Referenced by AddNewTsInBuffer(), CreateCombinedComponentsPerBlock(), and CreateCombinedComponentsPerSysId().
|
private |
Definition at line 152 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs().
|
protected |
Definition at line 60 of file CbmMQTsSamplerRepReq.h.
Referenced by HandleRequest(), InitHistograms(), and InitTask().
|
protected |
Definition at line 59 of file CbmMQTsSamplerRepReq.h.
Referenced by HandleRequest(), InitHistograms(), and InitTask().
|
private |
Buffering of partially sent timeslices, limited by fulHighWaterMark.
Definition at line 122 of file CbmMQTsSamplerRepReq.h.
Referenced by AddNewTsInBuffer(), CreateCombinedComponentsPerBlock(), CreateCombinedComponentsPerSysId(), and PrepareCompListPerSysId().
|
private |
Definition at line 151 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs().
|
private |
Definition at line 153 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs().
|
private |
Definition at line 147 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), InitHistograms(), and ResetHistograms().
|
private |
Definition at line 148 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), InitHistograms(), and ResetHistograms().
|
private |
Definition at line 146 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), InitHistograms(), and ResetHistograms().
|
private |
Histograms.
Definition at line 143 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), InitHistograms(), and ResetHistograms().
|
private |
Definition at line 144 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), InitHistograms(), and ResetHistograms().
|
private |
Definition at line 145 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), InitHistograms(), and ResetHistograms().
|
private |
Definition at line 97 of file CbmMQTsSamplerRepReq.h.
Referenced by HandleRequest().
|
private |
Definition at line 129 of file CbmMQTsSamplerRepReq.h.
Referenced by CreateAndSendFullTs(), GetNewTs(), HandleRequest(), InitTask(), and SendCommand().
|
protected |
Definition at line 57 of file CbmMQTsSamplerRepReq.h.
Referenced by InitTask(), SendHistoConfAndData(), and SendHistograms().
|
private |
Definition at line 128 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), InitTask(), and SendMissedTsIdx().
|
protected |
Definition at line 52 of file CbmMQTsSamplerRepReq.h.
Referenced by InitTask(), SendData(), and SendFirstTsIndex().
|
protected |
Definition at line 45 of file CbmMQTsSamplerRepReq.h.
Referenced by InitTask().
|
protected |
Definition at line 44 of file CbmMQTsSamplerRepReq.h.
Referenced by InitTask().
|
protected |
Definition at line 61 of file CbmMQTsSamplerRepReq.h.
Referenced by InitHistograms(), and InitTask().
|
protected |
Definition at line 48 of file CbmMQTsSamplerRepReq.h.
Referenced by InitTask().
|
private |
Definition at line 95 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), and InitTask().
|
private |
Definition at line 111 of file CbmMQTsSamplerRepReq.h.
Referenced by CreateCombinedComponentsPerSysId(), CreateCombinedComponentsPerSysId(), InitTask(), PrepareCompListPerBlock(), and PrepareCompListPerSysId().
|
private |
Definition at line 96 of file CbmMQTsSamplerRepReq.h.
Referenced by CalcRuntime(), and InitTask().
|
protected |
Definition at line 63 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), HandleRequest(), and SendFirstTsIndex().
|
protected |
Definition at line 50 of file CbmMQTsSamplerRepReq.h.
Referenced by AddNewTsInBuffer(), and InitTask().
|
protected |
Definition at line 42 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), and InitTask().
|
protected |
Definition at line 66 of file CbmMQTsSamplerRepReq.h.
Referenced by HandleRequest(), SendData(), and SendFirstTsIndex().
|
protected |
Definition at line 64 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs().
|
protected |
Definition at line 65 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), and HandleRequest().
|
protected |
Definition at line 58 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs(), HandleRequest(), InitHistograms(), and InitTask().
|
protected |
Definition at line 49 of file CbmMQTsSamplerRepReq.h.
Referenced by InitTask().
|
private |
Definition at line 150 of file CbmMQTsSamplerRepReq.h.
Referenced by GetNewTs().
|
private |
Definition at line 118 of file CbmMQTsSamplerRepReq.h.
Referenced by AddNewTsInBuffer(), CreateCombinedComponentsPerBlock(), InitTask(), and PrepareCompListPerBlock().
|
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 138 of file CbmMQTsSamplerRepReq.h.
Referenced by InitHistograms(), and SendHistoConfAndData().
|
private |
Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server.
Definition at line 134 of file CbmMQTsSamplerRepReq.h.
Referenced by InitHistograms(), and SendHistoConfAndData().
|
protected |
List of input files.
Definition at line 47 of file CbmMQTsSamplerRepReq.h.
Referenced by InitTask().
|
private |
Definition at line 119 of file CbmMQTsSamplerRepReq.h.
Referenced by CreateCombinedComponentsPerBlock(), InitTask(), and PrepareCompListPerBlock().
|
private |
Definition at line 115 of file CbmMQTsSamplerRepReq.h.
Referenced by CreateCombinedComponentsPerSysId(), PrepareCompListPerBlock(), and PrepareCompListPerSysId().