Hi all,
I’m trying to fit a reflected landau onto some output from a Geant4 simulation. My issue is that when I try to reflect the fit by setting the scale parameter to -1, the fit disappears entirely (but can be seen as a black line on the x-axis).
When the scale parameter is set to 1, a landau distribution fits over the dataset as expected. I have included my code below.
Thank-you,
Vincent
{
gROOT->Reset();
gROOT->SetStyle("Plain");
TFile f("B4.root");
TCanvas* c1 = new TCanvas("c1", "", 20, 20, 1000, 1000);
c1->Divide(1,1);
c1->cd(1);
TTree *B4 = (TTree*)f.Get("B4");
TF1 f1("f1","[0]*TMath::Landau(x,[1],[2])",0,530);
f1.SetParameters(1.59,480,0.3);
B4->Draw("Ecore>>h1(50,300,530)");
Ecore->Fit("f1");
_ROOT Version: 6.26
Platform: Fedora Linux
Compiler: GNU
couet
August 10, 2022, 7:34am
2
Welcome to the ROOT forum.
I do not see such scaling in your code. Your code does not seem complete.
Also, note you should not use gROOT->Reset()
that’s not recommended anymore.
If by the “scale parameter” you mean the parameter “[2]
”, then it MUST be a positive value.
You can try a “mirrored” version (“long tail” on the left side):
TF1 f1("f1", "[0] * TMath::Landau([1] - x, 0., [2])", 300., 530.);
1 Like
Hi couet,
My aplogies for the incomplete code, I accidentally copied the wrong version of the code.
My issue is now resolved, but I was wondering what is recommended instead of
gROOT->Reset()
When I remove the line of code, my mean changes, and the bins appear as crosses rather than rectangles.
Thank-you,
Vincent
system
Closed
August 24, 2022, 1:35pm
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.