Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Deconvolution2_1.C File Reference

Detailed Description

View in nbviewer Open in SWAN
Example to illustrate the Gold deconvolution (class TSpectrum2).

#include <TSpectrum2.h>
void Deconvolution2_1() {
Int_t i, j;
const Int_t nbinsx = 256;
const Int_t nbinsy = 256;
Double_t xmax = (Double_t)nbinsx;
Double_t ymax = (Double_t)nbinsy;
Double_t** source = new Double_t*[nbinsx];
for (i=0;i<nbinsx;i++)
source[i]=new Double_t[nbinsy];
TString dir = gROOT->GetTutorialDir();
TString file = dir+"/spectrum/TSpectrum2.root";
TFile *f = new TFile(file.Data());
auto decon = (TH2F*) f->Get("decon1");
Double_t** response = new Double_t*[nbinsx];
for (i=0;i<nbinsx;i++)
response[i]=new Double_t[nbinsy];
auto resp = (TH2F*) f->Get("resp1");
auto *s = new TSpectrum2();
for (i = 0; i < nbinsx; i++){
for (j = 0; j < nbinsy; j++){
source[i][j] = decon->GetBinContent(i + 1,j + 1);
}
}
for (i = 0; i < nbinsx; i++){
for (j = 0; j < nbinsy; j++){
response[i][j] = resp->GetBinContent(i + 1,j + 1);
}
}
s->Deconvolution(source,response,nbinsx,nbinsy,1000,1,1);
for (i = 0; i < nbinsx; i++){
for (j = 0; j < nbinsy; j++)
decon->SetBinContent(i + 1,j + 1, source[i][j]);
}
decon->Draw("SURF2");
}
#define f(i)
Definition RSha256.hxx:104
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
float xmin
float ymin
float xmax
float ymax
#define gROOT
Definition TROOT.h:407
R__EXTERN TStyle * gStyle
Definition TStyle.h:433
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
2-D histogram with a float per channel (see TH1 documentation)}
Definition TH2.h:258
Advanced 2-dimensional spectra processing.
Definition TSpectrum2.h:18
Basic string class.
Definition TString.h:139
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition TStyle.cxx:1636
Definition file.py:1
Authors
Miroslav Morhac, Olivier Couet

Definition in file Deconvolution2_1.C.