207 std::cout <<
"Performing the hadron saturation fit..." << std::endl;
210 TFitter* minimizer =
new TFitter(5);
213 TRandom* rand =
new TRandom();
215 minimizer->SetParameter(0,
"alpha",m_alpha,rand->Rndm()*0.001,0.0,0.5);
216 minimizer->SetParameter(1,
"gamma",m_gamma,rand->Rndm()*0.001,-2,2);
217 minimizer->SetParameter(2,
"delta",m_delta,rand->Rndm()*0.001,-2,2);
218 minimizer->SetParameter(3,
"power",m_power,rand->Rndm()*0.01,-5,5);
219 minimizer->SetParameter(4,
"ratio",m_ratio,rand->Rndm()*0.01,-100,100);
224 minimizer->ExecuteCommand(
"SET STR",
arg,1);
228 minimizer->ExecuteCommand(
"SET PRINT",
arg,1);
233 double fitpar[5], fiterr[5];
234 for(
int i = 0; i < 20; ++i ){
236 minimizer->SetParameter(0,
"alpha",m_alpha,rand->Rndm()*0.001,0.0,0.5);
237 minimizer->SetParameter(1,
"gamma",m_gamma,rand->Rndm()*0.001,-2,2);
238 minimizer->SetParameter(2,
"delta",m_delta,rand->Rndm()*0.001,-2,2);
239 minimizer->SetParameter(3,
"power",m_power,rand->Rndm()*0.01,-5,5);
240 minimizer->SetParameter(4,
"ratio",m_ratio,rand->Rndm()*0.01,-100,100);
242 int status = minimizer->ExecuteCommand(
"MIGRAD",
arg,1);
243 status = minimizer->ExecuteCommand(
"MIGRAD",
arg,1);
244 minimizer->PrintResults(1,0);
245 std::cout <<
"Fit status: " << status << std::endl;
248 while( status != 0 && counter < 10 ){
251 minimizer->SetParameter(0,
"alpha",m_alpha,rand->Rndm()*0.001,0.0,0.5);
252 minimizer->SetParameter(1,
"gamma",m_gamma,rand->Rndm()*0.001,-2,2);
253 minimizer->SetParameter(2,
"delta",m_delta,rand->Rndm()*0.001,-2,2);
254 minimizer->SetParameter(3,
"power",m_power,rand->Rndm()*0.01,-5,5);
255 minimizer->SetParameter(4,
"ratio",m_ratio,rand->Rndm()*0.01,-100,100);
257 status = minimizer->ExecuteCommand(
"MIGRAD",
arg,1);
258 std::cout <<
"Fit status: " << status << std::endl;
261 std::cout <<
"HadronSaturation::ERROR - BAD FIT!" << std::endl;
266 for(
int par = 0; par < 5; ++par ){
267 fitpar[par] = minimizer->GetParameter(par);
268 fiterr[par] = minimizer->GetParError(par);
271 std::cout <<
"HadronSaturation: fit results" << std::endl;
272 std::cout <<
"\t alpha (" << m_alpha <<
"): " << fitpar[0] <<
" +- " << fiterr[0] << std::endl;
273 std::cout <<
"\t gamma (" << m_gamma <<
"): " << fitpar[1] <<
" +- " << fiterr[1] << std::endl;
274 std::cout <<
"\t delta (" << m_delta <<
"): " << fitpar[2] <<
" +- " << fiterr[2] << std::endl;
275 std::cout <<
"\t power (" << m_power <<
"): " << fitpar[3] <<
" +- " << fiterr[3] << std::endl;
276 std::cout <<
"\t ratio (" << m_ratio <<
"): " << fitpar[4] <<
" +- " << fiterr[4] << std::endl;
280 double chi2, edm, errdef;
282 minimizer->GetStats(chi2,edm,errdef,nvpar,nparx);
283 std::cout <<
"\t\t Fit chi^2: " << chi2 << std::endl;
285 std::ofstream parfile;
286 parfile.open(
"sat-pars.fit.txt");
288 parfile << fitpar[0] << std::endl;
289 parfile << fitpar[1] << std::endl;
290 parfile << fitpar[2] << std::endl;
291 parfile << fitpar[3] << std::endl;
292 parfile << fitpar[4] << std::endl;