Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OnlMonClient.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file OnlMonClient.h
1 #ifndef ONLMONCLIENT_ONLMONCLIENT_H
2 #define ONLMONCLIENT_ONLMONCLIENT_H
3 
4 #include <onlmon/OnlMonBase.h>
5 #include <onlmon/OnlMonDefs.h>
6 
7 #include <ctime>
8 #include <list>
9 #include <map>
10 #include <set>
11 #include <string>
12 #include <vector>
13 
14 class ClientHistoList;
15 class OnlMonDraw;
16 class OnlMonHtml;
17 class TCanvas;
18 class TH1;
19 class TStyle;
20 
21 class OnlMonClient : public OnlMonBase
22 {
23  public:
24  static OnlMonClient *instance();
25  ~OnlMonClient() override;
27  void Verbosity(const int i) override;
28 
29  int UpdateServerHistoMap(const std::string &hname, const std::string &subsys, const std::string &hostname);
30  void PutHistoInMap(const std::string &hname, const std::string &subsys, const std::string &hostname, const int port);
31  void updateHistoMap(const std::string &subsys, const std::string &hname, TH1 *h1d);
32  int requestMonitorList(const std::string &hostname, const int moniport);
33  TH1 *getHisto(const std::string &monitor, const std::string &hname);
35  int requestHisto(const std::string &what = "ALL", const std::string &hostname = "localhost", const int moniport = OnlMonDefs::MONIPORT);
36  int requestHistoList(const std::string &subsys, const std::string &hostname, const int moniport, std::list<std::string> &histolist);
37  int requestHistoByName(const std::string &subsystem, const std::string &what = "ALL");
38  int requestHistoBySubSystem(const std::string &subsystem, int getall = 0);
39  void registerHisto(const std::string &hname, const std::string &subsys);
40  void Print(const char *what = "ALL");
41 
42  void AddServerHost(const std::string &hostname);
43  void registerDrawer(OnlMonDraw *Drawer);
45  int Draw(const char *who = "ALL", const char *what = "ALL");
46  int MakePS(const char *who = "ALL", const char *what = "ALL");
47  int MakeHtml(const char *who = "ALL", const char *what = "ALL");
48  int SavePlot(const std::string &who = "ALL", const std::string &what = "ALL");
49 
51  const std::string &path,
52  const std::string &basefilename,
53  const std::string &ext);
54 
55  void htmlAddMenu(const OnlMonDraw &drawer, const std::string &path,
56  const std::string &relfilename);
57 
58  void htmlNamer(const OnlMonDraw &drawer, const std::string &basefilename,
59  const std::string &ext, std::string &fullfilename,
60  std::string &filename);
61 
62  int LocateHistogram(const std::string &hname, const std::string &subsys);
63  int RunNumber();
64  time_t EventTime(const std::string &which);
65  time_t EventTime(const std::string &servername, const std::string &which);
66  int SendCommand(const char *hostname, const int port, const char *cmd);
67 
68  void SetDisplaySizeX(int xsize) { display_sizex = xsize; }
69  void SetDisplaySizeY(int ysize) { display_sizey = ysize; }
70  int GetDisplaySizeX() { return display_sizex; }
71  int GetDisplaySizeY() { return display_sizey; }
72  int CanvasToPng(TCanvas *canvas, std::string const &filename);
73  int HistoToPng(TH1 *histo, std::string const &pngfilename, const char *drawopt = "", const int statopt = 11);
74 
75  int SaveLogFile(const OnlMonDraw &drawer);
76  int SetStyleToDefault();
77  int isCosmicRun();
78  int isStandalone();
80  void CacheRunDB(const int runno);
81  void FindAllMonitors();
82  int FindMonitor(const std::string &name);
83  int IsMonitorRunning(const std::string &name);
84  std::string ExtractSubsystem(const std::string &filename);
85 
86  private:
87  OnlMonClient(const std::string &name = "ONLMONCLIENT");
88  int DoSomething(const std::string &who, const std::string &what, const std::string &opt);
89  void InitAll();
90 
92  OnlMonHtml *fHtml = nullptr;
93  TH1 *clientrunning = nullptr;
94  TStyle *defaultStyle = nullptr;
95 
96  int display_sizex = 0;
97  int display_sizey = 0;
98  int cosmicrun = 0;
99  int standalone = 0;
100  int cachedrun = 0;
101 
102  std::string runtype = "UNKNOWN";
103  std::set<std::string> m_MonitorFetchedSet;
104  std::map<std::string, std::map<const std::string, ClientHistoList *>> SubsysHisto;
105  std::map<std::string, std::pair<std::string, unsigned int>> MonitorHostPorts;
106  std::map<const std::string, ClientHistoList *> Histo;
107  std::map<const std::string, OnlMonDraw *> DrawerList;
108  std::vector<std::string> MonitorHosts;
109 };
110 
111 #endif /* ONLMONCLIENT_ONLMONCLIENT_H */