#include <OnlineDB/CSCCondDB/interface/SaturationFit.h>
Public Member Functions | |
SaturationFit (int N, float *charge_ptr, float *adc_ptr, float *u0_ptr, float *u1_ptr, float *u2_ptr, float *u3_ptr) | |
~SaturationFit () |
Definition at line 11 of file SaturationFit.h.
SaturationFit::SaturationFit | ( | int | N, | |
float * | charge_ptr, | |||
float * | adc_ptr, | |||
float * | u0_ptr, | |||
float * | u1_ptr, | |||
float * | u2_ptr, | |||
float * | u3_ptr | |||
) | [inline] |
Definition at line 15 of file SaturationFit.h.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), err, SaturationFcn::set_data(), SaturationFcn::x0start, SaturationFcn::x1start, SaturationFcn::x2start, and SaturationFcn::x3start.
00015 { 00016 double u[3],sigma[3],chisq; 00017 VariableMetricMinimizer* pMinimizer=new VariableMetricMinimizer() ; 00018 SaturationFcn* pFcn=new SaturationFcn(); 00019 pFcn->set_data(N,charge_ptr,adc_ptr); 00020 std::vector<double> par(4,0); 00021 std::vector<double> err(4,0); 00022 //printf(" about to fill pars \n"); 00023 par[0]=pFcn->x0start; 00024 par[1]=pFcn->x1start; 00025 par[2]=pFcn->x2start; 00026 par[3]=pFcn->x3start; 00027 //printf(" pars: %f %f %f %f \n",par[0],par[1],par[2],par[3]); 00028 err[0]=20.0; 00029 err[1]=0.0001; 00030 err[2]=1.0; 00031 err[3]=20.0; 00032 FunctionMinimum fmin = pMinimizer->Minimize(*pFcn, par, err, 1, 5000, 0.01); 00033 if( !fmin.IsValid()){ 00034 printf(" minuit did not converge \n"); 00035 } else { 00036 std::cout<<"fit succeeded... results: "<<fmin<<std::endl; 00037 chisq = fmin.Fval(); 00038 u[0] = fmin.UserParameters().Value( static_cast<unsigned int>(0) ); 00039 *u0_ptr=u[0]; 00040 sigma[0] = fmin.UserParameters().Error( static_cast<unsigned int>(0) ); 00041 u[1] = fmin.UserParameters().Value( static_cast<unsigned int>(1) ); 00042 *u1_ptr=u[1]; 00043 sigma[1] = fmin.UserParameters().Error( static_cast<unsigned int>(1) ); 00044 u[2] = fmin.UserParameters().Value( static_cast<unsigned int>(2) ); 00045 *u2_ptr=u[2]; 00046 sigma[2] = fmin.UserParameters().Error( static_cast<unsigned int>(2) ); 00047 u[3] = fmin.UserParameters().Value( static_cast<unsigned int>(3) ); 00048 *u3_ptr=u[3]; 00049 sigma[3] = fmin.UserParameters().Error( static_cast<unsigned int>(3) ); 00050 //std::cout<<"fitresults: "<<u[0]<<" "<<u[1]<<" "<<u[2]<<" "<<u[3]<<std::endl; 00051 00052 } 00053 }
SaturationFit::~SaturationFit | ( | ) | [inline] |