00001 #ifndef __BCENGINEMCMC__H 00002 #define __BCENGINEMCMC__H 00003 00004 /*! 00005 * \class BCEngineMCMC 00006 * \brief An engine class for Markov Chain Monte Carlo 00007 * \author Daniel Kollar 00008 * \author Kevin Kröninger 00009 * \version 1.0 00010 * \date 08.2008 00011 * \detail This class represents an engine class for Markov Chain 00012 * Monte Carlo (MCMC). One or more chains can be defined 00013 * simultaneously. 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 <vector> 00026 00027 // ROOT classes 00028 class TH1D; 00029 class TH2D; 00030 class TTree; 00031 class TRandom3; 00032 00033 // --------------------------------------------------------- 00034 00035 class BCEngineMCMC 00036 { 00037 00038 public: 00039 00040 /** \name Enumerators */ 00041 /* @{ */ 00042 00043 /** An enumerator for the status of a test. */ 00044 enum Precision{ kLow, kMedium, kHigh, kVeryHigh }; 00045 00046 /* @} */ 00047 /** \name Constructors and destructors */ 00048 /* @{ */ 00049 00050 /** 00051 * Default constructor. */ 00052 BCEngineMCMC(); 00053 00054 /** 00055 * Constructor. 00056 * @param n number of chains */ 00057 BCEngineMCMC(int n); 00058 00059 /** 00060 * Default copy constructor. */ 00061 BCEngineMCMC(const BCEngineMCMC & enginemcmc); 00062 00063 /** 00064 * Default destructor. */ 00065 virtual ~BCEngineMCMC(); 00066 00067 /* @} */ 00068 /** \name Assignment operators */ 00069 /* @{ */ 00070 00071 /** 00072 * Defaut assignment operator */ 00073 BCEngineMCMC & operator = (const BCEngineMCMC & engineMCMC); 00074 00075 /* @} */ 00076 /** \name Getters */ 00077 /* @{ */ 00078 00079 /* 00080 * @return number of parameters of the Markov chain */ 00081 int MCMCGetNParameters() 00082 { return fMCMCNParameters; }; 00083 00084 /* 00085 * @return number of Markov chains */ 00086 int MCMCGetNChains() 00087 { return fMCMCNChains; }; 00088 00089 /* 00090 * @return lag of the Markov chains */ 00091 int MCMCGetNLag() 00092 { return fMCMCNLag; }; 00093 00094 /* 00095 * @return number of iterations */ 00096 std::vector <int> MCMCGetNIterations() 00097 { return fMCMCNIterations; }; 00098 00099 /** 00100 * @return current iterations */ 00101 int MCMCGetCurrentIteration() 00102 { return fMCMCCurrentIteration; }; 00103 00104 /** 00105 * @return current chain index */ 00106 int MCMCGetCurrentChain() 00107 { return fMCMCCurrentChain; }; 00108 00109 /* 00110 * @return number of iterations needed for all chains to 00111 * converge simultaneously */ 00112 int MCMCGetNIterationsConvergenceGlobal() 00113 { return fMCMCNIterationsConvergenceGlobal; }; 00114 00115 /* 00116 * @return flag if converged or not */ 00117 bool MCMCGetFlagConvergenceGlobal() 00118 { return fMCMCFlagConvergenceGlobal; }; 00119 00120 /* 00121 * @return maximum number of iterations for a Markov chain */ 00122 int MCMCGetNIterationsMax() 00123 { return fMCMCNIterationsMax; }; 00124 00125 /* 00126 * @return number of iterations for a Markov chain */ 00127 int MCMCGetNIterationsRun() 00128 { return fMCMCNIterationsRun; }; 00129 00130 /* 00131 * @returns number of accepted trials for each chain */ 00132 std::vector <int> MCMCGetNTrialsTrue() 00133 { return fMCMCNTrialsTrue; }; 00134 00135 /* 00136 * @returns number of not-accepted trials for each chain */ 00137 std::vector <int> MCMCGetNTrialsFalse() 00138 { return fMCMCNTrialsFalse; }; 00139 00140 /* 00141 * @return mean value of the probability for each chain up to 00142 * the current iteration */ 00143 std::vector <double> MCMCGetprobMean() 00144 { return fMCMCprobMean; }; 00145 00146 /* 00147 * @return mean value of the probability for each chain up to 00148 * the current iteration */ 00149 std::vector <double> MCMCGetVariance() 00150 { return fMCMCprobVar; }; 00151 00152 /* 00153 * @return scale factor for all parameters and chains */ 00154 std::vector <double> MCMCGetTrialFunctionScaleFactor() 00155 { return fMCMCTrialFunctionScaleFactor; }; 00156 00157 /* 00158 * @return scale factor for all parameters and achain. 00159 * @param ichain chain index */ 00160 std::vector <double> MCMCGetTrialFunctionScaleFactor(int ichain); 00161 00162 /* 00163 * @return scale factor for a parameter and a chain. 00164 * @param ichain chain index 00165 * @param ipar parameter index */ 00166 double MCMCGetTrialFunctionScaleFactor(int ichain, int ipar); 00167 00168 /* 00169 * @return current point of each Markov chain */ 00170 std::vector <double> MCMCGetx() 00171 { return fMCMCx; }; 00172 00173 /* 00174 * @param ichain index of the Markov chain 00175 * @return current point of the Markov chain */ 00176 std::vector <double> MCMCGetx(int ichain); 00177 00178 /* 00179 * @param ichain chain index 00180 * @param ipar parameter index 00181 * @return parameter of the Markov chain */ 00182 double MCMCGetx(int ichain, int ipar); 00183 00184 /* 00185 * @return log of the probability of the current points of each Markov chain */ 00186 std::vector <double> MCMCGetLogProbx() 00187 { return fMCMCprob; }; 00188 00189 /* 00190 * @return log of the probability of the current points of the Markov chain. 00191 * @param ichain chain index */ 00192 double MCMCGetLogProbx(int ichain); 00193 00194 /* 00195 * @return pointer to the phase of a run. */ 00196 int MCMCGetPhase() 00197 { return fMCMCPhase; }; 00198 00199 /* 00200 * @return pointer to the cycle of a pre-run. */ 00201 int MCMCGetCycle() 00202 { return fMCMCCycle; }; 00203 00204 /* 00205 * @return maximum points of each Markov chain */ 00206 std::vector <double> MCMCGetMaximumPoints() 00207 { return fMCMCxMax; }; 00208 00209 /* 00210 * @return maximum point of Markov chain 00211 * @param i The index of the Markov chain */ 00212 std::vector <double> MCMCGetMaximumPoint(int i); 00213 00214 /* 00215 * @return maximum (log) probability of each Markov chain */ 00216 std::vector <double> MCMCGetMaximumLogProb() 00217 { return fMCMCprobMax; }; 00218 00219 /* 00220 * @return flag which defined initial position */ 00221 int MCMCGetFlagInitialPosition() 00222 { return fMCMCFlagInitialPosition; }; 00223 00224 /* 00225 * @return R-value criterion */ 00226 double MCMCGetRValueCriterion() 00227 { return fMCMCRValueCriterion; }; 00228 00229 /* 00230 * @return R-value criterion for parameters */ 00231 double MCMCGetRValueParametersCriterion() 00232 { return fMCMCRValueParametersCriterion; }; 00233 00234 /* 00235 * @return R-value */ 00236 double MCMCGetRValue() 00237 { return fMCMCRValue; }; 00238 00239 /* 00240 * @return R-value for a parameter 00241 * @param i parameter index */ 00242 double MCMCGetRValueParameters(int i) 00243 { return fMCMCRValueParameters.at(i); }; 00244 00245 /* 00246 * @return the flag if MCMC has been performed or not */ 00247 bool MCMCGetFlagRun() 00248 { return fMCMCFlagRun; }; 00249 00250 /* 00251 * Rtrieve the tree containing the Markov chain. 00252 * @param i index of the Markov chain 00253 * @return pointer to the tree */ 00254 TTree * MCMCGetMarkovChainTree(int i) 00255 { return fMCMCTrees.at(i); }; 00256 00257 /* 00258 * Retrieve a histogram of the 1D marginalized distribution of a single parameter. 00259 * @param i index of the parameter 00260 * @return pointer to the histogram */ 00261 TH1D * MCMCGetH1Marginalized(int i); 00262 00263 /* 00264 * Retrieve a histogram of the 2D marginalized distribution for two parameters. 00265 * @param i index of the first parameter 00266 * @param j index of the second parameter 00267 * @return pointer to the histogram */ 00268 TH2D * MCMCGetH2Marginalized(int i, int j); 00269 00270 /* 00271 * Return the random number generator */ 00272 TRandom3 * MCMCGetTRandom3() 00273 { return fRandom; }; 00274 00275 /* @} */ 00276 /** \name Setters */ 00277 /* @{ */ 00278 00279 /* 00280 * Set the scale factors for the trial functions 00281 * @param scale a vector of doubles containing the scale factors */ 00282 void MCMCSetTrialFunctionScaleFactor(std::vector <double> scale) 00283 { fMCMCTrialFunctionScaleFactorStart = scale; }; 00284 00285 /* 00286 * Sets the number of Markov chains which are run in parallel. */ 00287 void MCMCSetNChains(int n); 00288 00289 /* 00290 * Sets the lag of the Markov chains */ 00291 void MCMCSetNLag(int n) 00292 { fMCMCNLag = n; }; 00293 00294 /* 00295 * Sets the maximum number of iterations in the pre-run. */ 00296 void MCMCSetNIterationsMax(int n) 00297 { fMCMCNIterationsMax = n; }; 00298 00299 /* 00300 * Sets the number of iterations. */ 00301 void MCMCSetNIterationsRun(int n) 00302 { fMCMCNIterationsRun = n; }; 00303 00304 /* 00305 * Sets the minimum number of iterations in the pre-run */ 00306 void MCMCSetNIterationsPreRunMin(int n) 00307 { fMCMCNIterationsPreRunMin = n; }; 00308 00309 /* 00310 * Sets the number of iterations in the pre-run after which an 00311 * update on the statistics (convergence, efficiency, etc.) is done. 00312 * @param n The number of iterations.*/ 00313 void MCMCSetNIterationsUpdate(int n) 00314 { fMCMCNIterationsUpdate = n; }; 00315 00316 /* 00317 * Sets the maximum number of iterations in the pre-run after which an 00318 * update on the statistics (convergence, efficiency, etc.) is done. 00319 * If set to 0 no maximum is set. 00320 * @param n maximum number of iterations. */ 00321 void MCMCSetNIterationsUpdateMax(int n) 00322 { fMCMCNIterationsUpdateMax = n; }; 00323 00324 /* 00325 * Sets the minimum efficiency required for a chain. */ 00326 void MCMCSetMinimumEfficiency(double efficiency) 00327 { fMCMCEfficiencyMin = efficiency; }; 00328 00329 /* 00330 * Sets the maximum efficiency required for a chain. */ 00331 void MCMCSetMaximumEfficiency(double efficiency) 00332 { fMCMCEfficiencyMax = efficiency; }; 00333 00334 /* 00335 * Sets flag to write Markov chains to file. */ 00336 void MCMCSetWriteChainToFile(bool flag) 00337 { fMCMCFlagWriteChainToFile = flag; }; 00338 00339 /* 00340 * Sets flag to write pre run to file. */ 00341 void MCMCSetWritePreRunToFile(bool flag) 00342 { fMCMCFlagWritePreRunToFile = flag; }; 00343 00344 /* 00345 * Sets the initial positions for all chains. 00346 * @param x0s initial positions for all chains. */ 00347 void MCMCSetInitialPositions(std::vector<double> x0s); 00348 00349 /* 00350 * Sets the initial positions for all chains. 00351 * @param x0s initial positions for all chains. */ 00352 void MCMCSetInitialPositions(std::vector< std::vector<double> > x0s); 00353 00354 /* 00355 * Sets flag which defines initial position. */ 00356 void MCMCSetFlagInitialPosition(int flag) 00357 { fMCMCFlagInitialPosition = flag; }; 00358 00359 /* 00360 * Sets the flag which controls the sequence parameters during the 00361 * running of the MCMC. */ 00362 void MCMCSetFlagOrderParameters(bool flag) 00363 { fMCMCFlagOrderParameters = flag; }; 00364 00365 /* Sets the flag for all parameters to either fill histograms or not. */ 00366 void MCMCSetFlagFillHistograms(bool flag); 00367 00368 /* Sets the flag for a single parameter to either fill histograms or not. */ 00369 void MCMCSetFlagFillHistograms(int index, bool flag); 00370 00371 /* 00372 * Sets the R-value criterion for convergence of all chains. */ 00373 void MCMCSetRValueCriterion(double r) 00374 { fMCMCRValueCriterion = r; }; 00375 00376 /* 00377 * Sets the parameter R-value criterion for convergence of all chains */ 00378 void MCMCSetRValueParametersCriterion(double r) 00379 { fMCMCRValueParametersCriterion = r; }; 00380 00381 /* 00382 * Sets the tree containing the Markov chains. */ 00383 void MCMCSetMarkovChainTrees(std::vector <TTree *> trees); 00384 00385 /* 00386 * Initialize trees containing the Markov chains. */ 00387 void MCMCInitializeMarkovChainTrees(); 00388 00389 /* 00390 * Sets the histogram with 1D marginalized distributions for parameter. 00391 * @param i index of the parameter 00392 * @param h pointer to an existing histogram */ 00393 int SetMarginalized(int index, TH1D * h); 00394 00395 /* 00396 * Sets the histogram with 2D marginalized distributions for two parameters. 00397 * @param index1 index of the first parameter 00398 * @param index2 index of the second parameter 00399 * @param h pointer to an existing histogram */ 00400 int SetMarginalized(int index1, int index2, TH2D * h); 00401 00402 /* 00403 * Set the default values for the MCMC chain. */ 00404 void MCMCSetValuesDefault(); 00405 00406 /* 00407 * Set the values for a quick MCMC run. */ 00408 void MCMCSetValuesQuick(); 00409 00410 /* 00411 * Set the values for a detailed MCMC run. */ 00412 void MCMCSetValuesDetail(); 00413 00414 /** 00415 * Set the precision for the MCMC run. */ 00416 void MCMCSetPrecision(BCEngineMCMC::Precision precision); 00417 00418 /* @} */ 00419 /** \name Miscellaneous methods */ 00420 /* @{ */ 00421 00422 /* 00423 * Adds a parameter. 00424 * @param min minimum value of the parameter 00425 * @param max maximum value of the parameter 00426 * @return number of parameters after adding */ 00427 int MCMCAddParameter(double min, double max); 00428 00429 /* 00430 * Random walk trial function. The default trial function is a 00431 * Breit-Wigner. It can be overloaded by the user to set the trial 00432 * function. 00433 * @param ichain the chain index 00434 * @param x point with the dimension fMCMCNParameters */ 00435 virtual void MCMCTrialFunction(int ichain, std::vector <double> &x); 00436 00437 /* 00438 * Random walk trial function. The default trial function is a 00439 * Breit-Wigner. It can be overloaded by the user to set the trial 00440 * function. 00441 * @param ichain the chain index 00442 * @param ipar the parameter index 00443 * @return the unscaled proposal point */ 00444 virtual double MCMCTrialFunctionSingle(int ichain, int ipar); 00445 00446 /* 00447 * Returns a trial point for the Metropolis algorithm. 00448 * @param chain chain index 00449 * @param x proposal point 00450 * @return flag indicating whether the new point lies within the allowed range */ 00451 bool MCMCGetProposalPointMetropolis(int chain, std::vector <double> &x); 00452 00453 /* 00454 * Returns a trial point for the Metropolis algorithm. 00455 * @param chain chain index 00456 * @param x proposal point 00457 * @return flag indicating whether the new point lies within the allowed range */ 00458 bool MCMCGetProposalPointMetropolis(int chain, int parameter, std::vector <double> &x); 00459 00460 /* 00461 * Generates a new point using the Metropolis algorithm. 00462 * @param chain chain index */ 00463 bool MCMCGetNewPointMetropolis(int chain = 0); 00464 bool MCMCGetNewPointMetropolis(int chain, int parameter); 00465 00466 /* 00467 * Updates statistics: find new maximum */ 00468 void MCMCInChainCheckMaximum(); 00469 00470 /* 00471 * Updates statistics: */ 00472 void MCMCInChainUpdateStatistics(); 00473 00474 /* 00475 * Updates statistics: fill marginalized distributions */ 00476 void MCMCInChainFillHistograms(); 00477 00478 /* 00479 * Updates statistics: check convergence */ 00480 void MCMCInChainTestConvergenceAllChains(); 00481 00482 /* 00483 * Updates statistics: write chains to file */ 00484 void MCMCInChainWriteChains(); 00485 00486 /* 00487 * Needs to be overloaded in the derived class. 00488 * @return natural logarithm of the function to map with MCMC */ 00489 virtual double LogEval(std::vector <double> parameters); 00490 00491 /* 00492 * Runs Metropolis algorithm. */ 00493 int MCMCMetropolis(); 00494 00495 /* 00496 * Runs a pre run for the Metropolis algorithm. */ 00497 int MCMCMetropolisPreRun(); 00498 00499 /* 00500 * Resets the run statistics. */ 00501 void MCMCResetRunStatistics(); 00502 00503 /* 00504 * Initializes Markov chains. */ 00505 void MCMCInitializeMarkovChains(); 00506 00507 /* 00508 * Initializes the engine. 00509 * @return An error code */ 00510 int MCMCInitialize(); 00511 00512 /* 00513 * Reset the MCMC variables. 00514 * @return An error code */ 00515 int MCMCResetResults(); 00516 00517 /* 00518 * Interface allowing to execute arbitrary code for each iteration 00519 * of the MCMC. The frequency of calling this method is influenced 00520 * by the setup of the Lag and whether or not the MCMC is run with 00521 * ordered parameters. This method needs to be overloaded in the derived 00522 * class. */ 00523 virtual void MCMCIterationInterface() 00524 {}; 00525 00526 /* 00527 * Interface allowing to execute arbitrary code for each new point 00528 * of the MCMC. This method needs to be overloaded in the derived 00529 * class 00530 * @param point point that was generated and checked 00531 * @param ichain index of the chain 00532 * @param accepted flag whether or not the point was accepted for the chain 00533 */ 00534 virtual void MCMCCurrentPointInterface(std::vector <double> & point, int ichain, bool accepted) 00535 {}; 00536 00537 /* @} */ 00538 00539 private: 00540 00541 /* 00542 * Copies this BCEngineMCMC into another one. */ 00543 void Copy(BCEngineMCMC & enginemcmc) const; 00544 00545 /* 00546 * Defines a type of a pointer to a member function. */ 00547 typedef bool (BCEngineMCMC::*MCMCPointerToGetProposalPoint) (int chain, std::vector <double> xnew, std::vector <double> xold) const; 00548 00549 /* 00550 * Pointer to a member function */ 00551 MCMCPointerToGetProposalPoint fMCMCPointerToGetProposalPoint; 00552 00553 protected: 00554 00555 /* 00556 * Number of parameters */ 00557 int fMCMCNParameters; 00558 00559 /* 00560 * Parameter boundaries */ 00561 std::vector <double> fMCMCBoundaryMin; 00562 std::vector <double> fMCMCBoundaryMax; 00563 00564 /* 00565 * Parameter flags for marginalization */ 00566 std::vector <bool> fMCMCFlagsFillHistograms; 00567 00568 /* 00569 * Number of Markov chains ran in parallel */ 00570 int fMCMCNChains; 00571 00572 /* 00573 * The lag for the Markov Chain */ 00574 int fMCMCNLag; 00575 00576 /* 00577 * Number of total iterations of the Markov chains. The length of 00578 * the vector is equal to fMCMCNChains. */ 00579 std::vector<int> fMCMCNIterations; 00580 00581 /* 00582 * The current iteration number. If not called within the running 00583 * of the algorithm, return -1. */ 00584 int fMCMCCurrentIteration; 00585 00586 /* 00587 * The current chain index. If not called within the running of the 00588 * algorithm, return -1. */ 00589 int fMCMCCurrentChain; 00590 00591 /* 00592 * Number of iterations for updating scale factors */ 00593 int fMCMCNIterationsUpdate; 00594 00595 /* 00596 * Maximum number of iterations for updating scale factors */ 00597 int fMCMCNIterationsUpdateMax; 00598 00599 /* 00600 * Number of iterations needed for all chains to convergence 00601 * simulaneously */ 00602 int fMCMCNIterationsConvergenceGlobal; 00603 00604 /* 00605 * Flag for convergence */ 00606 bool fMCMCFlagConvergenceGlobal; 00607 00608 /* 00609 * Maximum number of iterations for a Markov chain prerun */ 00610 int fMCMCNIterationsMax; 00611 00612 /* 00613 * Number of iterations for a Markov chain run */ 00614 int fMCMCNIterationsRun; 00615 00616 /* 00617 * Minimum number of iterations for the pre-run */ 00618 int fMCMCNIterationsPreRunMin; 00619 00620 /* 00621 * Number of accepted trials for each chain. The length of the 00622 * vector is equal to fMCMCNChains * fMCMCNParameters. */ 00623 std::vector<int> fMCMCNTrialsTrue; 00624 00625 /* 00626 * Number of not accepted trials for each chain. The length of the 00627 * vector is equal to fMCMCNChains * fMCMCNParameters. */ 00628 std::vector<int> fMCMCNTrialsFalse; 00629 00630 /* 00631 * Flag to write Markov chains to file */ 00632 bool fMCMCFlagWriteChainToFile; 00633 00634 /* 00635 * Flag to write pre run to file */ 00636 bool fMCMCFlagWritePreRunToFile; 00637 00638 /* 00639 * Scales the width of the trial functions by a scale factor for 00640 * each parameter and chain */ 00641 std::vector <double> fMCMCTrialFunctionScaleFactor; 00642 00643 00644 /* 00645 * Start values of the scale factors for the trial functions. */ 00646 std::vector <double> fMCMCTrialFunctionScaleFactorStart; 00647 00648 /* 00649 * Defines if a prerun has been performed or not */ 00650 bool fMCMCFlagPreRun; 00651 00652 /* 00653 * Defines if MCMC has been performed or not */ 00654 bool fMCMCFlagRun; 00655 00656 /* 00657 * The intial position of each Markov chain. The length of the 00658 * vectors is equal to fMCMCNChains * fMCMCNParameters. First, the 00659 * values of the first Markov chain are saved, then those of the 00660 * second and so on */ 00661 std::vector <double> fMCMCInitialPosition; 00662 00663 /* 00664 * The minimum required efficiency for MCMC */ 00665 double fMCMCEfficiencyMin; 00666 00667 /* 00668 * The maximum allowed efficiency for MCMC */ 00669 double fMCMCEfficiencyMax; 00670 00671 /* 00672 * Variable which defines the initial position. 0 (default) center 00673 * of the allowed region, (1) random initial position (2) 00674 * pre-defined intial position. */ 00675 int fMCMCFlagInitialPosition; 00676 00677 /* 00678 * Flag which controls the sequence parameters during the running 00679 * of the MCMC. */ 00680 bool fMCMCFlagOrderParameters; 00681 00682 /* 00683 * Flag which controls fill histograms during main run. */ 00684 bool fMCMCFlagFillHistograms; 00685 00686 /* 00687 * The phase of the run. 00688 * 1: pre-run, 2: main run. 00689 */ 00690 int fMCMCPhase; 00691 00692 /* 00693 * The cycle of the pre-run 00694 */ 00695 int fMCMCCycle; 00696 00697 /* 00698 * The current points of each Markov chain. The length of the 00699 * vectors is equal to fMCMCNChains * fMCMCNParameters. First, the 00700 * values of the first Markov chain are saved, then those of the 00701 * second and so on. */ 00702 std::vector <double> fMCMCx; 00703 00704 /* 00705 * The maximum points of each Markov chain. The length of the vector 00706 * is fMCMCNChains * fMCMCNParameters. First, the values of the 00707 * first Markov chain are saved, then those of the second and so on. */ 00708 std::vector <double> fMCMCxMax; 00709 00710 /* 00711 * The mean of all parameters of each Markov chain. The length of 00712 * the vector is equal to fMCMCNChains * fMCMCNParameters. */ 00713 std::vector <double> fMCMCxMean; 00714 00715 /* 00716 * The variance of all parameters of each Markov chain. The length 00717 * of the vector is equal to fMCMCNChains * fMCMCNParameters. */ 00718 std::vector <double> fMCMCxVar; 00719 00720 /* 00721 * A temporary vector for a single Markov chain */ 00722 std::vector <double> fMCMCxLocal; 00723 00724 /* 00725 * The log of the probability of the current points of each Markov 00726 * chain. The length of the vectors is fMCMCNChains. */ 00727 std::vector<double> fMCMCprob; 00728 00729 /* 00730 * The maximum (log) probability of each Markov chain. The length of 00731 * the vector is fMCMCNChains. */ 00732 std::vector <double> fMCMCprobMax; 00733 00734 /* 00735 * The mean of all log prob values of each Markov chain. The 00736 * length of the vector is equal to fMCMCNChains. */ 00737 std::vector <double> fMCMCprobMean; 00738 00739 /* 00740 * The variance of all log prob values of each Markov chain. The 00741 * length of the vector is equal to fMCMCNChains. */ 00742 std::vector <double> fMCMCprobVar; 00743 00744 /* 00745 * The R-value criterion for convergence of log-likelihood*/ 00746 double fMCMCRValueCriterion; 00747 00748 /* 00749 * The R-value criterion for convergence of parameters */ 00750 double fMCMCRValueParametersCriterion; 00751 00752 /* 00753 * The R-value at which the chains did converge */ 00754 double fMCMCRValue; 00755 00756 /* The R-values for each parameter */ 00757 std::vector <double> fMCMCRValueParameters; 00758 00759 /* 00760 * Random number generator */ 00761 TRandom3 * fRandom; 00762 00763 /* 00764 * Number of bins per dimension for the marginalized distributions. */ 00765 std::vector<int> fMCMCH1NBins; 00766 00767 /* 00768 * An array of marginalized distributions */ 00769 std::vector <TH1D *> fMCMCH1Marginalized; 00770 std::vector <TH2D *> fMCMCH2Marginalized; 00771 00772 /* 00773 * The trees containing the Markov chains. The length of the vector 00774 * is fMCMCNChains. */ 00775 std::vector<TTree *> fMCMCTrees; 00776 }; 00777 00778 // --------------------------------------------------------- 00779 00780 #endif