ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
testUnfold5b.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_unfold5
3 ///
4 /// Version 17.0 example for multi-dimensional unfolding
5 ///
6 /// \macro_output
7 /// \macro_code
8 ///
9 /// \author Stefan Schmitt, DESY
10 
11 #include <iostream>
12 #include <fstream>
13 #include <TFile.h>
14 #include "TUnfoldBinning.h"
15 
16 using namespace std;
17 
18 void testUnfold5b()
19 {
20 
21  // write binning schemes to root file
22  TFile *binningSchemes=new TFile("testUnfold5_binning.root","recreate");
23 
24  // reconstructed pt, eta, discriminator
25 #define NBIN_PT_FINE 8
26 #define NBIN_ETA_FINE 10
27 #define NBIN_DISCR 4
28 
29  // generated pt, eta
30 #define NBIN_PT_COARSE 3
31 #define NBIN_ETA_COARSE 3
32 
33  // pt binning
34  Double_t ptBinsFine[NBIN_PT_FINE+1]=
35  {3.5,4.0,4.5,5.0,6.0,7.0,8.0,10.0,13.0};
36  Double_t ptBinsCoarse[NBIN_PT_COARSE+1]=
37  { 4.0, 5.0, 7.0, 10.0};
38  // eta binning
39  Double_t etaBinsFine[NBIN_ETA_FINE+1]=
40  {-3.,-2.5,-2.0,-1.,-0.5,0.0,0.5,1.,2.,2.5,3.};
41  Double_t etaBinsCoarse[NBIN_ETA_COARSE+1]=
42  { -2.0, -0.5, 0.5, 2. };
43 
44  // discriminator bins
45  Double_t discrBins[NBIN_DISCR+1]={0.,0.15,0.5,0.85,1.0};
46 
47  //=======================================================================
48  // detector level binning scheme
49 
50  TUnfoldBinning *detectorBinning=new TUnfoldBinning("detector");
51  // highest discriminator bin has fine binning
52  TUnfoldBinning *detectorDistribution=
53  detectorBinning->AddBinning("detectordistribution");
54  detectorDistribution->AddAxis("pt",NBIN_PT_FINE,ptBinsFine,
55  false, // no underflow bin (not reconstructed)
56  true // overflow bin
57  );
58  detectorDistribution->AddAxis("eta",NBIN_ETA_FINE,etaBinsFine,
59  false, // no underflow bin (not reconstructed)
60  false // no overflow bin (not reconstructed)
61  );
62  detectorDistribution->AddAxis("discriminator",NBIN_DISCR,discrBins,
63  false, // no underflow bin (empty)
64  false // no overflow bin (empty)
65  );
66  /* TUnfoldBinning *detectorExtra=
67  detectorBinning->AddBinning("detectorextra",7,"one;zwei;three"); */
68  detectorBinning->PrintStream(cout);
69 
70  //=======================================================================
71  // generator level binning
72  TUnfoldBinning *generatorBinning=new TUnfoldBinning("generator");
73 
74  // signal distribution is measured with coarse binning
75  // underflow and overflow bins are needed ot take care of
76  // what happens outside the phase-space
77  TUnfoldBinning *signalBinning = generatorBinning->AddBinning("signal");
78  signalBinning->AddAxis("ptgen",NBIN_PT_COARSE,ptBinsCoarse,
79  true, // underflow bin
80  true // overflow bin
81  );
82  signalBinning->AddAxis("etagen",NBIN_ETA_COARSE,etaBinsCoarse,
83  true, // underflow bin
84  true // overflow bin
85  );
86  // background distribution is unfolded with fine binning
87  // !!! in the reconstructed variable !!!
88  //
89  // This has the effect of "normalizing" the background in each
90  // pt,eta bin to the low discriminator values
91  // Only the shape of the discriminator in each (pt,eta) bin
92  // is taken from Monte Carlo
93  //
94  // This method has been applied e.g. in
95  // H1 Collaboration, "Prompt photons in Photoproduction"
96  // Eur.Phys.J. C66 (2010) 17
97  //
98  TUnfoldBinning *bgrBinning = generatorBinning->AddBinning("background");
99  bgrBinning->AddAxis("ptrec",NBIN_PT_FINE,ptBinsFine,
100  false, // no underflow bin (not reconstructed)
101  true // overflow bin
102  );
103  bgrBinning->AddAxis("etarec",NBIN_ETA_FINE,etaBinsFine,
104  false, // no underflow bin (not reconstructed)
105  false // no overflow bin (not reconstructed)
106  );
107  generatorBinning->PrintStream(cout);
108 
109  detectorBinning->Write();
110  generatorBinning->Write();
111 
112  delete binningSchemes;
113 }
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:823
Bool_t AddAxis(const char *name, Int_t nBins, const Double_t *binBorders, Bool_t hasUnderflow, Bool_t hasOverflow)
void PrintStream(std::ostream &out, Int_t indent=0) const
This class serves as a container of analysis bins analysis bins are specified by defining the axes of...
double Double_t
Definition: RtypesCore.h:55
TUnfoldBinning * AddBinning(TUnfoldBinning *binning)