BayesianAnalysisToolkit  0.9.3
Private Member Functions | Private Attributes | List of all members
BCModelManager Class Reference

A class representing a set of BCModels. More...

#include <BCModelManager.h>

Collaboration diagram for BCModelManager:
Collaboration graph
[legend]

Public Member Functions

Constructors and destructors
 BCModelManager ()
 
 BCModelManager (const BCModelManager &modelmanager)
 
virtual ~BCModelManager ()
 
Assignment operators
BCModelManageroperator= (const BCModelManager &modelmanager)
 
Member functions (get)
unsigned int GetNModels ()
 
BCModelGetModel (int index)
 
int GetNDataPoints ()
 
BCDataPointGetDataPoint (int index)
 
BCDataSetGetDataSet ()
 
Member functions (set)
void SetDataSet (BCDataSet *dataset)
 
void SetSingleDataPoint (BCDataPoint *datapoint)
 
void SetSingleDataPoint (BCDataSet *dataset, unsigned int index)
 
void SetNIterationsMax (int niterations)
 
void SetNIterationsMin (int niterations)
 
void SetNIterationsPrecisionCheck (int niterations)
 
void SetNIterationsOutput (int niterations)
 
void SetMarginalizationMethod (BCIntegrate::BCMarginalizationMethod method)
 
void SetIntegrationMethod (BCIntegrate::BCIntegrationMethod method)
 
void SetOptimizationMethod (BCIntegrate::BCOptimizationMethod method)
 
void SetRelativePrecision (double relprecision)
 
void SetAbsolutePrecision (double absprecision)
 
void SetNbins (unsigned int n)
 
void SetDataPointLowerBoundaries (BCDataPoint *datasetlowerboundaries)
 
void SetDataPointUpperBoundaries (BCDataPoint *datasetupperboundaries)
 
void SetDataPointLowerBoundary (int index, double lowerboundary)
 
void SetDataPointUpperBoundary (int index, double upperboundary)
 
void SetDataBoundaries (int index, double lowerboundary, double upperboundary)
 
void SetNChains (unsigned int n)
 
Member functions (miscellaneous methods)
void AddModel (BCModel *model, double probability=0.)
 
void AddDataPoint (BCDataPoint *datapoint)
 
int ReadDataFromFile (const char *filename, const char *treename, const char *branchnames)
 
int ReadDataFromFile (const char *filename, int nvariables)
 
int ReadDataFromFileTree (const char *filename, const char *treename, const char *branchnames)
 
int ReadDataFromFileTxt (const char *filename, int nbranches)
 
void Integrate ()
 
double BayesFactor (const unsigned int imodel1, const unsigned int imodel2)
 
void FindMode ()
 
void MarginalizeAll ()
 
void WriteMarkovChain (bool flag)
 
void ResetDataSet ()
 
void PrintModelComparisonSummary (const char *filename=0)
 
void PrintSummary (const char *filename=0)
 
void PrintResults ()
 
void CalculatePValue (bool flag_histogram=false)
 

Private Member Functions

void Copy (BCModelManager &modelmanager) const
 

Private Attributes

BCModelContainerfModelContainer
 
BCDataSetfDataSet
 

Detailed Description

A class representing a set of BCModels.

Author
Daniel Kollar
Kevin Kröninger
Version
1.0
Date
08.2008 This class represents a manager for BCModels. It handles common data sets and performs operations on BCModels simultaneously. Model comparsion in terms of a posteriori probabilities is only possible with this class.

Definition at line 32 of file BCModelManager.h.

Constructor & Destructor Documentation

BCModelManager::BCModelManager ( )

The default constructor.

Definition at line 23 of file BCModelManager.cxx.

24 {
26  fDataSet = 0;
27 }
BCModelManager::BCModelManager ( const BCModelManager modelmanager)

The default copy constructor.

Definition at line 39 of file BCModelManager.cxx.

40 {
41  modelmanager.Copy(*this);
42 }
BCModelManager::~BCModelManager ( )
virtual

The default destructor.

Definition at line 31 of file BCModelManager.cxx.

32 {
33  delete fModelContainer;
34  delete fDataSet;
35 }

Member Function Documentation

void BCModelManager::AddDataPoint ( BCDataPoint datapoint)
inline

Adds a data point to the data container.

Parameters
datapointThe data point

Definition at line 208 of file BCModelManager.h.

209  { fDataSet -> AddDataPoint(datapoint); };
void BCModelManager::AddModel ( BCModel model,
double  probability = 0. 
)

Adds a model to the container

Parameters
modelThe model
probabilityThe a priori probability
See Also
AddModel(BCModel * model)
SetModelPrior(BCModel * model, double probability)

Definition at line 92 of file BCModelManager.cxx.

93 {
94  // set a priori probability of new model
95  model->SetModelAPrioriProbability(probability);
96 
97  // set data set
98  model->SetDataSet(fDataSet);
99 
100  // fill model into container
101  fModelContainer->push_back(model);
102 }
double BCModelManager::BayesFactor ( const unsigned int  imodel1,
const unsigned int  imodel2 
)

Calculate Bayes factor for two models.

Parameters
imodel1index of model 1 (numerator)
imodel2index of model 2 (denominator)
Returns
Bayes factor or -1. on error

Definition at line 329 of file BCModelManager.cxx.

330 {
331  // Bayes Factors are the likelihoods integrated over the parameters
332  // Is this equal to the posteriors?
333  // NOOOO
334  // But it is equal to normalization factors.
335 
336  const double norm1 = fModelContainer->at(imodel1)->GetIntegral();
337  const double norm2 = fModelContainer->at(imodel2)->GetIntegral();
338 
339  // check model 1
340  if(norm1<0.) {
342  Form("BCModelManager::BayesFactor : Model %s (index %d) not normalized. Cannot calculate Bayes factor.",
343  fModelContainer->at(imodel1)->GetName().data(),imodel1));
344  return -1.;
345  }
346 
347  // check model 2
348  if(norm2<0.) {
350  Form("BCModelManager::BayesFactor : Model %s (index %d) not normalized. Cannot calculate Bayes factor.",
351  fModelContainer->at(imodel2)->GetName().data(),imodel2));
352  return -1.;
353  }
354 
355  // denominator cannot be zero
356  if(norm2==0. && norm1!=0.) {// not good since norm2 is double !!!
358  Form("BCModelManager::BayesFactor : Model %s (index %d) has ZERO probability. Bayes factor is infinite.",
359  fModelContainer->at(imodel2)->GetName().data(),imodel2));
360  return -1.;
361  }
362 
363  // denominator cannot be zero unless also numerator is zero
364  if(norm2==0. && norm1==0.) {// not good since norm2 and norm1 are both double !!!
366  Form("BCModelManager::BayesFactor : Models %s and %s have ZERO probability. Bayes factor is unknown. Returning 1.",
367  fModelContainer->at(imodel2)->GetName().data(),fModelContainer->at(imodel1)->GetName().data()));
368  return 1.;
369  }
370 
371  // now calculate the factor
372  return norm1/norm2;
373 }
void BCModelManager::CalculatePValue ( bool  flag_histogram = false)

Calculates the p-value for all models.

Definition at line 404 of file BCModelManager.cxx.

405 {
406  // calculate p-value for all models
407  for (unsigned int i = 0; i < GetNModels(); i++)
408  GetModel(i)->CalculatePValue(GetModel(i)->GetBestFitParameters(), flag_histogram);
409 }
void BCModelManager::Copy ( BCModelManager modelmanager) const
private

Copies this BCModelManager into another one

Definition at line 562 of file BCModelManager.cxx.

563 {
564  // don't copy the content only the pointers
565  modelmanager.fModelContainer = fModelContainer;
566  modelmanager.fDataSet = fDataSet;
567 }
void BCModelManager::FindMode ( )

Does the mode finding

Definition at line 377 of file BCModelManager.cxx.

378 {
379  // finds mode for all models registered
380  for (unsigned int i = 0; i < GetNModels(); i++)
381  GetModel(i)->FindMode();
382 }
BCDataPoint* BCModelManager::GetDataPoint ( int  index)
inline

Returns a data point of the common data set at an index.

Parameters
indexThe index of the data point in the data set.
Returns
The data point.

Definition at line 87 of file BCModelManager.h.

88  { return fDataSet -> GetDataPoint(index); };
BCDataSet* BCModelManager::GetDataSet ( )
inline

Returns the common data set.

Returns
The data set.

Definition at line 93 of file BCModelManager.h.

94  { return fDataSet; };
BCModel* BCModelManager::GetModel ( int  index)
inline

Returns the BCModel at a certain index of this BCModelManager.

Parameters
indexThe index of the model in the BCModelManager.
Returns
The BCModel at the index.

Definition at line 74 of file BCModelManager.h.

75  { return fModelContainer -> at(index); };
int BCModelManager::GetNDataPoints ( )
inline

Returns the number of entries in the common data set.

Returns
The number of entries.

Definition at line 80 of file BCModelManager.h.

81  { return (fDataSet) ? fDataSet -> GetNDataPoints() : 0; };
unsigned int BCModelManager::GetNModels ( )
inline
Returns
The number of models.

Definition at line 67 of file BCModelManager.h.

68  { return fModelContainer -> size(); };
void BCModelManager::Integrate ( )

Calculates the normalization of the likelihood for each model in the container.

Definition at line 306 of file BCModelManager.cxx.

307 {
308  // initialize likelihood norm
309  double normalization = 0.0;
310 
311  BCLog::OutSummary("Running normalization of all models.");
312 
313  for (unsigned int i = 0; i < GetNModels(); i++) {
314  fModelContainer->at(i)->Integrate();
315 
316  // add to total normalization
317  normalization += (fModelContainer->at(i)->GetIntegral() * fModelContainer->at(i)->GetModelAPrioriProbability());
318  }
319 
320  // set model a posteriori probabilities
321  for (unsigned int i = 0; i < GetNModels(); i++)
322  fModelContainer->at(i)->SetModelAPosterioriProbability(
323  (fModelContainer->at(i)->GetIntegral() * fModelContainer->at(i)->GetModelAPrioriProbability()) /
324  normalization);
325 }
void BCModelManager::MarginalizeAll ( )

Marginalize all probabilities wrt. single parameters and all combinations of two parameters for all models.

Definition at line 386 of file BCModelManager.cxx.

387 {
388  // marginalizes all models registered
389  for (unsigned int i = 0; i < GetNModels(); i++)
390  GetModel(i)->MarginalizeAll();
391 }
BCModelManager & BCModelManager::operator= ( const BCModelManager modelmanager)

The defaut assignment operator

Definition at line 46 of file BCModelManager.cxx.

47 {
48  if (this != &modelmanager)
49  modelmanager.Copy(* this);
50 
51  return * this;
52 }
void BCModelManager::PrintModelComparisonSummary ( const char *  filename = 0)

Prints a summary of model comparison into a file. If filename is omitted the summary will be printed onto the screen

Parameters
filenamename of the file to write into.

Definition at line 477 of file BCModelManager.cxx.

478 {
479  std::ofstream out;
480  std::streambuf * old_buffer = 0;
481 
482  if(file) {
483  out.open(file);
484  if (!out.is_open()) {
485  std::cerr<<"Couldn't open file "<<file<<std::endl;
486  return;
487  }
488  old_buffer = std::cout.rdbuf(out.rdbuf());
489  }
490 
491  // model summary
492  int nmodels = fModelContainer->size();
493  std::cout<<std::endl
494  <<"==========================================="<<std::endl
495  <<" Model Comparison Summary"<<std::endl
496  <<"==========================================="<<std::endl
497  <<std::endl
498  <<" Number of models : "<<nmodels<<std::endl
499  <<std::endl;
500 
501  // probability summary
502  std::cout<<" - A priori probabilities:"<<std::endl<<std::endl;
503 
504  for (int i=0; i<nmodels; i++)
505  std::cout<<" p("<< fModelContainer->at(i)->GetName()
506  <<") = "<< fModelContainer->at(i)->GetModelAPrioriProbability()
507  <<std::endl;
508  std::cout<<std::endl;
509 
510  std::cout<<" - A posteriori probabilities:"<<std::endl<<std::endl;
511 
512  for (int i = 0; i < nmodels; i++)
513  std::cout<<" p("<< fModelContainer->at(i)->GetName()
514  <<" | data) = "<< fModelContainer->at(i)->GetModelAPosterioriProbability()
515  <<std::endl;
516  std::cout<<std::endl;
517 
518  // Bayes factors summary
519  std::cout<<" - Bayes factors:"<<std::endl<<std::endl;
520  for (int i = 0; i < nmodels-1; i++)
521  for (int j = i+1; j < nmodels; j++)
522  std::cout<<" K = p(data | "<<fModelContainer->at(i)->GetName()<<") / "
523  <<"p(data | "<<fModelContainer->at(j)->GetName()<<") = "
524  <<BayesFactor(i,j)<<std::endl;
525  std::cout<<std::endl;
526 
527  // p-values summary
528  std::cout
529  <<" - p-values:"<<std::endl
530  <<std::endl;
531 
532  for (int i = 0; i < nmodels; i++)
533  {
534  double p = fModelContainer->at(i)->GetPValue();
535  std::cout <<" "<< fModelContainer->at(i)->GetName();
536  if(p>=0.)
537  std::cout<<": p-value = "<< p;
538  else
539  std::cout<<": p-value not calculated";
540  std::cout<<std::endl;
541  }
542  std::cout<<std::endl;
543 
544  std::cout<<"==========================================="<<std::endl<<std::endl;
545 
546  if (file)
547  std::cout.rdbuf(old_buffer);
548 
549 }
void BCModelManager::PrintResults ( )

Prints summaries of all files

Definition at line 553 of file BCModelManager.cxx.

554 {
555  // print summary of all models
556  for (unsigned int i = 0; i < GetNModels(); i++)
557  GetModel(i)->PrintResults(Form("%s.txt", GetModel(i)->GetName().data()));
558 }
void BCModelManager::PrintSummary ( const char *  filename = 0)

Prints a summary into a file. If filename is omitted the summary will be printed onto the screen. This method is obsolete. Use PrintResults() instead.

Parameters
filenamename of the file to write into.

Definition at line 413 of file BCModelManager.cxx.

414 {
415  std::ofstream out;
416  std::streambuf * old_buffer = 0;
417 
418  if(file) {
419  out.open(file);
420  if (!out.is_open()) {
421  std::cerr<<"Couldn't open file "<<file<<std::endl;
422  return;
423  }
424  old_buffer = std::cout.rdbuf(out.rdbuf());
425  }
426 
427  // model summary
428  int nmodels = fModelContainer->size();
429  std::cout<<std::endl
430  <<"======================================"<<std::endl
431  <<" Summary"<<std::endl
432  <<"======================================"<<std::endl
433  <<std::endl
434  <<" Number of models : "<<nmodels<<std::endl
435  <<std::endl
436  <<" - Models:"<<std::endl;
437 
438  for (int i = 0; i < nmodels; i++)
439  fModelContainer->at(i)->PrintSummary();
440 
441  // data summary
442  std::cout<<" - Data:"<<std::endl
443  <<std::endl
444  <<" Number of entries: "<<fDataSet->GetNDataPoints()<<std::endl
445  <<std::endl;
446 
447  std::cout<<"======================================"<<std::endl
448  <<" Model comparison"<<std::endl
449  <<std::endl;
450 
451  // probability summary
452  std::cout<<" - A priori probabilities:"<<std::endl<<std::endl;
453 
454  for (int i=0; i<nmodels; i++)
455  std::cout<<" p("<< fModelContainer->at(i)->GetName()
456  <<") = "<< fModelContainer->at(i)->GetModelAPrioriProbability()
457  <<std::endl;
458  std::cout<<std::endl;
459 
460  std::cout<<" - A posteriori probabilities:"<<std::endl<<std::endl;
461 
462  for (int i = 0; i < nmodels; i++)
463  std::cout<<" p("<< fModelContainer->at(i)->GetName()
464  <<" | data) = "<< fModelContainer->at(i)->GetModelAPosterioriProbability()
465  <<std::endl;
466  std::cout<<std::endl;
467 
468  std::cout<<"======================================"<<std::endl<<std::endl;
469 
470  if (file)
471  std::cout.rdbuf(old_buffer);
472 
473 }
int BCModelManager::ReadDataFromFile ( const char *  filename,
const char *  treename,
const char *  branchnames 
)
inline

Reads data from a file. For a description see the following member functions.

Definition at line 214 of file BCModelManager.h.

215  { return this -> ReadDataFromFileTree(filename, treename, branchnames); };
int BCModelManager::ReadDataFromFile ( const char *  filename,
int  nvariables 
)
inline

Definition at line 217 of file BCModelManager.h.

218  { return this -> ReadDataFromFileTxt(filename, nvariables); };
int BCModelManager::ReadDataFromFileTree ( const char *  filename,
const char *  treename,
const char *  branchnames 
)

Reads tree data from a ROOT file. Opens a ROOT file and gets a ROOT tree. It creates data set containing the values read from the file.

Parameters
filenameThe filename of the ROOT file
treenameThe name of the ROOT tree
branchnamesA vector of the names of the branches
See Also
ReadDataFromFileHist(char * filename, char * histname, const char* branchnames);
ReadDataFromFileTxt(char * filename, int nbranches);

Definition at line 242 of file BCModelManager.cxx.

243 {
244  if (fModelContainer->size() == 0) {
245  BCLog::OutError("BCModelManager::ReadDataFromFileTree : No model defined.");
246  return -1;
247  }
248 
249  // create data set
250  if (!fDataSet)
251  fDataSet = new BCDataSet();
252  else
253  fDataSet->Reset();
254 
255  // read data from tree
256  int read_file = fDataSet->ReadDataFromFileTree(filename, treename, branchnames);
257 
258  if (read_file >=0) {
260 
261  for (unsigned int i = 0; i < GetNModels(); i++)
262  fModelContainer->at(i)->SetDataSet(fDataSet);
263  }
264  else if (read_file == -1) {
265  delete fDataSet;
266  return -1;
267  }
268 
269  return 0;
270 }
int BCModelManager::ReadDataFromFileTxt ( const char *  filename,
int  nbranches 
)

Reads data from a txt file. Opens a txt file and creates data set containing the values read from the file.

Parameters
filenameThe filename of the ROOT file
nbranchesThe number of variables
See Also
ReadDataFromFileTree(char * filename, char * treename, std::vector<char*> branchnames)
ReadDataFromFileHist(char * filename, char * histname, const char * branchnames);

Definition at line 274 of file BCModelManager.cxx.

275 {
276  if (fModelContainer->size() == 0) {
277  BCLog::OutError("BCModelManager::ReadDataFromFileTree. No model defined.");
278  return -1;
279  }
280 
281  // create data set
282  if (!fDataSet)
283  fDataSet = new BCDataSet();
284  else
285  fDataSet->Reset();
286 
287  // read data from txt file
288  int read_file = fDataSet->ReadDataFromFileTxt(filename, nbranches);
289 
290  if (read_file >=0) {
292 
293  for (unsigned int i = 0; i < GetNModels(); i++)
294  fModelContainer->at(i)->SetDataSet(fDataSet);
295  }
296  else {
297  delete fDataSet;
298  return -1;
299  }
300 
301  return 0;
302 }
void BCModelManager::ResetDataSet ( )
inline

Resets the data set

Definition at line 268 of file BCModelManager.h.

269  { fDataSet -> Reset(); };
void BCModelManager::SetAbsolutePrecision ( double  absprecision)

Set absolute precision of the numerical integation

Definition at line 171 of file BCModelManager.cxx.

172 {
173  // set absolute precision for all models registered
174  for (unsigned int i = 0; i < GetNModels(); i++)
175  GetModel(i)->SetAbsolutePrecision(absprecision);
176 }
void BCModelManager::SetDataBoundaries ( int  index,
double  lowerboundary,
double  upperboundary 
)

Set the lower and upper boundaries for possible data values for a particular variable

Definition at line 225 of file BCModelManager.cxx.

226 {
227  // set lower and upper boundary values for all models registered
228  for (unsigned int i = 0; i < GetNModels(); i++)
229  GetModel(i)->SetDataBoundaries(index, lowerboundary, upperboundary);
230 }
void BCModelManager::SetDataPointLowerBoundaries ( BCDataPoint datasetlowerboundaries)

Sets the data point containing the lower boundaries of possible data values

Definition at line 189 of file BCModelManager.cxx.

190 {
191  // set lower boundary point for all models registered
192  for (unsigned int i = 0; i < GetNModels(); i++)
193  GetModel(i)->SetDataPointLowerBoundaries(datasetlowerboundaries);
194 }
void BCModelManager::SetDataPointLowerBoundary ( int  index,
double  lowerboundary 
)

Sets the lower boundary of possible data values for a particular variable

Definition at line 207 of file BCModelManager.cxx.

208 {
209  // set lower bounday values for all models registered
210  for (unsigned int i = 0; i < GetNModels(); i++)
211  GetModel(i)->SetDataPointLowerBoundary(index, lowerboundary);
212 }
void BCModelManager::SetDataPointUpperBoundaries ( BCDataPoint datasetupperboundaries)

Sets the data point containing the upper boundaries of possible data values

Definition at line 198 of file BCModelManager.cxx.

199 {
200  // set upper boundary point for all models registered
201  for (unsigned int i = 0; i < GetNModels(); i++)
202  GetModel(i)->SetDataPointUpperBoundaries(datasetupperboundaries);
203 }
void BCModelManager::SetDataPointUpperBoundary ( int  index,
double  upperboundary 
)

Sets the upper boundary of possible data values for a particular variable

Definition at line 216 of file BCModelManager.cxx.

217 {
218  // set upper boundary values for all models registered
219  for (unsigned int i = 0; i < GetNModels(); i++)
220  GetModel(i)->SetDataPointUpperBoundary(index, upperboundary);
221 }
void BCModelManager::SetDataSet ( BCDataSet dataset)

Sets the data set common to all BCModels in this BCModelManager.

Parameters
datasetA data set

Definition at line 56 of file BCModelManager.cxx.

57 {
58  // set data set
59  fDataSet = dataset;
60 
61  // set data set of all models in the manager
62  for (unsigned int i = 0; i < GetNModels(); i++)
64 }
void BCModelManager::SetIntegrationMethod ( BCIntegrate::BCIntegrationMethod  method)
Parameters
methodThe integration method

Definition at line 134 of file BCModelManager.cxx.

135 {
136  // set integration method for all models registered
137 
138  for (unsigned int i = 0; i < GetNModels(); i++)
139  GetModel(i)->SetIntegrationMethod(method);
140 }
void BCModelManager::SetMarginalizationMethod ( BCIntegrate::BCMarginalizationMethod  method)
Parameters
methodThe marginalization method

Definition at line 144 of file BCModelManager.cxx.

145 {
146  // set marginalization method for all models registered
147  for (unsigned int i = 0; i < GetNModels(); i++)
149 }
void BCModelManager::SetNbins ( unsigned int  n)
Parameters
nNumber of bins per dimension for the marginalized distributions. Default is 100. Minimum number allowed is 2.

Definition at line 180 of file BCModelManager.cxx.

181 {
182  // set number of bins for all models registered
183  for (unsigned int i = 0; i < GetNModels(); i++)
184  GetModel(i)->SetNbins(n);
185 }
void BCModelManager::SetNChains ( unsigned int  n)

Sets the number of Markov chains

Definition at line 233 of file BCModelManager.cxx.

234 {
235  // set number of Markov chains for all models registered
236  for (unsigned int i = 0; i < GetNModels(); i++)
237  GetModel(i)->MCMCSetNChains(n);
238 }
void BCModelManager::SetNIterationsMax ( int  niterations)

Definition at line 105 of file BCModelManager.cxx.

106 {
107  for (unsigned int i = 0; i < GetNModels(); i++)
108  GetModel(i)->SetNIterationsMax(niterations);
109 }
void BCModelManager::SetNIterationsMin ( int  niterations)

Sets the minimum number of iterations for the Monte Carlo integration for all BCModels in this BCModelManager.

Parameters
niterations

Definition at line 112 of file BCModelManager.cxx.

113 {
114  for (unsigned int i = 0; i < GetNModels(); i++)
115  GetModel(i)->SetNIterationsMin(niterations);
116 }
void BCModelManager::SetNIterationsOutput ( int  niterations)
Parameters
niterationsinterval for outputting during integration. If negative, frequency is autogenerated.

Definition at line 126 of file BCModelManager.cxx.

127 {
128  for (unsigned int i = 0; i < GetNModels(); i++)
129  GetModel(i)->SetNIterationsOutput(niterations);
130 }
void BCModelManager::SetNIterationsPrecisionCheck ( int  niterations)
Parameters
niterationsinterval for checking precision in integration routines

Definition at line 119 of file BCModelManager.cxx.

120 {
121  for (unsigned int i = 0; i < GetNModels(); i++)
122  GetModel(i)->SetNIterationsPrecisionCheck(niterations);
123 }
void BCModelManager::SetOptimizationMethod ( BCIntegrate::BCOptimizationMethod  method)
Parameters
methodThe mode finding method

Definition at line 153 of file BCModelManager.cxx.

154 {
155  // set mode finding method for all models registered
156  for (unsigned int i = 0; i < GetNModels(); i++)
157  GetModel(i)->SetOptimizationMethod(method);
158 }
void BCModelManager::SetRelativePrecision ( double  relprecision)
Parameters
relprecisionThe relative precision envisioned for Monte Carlo integration

Definition at line 162 of file BCModelManager.cxx.

163 {
164  // set relative precision for all models registered
165  for (unsigned int i = 0; i < GetNModels(); i++)
166  GetModel(i)->SetRelativePrecision(relprecision);
167 }
void BCModelManager::SetSingleDataPoint ( BCDataPoint datapoint)

Sets a single data point as a common data set.

Parameters
datapointA data point
See Also
SetSingleDataPoint(BCDataSet * dataset, int index)
SetDataSet(BCDataSet * dataset)

Definition at line 68 of file BCModelManager.cxx.

69 {
70  // create new data set consisting of a single data point
71  BCDataSet * dataset = new BCDataSet();
72 
73  // add the data point
74  dataset->AddDataPoint(datapoint);
75 
76  // set this new data set
77  SetDataSet(dataset);
78 }
void BCModelManager::SetSingleDataPoint ( BCDataSet dataset,
unsigned int  index 
)

Sets a single data point as a common data set.

Parameters
datasetA data set.
indexThe index of the data point in the data set specified.
See Also
SetSingleDataPoint(BCDataPoint * datapoint)
SetDataSet(BCDataSet * dataset)

Definition at line 82 of file BCModelManager.cxx.

83 {
84  if (index > dataset->GetNDataPoints())
85  return;
86 
87  SetSingleDataPoint(dataset->GetDataPoint(index));
88 }
void BCModelManager::WriteMarkovChain ( bool  flag)

Flag for writing Markov chain to file

Definition at line 395 of file BCModelManager.cxx.

396 {
397  // marginalizes all models registered
398  for (unsigned int i = 0; i < GetNModels(); i++)
399  GetModel(i)->WriteMarkovChain(flag);
400 }

Member Data Documentation

BCDataSet* BCModelManager::fDataSet
private

The data set common to all models.

Definition at line 306 of file BCModelManager.h.

BCModelContainer* BCModelManager::fModelContainer
private

The BCModelContainer containing all BCModels.

Definition at line 302 of file BCModelManager.h.


The documentation for this class was generated from the following files: