flavour
Model Class Referenceabstract

Abstract class for a model. More...

#include <model.h>

Inheritance diagram for Model:
Collaboration diagram for Model:

Public Member Functions

 Model ()
 
virtual ~Model ()
 
virtual parameters getlist (const parameters &p) const =0
 
virtual parameters generateparameters (int max=0) const =0
 
virtual int veto (const parameters &p, int max=0) const
 
double likelihood (const parameters &p, bool check=1, int max=0) const
 calculates the probability of getting all the experimental measures if the model describes the reality More...
 
double loglike (const parameters &p, bool check=1, int max=0) const
 

Public Attributes

TRandom3 * r
 

Detailed Description

Abstract class for a model.

Definition at line 361 of file model.h.

Constructor & Destructor Documentation

Model::Model ( )
inline

Definition at line 364 of file model.h.

364 : r(new TRandom3(0)){}
TRandom3 * r
Definition: model.h:405
virtual Model::~Model ( )
inlinevirtual

Definition at line 365 of file model.h.

365 {delete r;};
TRandom3 * r
Definition: model.h:405

Member Function Documentation

virtual parameters Model::generateparameters ( int  max = 0) const
pure virtual

Implemented in BGLmodels::BGL, and BGL2.

virtual parameters Model::getlist ( const parameters p) const
pure virtual

Implemented in BGLmodels::BGL, BGL2, and Juca.

double Model::likelihood ( const parameters p,
bool  check = 1,
int  max = 0 
) const
inline

calculates the probability of getting all the experimental measures if the model describes the reality

Parameters
pvector with the values of the free parameters

Definition at line 374 of file model.h.

374  {
375  if(veto(p,max) && check) return 0;
376  double total=loglike(p,0);
377  if(total<-1000) return 0;
378  return exp(total);
379  }
double loglike(const parameters &p, bool check=1, int max=0) const
Definition: model.h:381
virtual int veto(const parameters &p, int max=0) const
Definition: model.h:368
double Model::loglike ( const parameters p,
bool  check = 1,
int  max = 0 
) const
inline

Definition at line 381 of file model.h.

Referenced by main().

381  {
382  if(veto(p,max) && check) return -1000;
383  parameters pp(getlist(p));
384 
385  double total=0;
386  int n=0;
387  for(const_iterator i=begin();i!=end();i++) {
388  try{
389  n++;
390  total+=i->loglikelihood(pp);
391  }
392  catch(exception e){
393  cout<<n<<e.what()<<endl;
394  exit(1);
395  }
396  //catch(...){
397  //cout<<"DD "<<n<<endl;
398  //exit(1);
399  //}
400 }
401 
402  return -total;
403  }
virtual parameters getlist(const parameters &p) const =0
vector of parameters
Definition: model.h:177
virtual int veto(const parameters &p, int max=0) const
Definition: model.h:368

Here is the caller graph for this function:

virtual int Model::veto ( const parameters p,
int  max = 0 
) const
inlinevirtual

Reimplemented in BGLmodels::BGL.

Definition at line 368 of file model.h.

References parameters::isvalid().

368 {return !p.isvalid();}
bool isvalid() const
checks if all the values are between their minimums and maximums
Definition: model.h:193

Here is the call graph for this function:

Member Data Documentation

TRandom3* Model::r

Definition at line 405 of file model.h.


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