00001 #ifndef __BCSUMMARYTOOL__H 00002 #define __BCSUMMARYTOOL__H 00003 00004 /*! 00005 * \class BCSummaryTool 00006 00007 * This class can be used to summarize the results of an analysis. The 00008 * prior and posterior probabilities are compared. 00009 * \brief A class for summarizing the results of an analysis. 00010 * \author Daniel Kollar 00011 * \author Kevin Kröninger 00012 * \version 1.0.0 00013 * \date 15.02.2010 00014 */ 00015 00016 /* 00017 * Copyright (C) 2008-2010, Daniel Kollar and Kevin Kroeninger. 00018 * All rights reserved. 00019 * 00020 * For the licensing terms see doc/COPYING. 00021 */ 00022 00023 // --------------------------------------------------------- 00024 00025 #include <string> 00026 #include <vector> 00027 00028 class BCModel; 00029 class BCSummaryPriorModel; 00030 00031 // --------------------------------------------------------- 00032 00033 class BCSummaryTool 00034 { 00035 public: 00036 00037 /** \name Constructors and destructors */ 00038 /* @{ */ 00039 00040 /** 00041 * The default constructor. */ 00042 BCSummaryTool(); 00043 00044 /** 00045 * A constructor. */ 00046 BCSummaryTool(BCModel * model); 00047 00048 /** 00049 * The default destructor. */ 00050 ~BCSummaryTool(); 00051 00052 /* @} */ 00053 /** \name Member functions (get) */ 00054 /* @{ */ 00055 00056 /** 00057 * Retrieve pointer to the Prior model to allow for its detailed setup */ 00058 BCSummaryPriorModel * GetPriorModel() 00059 { return fPriorModel; } 00060 00061 /* @} */ 00062 /** \name Member functions (set) */ 00063 /* @{ */ 00064 00065 /** 00066 * Set the model to be summarized. 00067 * @param model The BCModel to be summarized.*/ 00068 void SetModel(BCModel * model) 00069 { fModel = model; }; 00070 00071 /* @} */ 00072 /** \name Member functions (misc) */ 00073 /* @{ */ 00074 00075 /** 00076 * Calculate the marginalized distributions using the prior 00077 * knowledge alone. 00078 * @return An error flag. 00079 */ 00080 int CalculatePriorModel(); 00081 00082 /** 00083 * Copy the summary information from the model. 00084 * @return An error flag. */ 00085 int CopySummaryData(); 00086 00087 /** 00088 * Print a summary plot for the parameters. 00089 * @return An error flag. */ 00090 int PrintParameterPlot(const char * filename = "parameters.eps"); 00091 00092 /** 00093 * Print a correlation matrix for the parameters. 00094 * @return An error flag. */ 00095 int PrintCorrelationMatrix(const char * filename = "matrix.eps"); 00096 00097 /** 00098 * Print a correlation plot for the parameters. 00099 * @return An error flag. */ 00100 int PrintCorrelationPlot(const char * filename = "correlation.eps"); 00101 00102 /** 00103 * Print a comparison of the prior knowledge to the posterior 00104 * knowledge for each parameter. 00105 * @return An error flag. */ 00106 int PrintKnowledgeUpdatePlots(const char * filename = "update.ps"); 00107 00108 /** 00109 * Print parameter summary as text. (not yet implemented) 00110 * @return An error flag.*/ 00111 int PrintParameterSummary() { return 1; }; 00112 00113 /** 00114 * Print correlation summary as text. (not yet implemented) 00115 * @return An error flag. */ 00116 int PrintCorrelationSummary() { return 1; }; 00117 00118 /** 00119 * Print a Latex table of the parameters. 00120 * @return An error flag. */ 00121 int PrintParameterLatex(const char * filename); 00122 00123 /** 00124 * Print a Latex table of the correlations. (not yet implemented) 00125 * @return An error flag. */ 00126 int PrintCorrelationLatex() { return 1; }; 00127 00128 /* @} */ 00129 00130 private: 00131 00132 /** Helper method to get an unique number to be used in histogram naming */ 00133 static unsigned int getNextIndex() 00134 { return ++fHCounter; } 00135 00136 /** helper variable to get an unique number to be used in histogram naming */ 00137 static unsigned int fHCounter; 00138 00139 /** 00140 * The model which results are summarized */ 00141 BCModel * fModel; 00142 00143 /** 00144 * parameter names */ 00145 std::vector <std::string> fParName; 00146 00147 /** 00148 * parameter minima */ 00149 std::vector <double> fParMin; 00150 00151 /** 00152 * Parameter maxima */ 00153 std::vector <double> fParMax; 00154 00155 /** 00156 * Correlation coefficients. 00157 * Length of vector equals number of parameters * number of parameters. */ 00158 std::vector <double> fCorrCoeff; 00159 00160 /** 00161 * Marginalized modes.\n 00162 * Length of vector equals number of parameters. */ 00163 std::vector <double> fMargMode; 00164 00165 /** 00166 * Mean values.\n 00167 * Length of vector equals number of parameters. */ 00168 std::vector <double> fMean; 00169 00170 /** 00171 * Global modes.\n 00172 * Length of vector equals number of parameters. */ 00173 std::vector <double> fGlobalMode; 00174 00175 /** 00176 * Quantiles.\n 00177 * The following quantiles are stored: 0.05, 0.10, 0.16, 0.5, 0.84, 0.90, 0.95.\n 00178 * Length of vector equals number of parameters * number of quantiles. */ 00179 std::vector <double> fQuantiles; 00180 00181 /** 00182 * Smallest intervals.\n 00183 * For each parameter a set of the smallest intervals is recorded.\n 00184 * Structure: number of intervals n + n * (start, stop, local max, local max pos, integral) 00185 * Length of vector equals number of parameters * number of quantiles. */ 00186 std::vector <double> fSmallInt; 00187 00188 /** 00189 * RMS values.\n 00190 * Length of vector equals number of parameters. */ 00191 std::vector <double> fRMS; 00192 00193 /** 00194 * Sum of probabilities for quantiles */ 00195 std::vector <double> fSumProb; 00196 00197 /** 00198 * A model for calculating the marginalized distributions for the 00199 * prior probabilities. */ 00200 BCSummaryPriorModel * fPriorModel; 00201 00202 /** 00203 * A flag: check if marginalized information is present */ 00204 bool fFlagInfoMarg; 00205 00206 /** 00207 * A flag: check if optimization information is present */ 00208 bool fFlagInfoOpt; 00209 00210 }; 00211 // --------------------------------------------------------- 00212 00213 #endif 00214