CbmRoot
|
#include <CbmDeviceMcbmEventSink.h>
Public Member Functions | |
CbmDeviceMcbmEventSink () | |
virtual | ~CbmDeviceMcbmEventSink () |
Protected Member Functions | |
virtual void | InitTask () |
bool | HandleMissTsData (FairMQMessagePtr &, int) |
bool | HandleData (FairMQParts &, int) |
bool | HandleCommand (FairMQMessagePtr &, int) |
Private Member Functions | |
bool | IsChannelNameAllowed (std::string channelName) |
Internal methods. More... | |
void | CheckTsQueues () |
void | PrepareTreeEntry (CbmUnpackedTimeslice unpTs) |
void | DumpTreeEntry () |
bool | SendHistograms () |
void | Finish () |
Private Attributes | |
Bool_t | fbFillHistos = kFALSE |
Constants. More... | |
Bool_t | fbFinishDone |
Switch ON/OFF filling of histograms. More... | |
std::string | fsOutputFileName = "mcbm_digis_events.root" |
Keep track of whether the Finish was already called. More... | |
std::string | fsChannelNameMissedTs = "missedts" |
message queues More... | |
std::string | fsChannelNameDataInput = "events" |
std::string | fsChannelNameCommands = "commands" |
std::string | fsChannelNameHistosInput = "histogram-in" |
std::string | fsChannelNameHistosConfig = "histo-conf" |
std::string | fsChannelNameCanvasConfig = "canvas-conf" |
uint32_t | fuPublishFreqTs = 100 |
Histograms management. More... | |
double_t | fdMinPublishTime = 0.5 |
double_t | fdMaxPublishTime = 5.0 |
std::vector< std::string > | fsAllowedChannels = {fsChannelNameDataInput} |
List of MQ channels names. More... | |
uint64_t | fuPrevTsIndex = 0 |
Parameters management. More... | |
uint64_t | fulNumMessages = 0 |
uint64_t | fulTsCounter = 0 |
uint64_t | fulMissedTsCounter = 0 |
std::chrono::system_clock::time_point | fLastPublishTime |
bool | fbReceivedEof = false |
Control Commands reception. More... | |
uint64_t | fuLastTsIndex = 0 |
uint64_t | fuTotalTsCount = 0 |
TClonesArray * | fTimeSliceMetaDataArray = nullptr |
TS MetaData storage. More... | |
TimesliceMetaData * | fTsMetaData = nullptr |
std::vector< CbmTofDigi > * | fvDigiT0 = nullptr |
Digis storage. More... | |
std::vector< CbmStsDigi > * | fvDigiSts = nullptr |
std::vector< CbmMuchBeamTimeDigi > * | fvDigiMuch = nullptr |
std::vector< CbmTrdDigi > * | fvDigiTrd = nullptr |
std::vector< CbmTofDigi > * | fvDigiTof = nullptr |
std::vector< CbmRichDigi > * | fvDigiRich = nullptr |
std::vector< CbmPsdDigi > * | fvDigiPsd = nullptr |
TClonesArray * | fEventsArray = nullptr |
CbmEvents. More... | |
std::vector< uint64_t > | fvulMissedTsIndices = {} |
output container of CbmEvents More... | |
std::map< uint64_t, CbmUnpackedTimeslice > | fmFullTsStorage = {} |
Buffered TS. More... | |
FairRunOnline * | fpRun = nullptr |
Data storage. More... | |
FairRootManager * | fpFairRootMgr = nullptr |
TFile * | fpOutRootFile = nullptr |
TObjArray | fArrayHisto = {} |
Array of histograms to send to the histogram server. More... | |
std::vector< std::pair< std::string, std::string > > | fvpsHistosFolder = {} |
Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server. More... | |
std::vector< std::pair< std::string, std::string > > | fvpsCanvasConfig = {} |
Definition at line 58 of file CbmDeviceMcbmEventSink.h.
CbmDeviceMcbmEventSink::CbmDeviceMcbmEventSink | ( | ) |
Definition at line 52 of file CbmDeviceMcbmEventSink.cxx.
|
virtual |
FIXME: Add pointers check before delete
Close things properly if not alredy done
Clear metadata
Clear vectors
Clear events TClonesArray
Definition at line 641 of file CbmDeviceMcbmEventSink.cxx.
|
private |
Check if the first TS in the full TS queue is the next one
Fill all storage variables registers for data output
Trigger FairRoot manager to dump Tree entry
Update counters
Increment iterator
Check if the first TS in the missed TS queue is the next one
Prepare entry with only dummy TS metadata and empty storage variables
Trigger FairRoot manager to dump Tree entry
Update counters
Increment iterator
Should be reached only if both queues at the end or hole found in both
Delete the processed entries
End of data: clean save of data + close file + send last state of histos if enabled
Definition at line 481 of file CbmDeviceMcbmEventSink.cxx.
|
private |
FairRunOnline style
Clear metadata array
Clear vectors
Clear event array
Definition at line 587 of file CbmDeviceMcbmEventSink.cxx.
|
private |
Definition at line 668 of file CbmDeviceMcbmEventSink.cxx.
References cbm::mq::ChangeState().
|
protected |
Extract the last TS index and global full TS count
Last TS index
Total TS count
End of data: clean save of data + close file + send last state of histos if enabled
TODO: different treatment in case of "BAD" ending compared to EOF? Source failure: clean save of received data + close file + send last state of histos if enabled
Definition at line 415 of file CbmDeviceMcbmEventSink.cxx.
Referenced by InitTask().
|
protected |
Extract unpacked data from input message
TS metadata TODO: code order of vectors in the TS MetaData!!
FIXME: Need to check if TS arrived in order (probably not!!!) + buffer!!!
Fill all storage variables registers for data output
Trigger FairRoot manager to dump Tree entry
Update counters
If not consecutive to last TS sent,
Clear metadata => crashes, maybe not needed as due to move the pointer is invalidated?
Check TS queue and process it if needed (in case it filled a hole!)
Histograms management
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 341 of file CbmDeviceMcbmEventSink.cxx.
Referenced by InitTask().
|
protected |
Check TS queue and process it if needed (in case it filled a hole!)
Definition at line 323 of file CbmDeviceMcbmEventSink.cxx.
Referenced by InitTask().
|
protectedvirtual |
Read options from executable
Associate the MissedTs Channel to the corresponding handler
Associate the command Channel to the corresponding handler
Associate the Event + Unp data Channel to the corresponding handler
Create input vectors
Prepare storage TClonesArrays TS MetaData storage
Events storage
TODO: remove TObject from CbmEvent and switch to vectors!
Prepare root output
Register all input data members with the FairRoot manager TS MetaData
Digis storage
Histograms management
Definition at line 54 of file CbmDeviceMcbmEventSink.cxx.
References HandleCommand(), HandleData(), and HandleMissTsData().
|
private |
|
private |
FIXME: poor man solution with lots of data copy until we undertsnad how to properly deal with FairMq messages ownership and memory managment
FIXME: Not sure if this is the proper way to insert the data
move version: safe but slow T0
STS
MUCH
TRD
T0F
RICH
PSD
Extract CbmEvent TClonesArray from input message
Definition at line 543 of file CbmDeviceMcbmEventSink.cxx.
References CbmUnpackedTimeslice::fEventsArray, CbmUnpackedTimeslice::fTsMetaData, CbmUnpackedTimeslice::fvDigiMuch, CbmUnpackedTimeslice::fvDigiPsd, CbmUnpackedTimeslice::fvDigiRich, CbmUnpackedTimeslice::fvDigiSts, CbmUnpackedTimeslice::fvDigiT0, CbmUnpackedTimeslice::fvDigiTof, and CbmUnpackedTimeslice::fvDigiTrd.
|
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 623 of file CbmDeviceMcbmEventSink.cxx.
|
private |
Array of histograms to send to the histogram server.
Definition at line 142 of file CbmDeviceMcbmEventSink.h.
|
private |
|
private |
Switch ON/OFF filling of histograms.
Definition at line 74 of file CbmDeviceMcbmEventSink.h.
|
private |
Control Commands reception.
Definition at line 108 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 90 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 89 of file CbmDeviceMcbmEventSink.h.
|
private |
CbmEvents.
Definition at line 127 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 104 of file CbmDeviceMcbmEventSink.h.
|
private |
Buffered TS.
Definition at line 134 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 138 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 139 of file CbmDeviceMcbmEventSink.h.
|
private |
Data storage.
Definition at line 137 of file CbmDeviceMcbmEventSink.h.
|
private |
List of MQ channels names.
Definition at line 93 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 86 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 83 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 82 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 85 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 84 of file CbmDeviceMcbmEventSink.h.
|
private |
message queues
Definition at line 81 of file CbmDeviceMcbmEventSink.h.
|
private |
Keep track of whether the Finish was already called.
User settings parameters Algo enum settings
Definition at line 79 of file CbmDeviceMcbmEventSink.h.
|
private |
TS MetaData storage.
Data reception Event (TS) header
Definition at line 116 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 117 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 109 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 103 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 101 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 102 of file CbmDeviceMcbmEventSink.h.
|
private |
Parameters management.
Statistics & missed TS detection
Definition at line 100 of file CbmDeviceMcbmEventSink.h.
|
private |
Histograms management.
Definition at line 88 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 110 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 121 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 125 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 124 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 120 of file CbmDeviceMcbmEventSink.h.
|
private |
Digis storage.
Definition at line 119 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 123 of file CbmDeviceMcbmEventSink.h.
|
private |
Definition at line 122 of file CbmDeviceMcbmEventSink.h.
|
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 148 of file CbmDeviceMcbmEventSink.h.
|
private |
Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server.
Definition at line 144 of file CbmDeviceMcbmEventSink.h.
|
private |
output container of CbmEvents
Storage for re-ordering Missed TS vector
Definition at line 132 of file CbmDeviceMcbmEventSink.h.