00001 // @(#)root/minuit2:$Id: GaussFcn.cxx 20880 2007-11-19 11:23:41Z rdm $ 00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005 00003 00004 /********************************************************************** 00005 * * 00006 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT * 00007 * * 00008 **********************************************************************/ 00009 00010 #include "GaussFcn.h" 00011 #include "GaussFunction.h" 00012 00013 #include <cassert> 00014 00015 namespace ROOT { 00016 00017 namespace Minuit2 { 00018 00019 00020 double GaussFcn::operator()(const std::vector<double>& par) const { 00021 00022 assert(par.size() == 3); 00023 GaussFunction gauss(par[0], par[1], par[2]); 00024 00025 double chi2 = 0.; 00026 for(unsigned int n = 0; n < fMeasurements.size(); n++) { 00027 chi2 += ((gauss(fPositions[n]) - fMeasurements[n])*(gauss(fPositions[n]) - fMeasurements[n])/fMVariances[n]); 00028 } 00029 00030 return chi2; 00031 } 00032 00033 00034 } // namespace Minuit2 00035 00036 } // namespace ROOT