Diana Software
QGHistogram.hh
Go to the documentation of this file.
1 #ifndef _QG_HISTOGRAM_HH_
2 #define _QG_HISTOGRAM_HH_
3 
11 #include <list>
12 #include <string>
13 #include <vector>
14 #include "QGPlot.hh"
15 #include "TH1D.h"
16 
18 
19 class QGHistogram : public TH1D, public QGPlot {
20 public:
22  QGHistogram();
23 
25  QGHistogram(const QGHistogram&);
26 
28  virtual ~QGHistogram();
29 
31  void AutoSetAxisParameters();
32 
34  void AutoSetStyle();
35 
37  void Display();
38 
40  void DisplayEditWindow();
41 
43  void DrawStyleHistogram();
44 
46  void Duplicate();
47 
49  void Erase();
50 
52  void Generate(QChain *chain = 0);
53 
55  Double_t GetBinWidth(Int_t bin=0) const {return fBinWidth;}
56 
58  static const std::list<QGHistogram*>& GetHistograms() {return fHistograms;}
59 
61  const char* GetName() const;
62 
64  Int_t GetNumberOfBins() const;
65 
68 
71 
73  Double_t GetXMin() const;
74 
76  Double_t GetXMax() const;
77 
79  bool IsBinWidthSet() {return fIsBinWidthSet;}
80 
82  bool IsXMaxSet() {return !fAutoSetXMax;}
83 
85  bool IsXMinSet() {return !fAutoSetXMin;}
86 
89 
91  void MakeStylePlot();
92 
94  void SetBinWidth(Double_t binWidth) {fBinWidth = binWidth; fIsBinWidthSet = true;}
95 
97  void SetName(const char *name = 0);
98 
100  void SetNumberOfBins(Int_t numberOfBins);
101 
103  void SetProperty(const std::string& key, const std::string& value);
104 
106  void SetXMax(Double_t xMax);
107 
109  void SetXMin(Double_t xMin);
110 
111 private:
114 
117 
120 
122  Double_t fBinWidth;
123 
125  std::vector<Double_t> fDataPoints;
126 
128  std::string fDrawOption;
129 
131  static std::list<QGHistogram*> fHistograms;
132 
135 
138 
141 
142  ClassDef(QGHistogram, 0)
143 };
144 
145 #endif
TChain used in diana.
Definition: QChain.hh:23
Class for histogram edit window.
Class for GUI histograms.
Definition: QGHistogram.hh:19
bool IsXMinSet()
Return true if x-axis minimum is set.
Definition: QGHistogram.hh:85
void SetNumberOfBins(Int_t numberOfBins)
Set number of bins.
Definition: QGHistogram.cc:416
virtual ~QGHistogram()
Destructor.
Definition: QGHistogram.cc:70
bool fAutoSetNumberOfBins
Flag to automatically set the number of bins.
Definition: QGHistogram.hh:113
void DrawStyleHistogram()
Draw a mini-histogram showing the style of this histogram.
Definition: QGHistogram.cc:248
void Erase()
Erase histogram.
Definition: QGHistogram.cc:271
Int_t fNumberOfUniqueDataPoints
Number of unique values among the data points, up to max 100.
Definition: QGHistogram.hh:137
Double_t GetXMax() const
Get x-max.
Definition: QGHistogram.cc:369
void AutoSetStyle()
Automatically set the histogram style.
Definition: QGHistogram.cc:136
Int_t GetNumberOfBins() const
Get number of bins.
Definition: QGHistogram.cc:374
Double_t GetXMin() const
Get x-min.
Definition: QGHistogram.cc:364
QGHistogram()
Default constructor.
Definition: QGHistogram.cc:43
void SetProperty(const std::string &key, const std::string &value)
Set property (used for opening a session)
Definition: QGHistogram.cc:421
std::string fDrawOption
Draw option.
Definition: QGHistogram.hh:128
bool fAutoSetXMin
Flag to automatically set the x-axis minimum.
Definition: QGHistogram.hh:119
void Duplicate()
Duplicate the histogram.
Definition: QGHistogram.cc:264
void Display()
Display histogram.
Definition: QGHistogram.cc:156
bool IsBinWidthSet()
Return true if bin width is set.
Definition: QGHistogram.hh:79
TH1D * fStyleHistogram
Mini-histogram to show style of this histogram.
Definition: QGHistogram.hh:140
void SetXMax(Double_t xMax)
Set x-max.
Definition: QGHistogram.cc:491
void MakeStylePlot()
Make style plot.
Definition: QGHistogram.cc:379
TH1D * GetStyleHistogram()
Get style histogram.
Definition: QGHistogram.hh:70
Double_t fBinWidth
Bin width.
Definition: QGHistogram.hh:122
const char * GetName() const
Get name of histogram.
Definition: QGHistogram.cc:321
bool fAutoSetXMax
Flag to automatically set the x-axis maximum.
Definition: QGHistogram.hh:116
std::vector< Double_t > fDataPoints
Collection of points underlying the histogram, useful for instant rebinning.
Definition: QGHistogram.hh:125
void DisplayEditWindow()
Display edit window for the histogram.
Definition: QGHistogram.cc:235
static const std::list< QGHistogram * > & GetHistograms()
Get collection of histograms.
Definition: QGHistogram.hh:58
void SetName(const char *name=0)
Set name of histogram.
Definition: QGHistogram.cc:395
Double_t GetBinWidth(Int_t bin=0) const
Get bin width.
Definition: QGHistogram.hh:55
void Generate(QChain *chain=0)
Generate histogram.
Definition: QGHistogram.cc:282
void SetXMin(Double_t xMin)
Set x-min.
Definition: QGHistogram.cc:496
bool IsXMaxSet()
Return true if x-axis maximum is set.
Definition: QGHistogram.hh:82
void AutoSetAxisParameters()
Automatically set axis parameters.
Definition: QGHistogram.cc:82
void GetParametersFromEditWindow()
Get parameters from edit window.
Definition: QGHistogram.cc:326
bool IsNumberOfBinsSet()
Return true if number of bins is set.
Definition: QGHistogram.hh:88
bool fIsBinWidthSet
Whether or not bin width is set.
Definition: QGHistogram.hh:134
void SetBinWidth(Double_t binWidth)
Set bin width.
Definition: QGHistogram.hh:94
static std::list< QGHistogram * > fHistograms
Collection of pointers to all QGHistograms.
Definition: QGHistogram.hh:131
Base class for GUI plots including histograms, scatter plots, pulses, and graphical cuts.
Definition: QGPlot.hh:21