123 npar =
f1->GetNpar();
129 for (
Int_t i=0;i<nPoints;i++) {
136 for (
Int_t i=0;i<nPoints;i++) {
137 for (
Int_t j=0;j<nPoints;j++) {
142 f1->SetNumberFitPoints(npfit);
147 return par[0]/(dm*dm+par[2]*par[2]);
160 if(rnd->
Rndm()>bgr) {
200 if(rnd->
Rndm()>frac) {
201 return rnd->
Gaus(mTrue+smallBias,smallSigma);
203 return rnd->
Gaus(mTrue+wideBias,wideSigma);
219 Double_t const luminosityData=100000;
220 Double_t const luminosityMC=1000000;
223 Int_t const nDet=250;
224 Int_t const nGen=100;
233 TH1D *histMgenMC=
new TH1D(
"MgenMC",
";mass(gen)",nGen,xminGen,xmaxGen);
234 TH1D *histMdetMC=
new TH1D(
"MdetMC",
";mass(det)",nDet,xminDet,xmaxDet);
235 TH2D *histMdetGenMC=
new TH2D(
"MdetgenMC",
";mass(det);mass(gen)",
236 nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
238 for(
Int_t i=0;i<neventMC;i++) {
251 histMgenMC->
Fill(mGen,luminosityData/luminosityMC);
253 histMdetMC->
Fill(mDet,luminosityData/luminosityMC);
268 histMdetGenMC->
Fill(mDet,mGen,luminosityData/luminosityMC);
275 TH2D *histMdetGenSysMC=
new TH2D(
"MdetgenSysMC",
";mass(det);mass(gen)",
276 nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
277 neventMC=rnd->
Poisson(luminosityMC*crossSection);
278 for(
Int_t i=0;i<neventMC;i++) {
284 histMdetGenSysMC->
Fill(mDet,mGen,luminosityData/luminosityMC);
290 TH1D *histMgenData=
new TH1D(
"MgenData",
";mass(gen)",nGen,xminGen,xmaxGen);
291 TH1D *histMdetData=
new TH1D(
"MdetData",
";mass(det)",nDet,xminDet,xmaxDet);
292 Int_t neventData=rnd->
Poisson(luminosityData*crossSection);
293 for(
Int_t i=0;i<neventData;i++) {
300 histMgenData->
Fill(mGen);
303 histMdetData->
Fill(mDet);
308 TH1D *histDensityGenData=
new TH1D(
"DensityGenData",
";mass(gen)",
309 nGen,xminGen,xmaxGen);
310 TH1D *histDensityGenMC=
new TH1D(
"DensityGenMC",
";mass(gen)",
311 nGen,xminGen,xmaxGen);
312 for(
Int_t i=1;i<=nGen;i++) {
330 if(unfold.SetInput(histMdetData)>=10000) {
331 std::cout<<
"Unfolding result may be wrong\n";
347#ifdef VERBOSE_LCURVE_SCAN
353 iBest=unfold.ScanLcurve(nScan,tauMin,tauMax,&lCurve,&logTauX,&logTauY);
356#ifdef VERBOSE_LCURVE_SCAN
366 TH2D *histMdetGenSys1=
new TH2D(
"Mdetgensys1",
";mass(det);mass(gen)",
367 nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
368 for(
Int_t i=0;i<=nDet+1;i++) {
370 for(
Int_t j=0;j<=nGen+1;j++) {
383 std::cout<<
"tau="<<unfold.GetTau()<<
"\n";
384 std::cout<<
"chi**2="<<unfold.GetChi2A()<<
"+"<<unfold.GetChi2L()
385 <<
" / "<<unfold.GetNdf()<<
"\n";
386 std::cout<<
"chi**2(sys)="<<unfold.GetChi2Sys()<<
"\n";
402 TH1 *histMunfold=unfold.GetOutput(
"Unfolded");
405 TH1 *histMdetFold=unfold.GetFoldedOutput(
"FoldedBack");
413 TH2 *histEmatTotal=unfold.GetEmatrixTotal(
"EmatTotal");
416 TH1D *histTotalError=
417 new TH1D(
"TotalError",
";mass(gen)",nGen,xminGen,xmaxGen);
418 for(
Int_t bin=1;bin<=nGen;bin++) {
429 TH1 *histRhoi=unfold.GetRhoItotal(
"rho_I",
443 gFitter->
SetFCN(chisquare_corr);
445 TF1 *bw=
new TF1(
"bw",bw_func,xminGen,xmaxGen,3);
452 histMunfold->
Fit(bw,
"UE");
466 histMdetGenMC->
Draw(
"BOX");
474 histTotalError->
Draw(
"E");
476 histMunfold->
Draw(
"SAME E1");
478 histDensityGenData->
Draw(
"SAME");
479 histDensityGenMC->
Draw(
"SAME HIST");
487 histMdetFold->
Draw();
488 histMdetMC->
Draw(
"SAME HIST");
490 TH1 *histInput=unfold.GetInput(
"Minput",
";mass(det)");
493 histInput->
Draw(
"SAME");
503 bestLogTauLogChi2->
Draw(
"*");
509 bestLcurve->
Draw(
"*");
511 output.
SaveAs(
"testUnfold1.ps");
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
externInt_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
static void RejectPoint(Bool_t reject=kTRUE)
static Bool_t RejectedPoint()
virtual void SetParameter(Int_t param, Double_t value)
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t GetNbinsX() const
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
virtual Double_t GetBinCenter(Int_t bin) const
virtual Double_t GetBinWidth(Int_t bin) const
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
void Draw(Option_t *option="") override
Default Draw method for all objects.
virtual void SetBinError(Int_t bin, Double_t error)
virtual Int_t Fill(Double_t x)
virtual Double_t GetBinContent(Int_t bin) const
virtual void SetBinContent(Int_t bin, Double_t content)
2-D histogram with a double per channel (see TH1 documentation)
Service class for 2-D histogram classes.
void SetBinContent(Int_t bin, Double_t content) override
Set bin content.
Double_t GetBinContent(Int_t binx, Int_t biny) const override
Int_t Fill(Double_t) override
Invalid Fill method.
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
void SaveAs(const char *filename="", Option_t *option="") const override
Save this object in the file specified by filename.
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...
Double_t Rndm() override
Machine independent random number generator.
virtual ULong64_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
Base class for spline implementation containing the Draw/Paint methods.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
virtual void GetKnot(Int_t i, Double_t &x, Double_t &y) const =0
An algorithm to unfold distributions from detector to truth level.
@ kSysErrModeRelative
matrix gives the relative shifts
@ kSysErrModeMatrix
matrix is an alternative to the default matrix, the errors are the difference to the original matrix
@ kHistMapOutputVert
truth level on y-axis of the response matrix
Abstract Base Class for Fitting.
virtual TObject * GetObjectFit() const
virtual void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
To set the address of the minimization objective function called by the native compiler (see function...
virtual TObject * GetUserFunc() const
static TVirtualFitter * Fitter(TObject *obj, Int_t maxpar=25)
Static function returning a pointer to the current fitter.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.