//////////////////////////////////////////////////////////////// // $Id: IMinimizer.cxx,v 1.3 2007/10/15 20:44:05 mcgrew Exp $ // // Implement the base class for function minimizers. #include #include #include "IMinimizer.hxx" COMET::IMinimizer::IMinimizer(COMET::IMinimizerFunc& func) : fFunction(func) {}; COMET::IMinimizer::~IMinimizer() {}; void COMET::IMinimizer::Optimize(int npar, double *par) { Minimize(npar, par); } void COMET::IMinimizer::Optimize(double& par1) { double par[1]; par[0] = par1; Minimize(1,par); par1 = par[0]; } void COMET::IMinimizer::Optimize(double& par1, double& par2) { double par[2]; par[0] = par1; par[1] = par2; Minimize(2,par); par1 = par[0]; par2 = par[1]; } void COMET::IMinimizer::Optimize(double& par1, double& par2, double& par3) { double par[3]; par[0] = par1; par[1] = par2; par[2] = par3; Minimize(3,par); par1 = par[0]; par2 = par[1]; par3 = par[2]; } void COMET::IMinimizer::Optimize(TVector3& par1) { double par[3]; par1.GetXYZ(par); Minimize(3,par); par1.SetXYZ(par[0],par[1],par[2]); } void COMET::IMinimizer::Optimize(TLorentzVector& par1) { double par[4]; par1.GetXYZT(par); Minimize(4,par); par1.SetXYZT(par[0],par[1],par[2],par[3]); } void COMET::IMinimizer::Optimize(TVector3& par1, TVector3& par2) { double par[6]; par1.GetXYZ(&par[0]); par2.GetXYZ(&par[3]); Minimize(6,par); par1.SetXYZ(par[0],par[1],par[2]); par2.SetXYZ(par[3],par[4],par[5]); } void COMET::IMinimizer::Optimize(TLorentzVector& par1, TVector3& par2) { double par[7]; par1.GetXYZT(&par[0]); par2.GetXYZ(&par[4]); Minimize(7,par); par1.SetXYZT(par[0],par[1],par[2],par[3]); par2.SetXYZ(par[4],par[5],par[6]); } COMET::IMinimizerFunc::IMinimizerFunc(int nPar) : fNParameters(nPar) { for (int i=0; i