Commit 73480ac0 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

correct a bug in the BgFit

parent 430f6be7
Pipeline #90460 passed with stage
in 4 minutes and 25 seconds
......@@ -106,7 +106,6 @@ void CXBgdFit::Update()
arr->SetLineColor(kBlue);
arr->SetFillColor(kBlue);
fBackgd.push_back(E);
cout<<E<<endl;
}
fPlayer->GetMainWindow()->RefreshPads();
......@@ -175,7 +174,10 @@ void CXBgdFit::Fit()
Int_t binmin = fHistogram->GetXaxis()->FindBin(fBackgd.at(i));
Int_t binmax = fHistogram->GetXaxis()->FindBin(fBackgd.at(i+1));
for(int ibin=binmin ; ibin<=binmax ; ibin++) HistoToFit->SetBinContent(ibin,fHistogram->GetBinContent(ibin));
for(int ibin=binmin ; ibin<=binmax ; ibin++) {
HistoToFit->SetBinContent(ibin,fHistogram->GetBinContent(ibin));
HistoToFit->SetBinError(ibin,fHistogram->GetBinError(ibin));
}
}
HistoToFit->GetXaxis()->SetRangeUser(fBackgd.front(), fBackgd.back());
......@@ -196,10 +198,15 @@ void CXBgdFit::Fit()
TString FitOpt = "R0S";
if(fPlayer->GetPrintLevel()>0) FitOpt +="V";
TFitResultPtr r = HistoToFit->Fit(fBackFunction,FitOpt.Data());
TFitResultPtr r = HistoToFit->Fit(fBackFunction,FitOpt.Data(),FitOpt.Data());
ostringstream text;
cout<<r<<endl;
if(r==-1) {
WARN_MESS << "Oups... Error in fitting histogram" << ENDL;
return;
}
text << "Fit results :";
cout<<text.str()<<endl;fPlayer->PrintInListBox(text.str(),kPrint);text.str("");
text << "Status: ";
......
......@@ -516,7 +516,6 @@ void CXHist1DPlayer::DoBgdFit()
{
fFitResultsBox->RemoveAll();
fListOfBgdFitObjects->ls();
for(int i=0 ; i<fListOfBgdFitObjects->GetEntries() ; i++) {
CXBgdFit *fit = (CXBgdFit*)fListOfBgdFitObjects->At(i);
fit->Fit();
......
......@@ -893,7 +893,6 @@ TH1 *CXMainWindow::GetHisto(TVirtualPad *pad, bool GetFirst)
obj = lnk->GetObject();
if (obj->InheritsFrom(TH1::Class()) && strcmp(obj->GetName() ,"hframe") != 0) {
hist = dynamic_cast<TH1*>(obj);
hist->Print();
if(GetFirst) return hist;
}
lnk = (TObjOptLink*)lnk->Next();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment