130 for (
Int_t i=0;i<nPoints;i++) {
137 for (
Int_t i=0;i<nPoints;i++) {
138 for (
Int_t j=0;j<nPoints;j++) {
148 return par[0]/(dm*dm+par[2]*par[2]);
161 if(rnd->
Rndm()>bgr) {
201 if(rnd->
Rndm()>frac) {
202 return rnd->
Gaus(mTrue+smallBias,smallSigma);
204 return rnd->
Gaus(mTrue+wideBias,wideSigma);
220 Double_t const luminosityData=100000;
221 Double_t const luminosityMC=1000000;
224 Int_t const nDet=250;
225 Int_t const nGen=100;
234 TH1D *histMgenMC=
new TH1D(
"MgenMC",
";mass(gen)",nGen,xminGen,xmaxGen);
235 TH1D *histMdetMC=
new TH1D(
"MdetMC",
";mass(det)",nDet,xminDet,xmaxDet);
236 TH2D *histMdetGenMC=
new TH2D(
"MdetgenMC",
";mass(det);mass(gen)",
237 nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
239 for(
Int_t i=0;i<neventMC;i++) {
252 histMgenMC->
Fill(mGen,luminosityData/luminosityMC);
254 histMdetMC->
Fill(mDet,luminosityData/luminosityMC);
269 histMdetGenMC->
Fill(mDet,mGen,luminosityData/luminosityMC);
276 TH2D *histMdetGenSysMC=
new TH2D(
"MdetgenSysMC",
";mass(det);mass(gen)",
277 nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
278 neventMC=rnd->
Poisson(luminosityMC*crossSection);
279 for(
Int_t i=0;i<neventMC;i++) {
285 histMdetGenSysMC->
Fill(mDet,mGen,luminosityData/luminosityMC);
291 TH1D *histMgenData=
new TH1D(
"MgenData",
";mass(gen)",nGen,xminGen,xmaxGen);
292 TH1D *histMdetData=
new TH1D(
"MdetData",
";mass(det)",nDet,xminDet,xmaxDet);
293 Int_t neventData=rnd->
Poisson(luminosityData*crossSection);
294 for(
Int_t i=0;i<neventData;i++) {
301 histMgenData->
Fill(mGen);
304 histMdetData->
Fill(mDet);
309 TH1D *histDensityGenData=
new TH1D(
"DensityGenData",
";mass(gen)",
310 nGen,xminGen,xmaxGen);
311 TH1D *histDensityGenMC=
new TH1D(
"DensityGenMC",
";mass(gen)",
312 nGen,xminGen,xmaxGen);
313 for(
Int_t i=1;i<=nGen;i++) {
331 if(unfold.SetInput(histMdetData)>=10000) {
332 std::cout<<
"Unfolding result may be wrong\n";
348#ifdef VERBOSE_LCURVE_SCAN
354 iBest=unfold.ScanLcurve(nScan,tauMin,tauMax,&lCurve,&logTauX,&logTauY);
357#ifdef VERBOSE_LCURVE_SCAN
367 TH2D *histMdetGenSys1=
new TH2D(
"Mdetgensys1",
";mass(det);mass(gen)",
368 nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
369 for(
Int_t i=0;i<=nDet+1;i++) {
371 for(
Int_t j=0;j<=nGen+1;j++) {
384 std::cout<<
"tau="<<unfold.GetTau()<<
"\n";
385 std::cout<<
"chi**2="<<unfold.GetChi2A()<<
"+"<<unfold.GetChi2L()
386 <<
" / "<<unfold.GetNdf()<<
"\n";
387 std::cout<<
"chi**2(sys)="<<unfold.GetChi2Sys()<<
"\n";
403 TH1 *histMunfold=unfold.GetOutput(
"Unfolded");
406 TH1 *histMdetFold=unfold.GetFoldedOutput(
"FoldedBack");
414 TH2 *histEmatTotal=unfold.GetEmatrixTotal(
"EmatTotal");
417 TH1D *histTotalError=
418 new TH1D(
"TotalError",
";mass(gen)",nGen,xminGen,xmaxGen);
419 for(
Int_t bin=1;bin<=nGen;bin++) {
430 TH1 *histRhoi=unfold.GetRhoItotal(
"rho_I",
444 gFitter->
SetFCN(chisquare_corr);
446 TF1 *bw=
new TF1(
"bw",bw_func,xminGen,xmaxGen,3);
453 histMunfold->
Fit(bw,
"UE");
467 histMdetGenMC->
Draw(
"BOX");
475 histTotalError->
Draw(
"E");
477 histMunfold->
Draw(
"SAME E1");
479 histDensityGenData->
Draw(
"SAME");
480 histDensityGenMC->
Draw(
"SAME HIST");
488 histMdetFold->
Draw();
489 histMdetMC->
Draw(
"SAME HIST");
491 TH1 *histInput=unfold.GetInput(
"Minput",
";mass(det)");
494 histInput->
Draw(
"SAME");
504 bestLogTauLogChi2->
Draw(
"*");
510 bestLcurve->
Draw(
"*");
512 output.SaveAs(
"testUnfold1.ps");
Int_t gErrorIgnoreLevel
Error handling routines.
R__EXTERN TStyle * gStyle
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
static void RejectPoint(Bool_t reject=kTRUE)
Static function to set the global flag to reject points the fgRejectPoint global flag is tested by al...
virtual Int_t GetNpar() const
virtual void SetNumberFitPoints(Int_t npfits)
virtual void InitArgs(const Double_t *x, const Double_t *params)
Initialize parameters addresses.
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=nullptr)
Evaluate function with given coordinates and parameters.
static Bool_t RejectedPoint()
See TF1::RejectPoint above.
virtual void SetParameter(Int_t param, Double_t value)
A TGraph is an object made of two arrays X and Y with npoints each.
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
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 GetNbinsX() const
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
When this static function is called with sumw2=kTRUE, all new histograms will automatically activate ...
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width for 1D histogram.
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.
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
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.
@ 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.