39 Double_t xeff = 0.3 + (1.0 - 0.3)/20.0*(xt + 10.0);
41 if (x > xeff)
return cutdummy;
48 void TSVDUnfoldExample()
50 gROOT->SetStyle(
"Plain");
62 TH1D *xini =
new TH1D(
"xini",
"MC truth", nbins, -10.0, 10.0);
63 TH1D *bini =
new TH1D(
"bini",
"MC reco", nbins, -10.0, 10.0);
64 TH2D *Adet =
new TH2D(
"Adet",
"detector response", nbins, -10.0, 10.0, nbins, -10.0, 10.0);
67 TH1D *
data =
new TH1D(
"data",
"data", nbins, -10.0, 10.0);
69 TH1D *datatrue =
new TH1D(
"datatrue",
"data truth", nbins, -10.0, 10.0);
71 TH2D *statcov =
new TH2D(
"statcov",
"covariance matrix", nbins, -10.0, 10.0, nbins, -10.0, 10.0);
74 for (
Int_t i= 0; i<100000; i++) {
85 for (
Int_t i=0; i<10000; i++) {
93 cout <<
"Created toy distributions and errors for: " << endl;
94 cout <<
"... \"true MC\" and \"reconstructed (smeared) MC\"" << endl;
95 cout <<
"... \"true data\" and \"reconstructed (smeared) data\"" << endl;
96 cout <<
"... the \"detector response matrix\"" << endl;
99 for (
int i=1; i<=data->
GetNbinsX(); i++) {
135 ustatcov->
Add( uadetcov );
139 utaucov->
Add( uadetcov );
148 for (
int i=1; i<=unfres->
GetNbinsX(); i++) {
159 leg->
AddEntry(unfres,
"Unfolded Data",
"p");
160 leg->
AddEntry(datatrue,
"True Data",
"l");
161 leg->
AddEntry(data,
"Reconstructed Data",
"l");
164 TCanvas *
c1 =
new TCanvas(
"c1",
"Unfolding toy example with TSVDUnfold", 1000, 900 );
170 frame->
SetTitle(
"Unfolding toy example with TSVDUnfold" );
189 unfres->
Draw(
"same");
190 datatrue->
Draw(
"same");
202 TH2D* covframe =
new TH2D( *ustatcov );
203 covframe->
SetTitle(
"TSVDUnfold covariance matrix" );
211 ustatcov->
Draw(
"colzsame" );
221 dframe->
SetTitle(
"TSVDUnfold |d_{i}|" );
230 ddist->
Draw(
"same" );
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
SVD Approach to Data Unfolding.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Random number generator class based on M.
virtual void SetLogy(Int_t value=1)=0
This class displays a legend box (TPaveText) containing several legend entries.
virtual Double_t Rndm()
Machine independent random number generator.
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 void Draw(Option_t *option="")
Draw this legend with its current attributes.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
TH1D * Unfold(Int_t kreg)
Perform the unfolding with regularisation parameter kreg.
virtual void SetMinimum(Double_t minimum=-1111)
TH2D * GetUnfoldCovMatrix(const TH2D *cov, Int_t ntoys, Int_t seed=1)
Determine for given input error matrix covariance matrix of unfolded spectrum from toy simulation giv...
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
TH2D * GetXinv() const
Returns the computed inverse of the covariance matrix.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
#define R(a, b, c, d, e, f, g, h, i)
TH2D * GetXtau() const
Returns the computed regularized covariance matrix corresponding to total uncertainties on measured s...
TH1D * GetD() const
Returns d vector (for choosing appropriate regularisation)
void SetNormalize(Bool_t normalize)
TH1D * GetSV() const
Returns singular values vector.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
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 void SetLineColor(Color_t lcolor)
Set the line color.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
TH2D * GetAdetCovMatrix(Int_t ntoys, Int_t seed=1)
Determine covariance matrix of unfolded spectrum from finite statistics in response matrix using pseu...
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
1-D histogram with a double per channel (see TH1 documentation)}
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
THist< 2, double, THistStatContent, THistStatUncertainty > TH2D
virtual Double_t BreitWigner(Double_t mean=0, Double_t gamma=1)
Return a number distributed following a BreitWigner function with mean and gamma. ...
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1 if errors are defined (see TH1::Sumw2), errors are also recalculated.
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)=0
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
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.
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content.
virtual Int_t GetNbinsX() const
Double_t Sqrt(Double_t x)
Int_t Fill(Double_t)
Invalid Fill method.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetBorderSize(Int_t bordersize=4)
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
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)}