00001 #ifndef _Q_MULTI_SCATTER_PLOT_HH_ 00002 #define _Q_MULTI_SCATTER_PLOT_HH_ 00003 00004 #include "QCuore.hh" 00005 #include "QIntervalSet.hh" 00006 #include <TF1.h> 00007 #include <TGraph.h> 00008 #include <TH1D.h> 00009 #include <map> 00010 #include <string> 00011 #include <vector> 00012 00013 Q_BEGIN_NAMESPACE 00014 00015 namespace ROOT {class TH1D;} 00016 00017 class QMultiScatterPlot { 00018 00019 public: 00020 QMultiScatterPlot(); 00021 00022 QMultiScatterPlot(const QMultiScatterPlot& other); 00023 00024 virtual ~QMultiScatterPlot(); 00025 00026 const QMultiScatterPlot& operator=(const QMultiScatterPlot& other); 00027 00028 void AddEntry(const double x, const double y, const int graphIndex = 0); 00029 00030 void AddFunction(const TF1* func, const int graphIndex = 0); 00031 00032 void AutoSetDisplayInRange( 00033 const double xLowerBound, const double xUpperBound, 00034 const double yLowerBound, const double yUpperBound 00035 ); 00036 00037 void AutoSetXAxisDisplayInRange( 00038 const double xLowerBound, const double xUpperBound); 00039 00040 void AutoSetYAxisDisplayInRange( 00041 const double yLowerBound, const double yUpperBound); 00042 00043 void Clear(); 00044 00045 void Draw(Option_t* chopt = ""); 00046 00047 int GetChannel() const 00048 { 00049 return fChannel; 00050 } 00051 00052 double GetMean(const Int_t axis = 2) const; 00053 00054 double GetMedianAbsoluteDeviationInRange(const Int_t axis, 00055 const double lowerBound, const double upperBound) const; 00056 00057 double GetMedianInRange(const Int_t axis, const double lowerBound, 00058 const double upperBound) const; 00059 00060 std::string GetName() const 00061 { 00062 return fName; 00063 } 00064 00065 double GetRMS(const Int_t axis = 2) const; 00066 00067 int GetRun() const 00068 { 00069 return fRun; 00070 } 00071 00072 const std::string& GetVarName() const 00073 { 00074 return fVarName; 00075 } 00076 00077 void Projection(const Int_t axis, TH1D& histogram); 00078 00079 void SaveAs(const std::string filename, Option_t* option = ""); 00080 00081 void SetChannel(const int channel) 00082 { 00083 fChannel = channel; 00084 SetName(); 00085 } 00086 00087 void SetName(); 00088 00089 void SetRun(const int run) 00090 { 00091 fRun = run; 00092 SetName(); 00093 } 00094 00095 void SetShadedIntervals(const QIntervalSet& intervals) 00096 { 00097 fShadedIntervals = intervals; 00098 } 00099 00100 void SetTitle(const std::string title); 00101 00102 void SetVarName(const std::string varName) 00103 { 00104 fVarName = varName; 00105 SetName(); 00106 } 00107 00108 void SetXVariable(const std::string var); 00109 00110 void SetYVariable(const std::string var); 00111 00112 private: 00113 int fChannel; 00114 00115 std::vector<Color_t> fColors; 00116 00117 std::map<int, TF1*> fFunction; 00118 00119 std::map<int, TGraph*> fGraph; 00120 00121 TH1D* fHistogram; 00122 00123 bool fIsXRangeAutoSet; 00124 00125 bool fIsYRangeAutoSet; 00126 00127 std::string fName; 00128 00129 int fNumPoints; 00130 00131 int fRun; 00132 00133 QIntervalSet fShadedIntervals; 00134 00135 std::string fTitle; 00136 00137 std::string fVarName; 00138 00139 double fXMax; 00140 00141 double fXMin; 00142 00143 std::string fXVariable; 00144 00145 double fYMax; 00146 00147 double fYMin; 00148 00149 std::string fYVariable; 00150 00151 }; 00152 00153 Q_END_NAMESPACE 00154 00155 #endif