70 while((
r<nmax)&&(
f>=probability[
r])) {
89 r=rnd->
Gaus(shapeParm[1],shapeParm[2]);
91 r=rnd->
Rndm()*(shapeParm[4]-shapeParm[3])+shapeParm[3];
96void testUnfold4(
bool printInfo =
false)
125 static const Double_t genFrac[]={0.3,0.6,0.1};
128 static const Double_t genShape[][5]=
129 {{1.0,2.0,1.5,0.,15.},
130 {1.0,7.0,2.5,0.,15.},
131 {0.0,0.0,0.0,0.,15.}};
135 TH1D *histDetDATA=
new TH1D(
"Yrec",
";DATA(Yrec)",nDet,xminDet,xmaxDet);
139 TH2D *histGenDetMC=
new TH2D(
"Yrec%Xgen",
"MC(Xgen,Yrec)",
140 nGen,xminGen,xmaxGen,nDet,xminDet,xmaxDet);
142 TH1D *histUnfold=
new TH1D(
"Xgen",
";DATA(Xgen)",nGen,xminGen,xmaxGen);
145 TH1D **histPullArea=
new TH1D* [nGen];
146 for(
int i=0;i<nGen;i++) {
154 for(
int itoy=0;itoy<1000;itoy++) {
155 if(!(itoy %10)) cout<<
"toy iteration: "<<itoy<<
"\n";
156 histDetDATA->
Reset();
157 histGenDetMC->
Reset();
160 for(
Int_t i=0;i<nData;i++) {
161 Int_t iGen=GenerateGenEvent(nGen,genFrac);
162 Double_t yObs=GenerateRecEvent(genShape[iGen]);
163 histDetDATA->
Fill(yObs);
167 for(
Int_t i=0;i<nMC;i++) {
168 Int_t iGen=GenerateGenEvent(nGen,genFrac);
169 Double_t yObs=GenerateRecEvent(genShape[iGen]);
170 histGenDetMC->
Fill(iGen,yObs);
183 unfold.SetInput(histDetDATA,0.0,1.0);
186 unfold.ScanLcurve(50,0.,0.,0,0,0);
189 unfold.GetOutput(histUnfold);
191 for(
int i=0;i<nGen;i++) {
200 unfold.ScanLcurve(50,0.,0.,0,0,0);
203 unfold.GetOutput(histUnfold);
205 for(
int i=0;i<nGen;i++) {
216 for(
int i=0;i<nGen;i++) {
218 histPullNC[i]->
Fit(
"gaus");
219 histPullNC[i]->
Draw();
221 for(
int i=0;i<nGen;i++) {
223 histPullArea[i]->
Fit(
"gaus");
224 histPullArea[i]->
Draw();
226 output.SaveAs(
"testUnfold4.ps");
R__EXTERN Int_t gErrorIgnoreLevel
R__EXTERN TStyle * gStyle
1-D histogram with a double per channel (see TH1 documentation)}
virtual void Reset(Option_t *option="")
Reset.
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
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 Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
When this static function is called with sumw2=kTRUE, all new histograms will automatically activate ...
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
2-D histogram with a double per channel (see TH1 documentation)}
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Int_t Fill(Double_t)
Invalid Fill method.
Random number generator class based on M.
This is the base class for the ROOT Random number generators.
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...
virtual Int_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
virtual Double_t Rndm()
Machine independent random number generator.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void SetOptFit(Int_t fit=1)
The type of information about fit parameters printed in the histogram statistics box can be selected ...
An algorithm to unfold distributions from detector to truth level, with background subtraction and pr...
static const char * GetTUnfoldVersion(void)
Return a string describing the TUnfold version.
@ kEConstraintArea
enforce preservation of the area
@ kEConstraintNone
use no extra constraint
@ kRegModeSize
regularise the amplitude of the output distribution
@ kHistMapOutputHoriz
truth level on x-axis of the response matrix
static void output(int code)