#include <iostream>
{
Double_t xeff = 0.3 + (1.0 - 0.3)/20.0*(xt + 10.0);
if (
x > xeff)
return cutdummy;
else {
return xt+xsmear;
}
}
void TSVDUnfoldExample()
{
gROOT->SetStyle(
"Plain");
TH1D *xini =
new TH1D(
"xini",
"MC truth", nbins, -10.0, 10.0);
TH1D *bini =
new TH1D(
"bini",
"MC reco", nbins, -10.0, 10.0);
TH2D *Adet =
new TH2D(
"Adet",
"detector response", nbins, -10.0, 10.0, nbins, -10.0, 10.0);
TH1D *datatrue =
new TH1D(
"datatrue",
"data truth", nbins, -10.0, 10.0);
TH2D *statcov =
new TH2D(
"statcov",
"covariance matrix", nbins, -10.0, 10.0, nbins, -10.0, 10.0);
for (
Int_t i= 0; i<100000; i++) {
}
}
for (
Int_t i=0; i<10000; i++) {
}
cout << "Created toy distributions and errors for: " << endl;
cout << "... \"true MC\" and \"reconstructed (smeared) MC\"" << endl;
cout << "... \"true data\" and \"reconstructed (smeared) data\"" << endl;
cout << "... the \"detector response matrix\"" << endl;
for (int i=1; i<=data->GetNbinsX(); i++) {
}
ustatcov->
Add( uadetcov );
utaucov->
Add( uadetcov );
}
leg->AddEntry(unfres,
"Unfolded Data",
"p");
leg->AddEntry(datatrue,
"True Data",
"l");
leg->AddEntry(data,
"Reconstructed Data",
"l");
leg->AddEntry(xini,
"True MC",
"l");
TCanvas *
c1 =
new TCanvas(
"c1",
"Unfolding toy example with TSVDUnfold", 1000, 900 );
frame->
SetTitle(
"Unfolding toy example with TSVDUnfold" );
data->SetLineColor(4);
data->SetLineWidth(2);
data->Draw("same");
c2->SetRightMargin ( 0.15 );
covframe->
SetTitle(
"TSVDUnfold covariance matrix" );
ustatcov->
Draw(
"colzsame" );
dframe->
SetTitle(
"TSVDUnfold |d_{i}|" );
}
#define R(a, b, c, d, e, f, g, h, i)
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
1-D histogram with a double per channel (see TH1 documentation)
void SetTitle(const char *title) override
Change/set the title.
virtual Int_t GetNbinsX() const
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),...
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.
virtual void SetMinimum(Double_t minimum=-1111)
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
2-D histogram with a double per channel (see TH1 documentation)
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.
Use the TLine constructor to create a simple line.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Random number generator class based on M.
SVD Approach to Data Unfolding.
TH1D * GetSV() const
Returns singular values vector.
TH2D * GetXtau() const
Returns the computed regularized covariance matrix corresponding to total uncertainties on measured s...
TH1D * Unfold(Int_t kreg)
Perform the unfolding with regularisation parameter kreg.
void SetNormalize(Bool_t normalize)
TH1D * GetD() const
Returns d vector (for choosing appropriate regularisation).
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...
TH2D * GetAdetCovMatrix(Int_t ntoys, Int_t seed=1)
Determine covariance matrix of unfolded spectrum from finite statistics in response matrix using pseu...
TH2D * GetXinv() const
Returns the computed inverse of the covariance matrix.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
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
Double_t Sqrt(Double_t x)
Returns the square root of x.