本文整理汇总了C++中TMinuit::mnpout方法的典型用法代码示例。如果您正苦于以下问题:C++ TMinuit::mnpout方法的具体用法?C++ TMinuit::mnpout怎么用?C++ TMinuit::mnpout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMinuit
的用法示例。
在下文中一共展示了TMinuit::mnpout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Ifit2
//.........这里部分代码省略.........
TF1* g2 = new TF1("g2","gaus",0.,4000.);
Int_t BinDown = hdE->GetXaxis()->FindBin(maxt-2.5);
Int_t BinUp = hdE->GetXaxis()->FindBin(maxt+2.5);
Double_t maxy = hdE->ProjectionY()->GetMaximumBin();
Double_t maxdE = hdE->GetYaxis()->GetBinCenter(maxy);
hdE->ProjectionY("hproj2",BinDown,BinUp)->Fit("g2", "I", "", maxdE-500., maxdE+500);
merry = g2->GetParameter(2);
cuty = maxdE+5*merry;
cout<<"err: "<<merrx<<" "<<merry<<endl;
cout<<"cut: "<<cutx<<" "<<cuty<<endl;
//Ranges of fitting
nbinsx = hdE->GetXaxis()->FindBin(38.);
nbinx0 = hdE->GetXaxis()->FindBin(maxt+4*merrx);
//I set range of fitting in y
Int_t up = hdE->GetYaxis()->GetNbins();
nbinsy = up;
Int_t nentr = hdE->GetEntries();
for(Int_t i=0; i<nbinsy; i++){
if(i<maxy) continue;
if(hdE->ProjectionX("hproj",i+1,i+1)->GetEntries()<0.0005*nentr){
nbinsy = i+1;
}
}
cout<<"x range: "<<maxt+4*merrx<<" - "<<38.<<endl;
cout<<"Y range: "<<hdE->GetYaxis()->GetBinCenter(nbinsy)<<endl;
//3Hen peak position
ym = maxdE;
xm = hdE->GetXaxis()->GetBinCenter(hdE->ProjectionX()->GetMaximumBin());
cout<<" xm, ym: "<<xm<<" "<<ym<<endl;
//Fit to profile - start parameters
TF1* g0 = new TF1("g0","pol2",15.,38.);
TProfile* pp;
pp = hdE->ProfileX();
pp->Fit("g0","IQ","0",maxt-5*merrx,/*hdE->GetXaxis()->GetBinCenter(nbinsx)*/38.);
//initialize TMinuit with a maximum of 3 params
ierflg = 0;
arglist[0] = 1;
minuit->mnexcm("SET ERR", arglist ,1,ierflg);
// Set starting values and step sizes for parameters
if(bin<5){
vstart[0] = g0->GetParameter(2);
vstart[1] = g0->GetParameter(1);
// vstart[2] = g0->GetParameter(0);
}
Double_t step[3] = {0.01 , 1. , 10.};
minuit->mnparm(0, "a", vstart[0], step[0], 0,0,ierflg);
minuit->mnparm(1, "b", vstart[1], step[1], 0,0,ierflg);
// minuit->mnparm(2, "c", vstart[2], step[2], 0,0,ierflg);
// Now ready for minimization step
arglist[0] = 1500;
arglist[1] = 1;
minuit->mnexcm("MIGRAD", arglist ,2,ierflg);
// Print results
Double_t amin,edm,errdef;
Int_t nvpar,nparx,icstat;
minuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
//gMinuit->mnprin(3,amin);
// get parameters
double pval[2],perr[2],plo[2],phi[2];
TString para0,para1,para2;
int istat;
minuit->mnpout(0,para0,pval[0],perr[0],plo[0],phi[0],istat);
minuit->mnpout(1,para1,pval[1],perr[1],plo[1],phi[1],istat);
//minuit->mnpout(2,para2,pval[2],perr[2],plo[2],phi[2],istat);
fFit[bin-1][el-1] = new TF1(Form("fFit_bin%02d_el%02d",bin,el), "pol2", 0., 40.);
fFit[bin-1][el-1]->FixParameter(2, pval[0]);
fFit[bin-1][el-1]->FixParameter(1, pval[1]);
fFit[bin-1][el-1]->FixParameter(0, ym - pval[0]*xm*xm - pval[1]*xm);
}
}
TCanvas* cc[6];
for(Int_t el=0; el<6; el++){
cc[el] = new TCanvas(Form("c_el%02d",el),Form("c_el%02d",el),1350,950);
cc[el]->Divide(4,6);
for(Int_t bin = 0; bin<24; bin++){
cc[el]->cd(bin+1);
hdEToF[el][bin]->Draw("colz");
fFit[el][bin]->Draw("same");
}
}
}