for (
Int_t i=0;i<nPoints;i++) {
else npfit++;
}
for (
Int_t i=0;i<nPoints;i++) {
for (
Int_t j=0;j<nPoints;j++) {
}
}
delete[] df;
f1->SetNumberFitPoints(npfit);
}
return par[0]/(dm*dm+par[2]*par[2]);
}
{
do {
do {
} while(t>=1.0);
} while(t<=0.0);
return t;
} else {
do {
do {
} while(t>=1.0);
} while(t>=0.0);
return t;
}
}
return rnd->
Gaus(mTrue+smallBias,smallSigma);
} else {
return rnd->
Gaus(mTrue+wideBias,wideSigma);
}
}
int testUnfold1()
{
TH1D *histMgenMC=
new TH1D(
"MgenMC",
";mass(gen)",nGen,xminGen,xmaxGen);
TH1D *histMdetMC=
new TH1D(
"MdetMC",
";mass(det)",nDet,xminDet,xmaxDet);
TH2D *histMdetGenMC=
new TH2D(
"MdetgenMC",
";mass(det);mass(gen)",
nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
for(
Int_t i=0;i<neventMC;i++) {
4.0,
0.2);
histMgenMC->
Fill(mGen,luminosityData/luminosityMC);
histMdetMC->
Fill(mDet,luminosityData/luminosityMC);
histMdetGenMC->
Fill(mDet,mGen,luminosityData/luminosityMC);
}
TH2D *histMdetGenSysMC=
new TH2D(
"MdetgenSysMC",
";mass(det);mass(gen)",
nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
neventMC=rnd->
Poisson(luminosityMC*crossSection);
for(
Int_t i=0;i<neventMC;i++) {
(0.5,
3.6,
0.15);
histMdetGenSysMC->
Fill(mDet,mGen,luminosityData/luminosityMC);
}
TH1D *histMgenData=
new TH1D(
"MgenData",
";mass(gen)",nGen,xminGen,xmaxGen);
TH1D *histMdetData=
new TH1D(
"MdetData",
";mass(det)",nDet,xminDet,xmaxDet);
for(
Int_t i=0;i<neventData;i++) {
3.8,
0.15);
histMgenData->
Fill(mGen);
histMdetData->
Fill(mDet);
}
TH1D *histDensityGenData=
new TH1D(
"DensityGenData",
";mass(gen)",
nGen,xminGen,xmaxGen);
TH1D *histDensityGenMC=
new TH1D(
"DensityGenMC",
";mass(gen)",
nGen,xminGen,xmaxGen);
for(
Int_t i=1;i<=nGen;i++) {
}
if(unfold.SetInput(histMdetData)>=10000) {
std::cout<<"Unfolding result may be wrong\n";
}
#ifdef VERBOSE_LCURVE_SCAN
#endif
iBest=unfold.ScanLcurve(nScan,tauMin,tauMax,&lCurve,&logTauX,&logTauY);
#ifdef VERBOSE_LCURVE_SCAN
#endif
TH2D *histMdetGenSys1=
new TH2D(
"Mdetgensys1",
";mass(det);mass(gen)",
nDet,xminDet,xmaxDet,nGen,xminGen,xmaxGen);
for(
Int_t i=0;i<=nDet+1;i++) {
for(
Int_t j=0;j<=nGen+1;j++) {
}
}
}
std::cout<<"tau="<<unfold.GetTau()<<"\n";
std::cout<<"chi**2="<<unfold.GetChi2A()<<"+"<<unfold.GetChi2L()
<<" / "<<unfold.GetNdf()<<"\n";
std::cout<<"chi**2(sys)="<<unfold.GetChi2Sys()<<"\n";
TH1 *histMunfold=unfold.GetOutput(
"Unfolded");
TH1 *histMdetFold=unfold.GetFoldedOutput(
"FoldedBack");
TH2 *histEmatTotal=unfold.GetEmatrixTotal(
"EmatTotal");
new TH1D(
"TotalError",
";mass(gen)",nGen,xminGen,xmaxGen);
for(
Int_t bin=1;bin<=nGen;bin++) {
}
TH1 *histRhoi=unfold.GetRhoItotal(
"rho_I",
nullptr,
nullptr,
"*[UO]",
&gHistInvEMatrix
);
gFitter->
SetFCN(chisquare_corr);
TF1 *bw=
new TF1(
"bw",bw_func,xminGen,xmaxGen,3);
histMunfold->
Fit(bw,
"UE");
histMdetGenMC->
Draw(
"BOX");
histTotalError->
Draw(
"E");
histMunfold->
Draw(
"SAME E1");
histDensityGenData->
Draw(
"SAME");
histDensityGenMC->
Draw(
"SAME HIST");
histMdetMC->
Draw(
"SAME HIST");
TH1 *histInput=unfold.GetInput(
"Minput",
";mass(det)");
bestLogTauLogChi2->
Draw(
"*");
output.
SaveAs(
"testUnfold1.ps");
return 0;
}
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.
This file is part of TUnfold.
TUnfold is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
TUnfold is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with TUnfold. If not, see http://www.gnu.org/licenses/.