Private Member Functions | Private Attributes

BCModelManager Class Reference

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

#include <BCModelManager.h>

Collaboration diagram for BCModelManager:
Collaboration graph
[legend]

List of all members.

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 SetMarginalizationMethod (BCIntegrate::BCMarginalizationMethod method)
void SetIntegrationMethod (BCIntegrate::BCIntegrationMethod method)
void SetOptimizationMethod (BCIntegrate::BCOptimizationMethod method)
void SetNiterationsPerDimension (unsigned int niterations)
void SetNSamplesPer2DBin (unsigned int n)
void SetRelativePrecision (double relprecision)
void SetNbins (unsigned int n)
void SetFillErrorBand (bool flag=true)
void UnetFillErrorBand ()
void SetFitFunctionIndexX (int index)
void SetFitFunctionIndexY (int index)
void SetFitFunctionIndices (int indexx, int indexy)
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 FixDataAxis (int index, bool fixed)
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 Normalize ()
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

BCDataSetfDataSet
BCModelContainerfModelContainer

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 34 of file BCModelManager.h.


Constructor & Destructor Documentation

BCModelManager::BCModelManager (  ) 

The default constructor.

Definition at line 25 of file BCModelManager.cxx.

BCModelManager::BCModelManager ( const BCModelManager modelmanager  ) 

The default copy constructor.

Definition at line 43 of file BCModelManager.cxx.

{
   modelmanager.Copy(*this);
}

BCModelManager::~BCModelManager (  )  [virtual]

The default destructor.

Definition at line 33 of file BCModelManager.cxx.

{
   delete fModelContainer;

   if (fDataSet)
      delete fDataSet;
}


Member Function Documentation

void BCModelManager::AddDataPoint ( BCDataPoint datapoint  )  [inline]

Adds a data point to the data container.

Parameters:
datapoint The data point

Definition at line 236 of file BCModelManager.h.

         { fDataSet -> AddDataPoint(datapoint); };

void BCModelManager::AddModel ( BCModel model,
double  probability = 0. 
)

Adds a model to the container

Parameters:
model The model
probability The a priori probability
See also:
AddModel(BCModel * model)
SetModelPrior(BCModel * model, double probability)

Definition at line 96 of file BCModelManager.cxx.

{
   // create index
   unsigned int index = fModelContainer->size();

   // set index of new model
   model->SetIndex(index);

   // set a priori probability of new model
   model->SetModelAPrioriProbability(probability);

   // set data set
   model->SetDataSet(fDataSet);

   // fill model into container
   fModelContainer->push_back(model);
}

double BCModelManager::BayesFactor ( const unsigned int  imodel1,
const unsigned int  imodel2 
)

Calculate Bayes factor for two models.

Parameters:
imodel1 index of model 1 (numerator)
imodel2 index of model 2 (denominator)
Returns:
Bayes factor or -1. on error

Definition at line 378 of file BCModelManager.cxx.

{
   // Bayes Factors are the likelihoods integrated over the parameters
   // Is this equal to the posteriors?
   //    NOOOO
   // But it is equal to normalization factors.

   const double norm1 = fModelContainer->at(imodel1)->GetNormalization();
   const double norm2 = fModelContainer->at(imodel2)->GetNormalization();

   // check model 1
   if(norm1<0.) {
      BCLog::OutError(
         Form("Model %s (index %d) not normalized. Cannot calculate Bayes factor.",
              fModelContainer->at(imodel1)->GetName().data(),imodel1));
      return -1.;
   }

   // check model 2
   if(norm2<0.) {
      BCLog::OutError(
         Form("Model %s (index %d) not normalized. Cannot calculate Bayes factor.",
              fModelContainer->at(imodel2)->GetName().data(),imodel2));
      return -1.;
   }

   // denominator cannot be zero
   if(norm2==0. && norm1!=0.) {// not good since norm2 is double !!!
      BCLog::OutError(
         Form("Model %s (index %d) has ZERO probability. Bayes factor is infinite.",
              fModelContainer->at(imodel2)->GetName().data(),imodel2));
      return -1.;
   }

   // denominator cannot be zero unless also numerator is zero
   if(norm2==0. && norm1==0.) {// not good since norm2 and norm1 are both double !!!
      BCLog::OutWarning(
         Form("Models %s and %s have ZERO probability. Bayes factor is unknown. Returning 1.",
              fModelContainer->at(imodel2)->GetName().data(),fModelContainer->at(imodel1)->GetName().data()));
      return 1.;
   }

   // now calculate the factor
   return norm1/norm2;
}

void BCModelManager::CalculatePValue ( bool  flag_histogram = false  ) 

Definition at line 453 of file BCModelManager.cxx.

{
   // calculate p-value for all models
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->CalculatePValue(GetModel(i)->GetBestFitParameters(), flag_histogram);
}

void BCModelManager::Copy ( BCModelManager modelmanager  )  const [private]

Definition at line 611 of file BCModelManager.cxx.

{
   // don't copy the content only the pointers
   modelmanager.fModelContainer = fModelContainer;
   modelmanager.fDataSet        = fDataSet;
}

void BCModelManager::FindMode (  ) 

Does the mode finding

Definition at line 426 of file BCModelManager.cxx.

{
   // finds mode for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->FindMode();
}

void BCModelManager::FixDataAxis ( int  index,
bool  fixed 
)

Definition at line 272 of file BCModelManager.cxx.

{
   // fix axis for all models
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->FixDataAxis(index, fixed);
}

BCDataPoint* BCModelManager::GetDataPoint ( int  index  )  [inline]

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

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

Definition at line 89 of file BCModelManager.h.

         { return fDataSet -> GetDataPoint(index); };

BCDataSet* BCModelManager::GetDataSet (  )  [inline]

Returns the common data set.

Returns:
The data set.

Definition at line 95 of file BCModelManager.h.

         { return fDataSet; };

BCModel* BCModelManager::GetModel ( int  index  )  [inline]

Returns the BCModel at a certain index of this BCModelManager.

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

Definition at line 76 of file BCModelManager.h.

         { 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 82 of file BCModelManager.h.

         { return (fDataSet) ? fDataSet -> GetNDataPoints() : 0; };

unsigned int BCModelManager::GetNModels (  )  [inline]
Returns:
The number of models.

Definition at line 69 of file BCModelManager.h.

         { return fModelContainer -> size(); };

void BCModelManager::MarginalizeAll (  ) 

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

Definition at line 435 of file BCModelManager.cxx.

{
   // marginalizes all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->MarginalizeAll();
}

void BCModelManager::Normalize (  ) 

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

Definition at line 354 of file BCModelManager.cxx.

{
   // initialize likelihood norm
   double normalization = 0.0;

//   BCLog::Out(BCLog::summary, BCLog::summary, "Running normalization of all models.");
   BCLog::OutSummary("Running normalization of all models.");

   for (unsigned int i = 0; i < GetNModels(); i++) {
      fModelContainer->at(i)->Normalize();

      // add to total normalization
      normalization += (fModelContainer->at(i)->GetNormalization() * fModelContainer->at(i)->GetModelAPrioriProbability());
   }

   // set model a posteriori probabilities
   for (unsigned int i = 0; i < GetNModels(); i++)
      fModelContainer->at(i)->SetModelAPosterioriProbability(
            (fModelContainer->at(i)->GetNormalization() * fModelContainer->at(i)->GetModelAPrioriProbability()) /
            normalization);
}

BCModelManager & BCModelManager::operator= ( const BCModelManager modelmanager  ) 

The defaut assignment operator

Definition at line 50 of file BCModelManager.cxx.

{
   if (this != &modelmanager)
      modelmanager.Copy(* this);

   return * this;
}

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:
filename name of the file to write into.

Definition at line 526 of file BCModelManager.cxx.

{
   ofstream out;
   std::streambuf * old_buffer = 0;

   if(file) {
      out.open(file);
      if (!out.is_open()) {
         std::cerr<<"Couldn't open file "<<file<<std::endl;
         return;
      }
      old_buffer = std::cout.rdbuf(out.rdbuf());
   }

   // model summary
   int nmodels = fModelContainer->size();
   std::cout<<std::endl
            <<"==========================================="<<std::endl
            <<" Model Comparison Summary"<<std::endl
            <<"==========================================="<<std::endl
            <<std::endl
            <<" Number of models               : "<<nmodels<<std::endl
            <<std::endl;

   // probability summary
   std::cout<<" - A priori probabilities:"<<std::endl<<std::endl;
  
   for (int i=0; i<nmodels; i++)
      std::cout<<"     p("<< fModelContainer->at(i)->GetName()
               <<") = "<< fModelContainer->at(i)->GetModelAPrioriProbability()
               <<std::endl;
   std::cout<<std::endl;

   std::cout<<" - A posteriori probabilities:"<<std::endl<<std::endl;

   for (int i = 0; i < nmodels; i++)
      std::cout<<"     p("<< fModelContainer->at(i)->GetName()
               <<" | data) = "<< fModelContainer->at(i)->GetModelAPosterioriProbability()
               <<std::endl;
   std::cout<<std::endl;

   // Bayes factors summary
   std::cout<<" - Bayes factors:"<<std::endl<<std::endl;
   for (int i = 0; i < nmodels-1; i++)
      for (int j = i+1; j < nmodels; j++)
         std::cout<<"     K = p(data | "<<fModelContainer->at(i)->GetName()<<") / "
                  <<"p(data | "<<fModelContainer->at(j)->GetName()<<") = "
                  <<BayesFactor(i,j)<<std::endl;
   std::cout<<std::endl;

   // p-values summary
   std::cout
      <<" - p-values:"<<std::endl
      <<std::endl;

   for (int i = 0; i < nmodels; i++)
   {
      double p = fModelContainer->at(i)->GetPValue();
      std::cout <<"     "<< fModelContainer->at(i)->GetName();
      if(p>=0.)
         std::cout<<":  p-value = "<< p;
      else
         std::cout<<":  p-value not calculated";
      std::cout<<std::endl;
   }
   std::cout<<std::endl;

   std::cout<<"==========================================="<<std::endl<<std::endl;

   if (file)
      std::cout.rdbuf(old_buffer);

}

void BCModelManager::PrintResults (  ) 

Definition at line 602 of file BCModelManager.cxx.

{
   // print summary of all models
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->PrintResults(Form("%s.txt", GetModel(i)->GetName().data()));
}

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:
filename name of the file to write into.

Definition at line 462 of file BCModelManager.cxx.

{
   ofstream out;
   std::streambuf * old_buffer = 0;

   if(file) {
      out.open(file);
      if (!out.is_open()) {
         std::cerr<<"Couldn't open file "<<file<<std::endl;
         return;
      }
      old_buffer = std::cout.rdbuf(out.rdbuf());
   }

   // model summary
   int nmodels = fModelContainer->size();
   std::cout<<std::endl
            <<"======================================"<<std::endl
            <<" Summary"<<std::endl
            <<"======================================"<<std::endl
            <<std::endl
            <<" Number of models               : "<<nmodels<<std::endl
            <<std::endl
            <<" - Models:"<<std::endl;

   for (int i = 0; i < nmodels; i++)
      fModelContainer->at(i)->PrintSummary();

   // data summary
   std::cout<<" - Data:"<<std::endl
            <<std::endl
            <<"     Number of entries: "<<fDataSet->GetNDataPoints()<<std::endl
            <<std::endl;

   std::cout<<"======================================"<<std::endl
            <<" Model comparison"<<std::endl
            <<std::endl;

   // probability summary
   std::cout<<" - A priori probabilities:"<<std::endl<<std::endl;
  
   for (int i=0; i<nmodels; i++)
      std::cout<<"     p("<< fModelContainer->at(i)->GetName()
               <<") = "<< fModelContainer->at(i)->GetModelAPrioriProbability()
               <<std::endl;
   std::cout<<std::endl;

   std::cout<<" - A posteriori probabilities:"<<std::endl<<std::endl;

   for (int i = 0; i < nmodels; i++)
      std::cout<<"     p("<< fModelContainer->at(i)->GetName()
               <<" | data) = "<< fModelContainer->at(i)->GetModelAPosterioriProbability()
               <<std::endl;
   std::cout<<std::endl;

   std::cout<<"======================================"<<std::endl<<std::endl;

   if (file)
      std::cout.rdbuf(old_buffer);

}

int BCModelManager::ReadDataFromFile ( const char *  filename,
int  nvariables 
) [inline]

Definition at line 245 of file BCModelManager.h.

      { return this -> ReadDataFromFileTxt(filename, nvariables); };

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 242 of file BCModelManager.h.

      { return this ->  ReadDataFromFileTree(filename, treename, branchnames); };

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:
filename The filename of the ROOT file
treename The name of the ROOT tree
branchnames A 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 290 of file BCModelManager.cxx.

{
   if (fModelContainer->size() < 0) {
      BCLog::Out(BCLog::warning, BCLog::warning, "BCModelManager::ReadDataFromFileTree : No model defined.");
      return ERROR_NOMODELS;
   }

   // create data set
   if (!fDataSet)
      fDataSet = new BCDataSet();
   else
      fDataSet->Reset();

   // read data from tree
   int read_file = fDataSet->ReadDataFromFileTree(filename, treename, branchnames);

   if (read_file >=0) {
      SetDataSet(fDataSet);

      for (unsigned int i = 0; i < GetNModels(); i++)
         fModelContainer->at(i)->SetDataSet(fDataSet);
   }
   else if (read_file == ERROR_FILENOTFOUND) {
      delete fDataSet;
      return ERROR_FILENOTFOUND;
   }

   return 0;
}

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:
filename The filename of the ROOT file
nbranches The 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 322 of file BCModelManager.cxx.

{
   if (fModelContainer->size() < 0) {
      BCLog::Out(BCLog::warning, BCLog::warning, "BCModelManager::ReadDataFromFileTree. No model defined.");
      return ERROR_NOMODELS;
   }

   // create data set
   if (!fDataSet)
      fDataSet = new BCDataSet();
   else
      fDataSet->Reset();

   // read data from txt file
   int read_file = fDataSet->ReadDataFromFileTxt(filename, nbranches);

   if (read_file >=0) {
      SetDataSet(fDataSet);

      for (unsigned int i = 0; i < GetNModels(); i++)
         fModelContainer->at(i)->SetDataSet(fDataSet);
   }
   else {
      delete fDataSet;
      return ERROR_FILENOTFOUND;
   }

   return 0;
}

void BCModelManager::ResetDataSet (  )  [inline]

Resets the data set

Definition at line 296 of file BCModelManager.h.

         { fDataSet -> Reset(); };

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 263 of file BCModelManager.cxx.

{
   // set lower and upper boundary values for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetDataBoundaries(index, lowerboundary, upperboundary);
}

void BCModelManager::SetDataPointLowerBoundaries ( BCDataPoint datasetlowerboundaries  ) 

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

Definition at line 227 of file BCModelManager.cxx.

{
   // set lower boundary point for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetDataPointLowerBoundaries(datasetlowerboundaries);
}

void BCModelManager::SetDataPointLowerBoundary ( int  index,
double  lowerboundary 
)

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

Definition at line 245 of file BCModelManager.cxx.

{
   // set lower bounday values for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetDataPointLowerBoundary(index, lowerboundary);
}

void BCModelManager::SetDataPointUpperBoundaries ( BCDataPoint datasetupperboundaries  ) 

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

Definition at line 236 of file BCModelManager.cxx.

{
   // set upper boundary point for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetDataPointUpperBoundaries(datasetupperboundaries);
}

void BCModelManager::SetDataPointUpperBoundary ( int  index,
double  upperboundary 
)

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

Definition at line 254 of file BCModelManager.cxx.

{
   // set upper boundary values for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetDataPointUpperBoundary(index, upperboundary);
}

void BCModelManager::SetDataSet ( BCDataSet dataset  ) 

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

Parameters:
dataset A data set

Definition at line 60 of file BCModelManager.cxx.

{
   // set data set
   fDataSet = dataset;

   // set data set of all models in the manager
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetDataSet(fDataSet);
}

void BCModelManager::SetFillErrorBand ( bool  flag = true  ) 

Turn on or off the filling of the error band during the MCMC run for all models added to the model manager before calling this method.

Parameters:
flag set to true for turning on the filling

Definition at line 192 of file BCModelManager.cxx.

{
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetFillErrorBand(flag);
}

void BCModelManager::SetFitFunctionIndexX ( int  index  ) 

Sets index of the x values in function fits.

Parameters:
index Index of the x values

Definition at line 200 of file BCModelManager.cxx.

{
   // set fit function x index for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetFitFunctionIndexX(index);
}

void BCModelManager::SetFitFunctionIndexY ( int  index  ) 

Sets index of the y values in function fits.

Parameters:
index Index of the y values

Definition at line 209 of file BCModelManager.cxx.

{
   // set  fit function y index for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetFitFunctionIndexY(index);
}

void BCModelManager::SetFitFunctionIndices ( int  indexx,
int  indexy 
)

Definition at line 218 of file BCModelManager.cxx.

{
   // set fit function indices for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetFitFunctionIndices(indexx, indexy);
}

void BCModelManager::SetIntegrationMethod ( BCIntegrate::BCIntegrationMethod  method  ) 
Parameters:
method The integration method

Definition at line 128 of file BCModelManager.cxx.

{
   // set integration method for all models registered

   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetIntegrationMethod(method);
}

void BCModelManager::SetMarginalizationMethod ( BCIntegrate::BCMarginalizationMethod  method  ) 

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

Parameters:
niterations 
method The marginalization method

Definition at line 138 of file BCModelManager.cxx.

{
   // set marginalization method for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetMarginalizationMethod(method);
};

void BCModelManager::SetNbins ( unsigned int  n  ) 
Parameters:
n Number of bins per dimension for the marginalized distributions. Default is 100. Minimum number allowed is 2.

Definition at line 183 of file BCModelManager.cxx.

{
   // set number of bins for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->BCIntegrate::SetNbins(n);
}

void BCModelManager::SetNChains ( unsigned int  n  ) 

Definition at line 281 of file BCModelManager.cxx.

{
   // set number of Markov chains for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->MCMCSetNChains(n);
}

void BCModelManager::SetNiterationsPerDimension ( unsigned int  niterations  ) 
Parameters:
niterations Number of iterations per dimension for Monte Carlo integration.

Definition at line 156 of file BCModelManager.cxx.

{
   // set number of iterations per dimension for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetNiterationsPerDimension(niterations);
}

void BCModelManager::SetNSamplesPer2DBin ( unsigned int  n  ) 
Parameters:
n Number of samples per 2D bin per variable in the Metropolis marginalization. Default is 100.

Definition at line 165 of file BCModelManager.cxx.

{
   // set samples per 2d bin for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetNSamplesPer2DBin(n);
}

void BCModelManager::SetOptimizationMethod ( BCIntegrate::BCOptimizationMethod  method  ) 
Parameters:
method The mode finding method

Definition at line 147 of file BCModelManager.cxx.

{
   // set mode finding method for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetOptimizationMethod(method);
}

void BCModelManager::SetRelativePrecision ( double  relprecision  ) 
Parameters:
relprecision The relative precision envisioned for Monte Carlo integration

Definition at line 174 of file BCModelManager.cxx.

{
   // set relative precision for all models registered
   for (unsigned int i = 0; i < GetNModels(); i++)
      GetModel(i)->SetRelativePrecision(relprecision);
}

void BCModelManager::SetSingleDataPoint ( BCDataPoint datapoint  ) 

Sets a single data point as a common data set.

Parameters:
datapoint A data point
See also:
SetSingleDataPoint(BCDataSet * dataset, int index)
SetDataSet(BCDataSet * dataset)

Definition at line 72 of file BCModelManager.cxx.

{
   // create new data set consisting of a single data point
   BCDataSet * dataset = new BCDataSet();

   // add the data point
   dataset->AddDataPoint(datapoint);

   // set this new data set
   SetDataSet(dataset);
}

void BCModelManager::SetSingleDataPoint ( BCDataSet dataset,
unsigned int  index 
)

Sets a single data point as a common data set.

Parameters:
dataset A data set.
index The index of the data point in the data set specified.
See also:
SetSingleDataPoint(BCDataPoint * datapoint)
SetDataSet(BCDataSet * dataset)

Definition at line 86 of file BCModelManager.cxx.

{
   if (index < 0 || index > dataset->GetNDataPoints())
      return;

   SetSingleDataPoint(dataset->GetDataPoint(index));
}

void BCModelManager::UnetFillErrorBand (  )  [inline]

Turn off the filling of the error band during the MCMC run for all models added to the model manager before calling this method.

Definition at line 172 of file BCModelManager.h.

         { SetFillErrorBand(false); };

void BCModelManager::WriteMarkovChain ( bool  flag  ) 

Definition at line 444 of file BCModelManager.cxx.

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


Member Data Documentation

The data set common to all models.

Definition at line 334 of file BCModelManager.h.

The BCModelContainer containing all BCModels.

Definition at line 330 of file BCModelManager.h.


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