00001 #ifndef _QG_HISTOGRAM_HH_ 00002 #define _QG_HISTOGRAM_HH_ 00003 00011 #include <list> 00012 #include <string> 00013 #include <vector> 00014 #include "QGPlot.hh" 00015 #include "TH1D.h" 00016 00017 class QGHistogramEditWindow; 00018 00019 class QGHistogram : public TH1D, public QGPlot { 00020 public: 00022 QGHistogram(); 00023 00025 QGHistogram(const QGHistogram&); 00026 00028 virtual ~QGHistogram(); 00029 00031 void AutoSetAxisParameters(); 00032 00034 void AutoSetStyle(); 00035 00037 void Display(); 00038 00040 void DisplayEditWindow(); 00041 00043 void DrawStyleHistogram(); 00044 00046 void Duplicate(); 00047 00049 void Erase(); 00050 00052 void Generate(QChain *chain = 0); 00053 00055 Double_t GetBinWidth() const {return fBinWidth;} 00056 00058 static const std::list<QGHistogram*>& GetHistograms() {return fHistograms;} 00059 00061 const char* GetName() const; 00062 00064 Int_t GetNumberOfBins() const; 00065 00067 void GetParametersFromEditWindow(); 00068 00070 TH1D *GetStyleHistogram() {return fStyleHistogram;} 00071 00073 Double_t GetXMin() const; 00074 00076 Double_t GetXMax() const; 00077 00079 bool IsBinWidthSet() {return fIsBinWidthSet;} 00080 00082 bool IsXMaxSet() {return !fAutoSetXMax;} 00083 00085 bool IsXMinSet() {return !fAutoSetXMin;} 00086 00088 bool IsNumberOfBinsSet() {return !fAutoSetNumberOfBins;} 00089 00091 void MakeStylePlot(); 00092 00094 void SetBinWidth(Double_t binWidth) {fBinWidth = binWidth; fIsBinWidthSet = true;} 00095 00097 void SetName(const char *name = 0); 00098 00100 void SetNumberOfBins(Int_t numberOfBins); 00101 00103 void SetProperty(const std::string& key, const std::string& value); 00104 00106 void SetXMax(Double_t xMax); 00107 00109 void SetXMin(Double_t xMin); 00110 00111 private: 00113 bool fAutoSetNumberOfBins; 00114 00116 bool fAutoSetXMax; 00117 00119 bool fAutoSetXMin; 00120 00122 Double_t fBinWidth; 00123 00125 std::vector<Double_t> fDataPoints; 00126 00128 std::string fDrawOption; 00129 00131 static std::list<QGHistogram*> fHistograms; 00132 00134 bool fIsBinWidthSet; 00135 00137 Int_t fNumberOfUniqueDataPoints; 00138 00140 TH1D *fStyleHistogram; 00141 00142 ClassDef(QGHistogram, 0) 00143 }; 00144 00145 #endif