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

Correct errors on calibration procedure

Correct a bug in fit result
Add possibility to select the minimizer
parent 581225ae
Pipeline #51149 passed with stage
in 7 minutes and 43 seconds
......@@ -20,6 +20,7 @@ void CXArrow::SetEnergy(Float_t E)
{
SetX1(E);
SetX2(E);
if(fFit) fFit->Update();
}
void CXArrow::Set(Double_t X, Double_t Y1, Double_t Y2)
......
......@@ -285,11 +285,11 @@ void CXCanvas::HandleInput(EEventType event, Int_t px, Int_t py)
Double_t size = 0.4 - 0.35 * fVenerMode;
// Int_t X0 = TheHisto->GetXaxis()->GetFirst();
// Int_t X1 = TheHisto->GetXaxis()->GetLast();
// Int_t X0 = TheHisto->GetXaxis()->GetFirst();
// Int_t X1 = TheHisto->GetXaxis()->GetLast();
// Int_t Y0 = TheHisto->GetYaxis()->GetFirst();
// Int_t Y1 = TheHisto->GetYaxis()->GetLast();
// Int_t Y0 = TheHisto->GetYaxis()->GetFirst();
// Int_t Y1 = TheHisto->GetYaxis()->GetLast();
Double_t XCenter = (fCanvas->GetUxmax()+fCanvas->GetUxmin())*0.5;
Double_t YCenter = (fCanvas->GetUymax()+fCanvas->GetUymin())*0.5;
......@@ -310,23 +310,23 @@ void CXCanvas::HandleInput(EEventType event, Int_t px, Int_t py)
if ((distX <= size) && (distY <= size)) return;
// Int_t dX = TMath::Nint(ddX * (0.05 + 0.05 * fVenerMode));
// Int_t dY = TMath::Nint(ddY * (0.05 + 0.05 * fVenerMode));
// Int_t dX = TMath::Nint(ddX * (0.05 + 0.05 * fVenerMode));
// Int_t dY = TMath::Nint(ddY * (0.05 + 0.05 * fVenerMode));
// if (TMath::Abs(dX) < 1) dX = TMath::Sign(1., ddX);
// if (TMath::Abs(dX) < 1) dX = TMath::Sign(1., ddX);
Int_t dX = 0;
Int_t dY = 0;
// Double_t ppx = AbsPixeltoX(px);
// Double_t ppy = AbsPixeltoY(py);
// Double_t ppx = AbsPixeltoX(px);
// Double_t ppy = AbsPixeltoY(py);
TAxis* ax = TheHisto->GetXaxis();
Int_t X0 = ax->GetFirst();
Int_t X1 = ax->GetLast();
px = ax->FindBin(ppx);
// cout<<X1<<" "<<X0<<" "<<px<<endl;
// cout<<X1<<" "<<X0<<" "<<px<<endl;
Double_t ddX = (X1 + X0) * 0.5 - px;
TAxis* ay = TheHisto->GetYaxis();
......@@ -911,164 +911,8 @@ Bool_t CXCanvas::HandleKey(Int_t px, Int_t py)
if (!fSelected) return kTRUE;
switch ((EKeySym)py)
{
case kKey_F1:
break;
case kKey_F2:
break;
case kKey_F3:
break;
case kKey_F4:
break;
case kKey_F5:
break;
case kKey_F6:
break;
case kKey_F7:
break;
case kKey_F8:
break;
case kKey_F9:
gPad->SetLogx(!gPad->GetLogx());
Modified();
Update();
break;
case kKey_F10:
gPad->SetLogy(!gPad->GetLogy());
Modified();
Update();
break;
case kKey_F11:
gPad->SetLogz(!gPad->GetLogz());
Modified();
Update();
break;
case kKey_F12:
if (fSelected->InheritsFrom("TAxis")) {
((TAxis*)fSelected)->UnZoom();
Modified();
Update();
}
else if (FindHisto() && (FindHisto()->InheritsFrom("TH1") || FindHisto()->InheritsFrom("TH1D") ) ) {
if(fMainWindow->IsCtrlOn() == false){
((TH1*)FindHisto())->GetYaxis()->UnZoom();
((TH1*)FindHisto())->GetXaxis()->UnZoom();
gPad->Modified();
gPad->Update();
}
else{
TObject *obj = nullptr;
TH1 *hist = nullptr;
TIter next(fPrimitives);
while ((obj = next())) {
if (obj->InheritsFrom(TPad::Class())) {
hist = FindHisto(((TVirtualPad*)obj));
if(hist){
hist->GetXaxis()->UnZoom();
hist->GetYaxis()->UnZoom();
((TVirtualPad*)obj)->Update();
((TVirtualPad*)obj)->Modified();
}
}
}
}
}
break;
case kKey_Left:
if (fSelected->InheritsFrom("TAxis") && ((TString)fSelected->GetName()) == "xaxis") MoveAxis(FindHisto()->GetXaxis(), -1);
else if (fSelected->InheritsFrom("TH1")) MoveAxis(FindHisto()->GetXaxis(), -1);
break;
case kKey_Down:
if (fSelected->InheritsFrom("TAxis") && ((TString)fSelected->GetName()) == "yaxis") MoveAxis((TAxis*)fSelected, -1);
else if (fSelected->InheritsFrom("TH1")) MoveAxis(FindHisto()->GetYaxis(), -1);
break;
case kKey_Right:
if (fSelected->InheritsFrom("TAxis") && ((TString)fSelected->GetName()) == "xaxis") MoveAxis((TAxis*)fSelected, 1);
else if (fSelected->InheritsFrom("TH1")) MoveAxis(FindHisto()->GetXaxis(), 1);
break;
case kKey_Up:
if (fSelected->InheritsFrom("TAxis") && ((TString)fSelected->GetName()) == "yaxis") MoveAxis((TAxis*)fSelected, 1);
else if (fSelected->InheritsFrom("TH1")) MoveAxis(FindHisto()->GetYaxis(), 1);
break;
case kKey_C:
SetCrosshair(!GetCrosshair());
gPad->Modified();
gPad->Update();
break;
case kKey_Plus:
if (fSelected->InheritsFrom("TH2")) {
((TH2*)fSelected)->SetMinimum(((TH1*)fSelected)->GetMinimum() + 1);
gPad->Modified();
gPad->Update();
} else if (fSelected->InheritsFrom("TF1")) {
((TF1*)fSelected)->SetNpx(((TF1*)fSelected)->GetNpx() + 50);
gPad->Modified();
gPad->Update();
} else if (fSelected->InheritsFrom("TH1")) {
TIter it(((TH1*)fSelected)->GetListOfFunctions());
while ((obj = it())) {
((TF1*)obj)->SetNpx(((TF1*)obj)->GetNpx() + 50);
}
gPad->Modified();
gPad->Update();
}
ScaleFact *=2;
if(ScaleFact>0.99)
ScaleFact = 0.99;
break;
case kKey_Minus:
if (fSelected->InheritsFrom("TH2")) {
if (((TH1*)fSelected)->GetMinimum() > 0)((TH2*)fSelected)->SetMinimum(((TH1*)fSelected)->GetMinimum() - 1);
Modified();
Update();
} else if (fSelected->InheritsFrom("TF1")) {
((TF1*)fSelected)->SetNpx(((TF1*)fSelected)->GetNpx() - 50);
Modified();
Update();
} else if (fSelected->InheritsFrom("TH1")) {
TIter it(((TH1*)fSelected)->GetListOfFunctions());
while ((obj = it()))((TF1*)obj)->SetNpx(((TF1*)obj)->GetNpx() - 50);
Modified();
Update();
}
ScaleFact *=0.5;
if(ScaleFact<0.01)
ScaleFact = 0.01;
break;
default:
;
}
bool CTRL = ( px == py-96);
if(CTRL)
{
if(CTRL) {
switch ((EKeySym)py) {
case kKey_a:
......@@ -1187,6 +1031,160 @@ Bool_t CXCanvas::HandleKey(Int_t px, Int_t py)
return kTRUE;
}
}
else {
switch ((EKeySym)py) {
case kKey_F1:
break;
case kKey_F2:
break;
case kKey_F3:
break;
case kKey_F4:
break;
case kKey_F5:
break;
case kKey_F6:
break;
case kKey_F7:
break;
case kKey_F8:
break;
case kKey_F9:
gPad->SetLogx(!gPad->GetLogx());
Modified();
Update();
break;
case kKey_F10:
gPad->SetLogy(!gPad->GetLogy());
Modified();
Update();
break;
case kKey_F11:
gPad->SetLogz(!gPad->GetLogz());
Modified();
Update();
break;
case kKey_F12:
if (fSelected->InheritsFrom("TAxis")) {
((TAxis*)fSelected)->UnZoom();
Modified();
Update();
}
else if (FindHisto() && (FindHisto()->InheritsFrom("TH1") || FindHisto()->InheritsFrom("TH1D") ) ) {
if(fMainWindow->IsCtrlOn() == false){
((TH1*)FindHisto())->GetYaxis()->UnZoom();
((TH1*)FindHisto())->GetXaxis()->UnZoom();
gPad->Modified();
gPad->Update();
}
else{
TObject *obj = nullptr;
TH1 *hist = nullptr;
TIter next(fPrimitives);
while ((obj = next())) {
if (obj->InheritsFrom(TPad::Class())) {
hist = FindHisto(((TVirtualPad*)obj));
if(hist){
hist->GetXaxis()->UnZoom();
hist->GetYaxis()->UnZoom();
((TVirtualPad*)obj)->Update();
((TVirtualPad*)obj)->Modified();
}
}
}
}
}
break;
case kKey_Left:
if (fSelected->InheritsFrom("TAxis") && ((TString)fSelected->GetName()) == "xaxis") MoveAxis(FindHisto()->GetXaxis(), -1);
else if (fSelected->InheritsFrom("TH1")) MoveAxis(FindHisto()->GetXaxis(), -1);
break;
case kKey_Down:
if (fSelected->InheritsFrom("TAxis") && ((TString)fSelected->GetName()) == "yaxis") MoveAxis((TAxis*)fSelected, -1);
else if (fSelected->InheritsFrom("TH1")) MoveAxis(FindHisto()->GetYaxis(), -1);
break;
case kKey_Right:
if (fSelected->InheritsFrom("TAxis") && ((TString)fSelected->GetName()) == "xaxis") MoveAxis((TAxis*)fSelected, 1);
else if (fSelected->InheritsFrom("TH1")) MoveAxis(FindHisto()->GetXaxis(), 1);
break;
case kKey_Up:
if (fSelected->InheritsFrom("TAxis") && ((TString)fSelected->GetName()) == "yaxis") MoveAxis((TAxis*)fSelected, 1);
else if (fSelected->InheritsFrom("TH1")) MoveAxis(FindHisto()->GetYaxis(), 1);
break;
case kKey_C:
SetCrosshair(!GetCrosshair());
gPad->Modified();
gPad->Update();
break;
case kKey_Plus:
if (fSelected->InheritsFrom("TH2")) {
((TH2*)fSelected)->SetMinimum(((TH1*)fSelected)->GetMinimum() + 1);
gPad->Modified();
gPad->Update();
} else if (fSelected->InheritsFrom("TF1")) {
((TF1*)fSelected)->SetNpx(((TF1*)fSelected)->GetNpx() + 50);
gPad->Modified();
gPad->Update();
} else if (fSelected->InheritsFrom("TH1")) {
TIter it(((TH1*)fSelected)->GetListOfFunctions());
while ((obj = it())) {
((TF1*)obj)->SetNpx(((TF1*)obj)->GetNpx() + 50);
}
gPad->Modified();
gPad->Update();
}
ScaleFact *=2;
if(ScaleFact>0.99)
ScaleFact = 0.99;
break;
case kKey_Minus:
if (fSelected->InheritsFrom("TH2")) {
if (((TH1*)fSelected)->GetMinimum() > 0)((TH2*)fSelected)->SetMinimum(((TH1*)fSelected)->GetMinimum() - 1);
Modified();
Update();
} else if (fSelected->InheritsFrom("TF1")) {
((TF1*)fSelected)->SetNpx(((TF1*)fSelected)->GetNpx() - 50);
Modified();
Update();
} else if (fSelected->InheritsFrom("TH1")) {
TIter it(((TH1*)fSelected)->GetListOfFunctions());
while ((obj = it()))((TF1*)obj)->SetNpx(((TF1*)obj)->GetNpx() - 50);
Modified();
Update();
}
ScaleFact *=0.5;
if(ScaleFact<0.01)
ScaleFact = 0.01;
break;
default:
;
}
}
fPPressed = kFALSE;
fJPressed = kFALSE;
return kTRUE;
......@@ -1317,11 +1315,13 @@ void CXCanvas::InitInfos()
AddShortcutsInfo("<ctrl> x", "cut the object under cursor");
AddShortcutsInfo("<ctrl> v", "paste the last object copied");
AddShortcutsInfo("<ctrl> d", "undraw the object under cursor (object not deleted)");
AddShortcutsInfo("<Maj> S", "Add selected object to stored spectra");
AddShortcutsInfo("<Maj> S", "Add selected object to stored spectra");
AddShortcutsInfo("","");
AddShortcutsInfo("s", "Peak search");
AddShortcutsInfo("f", "start a new gamma fit, or process the fit when arrows are placed");
AddShortcutsInfo("f", "define a new gamma fit");
AddShortcutsInfo("<ctrl> f", "Fit");
AddShortcutsInfo("<ctrl> a", "Calibrate");
AddShortcutsInfo("c", "clear the current Pad (arrows, fits...)");
AddShortcutsInfo("","");
AddShortcutsInfo("Gamma Gamma mode","");
......
......@@ -13,6 +13,7 @@
#include "TPad.h"
#include "TGNumberEntry.h"
#include "TGButton.h"
#include "Fit/Fitter.h"
#include "CXHist1DPlayer.h"
#include "CXArrow.h"
......@@ -50,7 +51,7 @@ CXFit::~CXFit()
void CXFit::AddArrow(Double_t Energy)
{
Int_t Bin = fHistogram->FindBin(Energy);
Float_t Value = fHistogram->GetBinContent(Bin);
Double_t Value = fHistogram->GetBinContent(Bin);
for(int i=fHistogram->FindBin(Energy)-2 ; i<=fHistogram->FindBin(Energy)+2 ; i++){
if(i>0 && fHistogram->GetBinContent(i)>Value){
......@@ -60,7 +61,7 @@ void CXFit::AddArrow(Double_t Energy)
}
Energy = fHistogram->GetBinCenter(Bin);
Float_t MaxGlob = fHistogram->GetMaximum();
Double_t MaxGlob = fHistogram->GetMaximum();
CXArrow *arrow = new CXArrow(this,Energy,(Value + MaxGlob/100.) ,(Value +MaxGlob/15.),0.01,"<|");
arrow->SetAngle(30);
......@@ -109,8 +110,8 @@ void CXFit::Update()
for(uint i=0 ; i<back.GetEntries() ; i++) {
CXArrow *arr = (CXArrow*)back.At(i);
Double_t E = arr->GetEnergy();
Float_t MaxGlob = fHistogram->GetMaximum();
Float_t Value = fHistogram->GetBinContent(fHistogram->FindBin(E));
Double_t MaxGlob = fHistogram->GetMaximum();
Double_t Value = fHistogram->GetBinContent(fHistogram->FindBin(E));
arr->Set(E,(Value + MaxGlob/100.), (Value+MaxGlob/15.));
arr->SetLineColor(kBlue);
arr->SetFillColor(kBlue);
......@@ -119,8 +120,8 @@ void CXFit::Update()
for(uint i=0 ; i<Ener.GetEntries() ; i++) {
CXArrow *arr = (CXArrow*)Ener.At(i);
Double_t E = arr->GetEnergy();
Float_t MaxGlob = fHistogram->GetMaximum();
Float_t Value = fHistogram->GetBinContent(fHistogram->FindBin(E));
Double_t MaxGlob = fHistogram->GetMaximum();
Double_t Value = fHistogram->GetBinContent(fHistogram->FindBin(E));
arr->Set(E,(Value + MaxGlob/100.), (Value+MaxGlob/15.));
arr->SetLineColor(kRed);
arr->SetFillColor(kRed);
......@@ -175,23 +176,27 @@ void CXFit::Fit()
return;
}
ROOT::Math::MinimizerOptions::SetDefaultMinimizer(fPlayer->GetMinimizer(),fPlayer->GetAlgorithm());
ROOT::Math::MinimizerOptions::SetDefaultTolerance(fPlayer->GetTolerance());
ROOT::Math::MinimizerOptions::SetDefaultPrintLevel(fPlayer->GetPrintLevel());
// fPlayer->GetFitResultsBox()->RemoveAll();
Float_t DefFWHM = fPlayer->fNE_FWHM[0]->GetNumber();
Float_t DefFWHM_min = fPlayer->fNE_FWHM[1]->GetNumber();
Float_t DefFWHM_max = fPlayer->fNE_FWHM[2]->GetNumber();
Double_t DefFWHM = fPlayer->fNE_FWHM[0]->GetNumber();
Double_t DefFWHM_min = fPlayer->fNE_FWHM[1]->GetNumber();
Double_t DefFWHM_max = fPlayer->fNE_FWHM[2]->GetNumber();
Float_t LeftTailVal = fPlayer->fNE_LT[0]->GetNumber();;
Float_t LeftTailValMin = fPlayer->fNE_LT[1]->GetNumber();;
Float_t LeftTailValMax = fPlayer->fNE_LT[2]->GetNumber();;
Double_t LeftTailVal = fPlayer->fNE_LT[0]->GetNumber();;
Double_t LeftTailValMin = fPlayer->fNE_LT[1]->GetNumber();;
Double_t LeftTailValMax = fPlayer->fNE_LT[2]->GetNumber();;
Float_t RightTailVal = fPlayer->fNE_RT[0]->GetNumber();;
Float_t RightTailValMin = fPlayer->fNE_RT[1]->GetNumber();;
Float_t RightTailValMax = fPlayer->fNE_RT[2]->GetNumber();;
Double_t RightTailVal = fPlayer->fNE_RT[0]->GetNumber();;
Double_t RightTailValMin = fPlayer->fNE_RT[1]->GetNumber();;
Double_t RightTailValMax = fPlayer->fNE_RT[2]->GetNumber();;
Float_t StepVal = 0.01;
Float_t StepValMin = -1.;
Float_t StepValMax = 1.;
Double_t StepVal = 0.01;
Double_t StepValMin = -1.;
Double_t StepValMax = 1.;
Int_t NPars = 3+6*fEnergies.size();
......@@ -216,17 +221,17 @@ void CXFit::Fit()
fFitFunction->FixParameter(0, fEnergies.size()); // 1 peak
Float_t x,y;
Double_t x,y;
x = fPad->GetUxmin();
y = fPad->GetUxmax();
fHistogram->GetXaxis()->SetRangeUser(fBackgd[0],fBackgd[1]);
//Calc Bckd
fFitFunction->SetParameter(1, fHistogram->GetBinContent(fHistogram->FindBin(fBackgd[0])));
fFitFunction->SetParLimits(1, fHistogram->GetMinimum(),fHistogram->GetMaximum());
fFitFunction->SetParLimits(1, 0.,fHistogram->GetMaximum());
fFitFunction->SetParameter(2, 0);
fFitFunction->SetParLimits(2, -10, 10);
fFitFunction->SetParLimits(2, -50., 0.);
if(fPlayer->fUsePol1==false)
fFitFunction->FixParameter(2,0);
......@@ -234,7 +239,7 @@ void CXFit::Fit()
for(uint i=0 ; i<fEnergies.size() ; i++) {
//Height
fFitFunction->SetParameter(3+i*6+0, fHistogram->GetBinContent(fHistogram->FindBin(fEnergies[i])) - (fHistogram->GetBinContent(fHistogram->FindBin(fBackgd[0]))+fHistogram->GetBinContent(fHistogram->FindBin(fBackgd[1])))*0.5 );
fFitFunction->SetParLimits(3+i*6+0, fHistogram->GetBinContent((fHistogram->FindBin(fEnergies[i]))-(fHistogram->GetBinContent(fHistogram->FindBin(fBackgd[0]))+fHistogram->GetBinContent(fHistogram->FindBin(fBackgd[1])))*0.5)*0.5, fHistogram->GetBinContent(fHistogram->GetMaximumBin()));
fFitFunction->SetParLimits(3+i*6+0, fHistogram->GetBinContent((fHistogram->FindBin(fEnergies[i]))-(fHistogram->GetBinContent(fHistogram->FindBin(fBackgd[0]))+fHistogram->GetBinContent(fHistogram->FindBin(fBackgd[1])))*0.5)*0.5, fHistogram->GetBinContent(fHistogram->GetMaximumBin())*1.5);
//Position
fFitFunction->SetParameter(3+i*6+1, fEnergies[i]);
fFitFunction->SetParLimits(3+i*6+1, fEnergies[i]-DefFWHM, fEnergies[i]+DefFWHM);
......@@ -268,7 +273,9 @@ void CXFit::Fit()
fHistogram->GetXaxis()->SetRangeUser(x,y);
TFitResultPtr r = fHistogram->Fit(fFitFunction,"R0S");
TString FitOpt = "R0S";
if(fPlayer->GetPrintLevel()>0) FitOpt +="V";
TFitResultPtr r = fHistogram->Fit(fFitFunction,FitOpt.Data());
if(fPlayer->fFixAmpli->GetState() == kButtonDown) {
......@@ -278,11 +285,11 @@ void CXFit::Fit()
fBackFunction->SetParameters(fFitFunction->GetParameters());
for(uint i=0 ; i<fEnergies.size() ; i++) {
Float_t Ampli = fHistogram->GetBinContent(fHistogram->FindBin(fEnergies[i]))- fBackFunction->Eval(fEnergies[i]);
Double_t Ampli = fHistogram->GetBinContent(fHistogram->FindBin(fEnergies[i]))- fBackFunction->Eval(fEnergies[i]);
fFitFunction->FixParameter(3+i*6+0,Ampli);
}
r = fHistogram->Fit(fFitFunction,"R0S");
r = fHistogram->Fit(fFitFunction,FitOpt.Data());
}
//Extract Background
......@@ -308,6 +315,18 @@ void CXFit::Fit()
text << "Fit results :";
cout<<text.str()<<endl;fPlayer->PrintInListBox(text.str(),kPrint);text.str("");
text << "Status: ";
if(r->Status()==0)
text << " Successeful" << endl;
else
text << " Failed" << endl;
cout<<text.str();
if(r->Status()==0)
fPlayer->PrintInListBox(text.str(),kPrint);
else
fPlayer->PrintInListBox(text.str(),kError);
text.str("");
text << "Chi2 = "<< r->Chi2();
cout<<text.str()<<endl;fPlayer->PrintInListBox(text.str(),kInfo);text.str("");
text << "Ndf = "<< r->Ndf();
......@@ -334,29 +353,29 @@ void CXFit::Fit()
fListOfPeaks->Add(peak);
Float_t Area = (peak->Integral(fBackgd[0],fBackgd[1],1e-6)-fBackFunction->Integral(fBackgd[0],fBackgd[1],1e-6))/fHistogram->GetBinWidth(1);
Float_t AreaErr = 2*sqrt(Area);
Float_t Mean = peak->GetParameter(3+i*6+1);
Float_t MeanErr = peak->GetParError(3+i*6+1);
Float_t FWHM = peak->GetParameter(3+i*6+2);
Float_t FWHMErr = peak->GetParError(3+i*6+2);
Float_t LeftT = TMath::Abs(peak->GetParameter(3+i*6+3));
Float_t LeftTErr = peak->GetParError(3+i*6+3);
Float_t Right = peak->GetParameter(3+i*6+4);
Float_t RightErr = peak->GetParError(3+i*6+4);
Double_t Area = (peak->Integral(fBackgd[0],fBackgd[1],1e-6)-fBackFunction->Integral(fBackgd[0],fBackgd[1],1e-6))/fHistogram->GetBinWidth(1);
Double_t AreaErr = 2*sqrt(Area);
Double_t Mean = peak->GetParameter(3+i*6+1);
Double_t MeanErr = peak->GetParError(3+i*6+1);
Double_t FWHM = peak->GetParameter(3+i*6+2);
Double_t FWHMErr = peak->GetParError(3+i*6+2);
Double_t LeftT = TMath::Abs(peak->GetParameter(3+i*6+3));
Double_t LeftTErr = peak->GetParError(3+i*6+3);
Double_t Right = peak->GetParameter(3+i*6+4);
Double_t RightErr = peak->GetParError(3+i*6+4);
peak->SetParameter(1,0);//without backgroud
Float_t Max = peak->GetParameter(3+i*6+0);
Float_t MaxErr = peak->GetParError(3+i*6+0);
Double_t Max = peak->GetParameter(3+i*6+0);
Double_t MaxErr = peak->GetParError(3+i*6+0);
Float_t FWHM_L = peak->GetX(Max/2,fBackgd[0],Mean,1e-6