Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Deconvolution2_HR.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_spectrum
3/// Example to illustrate boosted Gold deconvolution (class TSpectrum2).
4///
5/// \macro_image
6/// \macro_code
7///
8/// \authors Miroslav Morhac, Olivier Couet
9
10#include <TSpectrum2.h>
11
13{
14 Int_t i, j;
15 const Int_t nbinsx = 64;
16 const Int_t nbinsy = 64;
17 Double_t xmin = 0;
19 Double_t ymin = 0;
21 Double_t **source = new Double_t *[nbinsx];
22 for (i = 0; i < nbinsx; i++)
23 source[i] = new Double_t[nbinsy];
24 TString dir = gROOT->GetTutorialDir();
25 TString file = dir + "/legacy/spectrum/TSpectrum2.root";
26 TFile *f = new TFile(file.Data());
27 auto decon = (TH2F *)f->Get("decon2");
28 Double_t **response = new Double_t *[nbinsx];
29 for (i = 0; i < nbinsx; i++)
30 response[i] = new Double_t[nbinsy];
31 auto resp = (TH2F *)f->Get("resp2");
33 auto *s = new TSpectrum2();
34 for (i = 0; i < nbinsx; i++) {
35 for (j = 0; j < nbinsy; j++) {
36 source[i][j] = decon->GetBinContent(i + 1, j + 1);
37 }
38 }
39 for (i = 0; i < nbinsx; i++) {
40 for (j = 0; j < nbinsy; j++) {
41 response[i][j] = resp->GetBinContent(i + 1, j + 1);
42 }
43 }
44 s->Deconvolution(source, response, nbinsx, nbinsy, 1000, 1, 1);
45 for (i = 0; i < nbinsx; i++) {
46 for (j = 0; j < nbinsy; j++)
47 decon->SetBinContent(i + 1, j + 1, source[i][j]);
48 }
49 decon->Draw("SURF2");
50}
#define f(i)
Definition RSha256.hxx:104
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
float xmin
float ymin
float xmax
float ymax
#define gROOT
Definition TROOT.h:406
R__EXTERN TStyle * gStyle
Definition TStyle.h:436
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:303
Advanced 2-dimensional spectra processing.
Definition TSpectrum2.h:18
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
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:1640