BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCMVCPhysicsModel.cxx
1 /*
2  * Copyright (C) 2007-2014, the BAT core developer team
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  * For documentation see http://mpp.mpg.de/bat
7  */
8 
9 // ---------------------------------------------------------
10 
11 #include "BCMVCPhysicsModel.h"
12 #include "BCMVCObservable.h"
13 
14 #include "../../BAT/BCModel.h"
15 #include "../../BAT/BCMath.h"
16 #include "../../BAT/BCLog.h"
17 
18 // ---------------------------------------------------------
19 BCMVCPhysicsModel::BCMVCPhysicsModel() : BCMVCombination()
20 {
21 }
22 
23 // ---------------------------------------------------------
24 BCMVCPhysicsModel::~BCMVCPhysicsModel()
25 {
26 }
27 
28 // ---------------------------------------------------------
29 double BCMVCPhysicsModel::LogLikelihood(const std::vector<double> &parameters)
30 {
31  std::vector<double> observables;
32 
33  for (int i = 0; i < fNObservables; ++i)
34  observables.push_back(CalculateObservable(i, parameters));
35 
36  return BCMVCombination::LogLikelihood(observables);
37 }
38 
39 // ---------------------------------------------------------
40 void BCMVCPhysicsModel::AddObservable(std::string name, double min, double max)
41 {
42  // check if observable exists already
43  int index = GetIndexObservable(name);
44 
45  if (index >= 0)
46  return;
47 
48  BCMVCObservable* observable = new BCMVCObservable();
49  observable->SetName(name);
50  observable->SetMinMax(min, max);
51  fObservables.push_back(observable);
52 
53  fNObservables++;
54 }
55 
56 // ---------------------------------------------------------
double LogLikelihood(const std::vector< double > &parameters)
double LogLikelihood(const std::vector< double > &parameters)