00001 00011 /* 00012 * Copyright (C) 2008, Daniel Kollar and Kevin Kroeninger. 00013 * All rights reserved. 00014 * 00015 * For the licensing terms see doc/COPYING. 00016 */ 00017 00018 // --------------------------------------------------------- 00019 00020 #ifndef __BCMODELTEST__H 00021 #define __BCMODELTEST__H 00022 00023 #include "BCModel.h" 00024 00025 // --------------------------------------------------------- 00026 00027 class BCModelTest : public BCModel 00028 { 00029 00030 public: 00031 00033 /* @{ */ 00034 BCModelTest(const char* name); 00038 00042 ~BCModelTest(); 00043 00044 /* @} */ 00045 00047 /* @{ */ 00048 00049 /* 00050 * Calculated the p-value. 00051 * @param flag_histogram A histogram is either filled or not. 00052 * @return The p-value. 00053 */ 00054 double GetCalculatedPValue(bool flag_histogram = false); 00055 00056 /* 00057 * @return The distribution of log(likelihood). 00058 */ 00059 TH1D * GetHistogramLogProb() 00060 { return fHistogramLogProb; }; 00061 00062 /* 00063 * @return The test model. 00064 */ 00065 BCModel * GetTestModel() 00066 { return fTestModel; }; 00067 00068 /* @} */ 00069 00071 /* @{ */ 00072 00073 /* 00074 * Set the model to be tested. 00075 * @param testmodel A pointer to the model to be tested. 00076 */ 00077 void SetTestModel(BCModel * testmodel) 00078 { fTestModel = testmodel; }; 00079 00080 /* 00081 * Sets the set of parameters which the p-values is calculated for. 00082 * @param parameters The parameters. 00083 * @return An error code. 00084 */ 00085 int SetTestPoint(std::vector<double> parameters); 00086 00087 /* @} */ 00088 00090 /* @{ */ 00091 00092 double LogLikelihood(std::vector <double> parameters); 00093 00094 double LogAPrioriProbability(std::vector <double> parameters) 00095 { return 0; }; 00096 00097 void MCMCUserInterface(); 00098 00099 /* @} */ 00100 00101 private: 00102 00103 /* 00104 * A map of data points and data values. 00105 */ 00106 std::vector<int> fMapDataPoint; 00107 std::vector<int> fMapDataValue; 00108 00109 /* 00110 * Counter for the evaluation of the p-value. 00111 */ 00112 int fPValueBelow; 00113 int fPValueAbove; 00114 00115 /* 00116 * A pointer to the model which is tested. 00117 */ 00118 BCModel * fTestModel; 00119 00120 /* 00121 * A data set used for temporary storage. 00122 */ 00123 BCDataSet * fTemporaryDataSet; 00124 00125 /* 00126 * The log(likelihood) and its ranges. 00127 */ 00128 double fLogLikelihood; 00129 double fLogLikelihoodMin; 00130 double fLogLikelihoodMax; 00131 00132 /* 00133 * The distribution of log(likelihood). 00134 */ 00135 TH1D * fHistogramLogProb; 00136 00137 }; 00138 00139 // --------------------------------------------------------- 00140 00141 #endif