// root.cern.ch/root/htmldoc/guides/spectrum/Spectrum.html#deconvolution---unfolding // root.cern.ch/doc/master/Deconvolution__wide_8C.html // Example to illustrate deconvolution function (class TSpectrum). // // Authors: Miroslav Morhac, Olivier Couet void Deconvolution_wide () { Int_t i; const Int_t nbins = 256; Double_t xmin = 0; Double_t xmax = nbins; Double_t* source = new Double_t [nbins]; Double_t* response = new Double_t [nbins]; gROOT->ForceStyle(); TFile* f = new TFile ("TSpectrum.root"); TH1F* hdata = (TH1F*) f->Get ("decon3"); hdata->SetTitle ("Deconvolution of closely positioned overlapping peaks using Gold deconvolution method"); TH1F* hresponse = (TH1F*) f->Get ("decon_response_wide"); for (i = 0; i < nbins; i++) source [i] = hdata ->GetBinContent (i+1); for (i = 0; i < nbins; i++) response[i] = hresponse->GetBinContent (i+1); hdata->SetMaximum (50000); hdata->Draw ("L"); TSpectrum* Analyser1dim = new TSpectrum (); Analyser1dim->Deconvolution (source, response, 256, 10000, 1, 1); /* const char* TSpectrum::Deconvolution ( Double_t* source, // pointer to the vector of source spectrum const Double_t* response, // pointer to the vector of response spectrum Int_t ssize, // length of source and response spectra Int_t numberIterations, // for details we refer to documentation Int_t numberRepetitions, // for repeated boosted deconvolution Double_t boost // boosting coefficient, [xi] --> [xi]^boost ) This function calculates deconvolution from the source spectrum according to the response spectrum using the Gold deconvolution algorithm. The result is placed in the vector pointed by source pointer. On successful completion it returns 0. On error it returns pointer to the string describing error. If desired after every numberIterations one can apply boosting operation (exponential function with exponent given by boost coefficient) and repeat it numberRepetitions times. See: root.cern.ch/doc/v608/classTSpectrum.html#a81b35e9f63977f017e8a31295f01e05e */ TH1F* hresult = (TH1F*) hresponse->Clone ("hresult"); hresult->Reset (); for (i = 0; i < nbins; i++) hresult->SetBinContent (i+1, source[i]); hresult->SetLineColor (kRed); hresult->Draw ("SAME L"); }