Peak shifting in a histogram

I have one TOF spectra corresponding to gamma’s and neutrons from an organic neutron scintillator detector. But since the data is stored in different files and experiment being carried out for several days so I have RF shift problem means gamma peak in two different files have different value. E.g in first file the gamma peak is at 1749 number channel but in the next file it falls at 950th number channel. So there is a difference of approx 800 channels; ideally it should be at the same position as earlier.
I have around 100 detectors and corresponding 100 Time-of-flight (TOF) histograms corresponding to these detectors and approx. 200 files where the gamma peaks (or centroids) need to be alligh at a particular position in all the files for all the neutron detectors. What can be done in this case??

Please read tips for efficient and successful posting and posting code

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

It looks like you are producing these histograms from a TTree. The first thing to do is to impose the histogram binning and limits by using TTree::Draw the following way:


where h is an histogram you created before that command to impose the limits and binning.
something like:

auto h = new TH1D("h","h",1000,0.,4100.);

Then assuming you know the shift s for each histogram, something like:


should be enough to align all the histogram.
So the real question is: do you know the shift for each histogram ?

What is “x” here???

Yes I know the shift for each histogram. I have noted the value of shift for each histogram in all the data files. Also I generated the histogram in the following manner:

T8009 = new TH1D(“T8009”,“T8009”,2700,1,4096);

(consider first image; second image was made using TTree and was for reference only. I am not using that here)
And then I am filling this histogram because it corresponds to a particular channel of TDC (time-to-digital converter)


In the next step I write the histogram:


I am doing all these using TSelector option of ROOT.

x is the tree variable you want draw.

So if you start from a tree I explained you how to proceed.
If you fill the histogram using Fill you can apply the shift there also:


I tried this option of Fill(t8009+s);
But I guess this will shift the whole spectra/histogram by 100 channels and not the gamma centroid peak.
Actually I tried doing that but I only got an intense peak at 100th number channel and histogram remained as it is.

Yes of course, but that sounds logical ? why only a portion of the spectra should be shifted ? seems to me if a calibration issue is involved at some point, it should somehow affect the whole spectra, not only a specific part of it ?

1 Like

Yeah, you are right (y)
Thank you!!!
it is working.

1 Like

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