00001 00012 /* 00013 * Copyright (C) 2008, Daniel Kollar and Kevin Kroeninger. 00014 * All rights reserved. 00015 * 00016 * For the licensing terms see doc/COPYING. 00017 */ 00018 00019 // --------------------------------------------------------- 00020 00021 #ifndef __BCH2D__H 00022 #define __BCH2D__H 00023 00024 #include <vector> 00025 00026 #include <TH1D.h> 00027 #include <TH2D.h> 00028 #include <TGraph.h> 00029 00030 // --------------------------------------------------------- 00031 00032 class BCH2D 00033 { 00034 00035 public: 00036 00038 /* @{ */ 00039 00043 BCH2D(); 00044 00048 ~BCH2D(); 00049 00050 /* @} */ 00051 00053 /* @{ */ 00054 00058 TH2D * GetHistogram() 00059 { return fHistogram; }; 00060 00064 void GetMean(double& mean); 00065 00069 void GetMode(double& mode); 00070 00071 /* @} */ 00072 00074 /* @{ */ 00075 00079 void SetHistogram(TH2D * hist) 00080 { fHistogram = hist; }; 00081 00086 void SetGlobalMode(double mode[2]) 00087 { fMode[0] = mode[0]; fMode[1] = mode[1]; fModeFlag =1; }; 00088 00089 /* @} */ 00090 00092 /* @{ */ 00093 00094 // methods 00095 00104 void Print(const char * filename, int options=0, int ww=0, int wh=0); 00105 00110 void Draw(int options=0); 00111 00112 /* 00113 * Calculates the integral of the distribution as a function of the 00114 * height. 00115 */ 00116 void CalculateIntegratedHistogram(); 00117 00118 /* 00119 * Calculates the height below which the integrated probability has 00120 * a certain value. 00121 * @param p The integrated probability in the region below the height to be estimated. 00122 */ 00123 double GetLevel(double p); 00124 00131 std::vector <int> GetNIntervalsY(TH2D * h, int &nfoundmax); 00132 00136 TGraph * GetLowestBandGraph(TH2D * h, std::vector<int> nint); 00137 TGraph * GetLowestBandGraph(TH2D * h); 00138 00139 00140 std::vector <double> GetLevelBoundary(TH2D * h, double level); 00141 TGraph * GetBandGraph(TH2D * h , double level1, double level2); 00142 00143 TGraph ** GetBandGraphs(TH2D * h); 00144 TGraph ** GetBandGraphs(TH2D * h, int &n); 00145 00146 /* @} */ 00147 00148 private: 00149 00153 TH2D * fHistogram; 00154 00158 TH1D * fIntegratedHistogram; 00159 00163 double fMode[2]; 00164 00168 int fModeFlag; 00169 00170 }; 00171 00172 // --------------------------------------------------------- 00173 00174 #endif