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 /** \name Member functions (set) */ 00058 /* @{ */ 00059 00060 /** 00061 * Set the model to be summarized. 00062 * @param model The BCModel to be summarized.*/ 00063 void SetModel(BCModel * model) 00064 { fModel = model; }; 00065 00066 /* @} */ 00067 /** \name Member functions (misc) */ 00068 /* @{ */ 00069 00070 /** 00071 * Calculate the marginalized distributions using the prior 00072 * knowledge alone. 00073 * @return An error flag. 00074 */ 00075 int CalculatePriorModel(); 00076 00077 /** 00078 * Copy the summary information from the model. 00079 * @return An error flag. */ 00080 int CopySummaryData(); 00081 00082 /** 00083 * Print a summary plot for the parameters. 00084 * @return An error flag. */ 00085 int PrintParameterPlot(const char * filename = "parameters.eps"); 00086 00087 /** 00088 * Print a correlation plot for the parameters. 00089 * @return An error flag. */ 00090 int PrintCorrelationPlot(const char * filename = "correlation.eps"); 00091 00092 /** 00093 * Print a comparison of the prior knowledge to the posterior 00094 * knowledge for each parameter. 00095 * @return An error flag. */ 00096 int PrintKnowlegdeUpdatePlot(const char * filename = "update.eps"); 00097 00098 /** 00099 * Print parameter summary as text. (not yet implemented) 00100 * @return An error flag.*/ 00101 int PrintParameterSummary() { return 1; }; 00102 00103 /** 00104 * Print correlation summary as text. (not yet implemented) 00105 * @return An error flag. */ 00106 int PrintCorrelationSummary() { return 1; }; 00107 00108 /** 00109 * Print a Latex table of the parameters. 00110 * @return An error flag. */ 00111 int PrintParameterLatex(const char * filename); 00112 00113 /** 00114 * Print a Latex table of the correlations. (not yet implemented) 00115 * @return An error flag. */ 00116 int PrintCorrelationLatex() { return 1; }; 00117 00118 /* @} */ 00119 00120 private: 00121 00122 /** Helper method to get an unique number to be used in histogram naming */ 00123 static unsigned int getNextIndex() 00124 { return ++fHCounter; } 00125 00126 /** helper variable to get an unique number to be used in histogram naming */ 00127 static unsigned int fHCounter; 00128 00129 /** 00130 * The model which results are summarized */ 00131 BCModel * fModel; 00132 00133 /** 00134 * parameter names */ 00135 std::vector <std::string> fParName; 00136 00137 /** 00138 * parameter minima */ 00139 std::vector <double> fParMin; 00140 00141 /** 00142 * Parameter maxima */ 00143 std::vector <double> fParMax; 00144 00145 /** 00146 * Correlation coefficients. 00147 * Length of vector equals number of parameters * number of parameters. */ 00148 std::vector <double> fCorrCoeff; 00149 00150 /** 00151 * Marginalized modes.\n 00152 * Length of vector equals number of parameters. */ 00153 std::vector <double> fMargMode; 00154 00155 /** 00156 * Mean values.\n 00157 * Length of vector equals number of parameters. */ 00158 std::vector <double> fMean; 00159 00160 /** 00161 * Global modes.\n 00162 * Length of vector equals number of parameters. */ 00163 std::vector <double> fGlobalMode; 00164 00165 /** 00166 * Quantiles.\n 00167 * The following quantiles are stored: 0.05, 0.10, 0.16, 0.5, 0.84, 0.90, 0.95.\n 00168 * Length of vector equals number of parameters * number of quantiles. */ 00169 std::vector <double> fQuantiles; 00170 00171 /** 00172 * Smallest intervals.\n 00173 * For each parameter a set of the smallest intervals is recorded.\n 00174 * Structure: number of intervals n + n * (start, stop, local max, local max pos, integral) 00175 * Length of vector equals number of parameters * number of quantiles. */ 00176 std::vector <double> fSmallInt; 00177 00178 /** 00179 * RMS values.\n 00180 * Length of vector equals number of parameters. */ 00181 std::vector <double> fRMS; 00182 00183 /** 00184 * Sum of probabilities for quantiles */ 00185 std::vector <double> fSumProb; 00186 00187 /** 00188 * A model for calculating the marginalized distributions for the 00189 * prior probabilities. */ 00190 BCSummaryPriorModel * fPriorModel; 00191 00192 /** 00193 * A flag: check if marginalized information is present */ 00194 bool fFlagInfoMarg; 00195 00196 /** 00197 * A flag: check if optimization information is present */ 00198 bool fFlagInfoOpt; 00199 00200 }; 00201 // --------------------------------------------------------- 00202 00203 #endif 00204