I am trying to subtract background.
When I do so everything else works but I do not understand why I have something in the negative of y-axis? Can someone please help me out?

Here is the attached code- - - Envoi sécurisé et gratuit de gros fichiers

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

If you do this:

  TH1F* Background = (TH1F*)test->ShowBackground(20,"same");

and zoom in at the first bins you see that the second bin in Background has ~2500 entries, which is then subtracted from test, which is already near zero.

Try adding the option “nosmoothing” to ShowBackground:

TH1F* Background = (TH1F*)test->ShowBackground(20,"same,nosmoothing");

1 Like

Thanks a lot, can you please let me know if there is also a way to automate this using a peak finder function?

I would like the program to find the peaks, fit them and get the area under the fit.

Check out: