Logo ROOT   6.08/07
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
double par[1]
Definition: unuranDistr.cxx:38
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
std::vector< double > fMeasurements
Definition: GaussFcn.h:47
std::vector< double > fMVariances
Definition: GaussFcn.h:49
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
std::vector< double > fPositions
Definition: GaussFcn.h:48
const Int_t n
Definition: legend1.C:16