00001 #ifndef __BCMODELOUTPUT__H 00002 #define __BCMODELOUTPUT__H 00003 00016 /* 00017 * Copyright (C) 2008, Daniel Kollar and Kevin Kroeninger. 00018 * All rights reserved. 00019 * 00020 * For the licensing terms see doc/COPYING. 00021 */ 00022 00023 // --------------------------------------------------------- 00024 00025 #include <vector> 00026 00027 // BAT classes 00028 class BCModel; 00029 00030 // ROOT classes 00031 class TTree; 00032 class TFile; 00033 class TObject; 00034 00035 const int MAXNPARAMETERS = 20; 00036 00037 // --------------------------------------------------------- 00038 00039 class BCModelOutput 00040 { 00041 public: 00042 00044 /* @{ */ 00045 00048 BCModelOutput(); 00049 00054 BCModelOutput(BCModel * model, const char * filenname); 00055 00058 BCModelOutput(const BCModelOutput & modeloutput); 00059 00062 virtual ~BCModelOutput(); 00063 00064 /* @} */ 00065 00067 /* @{ */ 00068 00071 BCModelOutput & operator = (const BCModelOutput & modeloutput); 00072 00073 /* @} */ 00074 00076 /* @{ */ 00077 00081 TTree * GetAnalysisTree() 00082 { return fAnalysisTree; }; 00083 00087 TFile * GetFile() 00088 { return fOutputFile; }; 00089 00090 /* @} */ 00091 00093 /* @{ */ 00094 00098 void SetModel(BCModel * model); 00099 00100 00104 void SetFile(const char * filename); 00105 00106 /* @} */ 00107 00109 /* @{ */ 00110 00114 void WriteMarkovChain(bool flag = true); 00115 00118 void FillAnalysisTree(); 00119 00122 void WriteMarginalizedDistributions(); 00123 00126 void WriteErrorBand(); 00127 00130 void Write(TObject * o); 00131 00134 void Close(); 00135 00136 /* @} */ 00137 00138 private: 00139 00142 void Init(); 00143 00144 /* 00145 * Copies this BCModelOutput into another one */ 00146 void Copy(BCModelOutput & modeloutput) const; 00147 00150 void InitializeAnalysisTree(); 00151 00154 void InitializeMarkovChainTrees(); 00155 00158 void InitializeSATree(); 00159 00162 TTree * fAnalysisTree; 00163 00164 /* 00165 * The trees containing the Markov chains. The length of the vector 00166 * is fMCMCNChains. */ 00167 std::vector<TTree *> fMarkovChainTrees; 00168 00169 /* 00170 * The tree for the simulated annealing. */ 00171 TTree * fTreeSA; 00172 00175 char * fFileName; 00176 00179 TFile * fOutputFile; 00180 00183 BCModel * fModel; 00184 00187 int fIndex; 00188 unsigned int fNParameters; 00189 double fProbability_apriori; 00190 double fProbability_aposteriori; 00191 double fMode_global[MAXNPARAMETERS]; 00192 double fMode_marginalized[MAXNPARAMETERS]; 00193 double fMean_marginalized[MAXNPARAMETERS]; 00194 double fMedian_marginalized[MAXNPARAMETERS]; 00195 double fQuantile_05[MAXNPARAMETERS]; 00196 double fQuantile_10[MAXNPARAMETERS]; 00197 double fQuantile_16[MAXNPARAMETERS]; 00198 double fQuantile_84[MAXNPARAMETERS]; 00199 double fQuantile_90[MAXNPARAMETERS]; 00200 double fQuantile_95[MAXNPARAMETERS]; 00201 00204 std::vector<double> * fParameters; 00205 std::vector<double> * fLogLikelihood; 00206 std::vector <int> * fIteration; 00207 00210 int * fSAIteration; 00211 int fSANParameters; 00212 double * fSATemperature; 00213 double * fSALogProb; 00214 std::vector<double> * fSAParameters; 00215 }; 00216 00217 // --------------------------------------------------------- 00218 00219 #endif