1 #include "Minuit2/VariableMetricMinimizer.h" 2 #include "Minuit2/FunctionMinimum.h" 3 #include "Minuit2/MnPrint.h" 13 SaturationFit(
int N,
float *charge_ptr,
float *adc_ptr,
float *u0_ptr,
float *u1_ptr,
float *u2_ptr,
float*u3_ptr){
14 double u[3],sigma[3],chisq;
15 VariableMetricMinimizer* pMinimizer=
new VariableMetricMinimizer() ;
17 pFcn->
set_data(N,charge_ptr,adc_ptr);
18 std::vector<double> par(4,0);
19 std::vector<double>
err(4,0);
30 FunctionMinimum fmin = pMinimizer->Minimize(*pFcn, par, err, 1, 5000, 0.01);
32 printf(
" minuit did not converge \n");
34 std::cout<<
"fit succeeded... results: "<<fmin<<std::endl;
36 u[0] = fmin.UserParameters().Value( static_cast<unsigned int>(0) );
38 sigma[0] = fmin.UserParameters().Error( static_cast<unsigned int>(0) );
39 u[1] = fmin.UserParameters().Value( static_cast<unsigned int>(1) );
41 sigma[1] = fmin.UserParameters().Error( static_cast<unsigned int>(1) );
42 u[2] = fmin.UserParameters().Value( static_cast<unsigned int>(2) );
44 sigma[2] = fmin.UserParameters().Error( static_cast<unsigned int>(2) );
45 u[3] = fmin.UserParameters().Value( static_cast<unsigned int>(3) );
47 sigma[3] = fmin.UserParameters().Error( static_cast<unsigned int>(3) );
void set_data(int N, float *charge_ptr, float *adc_ptr)
SaturationFit(int N, float *charge_ptr, float *adc_ptr, float *u0_ptr, float *u1_ptr, float *u2_ptr, float *u3_ptr)