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

Add Pol1 and Step backgrounds as options

Correction on the calculation of the residue
parent 5840e676
......@@ -88,7 +88,7 @@ CXHist1DPlayer::CXHist1DPlayer(const TGCompositeFrame *MotherFrame, UInt_t w, UI
fFixMean = new TGCheckButton(fHorizontalFrame, "Fixed", 0);
fFixMean->Connect("Clicked()", "CXHist1DPlayer", this, "HandleMyButton()");
fHorizontalFrame->AddFrame(fFixMean,new TGLayoutHints(kLHintsTop | kLHintsLeft,15,5,0,0));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,-10,-10,10,5));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,-10,-10,0,5));
fHorizontalFrame = new TGCompositeFrame(fGroupFrame, 60, 20, kHorizontalFrame);
fHorizontalFrame->AddFrame(label = new TGLabel(fHorizontalFrame, "Amplitude:"),new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 5, 0, 0));
......@@ -96,7 +96,7 @@ CXHist1DPlayer::CXHist1DPlayer(const TGCompositeFrame *MotherFrame, UInt_t w, UI
fFixAmpli = new TGCheckButton(fHorizontalFrame, "Fixed", 0);
fFixAmpli->Connect("Clicked()", "CXHist1DPlayer", this, "HandleMyButton()");
fHorizontalFrame->AddFrame(fFixAmpli,new TGLayoutHints(kLHintsTop | kLHintsLeft,15,5,0,0));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,-10,-10,10,5));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,-10,-10,0,5));
fHorizontalFrame = new TGCompositeFrame(fGroupFrame, 60, 20, kHorizontalFrame);
fHorizontalFrame->AddFrame(label = new TGLabel(fHorizontalFrame, "FWHM:"),new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 24, 0, 0));
......@@ -104,7 +104,20 @@ CXHist1DPlayer::CXHist1DPlayer(const TGCompositeFrame *MotherFrame, UInt_t w, UI
fFixFWHM = new TGCheckButton(fHorizontalFrame, "Fixed", 0);
fFixFWHM->Connect("Clicked()", "CXHist1DPlayer", this, "HandleMyButton()");
fHorizontalFrame->AddFrame(fFixFWHM,new TGLayoutHints(kLHintsTop | kLHintsLeft,15,5,0,0));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,-10,-10,10,5));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,-10,-10,0,5));
fHorizontalFrame = new TGCompositeFrame(fGroupFrame, 60, 20, kHorizontalFrame);
fHorizontalFrame->AddFrame(label = new TGLabel(fHorizontalFrame, "Background:"),new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 0, 0));
label->SetTextColor(CXblue);
fBckStep = new TGCheckButton(fHorizontalFrame, "Step", 0);
fBckStep->Connect("Clicked()", "CXHist1DPlayer", this, "HandleMyButton()");
fBckStep->SetState((EButtonState)fUseStep);
fHorizontalFrame->AddFrame(fBckStep,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,5,0,0));
fBckPol1 = new TGCheckButton(fHorizontalFrame, "Pol1", 0);
fBckPol1->Connect("Clicked()", "CXHist1DPlayer", this, "HandleMyButton()");
fBckPol1->SetState((EButtonState)fUsePol1);
fHorizontalFrame->AddFrame(fBckPol1,new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,0,0));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,-10,-10,0,5));
fHorizontalFrame = new TGCompositeFrame(fGroupFrame, 60, 20, kHorizontalFrame);
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "Val "),new TGLayoutHints(kLHintsTop | kLHintsLeft, 3, 3, 0, 0));
......@@ -547,6 +560,9 @@ void CXHist1DPlayer::DoFit()
fFitFunction->SetParameter(2, 0);
fFitFunction->SetParLimits(2, -10, 10);
if(fUsePol1==false)
fFitFunction->FixParameter(2,0);
for(uint i=0 ; i<fFitEnergies.size() ; i++)
{
//Height
......@@ -579,6 +595,8 @@ void CXHist1DPlayer::DoFit()
//AmplitudeStep
fFitFunction->SetParameter(3+i*6+5, StepVal);
fFitFunction->SetParLimits(3+i*6+5, StepValMin, StepValMax);
if(fUseStep==false)
fFitFunction->FixParameter(3+i*6+5,0);
}
fCurrentHist->GetXaxis()->SetRangeUser(x,y);
......@@ -738,6 +756,9 @@ void CXHist1DPlayer::DoFit()
void CXHist1DPlayer::HandleMyButton()
{
fUseStep = (Bool_t)fBckStep->GetState();
fUsePol1 = (Bool_t)fBckPol1->GetState();
if(fUseLT->GetState() == kButtonUp)
{
fFixLT->SetState(kButtonDisabled);
......@@ -925,7 +946,7 @@ double CXHist1DPlayer::Residue(double*xx,double*pp)
{
double x = xx[0];
return fFitFunction->Eval(x) - fCurrentHist->GetBinContent(fCurrentHist->FindBin(x));
return fFitFunction->Eval(fCurrentHist->GetBinCenter(fCurrentHist->FindBin(x))) - fCurrentHist->GetBinContent(fCurrentHist->FindBin(x));
}
......
......@@ -65,11 +65,14 @@ private:
TGCheckButton *fUseLT, *fUseRT;
TGCheckButton *fFixFWHM, *fFixLT, *fFixRT, *fFixMean, *fFixAmpli;
TGCheckButton *fBckStep, *fBckPol1;
TGNumberEntry *fNE_FWHM[3];
TGNumberEntry *fNE_LT[3];
TGNumberEntry *fNE_RT[3];
Bool_t fUseStep = true;
Bool_t fUsePol1 = false;
TGListBox *fFitResultsBox = nullptr;
public:
......
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