Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TpotMonDraw.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TpotMonDraw.h
1 #ifndef TPOT_TPOTMONDRAW_H
2 #define TPOT_TPOTMONDRAW_H
3 
4 #include "MicromegasGeometry.h"
5 
8 #include <onlmon/OnlMonDraw.h>
9 
10 #include <TFile.h>
11 
12 #include <array>
13 #include <memory>
14 #include <string>
15 
16 class OnlMonDB;
17 class TCanvas;
18 class TH1;
19 class TPad;
20 
21 class TpotMonDraw : public OnlMonDraw
22 {
23  public:
24 
27 
29  ~TpotMonDraw() override = default;
30 
31  int Init() override;
32  int Draw(const std::string &what = "ALL") override;
33  int MakeHtml(const std::string &what = "ALL") override;
34  int SavePlot(const std::string &what = "ALL", const std::string &type = "png") override;
35 
36  // get detector names
37  std::vector<std::string> get_detnames_sphenix() const
38  { return m_detnames_sphenix; }
39 
40  // define signal sample window
41  using sample_window_t = std::pair<int, int>;
44 
45  private:
46 
47  // draw message to specify that server is dead
48  int DrawDeadServer(TPad*) override;
49 
50  // draw run and time in a given pad
51  void draw_time( TPad*);
52 
53  TCanvas* get_canvas(const std::string& name, bool clear = true );
54  TCanvas* create_canvas(const std::string &name);
55 
56  int draw_counters();
59 
60  using histogram_array_t = std::array<TH1*, MicromegasDefs::m_nfee>;
61 
62  // drawing options
64  {
65  None = 0,
66  Logx = 1<<0,
67  Logy = 1<<1,
68  Logz = 1<<2,
69  Colz = 1<<3
70  };
71 
73  TH1* get_histogram( const std::string& name ) const;
74 
76  histogram_array_t get_histograms( const std::string& name ) const;
77 
79  TH1* get_ref_histogram( const std::string& name ) const;
80 
82  histogram_array_t get_ref_histograms( const std::string& name ) const;
83 
86 
88 
89  double get_ref_scale_factor() const;
90 
92  /*
93  * a copy of the source histogram is done. It must be deleted after the fact
94  */
95  TH1* normalize( TH1*, double scale = 1 ) const;
96 
98  int draw_array( const std::string& name, const histogram_array_t& array, unsigned int options = DrawOptions::None )
99  { return draw_array( name, array, {{nullptr}}, options ); }
100 
102  int draw_array( const std::string& name, const histogram_array_t&, const histogram_array_t& /*reference*/, unsigned int /*options*/ = DrawOptions::None );
103 
105 
106  void draw_detnames_sphenix( const std::string& suffix = std::string());
107 
110 
113 
115  std::vector<std::string> m_detnames_sphenix;
116 
118  int TimeOffsetTicks = -1;
119 
120  // sample window
122 
123  // reference histograms filename
125 
126  // reference histograms TFile
127  std::unique_ptr<TFile> m_ref_histograms_tfile;
128 
129  // canvases
130  std::vector<TCanvas*> m_canvas;
131  std::unique_ptr<OnlMonDB> dbvars;
132 };
133 
134 #endif /* TPOT_TPOTMONDRAW_H */