Sum of two Landau plus Gauss noise for an Energy Loss Distribution

Dear friends,

As already posted in my previous thread Reading multiple .dat files and save plots in .root
I am shooting beta particles in matter.

The plot must be a sum of three contributions: a truncated Landau (taking into account the 0.55 MeV 90Sr->90Y decay), another truncated Landau (taking into account the 2.28 MeV 90Y->90Zr decay) and of course, the omnipresent gaussian noise.

Now… i want to read, plot and fit with a curve which is Landau1+Landau2+gauss but at the same time
i would love to see on the same graph also the single components superimposed (namely the two landaus and the gaussian noise).

I know that this is a heavy request. Of course before i ask to you i already tried my very best. Consider that i’m (seriously) playing with ROOT since two months, this is the best i could create. It is NOT what i need and not the best of sharp coding but… it is working though.

I attach the code (merged withe the previous post solution).

N6724_eh.C (8.2 KB)

And i attach one of the runs to plot and have fun for all of you. Hope you will enjoy.
NOTE: in order to attach i am forced to change extention to .txt. You can download and safely turn it into .dat again by simply renaming it.

run.txt (134.6 KB)

Now the deal:

1.) the script is too much verbose and require too many input from the user that is required to “first guess” a lot of numbers to initialize the fit. I have no clue if this can be avoided but the fit doesn’t converge this easly if the parameters are not properly initiated.

2.) The plot appears to have a landau, often two landau but the gauss (blu line in the figure below) is never really plotted realistically… even the two landaus are not what i expect. The FIT (red line, see figure below) appears only after that i open the fit panel, fit the data and iterate like 30 times adjusting the paramenters… and i would like to avoid that.

Can you help me to

a)improve the code by ruling out macroscopic bad practices i used because my non-expertise?
b)make the fit line (landau1+landau2+gauss) appear directly without forcing me to actually do the fit from FitPanel?
c)have the three contributes (landau 1,2 and gauus) plotted as well in a realistic way (and not like you see in the figure, that looks like minions…)

Anyone who can help will have a marble bust… or probably my aeternal gratitude…

Thank you in advance.

Nevertheless, i think my rough code can help in anycase since this specific problem in the web is nowhere to be found and a lot of physicists have easy access to Strontium. Hope i helped a bit and to be helped a bit more… :slight_smile:



@moneta is our specialist, and I’m sure he will be interested by your problem and will help you as soon as he’s back.

Cheers, Bertrand.

Thank you very much!
In the meantime i’ll try to improve the code but i’m quite sure a lot of things are out of my actual control and understanding.

The problem itself is actual and on the edge of the research over solid state physics. The Detector itself represent a very new and novel improvement for hybrid detection of alpha, beta and gamma particles, not to mention (maybe) the x-rays… A paper will soon be published and if you like i’ll let you know. For sure to import the power of ROOT inside solid state phys. (and not only to cover High energy experiments) can be of interest but, as you can see by yourself, we enter in a new territory where new solutions are to be found.

Just for the sake of completeness, the script is thought to work with my set-up which main part is represented by a CAEN digitizer (the N6724, hence the name of the executable).

I hope i proposed an interesting game. Thank you.

1 Like

Yes, this is definitively interesting. BTW, how did you come to the “(gaus(6)+landau(3))+landau(0)” distribution?

I had a very asymmetric spectra (see the snapshot in log scale where the landau falls like a straight line more or less) with another sample of diamond (i use mainly Element Six diamonds) and this, i think, is the first time this feature is actually measured or at least pointed out. Normally when you borrow Strontium from the radioactive guys, you only think about the main energetic decay at 2.28 MeV which passes through (a typical) thickness of sample. Since a lot of guys work with two triggers people use to select only the through going beta. At the begining my setup was easier and i did not include a second trigger (you clearly need another channel or another digitizer if you have money enough). Then i took both the decays and recorded them together. The energy release follows bethe block. The distribution is best approximated with a landau (but you need to cut at high energy to be physically acceptable). ROOT provides such a function. I took two since no theoretically difference must hold between the 0.5 and 2.3 MeV beta. The first one of course remains inside the bulk… Then i noticed that with only two landau it is really unlikely that you can take care of the long tail going to zero. Then i remembered i forgot the gaussian noise… this is the story more or less… :slight_smile:

1 Like

OK, thanks for the explanation :slight_smile:

1 Like

BTW, if you use the “R” (Range) option when fitting (gr->Fit("fSpectrum","R")), then you should specify a reasonable range (e.g. 0 - 18000) for your TF1s. Something like:

   TF1 *fSignalY = new TF1("fSignalY","landau(0)",0.,18000.); // Landau1 ruling 90Sr->90Y
   TF1 *fSignalZr = new TF1("fSignalZr","landau(3)",0.,18000.); // Landau2 ruling 90Sr->90Zr
   TF1 *fBackground = new TF1("fBackground","gaus(6)",0.,18000.); // Gauss noise
   TF1 *fSpectrum = new TF1("fSpectrum","gaus(6)+landau(3)+landau(0)",0.,18000.); //Sum over pdfs
1 Like

Just the simple correction you told me yesterday allows me (assumed that i initiated all the parameters in a very very very wise way) to obtain directly the right kind of plot (see attachement).

Now the problem is that if i go fine with FitPanel and iterate to best fitting, the curves L1, L2 and gauss they stay the same, they don’t update like of course the FIT red line does… it should be easy to fix that though. I’ll try myself but any help is highly appreciated. But THANK YOU

I think that this script can end up to be of great help to whom use the Sr as source

Hi again,

It is difficult to update the TF1 following an update of the fit, but you can take a look at this example:
N6724_eh_s.C (8.9 KB)
(I commented out the non relevant part of the code)
To summarize, I use signal/slot mechanism to connect any Clicked() button signal to a startUpdateTimer() function: TQObject::Connect("TGTextButton", "Clicked()", 0, 0, "startUpdateTimer()")
And the startUpdateTimer() function checks if the pressed button is the “Fit” button from the fit panel, and then start a single shot timer, wich will execute the updateFitting() function.

void startUpdateTimer()
   TGTextButton *btn = (TGTextButton *) gTQSender;
   if (btn) {
      TString text = btn->GetString();
      if (text == "Fit") {
         // one can adjust the time (in ms), depending on the fitting time...
         TTimer::SingleShot(1000, 0, 0, "updateFitting()");

This timer is necessary to perform the update after the end of the fitting (timing adjustment might be necessary…)
It’s not a perfect (nor very elegant) solution, but it should work…
And Note that you may have to use ACLiC to be able to get it working

Cheers, Bertrand.

1 Like

Wow… here we are going to hit black belts…
Ok i’ll try to implement this wonderful idea. In the meantime i fixed some minor issues. Soon i’ll try to post a “semi” final script for everybody. Other features are too much specific of my experiment and some people wouldn’t care to have them on the main script. I’m trying to keep it essential.

Thank you a lot!!! my analysis speeded up with ROOT of 250%… :stuck_out_tongue:

For the first time since one year i’m quicker than my senior investigator to show the preliminary plots after collected raw data. Hehehe… (proud!!). So we can safely say that ROOT won against gnuplot/kaleidagraph in showing multiplots and performing fit (few minutes against tens).


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