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) |
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 |
Parameters. More... | |
std::string | fsChannelNameHistosConfig |
std::string | fsChannelNameCanvasConfig |
std::string | fsHistoFileName |
uint32_t | fuHttpServerPort |
TObjArray | fArrayHisto |
Array of histograms with unique names. More... | |
std::vector< std::pair< std::string, std::string > > | fvpsHistosFolder |
Vector of string with ( HistoName, FolderPath ) to send to the histogram server. More... | |
std::vector< std::pair< std::string, std::string > > | fvpsCanvasConfig |
std::vector< bool > | fvbCanvasReady |
bool | fbAllCanvasReady |
std::vector< std::pair< TNamed *, std::string > > | fvHistos |
std::vector< bool > | fvbHistoRegistered |
Vector of Histos pointers and folder path. More... | |
bool | fbAllHistosRegistered |
std::vector< std::pair< TCanvas *, std::string > > | fvCanvas |
std::vector< bool > | fvbCanvasRegistered |
Vector of Canvas pointers and folder path. More... | |
bool | fbAllCanvasRegistered |
int | fNMessages |
Internal status. More... | |
THttpServer * | fServer |
std::thread | fThread |
bool | fStopThread |
Definition at line 23 of file CbmMqHistoServer.h.
CbmMqHistoServer::CbmMqHistoServer | ( | ) |
Definition at line 36 of file CbmMqHistoServer.cxx.
|
virtual |
Definition at line 52 of file CbmMqHistoServer.cxx.
|
private |
Definition at line 287 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
To avoid the server sucking all Histos from gROOT when no output file is used
Definition at line 54 of file CbmMqHistoServer.cxx.
References fsChannelNameCanvasConfig, fsChannelNameHistosConfig, fsChannelNameHistosInput, fServer, fsHistoFileName, fuHttpServerPort, ReceiveCanvasConfig(), ReceiveData(), and ReceiveHistoConfig().
|
protectedvirtual |
Definition at line 227 of file CbmMqHistoServer.cxx.
References fStopThread, and fThread.
|
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 303 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 213 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 233 of file CbmMqHistoServer.cxx.
References fArrayHisto, fbAllHistosRegistered, FindHistogram(), first, fServer, fvbHistoRegistered, fvHistos, and fvpsHistosFolder.
|
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 179 of file CbmMqHistoServer.cxx.
References fbAllCanvasReady, fbAllCanvasRegistered, first, fvbCanvasReady, fvbCanvasRegistered, fvCanvas, and fvpsCanvasConfig.
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
TODO: control flags communication with histo server Idea: 1 req channel (per device or not mixup?), polling every N TS and/or M s
Definition at line 79 of file CbmMqHistoServer.cxx.
References bMqHistoServerResetHistos, bMqHistoServerSaveHistos, fbAllCanvasReady, fNMessages, fvbCanvasReady, fvpsCanvasConfig, i, mtx, PrepareCanvas(), ResetHistograms(), and SaveHistograms().
Referenced by InitTask().
|
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 147 of file CbmMqHistoServer.cxx.
References fbAllHistosRegistered, first, fvbHistoRegistered, fvHistos, and fvpsHistosFolder.
Referenced by InitTask().
|
private |
Definition at line 297 of file CbmMqHistoServer.cxx.
References fArrayHisto.
Referenced by ReceiveData().
|
private |
(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
Definition at line 383 of file CbmMqHistoServer.cxx.
References fsHistoFileName, fvCanvas, and fvHistos.
Referenced by ReceiveData().
void CbmMqHistoServer::UpdateHttpServer | ( | ) |
Definition at line 218 of file CbmMqHistoServer.cxx.
References fServer, fStopThread, and mtx.
Referenced by PreRun().
|
private |
Array of histograms with unique names.
Definition at line 53 of file CbmMqHistoServer.h.
Referenced by FindHistogram(), PrepareCanvas(), ReadHistogram(), and ResetHistograms().
|
private |
Definition at line 61 of file CbmMqHistoServer.h.
Referenced by ReceiveCanvasConfig(), and ReceiveData().
|
private |
Definition at line 70 of file CbmMqHistoServer.h.
Referenced by PrepareCanvas(), and ReceiveCanvasConfig().
|
private |
Definition at line 66 of file CbmMqHistoServer.h.
Referenced by ReadHistogram(), and ReceiveHistoConfig().
|
private |
|
private |
Definition at line 48 of file CbmMqHistoServer.h.
Referenced by InitTask().
|
private |
Definition at line 47 of file CbmMqHistoServer.h.
Referenced by InitTask().
|
private |
|
private |
Definition at line 75 of file CbmMqHistoServer.h.
Referenced by InitTask(), PrepareCanvas(), ReadHistogram(), and UpdateHttpServer().
|
private |
Definition at line 49 of file CbmMqHistoServer.h.
Referenced by InitTask(), and SaveHistograms().
|
private |
Definition at line 78 of file CbmMqHistoServer.h.
Referenced by PostRun(), PreRun(), and UpdateHttpServer().
|
private |
Definition at line 77 of file CbmMqHistoServer.h.
|
private |
Definition at line 50 of file CbmMqHistoServer.h.
Referenced by InitTask().
|
private |
Definition at line 60 of file CbmMqHistoServer.h.
Referenced by ReceiveCanvasConfig(), and ReceiveData().
|
private |
Vector of Canvas pointers and folder path.
Definition at line 69 of file CbmMqHistoServer.h.
Referenced by PrepareCanvas(), and ReceiveCanvasConfig().
|
private |
Vector of Histos pointers and folder path.
Definition at line 65 of file CbmMqHistoServer.h.
Referenced by ReadHistogram(), and ReceiveHistoConfig().
|
private |
Definition at line 68 of file CbmMqHistoServer.h.
Referenced by PrepareCanvas(), ReceiveCanvasConfig(), and SaveHistograms().
|
private |
Definition at line 64 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 59 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 55 of file CbmMqHistoServer.h.
Referenced by ReadHistogram(), and ReceiveHistoConfig().