ROOTPWA
TLogMultiGaus.cc
Go to the documentation of this file.
1 
2 //
3 // Copyright 2009 Sebastian Neubert
4 //
5 // This file is part of rootpwa
6 //
7 // rootpwa is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // rootpwa is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
19 //
21 //-----------------------------------------------------------
22 // File and Version Information:
23 // $Id$
24 //
25 // Description:
26 // Implementation of class TLogMultiGaus
27 // see TLogMultiGaus.hh for details
28 //
29 //
30 // Author List:
31 // Sebastian Neubert TUM (original author)
32 //
33 //
34 //-----------------------------------------------------------
35 
36 // This Class' Header ------------------
37 #include "TLogMultiGaus.h"
38 
39 // C/C++ Headers ----------------------
40 #include <fstream>
41 #include <iostream>
42 #include <sstream>
43 using std::cout;
44 using std::endl;
45 using std::ifstream;
46 #include <assert.h>
47 
48 // Collaborating Class Headers --------
49 #include "TString.h"
50 #include "TMath.h"
51 #include "TMatrixD.h"
52 #include "TVectorD.h"
53 #include "TSystem.h"
54 #include "TStopwatch.h"
55 
56 // Class Member definitions -----------
57 
59 {}
60 
62 {}
63 
64 
65 
66 
67 // Likelyhood and first derivatives in one go: *****************************
68 
69 void
70 TLogMultiGaus::FdF(const double* x, double& f, double* df) const {
71  TVectorD v(_dim);
72  for(unsigned int i=0;i<_dim;++i){
73  v[i]=x[i];
74  }
75 
76  TVectorD vp=_precs*v;
77  double res=v*vp;
78 
79  for(unsigned int i=0;i<_dim;++i){
80  df[i]=vp[i];
81  }
82 
83  res*=0.5;
84  f=res;
85  return;
86 }
87 
88 
89 //************************************************************************
90 
91 double
92 TLogMultiGaus::DoEval(const double* x) const
93 {
94 
95  // call FdF
96  double df[_dim];
97  double L;
98  FdF(x, L,df);
99  return L;
100 
101 }
102 
103 
104 
105 unsigned int
107  return _dim;
108 }
109 
110 
111 double
112 TLogMultiGaus::DoDerivative(const double*, unsigned int) const {
113  return 0;
114 }