Fit with gaussian distribution

Hi, i have to fit these dates:

quarto.txt (48.6 KB)

that create this picture:

and my professor gave me this program:

multipeak.C (489 Bytes)

Now i don’t know how can i use this program in order to fit the dates. How can i do?

Thanks :slight_smile:

Nobody?

Thank you :slight_smile:

Alberto,

I think you have in hands a file which lists counts and channels and a macro which fits a function which is the sum of 12 gaussians, right?
So, what you need to do is:

  • Fill a histogram with the values you have in your input file. In order to do that you can use a TH1F object with the correct binning, i.e. the one which respects the granularity of your channels.
  • Fit to it the function you have in the code. In order to do that, you’ll need a TF1 built on top of your function. The way in which you fit a TF1 to a histogram can be learned here.

The sum of 12 gaussians can fit basically anything. This problem will require that you inject meaningful initial values for the means and sigmas of the gaussians. Again, have a look to the doc of TF1 if you are not sure how to set the value of functions’ parameters.

Cheers,
D

1 Like

Thank you,

my text file has two columns is TH1F correct ? Moreover can you give me example of this programs because i don’t know how can i take the dates from txt file to root?
Last question, my professor gave me multipeak (i have posted it in the first message) is it wrong? How can i use it?

Thanks

Ok i have found the solution, thanks

Alberto,

for your future self and the community it could be nice to enrich this thread with the solution you found… Your call.

Cheers,
D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.