Commit 278e9f6a authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

Correct bug on calibration fit result

parent 4177d91b
Pipeline #54874 passed with stage
in 5 minutes and 51 seconds
......@@ -13,6 +13,7 @@
#include "TF1.h"
#include "TMath.h"
#include "TGComboBox.h"
#include "TRatioPlot.h"
#include "CXMainWindow.h"
......@@ -341,7 +342,7 @@ void CXHist1DCalib::Calibrate()
}
f->Draw("same");
fListOfObjects->Add(f);
i += NSubPeaks;
i += NSubPeaks-1;
}
hist->GetXaxis()->SetRangeUser(xmin-(xmax-xmin)*0.1,xmax+(xmax-xmin)*0.1);
......
......@@ -1025,6 +1025,7 @@ int GwRecalEnergy::FitPeaks(int verbose)
res.Lambda = m_pCFit->TailLeft(jj);
res.Rho = m_pCFit->TailRight(jj);
res.S = m_pCFit->Step(jj);
res.errposi = m_pCFit->PositionErr(jj);
bool bad = (res.area < 10) || (res.fwhm >= 5*specFWHMdef) || (res.tailR > 5.f*res.tailL);
if(verbose > 0) {
......@@ -1159,6 +1160,8 @@ Int_t GwRecalEnergy::EROOTCalibration()
Peaks[np].erefindex = ne;
Peaks[np].eref = Energies[ne];
Peaks[np].good = true;
// Peaks[np].errposi = pow(Peaks[np].fwhm/s2fwhm, 2.)/Peaks[np].area;
if(Xmin==0. || Peaks[np].posi < Xmin) Xmin = Peaks[np].posi;
if(Peaks[np].posi > Xmax) Xmax = Peaks[np].posi;
break;
......@@ -1202,6 +1205,7 @@ Int_t GwRecalEnergy::EROOTCalibration()
for(size_t np = 0; np < Peaks.size(); np++) {
if(Peaks[np].good) {
fCalibGraph->SetPoint(fCalibGraph->GetN(), Peaks[np].posi, Energies[Peaks[np].erefindex]);
// fCalibGraph->SetPointError(fCalibGraph->GetN()-1, Peaks[np].errposi, 0.);
}
}
......@@ -1219,7 +1223,7 @@ Int_t GwRecalEnergy::EROOTCalibration()
fCalibGraph->Fit(fCalibFunction,"Q0R");
}
TFitResultPtr r = fCalibGraph->Fit(fCalibFunction,"SRQ0");
TFitResultPtr r = fCalibGraph->Fit(fCalibFunction,"SRQ");
if(Verbosity>1) r->Print();
......@@ -1236,7 +1240,7 @@ Int_t GwRecalEnergy::EROOTCalibration()
double fwhm_e = fCalibFunction->Eval(Peaks[np].fwhm)-fCalibFunction->GetParameter(0);
double res = ecal-Energies[Peaks[np].erefindex];
fResidueGraph->SetPoint(fResidueGraph->GetN(),Energies[Peaks[np].erefindex],res);
fResidueGraph->SetPointError(fResidueGraph->GetN()-1,0.,r->GetConfidenceIntervals()[fResidueGraph->GetN()-1]);
// fResidueGraph->SetPointError(fResidueGraph->GetN()-1,0.,r->GetConfidenceIntervals()[fResidueGraph->GetN()-1]);
if(Verbosity > 1) cout<<"#2" << setw(12) << setprecision(1) << Peaks[np].area << setw(12) << setprecision(2) << Peaks[np].posi << setw(12) << setprecision(3) << Peaks[np].fwhm << setw(12) << setprecision(3) << fwhm_e << setw(13) << setprecision(3) << ecal << setw(15) << setprecision(3) << res <<endl;
ngood++;
}
......
......@@ -34,6 +34,7 @@ struct Fitted
double area;
double ampli;
double posi;
double errposi;
double fw05;
double fw01;
double fwhm;
......
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