Energy calibration of gamma ray-detector


I am working on project to calculate resolution of LaBr detector, I have my spectra in root format. I don’t know how to convert channel no. to Energy. I have spectra of Eu-152 and Co-60.
Please guide me regarding this.

Thank you

You need to identify at least two peaks that have known energy, fit a gaussian to each one, and then use the resulting positions for a linear fit to convert channels to energy. Have a look here for more information.

The energy calibration curve for Ge or Scintillation detector is usually described by the following 2 degrees polynomial function:

//suppose you have five gamma peaks for the calibration.

Float_t energy[5]={121.78, 244.7, 344.28, 411.12, 443.96};//fill with your 152Eu gamma peak energies
Float_t channel[5]={100,200,300,400,500};//fill with your channel numbers from gamma peak fitting
TGraph *g=new TGraph;
g->SetPoint(5, channel, energy);//fill data to a Graph
g->Fit("pol2");//fit the graph with pol2

then calibrate your spectrum with the parameters obtained above

void calibration(TH1D *h0)
    double p0=0;//fill with your fitted parameter values
    double p1=1;//
    double p2=0;//
// TH1D *h0 - raw gamma spectrum
    TH1D *g0=new TH1D("g0","g0",2500,0,2500);//g0 - calibrated spectrum
    TRandom3 *r=new TRandom3(0);
    for(int i=0;i<2500;i++){
        Long64_t eN=h0->GetBinContent(i);
        Double_t e=h0->GetBinCenter(i);
        for(Long64_t j=0;j<eN;j++){
            Double_t ea=e+r->Rndm()*0.2-0.1;
        if(i%1000==0) cout<<i<<endl;
    TFile *f=new TFile("gammacali.root","recreate");

Thank you for the reply. I am using Co-60 spectra as a known energy spectra for calibration.

Thank you so much for your help. It really helped in getting the results.

What if i have two histograms with two different calibrations and I want to sum each other

I think, you will first need to “calibrate” both “raw” data samples separately. Then create a new histogram, with the x-axis representing “energy” (i.e. not “channels”), and fill this new histogram with your “raw” data from both samples, applying the required (sample specific) “energy calibration” on the fly.

1 Like

If you have two calibrated energy spectra.
For example, TH1D *he1, *he2, then
TH1D *hesum;

can you share with me your macro of this co-60 calibrated data

Sorry, I don’t have the data with me now. I completed the above project.

Hi Zhli,
Where we can define the raw spectra (TH1D*h0).? I am working on a similar problem. I have fitted parameters and I want to generate the calibrated spectrum.