69 while((r<nmax)&&(f>=probability[r])) {
88 r=rnd->
Gaus(shapeParm[1],shapeParm[2]);
90 r=rnd->
Rndm()*(shapeParm[4]-shapeParm[3])+shapeParm[3];
120 static const Double_t genFrac[]={0.3,0.6,0.1};
123 static const Double_t genShape[][5]=
124 {{1.0,2.0,1.5,0.,15.},
125 {1.0,7.0,2.5,0.,15.},
126 {0.0,0.0,0.0,0.,15.}};
130 TH1D *histDetDATA=
new TH1D(
"Yrec",
";DATA(Yrec)",nDet,xminDet,xmaxDet);
134 TH2D *histGenDetMC=
new TH2D(
"Yrec%Xgen",
"MC(Xgen,Yrec)",
135 nGen,xminGen,xmaxGen,nDet,xminDet,xmaxDet);
137 TH1D *histUnfold=
new TH1D(
"Xgen",
";DATA(Xgen)",nGen,xminGen,xmaxGen);
140 TH1D **histPullArea=
new TH1D* [nGen];
141 for(
int i=0;i<nGen;i++) {
149 for(
int itoy=0;itoy<1000;itoy++) {
150 if(!(itoy %10)) cout<<
"toy iteration: "<<itoy<<
"\n";
151 histDetDATA->
Reset();
152 histGenDetMC->
Reset();
155 for(
Int_t i=0;i<nData;i++) {
156 Int_t iGen=GenerateGenEvent(nGen,genFrac);
157 Double_t yObs=GenerateRecEvent(genShape[iGen]);
158 histDetDATA->
Fill(yObs);
162 for(
Int_t i=0;i<nMC;i++) {
163 Int_t iGen=GenerateGenEvent(nGen,genFrac);
164 Double_t yObs=GenerateRecEvent(genShape[iGen]);
165 histGenDetMC->
Fill(iGen,yObs);
178 unfold.SetInput(histDetDATA,0.0,1.0);
181 unfold.ScanLcurve(50,0.,0.,0,0,0);
184 unfold.GetOutput(histUnfold);
186 for(
int i=0;i<nGen;i++) {
195 unfold.ScanLcurve(50,0.,0.,0,0,0);
198 unfold.GetOutput(histUnfold);
200 for(
int i=0;i<nGen;i++) {
211 for(
int i=0;i<nGen;i++) {
213 histPullNC[i]->
Fit(
"gaus");
214 histPullNC[i]->
Draw();
216 for(
int i=0;i<nGen;i++) {
218 histPullArea[i]->
Fit(
"gaus");
219 histPullArea[i]->
Draw();
221 output.
SaveAs(
"testUnfold4.ps");
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Random number generator class based on M.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
R__EXTERN TStyle * gStyle
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
An algorithm to unfold distributions from detector to truth level, with background subtraction and pr...
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
When this static function is called with sumw2=kTRUE, all new histograms will automatically activate ...
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
truth level on x-axis of the response matrix
This is the base class for the ROOT Random number generators.
regularise the amplitude of the output distribution
virtual void Reset(Option_t *option="")
Reset.
virtual Double_t Rndm()
Machine independent random number generator.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
static const char * GetTUnfoldVersion(void)
Return a string describing the TUnfold version.
1-D histogram with a double per channel (see TH1 documentation)}
enforce preservation of the area
THist< 2, double, THistStatContent, THistStatUncertainty > TH2D
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
virtual Int_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save Pad contents in a file in one of various formats.
Int_t Fill(Double_t)
Invalid Fill method.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
2-D histogram with a double per channel (see TH1 documentation)}