Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OnlMonClient.h
Go to the documentation of this file.
1 #ifndef _ONL_MON_CLIENT__H_
2 #define _ONL_MON_CLIENT__H_
3 #include <fun4all/SubsysReco.h>
4 #include "OnlMonCanvas.h"
6 class TSocket;
7 class TH1;
8 class TH2;
9 class TH3;
10 
12 
35 class OnlMonClient: public SubsysReco {
36  protected:
37  typedef enum { MODE_ADD, MODE_UPDATE } HistMode_t;
38 
39  private:
40  std::string m_title;
41  Fun4AllHistoManager* m_hm;
42  int m_n_can;
43  OnlMonCanvas* m_list_can[9];
44 
45  typedef std::map<std::string, HistMode_t> HistModeMap_t;
46  HistModeMap_t m_hist_mode;
47 
48  typedef enum { BIN_RUN = 1, BIN_SPILL = 2, BIN_EVENT = 3, BIN_SPILL_MIN = 4, BIN_SPILL_MAX = 5 } BasicIdBin_t;
49  typedef enum { BIN_N_EVT = 1, BIN_N_SP = 2 } BasicInfoBin_t;
50  TH1* m_h1_basic_id;
51  TH1* m_h1_basic_cnt;
52 
53  typedef std::vector<TH1*> HistList_t;
54  HistList_t m_list_h1;
55 
56  typedef std::map<int, TH1*> SpillHistMap_t; // [spill] -> TH1*
57  typedef std::map<std::string, SpillHistMap_t> Name2SpillHistMap_t; // [hist name]
58  Name2SpillHistMap_t m_map_hist_sp;
59  int m_spill_id_pre;
60  bool m_make_sp_hist; //< True if spill-by-spill hists are active.
61 
63  typedef std::vector<OnlMonClient*> SelfList_t;
64  static SelfList_t m_list_us;
65  static bool m_bl_clear_us;
66 
67  public:
68  OnlMonClient();
69  virtual ~OnlMonClient();
70  virtual OnlMonClient* Clone();
71 
72  void Title(const std::string &title) { m_title = title; }
73  std::string Title() { return m_title; }
74 
75  int Init(PHCompositeNode *topNode);
76  int InitRun(PHCompositeNode *topNode);
77  int process_event(PHCompositeNode *topNode);
78  int End(PHCompositeNode *topNode);
79 
80  void GetBasicID(int* run_id=0, int* spill_id=0, int* event_id=0, int* spill_id_min=0, int* spill_id_max=0);
81  void GetBasicCount(int* n_evt=0, int* n_sp=0);
82  int StartMonitor();
83  TH1* FindMonHist(const std::string name, const bool non_null=true);
84 
85  virtual int InitOnlMon(PHCompositeNode *topNode);
86  virtual int InitRunOnlMon(PHCompositeNode *topNode);
87  virtual int ProcessEventOnlMon(PHCompositeNode *topNode);
88  virtual int EndOnlMon(PHCompositeNode *topNode);
89  virtual int FindAllMonHist();
90  virtual int DrawMonitor();
91 
92  static void SetClearUsFlag(const bool val) { m_bl_clear_us = val; }
93  static bool GetClearUsFlag() { return m_bl_clear_us; }
94 
95  int SendHist(TSocket* sock, int sp_min, int sp_max);
96 
97  protected:
98  void RegisterHist(TH1* h1, const HistMode_t mode=MODE_ADD);
99 
100  void NumCanvases(const int num) { m_n_can = num; }
101  int NumCanvases() { return m_n_can; }
102  OnlMonCanvas* GetCanvas(const int num=0);
103 
104  private:
105  void ClearSpillHist();
106  void MakeSpillHist(const int spill_id, const int spill_id_new=0);
107  void DisableSpillHist();
108  void MakeMergedHist(HistList_t& list_h1, const int sp_min=0, const int sp_max=0);
109  int ReceiveHist();
110  void ClearHistList(HistList_t& list_h1);
111  void ClearCanvasList();
112  int DrawCanvas(const bool at_end=false);
113 };
114 
115 #endif /* _ONL_MON_CLIENT__H_ */
virtual int EndOnlMon(PHCompositeNode *topNode)
int NumCanvases()
Definition: OnlMonClient.h:101
OnlMonCanvas * GetCanvas(const int num=0)
int SendHist(TSocket *sock, int sp_min, int sp_max)
void GetBasicCount(int *n_evt=0, int *n_sp=0)
int process_event(PHCompositeNode *topNode)
Definition: OnlMonClient.cc:88
virtual int InitOnlMon(PHCompositeNode *topNode)
int StartMonitor()
void RegisterHist(TH1 *h1, const HistMode_t mode=MODE_ADD)
std::string Title()
Definition: OnlMonClient.h:73
void Title(const std::string &title)
Definition: OnlMonClient.h:72
virtual int FindAllMonHist()
int InitRun(PHCompositeNode *topNode)
Definition: OnlMonClient.cc:61
void NumCanvases(const int num)
Definition: OnlMonClient.h:100
virtual int ProcessEventOnlMon(PHCompositeNode *topNode)
void GetBasicID(int *run_id=0, int *spill_id=0, int *event_id=0, int *spill_id_min=0, int *spill_id_max=0)
virtual OnlMonClient * Clone()
Definition: OnlMonClient.cc:49
int End(PHCompositeNode *topNode)
Called at the end of all processing.
int Init(PHCompositeNode *topNode)
Definition: OnlMonClient.cc:55
static bool GetClearUsFlag()
Definition: OnlMonClient.h:93
virtual ~OnlMonClient()
Definition: OnlMonClient.cc:40
TH1 * FindMonHist(const std::string name, const bool non_null=true)
virtual int DrawMonitor()
virtual int InitRunOnlMon(PHCompositeNode *topNode)
Base class for the OnlMon subsystem module.
Definition: OnlMonClient.h:35
static void SetClearUsFlag(const bool val)
Definition: OnlMonClient.h:92