CbmRoot
|
#include <CbmMqHistoServer.h>
Public Member Functions | |
CbmMqHistoServer () | |
virtual | ~CbmMqHistoServer () |
void | UpdateHttpServer () |
Protected Member Functions | |
virtual void | InitTask () |
bool | ReceiveData (FairMQMessagePtr &msg, int index) |
bool | ReceiveHistoConfig (FairMQMessagePtr &msg, int index) |
bool | ReceiveCanvasConfig (FairMQMessagePtr &msg, int index) |
bool | ReceiveConfigAndData (FairMQParts &msg, int index) |
virtual void | PreRun () |
virtual void | PostRun () |
Private Member Functions | |
template<class HistoT > | |
bool | ReadHistogram (HistoT *pHist) |
int | FindHistogram (const std::string &name) |
bool | PrepareCanvas (uint32_t uCanvIdx) |
bool | ResetHistograms () |
bool | SaveHistograms () |
Private Attributes | |
std::string | fsChannelNameHistosInput = "histogram-in" |
Parameters. | |
std::string | fsChannelNameHistosConfig = "histo-conf" |
std::string | fsChannelNameCanvasConfig = "canvas-conf" |
std::string | fsHistoFileName = "MqHistos.root" |
uint32_t | fuHttpServerPort = 8098 |
TObjArray | fArrayHisto |
Array of histograms with unique names. | |
std::vector< std::pair< std::string, std::string > > | fvpsHistosFolder = {} |
Vector of string with ( HistoName, FolderPath ) to send to the histogram server. | |
std::vector< std::pair< std::string, std::string > > | fvpsCanvasConfig = {} |
std::vector< bool > | fvbCanvasReady = {} |
bool | fbAllCanvasReady = false |
std::vector< std::pair< TNamed *, std::string > > | fvHistos = {} |
std::vector< bool > | fvbHistoRegistered = {} |
Vector of Histos pointers and folder path. | |
bool | fbAllHistosRegistered = false |
std::vector< std::pair< TCanvas *, std::string > > | fvCanvas = {} |
std::vector< bool > | fvbCanvasRegistered = {} |
Vector of Canvas pointers and folder path. | |
bool | fbAllCanvasRegistered = false |
int | fNMessages = 0 |
Internal status. | |
THttpServer * | fServer = nullptr |
std::thread | fThread |
bool | fStopThread = false |
Definition at line 20 of file CbmMqHistoServer.h.
CbmMqHistoServer::CbmMqHistoServer | ( | ) |
Definition at line 36 of file CbmMqHistoServer.cxx.
|
virtual |
Definition at line 42 of file CbmMqHistoServer.cxx.
|
private |
Definition at line 358 of file CbmMqHistoServer.cxx.
References fArrayHisto.
Referenced by PrepareCanvas(), and ReadHistogram().
|
protectedvirtual |
Read options from executable
Link channels to methods in order to process received messages
If multi-parts, go to method processing combined Config+Data
To avoid the server sucking all Histos from gROOT when no output file is used
Definition at line 44 of file CbmMqHistoServer.cxx.
References fsChannelNameCanvasConfig, fsChannelNameHistosConfig, fsChannelNameHistosInput, fServer, fsHistoFileName, fuHttpServerPort, ReceiveCanvasConfig(), ReceiveConfigAndData(), ReceiveData(), and ReceiveHistoConfig().
|
protectedvirtual |
Definition at line 297 of file CbmMqHistoServer.cxx.
References fStopThread, fThread, and SaveHistograms().
|
private |
First check if all objects to be drawn are present
Check for empty pads!
Create new canvas and pads
Loop on pads
Pad settings
Add objects (we know they are there
Update flag telling whether all known canvases are registered
Definition at line 374 of file CbmMqHistoServer.cxx.
References ExtractCanvasConfigFromString(), fArrayHisto, fbAllCanvasRegistered, FindHistogram(), fServer, fvbCanvasRegistered, fvCanvas, fvpsCanvasConfig, CanvasConfig::GetGridx(), CanvasConfig::GetGridy(), CanvasConfig::GetLogx(), CanvasConfig::GetLogy(), CanvasConfig::GetLogz(), CanvasConfig::GetName(), CanvasConfig::GetNbObjsInPad(), CanvasConfig::GetNbPads(), CanvasConfig::GetNbPadsX(), CanvasConfig::GetNbPadsY(), CanvasConfig::GetObjName(), CanvasConfig::GetOption(), and CanvasConfig::GetTitle().
Referenced by ReceiveData().
|
protectedvirtual |
Definition at line 281 of file CbmMqHistoServer.cxx.
References fStopThread, fThread, and UpdateHttpServer().
|
private |
If new histo received, try to register it if configuration available
Jump histos already ready
Check if name matches one in config for others
Update flag telling whether all known histos are registered
Definition at line 306 of file CbmMqHistoServer.cxx.
References fArrayHisto, fbAllHistosRegistered, FindHistogram(), first, fServer, fvbHistoRegistered, fvHistos, and fvpsHistosFolder.
Referenced by ReceiveData().
|
protected |
Check if canvas name already received in previous messages Linear search should be ok as config is shared only at startup
Not sure if we should return false here...
Definition at line 180 of file CbmMqHistoServer.cxx.
References fbAllCanvasReady, fbAllCanvasRegistered, first, fvbCanvasReady, fvbCanvasRegistered, fvCanvas, and fvpsCanvasConfig.
Referenced by InitTask(), and ReceiveConfigAndData().
|
protected |
Reject anything but a at least Header + Histo Config + Canvas Config + Histo Data
PAL, 09/04/2021, Debug message catching missed method overload/polymorphism: contrary to my expectation, if 2 method bound to same channel, one with FairMQMessagePtr and one with FairMQParts, all messages go to multipart version and FairMQMessagePtr is converted to size 1 FairMQParts
Header contains a pair of
Decode parts for histograms configuration
Decode parts for histograms configuration
Decode the histograms data now that the configuration is loaded
Definition at line 213 of file CbmMqHistoServer.cxx.
References ReceiveCanvasConfig(), ReceiveData(), and ReceiveHistoConfig().
Referenced by InitTask().
|
protected |
Need to use Delete instead of Clear to avoid memory leak!!!
If new histos received, try to prepare as many canvases as possible Should be expensive on start and cheap afterward
Jump canvases already ready
Now come the expensive part as we unpack its config and check each histo
Definition at line 76 of file CbmMqHistoServer.cxx.
References fbAllCanvasReady, fNMessages, fvbCanvasReady, fvpsCanvasConfig, mtx, PrepareCanvas(), and ReadHistogram().
Referenced by InitTask(), and ReceiveConfigAndData().
|
protected |
Check if histo name already received in previous messages Linear search should be ok as config is shared only at startup
Not sure if we should return false here...
Definition at line 148 of file CbmMqHistoServer.cxx.
References fbAllHistosRegistered, first, fvbHistoRegistered, fvHistos, and fvpsHistosFolder.
Referenced by InitTask(), and ReceiveConfigAndData().
|
private |
Definition at line 367 of file CbmMqHistoServer.cxx.
References fArrayHisto.
|
private |
Save old global file and folder pointer to avoid messing with FairRoot
(Re-)Create ROOT file to store the histos
Register the histos in the HTTP server
Make sure we end up in chosen folder
Write plot
Make sure we end up in chosen folder
Write plot
Restore old global file and folder pointer to avoid messing with FairRoot
Definition at line 454 of file CbmMqHistoServer.cxx.
References fsHistoFileName, fvCanvas, and fvHistos.
Referenced by PostRun().
void CbmMqHistoServer::UpdateHttpServer | ( | ) |
Definition at line 287 of file CbmMqHistoServer.cxx.
References fServer, fStopThread, and mtx.
Referenced by PreRun().
|
private |
Array of histograms with unique names.
Definition at line 52 of file CbmMqHistoServer.h.
Referenced by FindHistogram(), PrepareCanvas(), ReadHistogram(), and ResetHistograms().
|
private |
Definition at line 60 of file CbmMqHistoServer.h.
Referenced by ReceiveCanvasConfig(), and ReceiveData().
|
private |
Definition at line 67 of file CbmMqHistoServer.h.
Referenced by PrepareCanvas(), and ReceiveCanvasConfig().
|
private |
Definition at line 64 of file CbmMqHistoServer.h.
Referenced by ReadHistogram(), and ReceiveHistoConfig().
|
private |
|
private |
Definition at line 47 of file CbmMqHistoServer.h.
Referenced by InitTask().
|
private |
Definition at line 46 of file CbmMqHistoServer.h.
Referenced by InitTask().
|
private |
|
private |
Definition at line 72 of file CbmMqHistoServer.h.
Referenced by InitTask(), PrepareCanvas(), ReadHistogram(), and UpdateHttpServer().
|
private |
Definition at line 48 of file CbmMqHistoServer.h.
Referenced by InitTask(), and SaveHistograms().
|
private |
Definition at line 75 of file CbmMqHistoServer.h.
Referenced by PostRun(), PreRun(), and UpdateHttpServer().
|
private |
Definition at line 74 of file CbmMqHistoServer.h.
|
private |
Definition at line 49 of file CbmMqHistoServer.h.
Referenced by InitTask().
|
private |
Definition at line 59 of file CbmMqHistoServer.h.
Referenced by ReceiveCanvasConfig(), and ReceiveData().
|
private |
Vector of Canvas pointers and folder path.
Definition at line 66 of file CbmMqHistoServer.h.
Referenced by PrepareCanvas(), and ReceiveCanvasConfig().
|
private |
Vector of Histos pointers and folder path.
Definition at line 63 of file CbmMqHistoServer.h.
Referenced by ReadHistogram(), and ReceiveHistoConfig().
|
private |
Definition at line 65 of file CbmMqHistoServer.h.
Referenced by PrepareCanvas(), ReceiveCanvasConfig(), and SaveHistograms().
|
private |
Definition at line 62 of file CbmMqHistoServer.h.
Referenced by ReadHistogram(), ReceiveHistoConfig(), and SaveHistograms().
|
private |
Vector of string pairs with ( CanvasName, CanvasConfig ) to send to the histogram server Format of Can config is "Name;Title;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 58 of file CbmMqHistoServer.h.
Referenced by PrepareCanvas(), ReceiveCanvasConfig(), and ReceiveData().
|
private |
Vector of string with ( HistoName, FolderPath ) to send to the histogram server.
Definition at line 54 of file CbmMqHistoServer.h.
Referenced by ReadHistogram(), and ReceiveHistoConfig().