ROOT  6.06/09
Reference Guide
GaussFcn.cxx
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 #include "GaussFcn.h"
11 #include "GaussFunction.h"
12 
13 #include <cassert>
14 
15 namespace ROOT {
16 
17  namespace Minuit2 {
18 
19 
20 double GaussFcn::operator()(const std::vector<double>& par) const {
21 
22  assert(par.size() == 3);
23  GaussFunction gauss(par[0], par[1], par[2]);
24 
25  double chi2 = 0.;
26  for(unsigned int n = 0; n < fMeasurements.size(); n++) {
27  chi2 += ((gauss(fPositions[n]) - fMeasurements[n])*(gauss(fPositions[n]) - fMeasurements[n])/fMVariances[n]);
28  }
29 
30  return chi2;
31 }
32 
33 
34  } // namespace Minuit2
35 
36 } // namespace ROOT
virtual double operator()(const std::vector< double > &) const
The meaning of the vector of parameters is of course defined by the user, who uses the values of thos...
Definition: GaussFcn.cxx:20
double par[1]
Definition: unuranDistr.cxx:38
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
#define assert(cond)
Definition: unittest.h:542
std::vector< double > fMeasurements
Definition: GaussFcn.h:47
std::vector< double > fMVariances
Definition: GaussFcn.h:49
std::vector< double > fPositions
Definition: GaussFcn.h:48
const Int_t n
Definition: legend1.C:16