33 TFile *outputFile=
new TFile(
"testUnfold5_results.root",
"recreate");
37 TFile *inputFile=
new TFile(
"testUnfold5_histograms.root");
43 inputFile->GetObject(
"detector",detectorBinning);
44 inputFile->GetObject(
"generator",generatorBinning);
46 if((!detectorBinning)||(!generatorBinning)) {
47 cout<<
"problem to read binning schemes\n";
51 detectorBinning->
Write();
52 generatorBinning->
Write();
55 TH1 *histDataReco,*histDataTruth;
58 inputFile->GetObject(
"histDataReco",histDataReco);
59 inputFile->GetObject(
"histDataTruth",histDataTruth);
60 inputFile->GetObject(
"histMCGenRec",histMCGenRec);
62 histDataReco->
Write();
63 histDataTruth->
Write();
64 histMCGenRec->
Write();
66 if((!histDataReco)||(!histDataTruth)||(!histMCGenRec)) {
67 cout<<
"problem to read input histograms\n";
85 const char *REGULARISATION_DISTRIBUTION=0;
86 const char *REGULARISATION_AXISSTEERING=
"*[B]";
90 regMode,constraintMode,densityFlags,
91 generatorBinning,detectorBinning,
92 REGULARISATION_DISTRIBUTION,
93 REGULARISATION_AXISSTEERING);
96 unfold.SetInput(histDataReco );
100 TH2 *histL= unfold.GetL(
"L");
102 cout<<
"L["<<unfold.GetLBinning()->GetBinName(j)<<
"]";
105 if(c!=0.0) cout<<
" ["<<i<<
"]="<<
c;
123 const char *SCAN_DISTRIBUTION=
"signal";
124 const char *SCAN_AXISSTEERING=0;
126 Int_t iBest=unfold.ScanTau(nScan,0.,0.,&rhoLogTau,
128 SCAN_DISTRIBUTION,SCAN_AXISSTEERING,
133 rhoLogTau->
GetKnot(iBest,t[0],rho[0]);
134 lCurve->GetPoint(iBest,x[0],y[0]);
135 TGraph *bestRhoLogTau=
new TGraph(1,t,rho);
136 TGraph *bestLCurve=
new TGraph(1,x,y);
138 for(
Int_t i=0;i<nScan;i++) {
139 rhoLogTau->
GetKnot(i,tAll[i],rhoAll[i]);
141 TGraph *knots=
new TGraph(nScan,tAll,rhoAll);
143 cout<<
"chi**2="<<unfold.GetChi2A()<<
"+"<<unfold.GetChi2L()
144 <<
" / "<<unfold.GetNdf()<<
"\n";
151 TH1 *histDataUnfold=unfold.GetOutput(
"unfolded signal",0,0,0,
kFALSE);
154 TH1 *histMCTruth=histMCGenRec->
ProjectionX(
"histMCTruth",0,-1,
"e");
157 histMCReco->
Scale(scaleFactor);
158 histMCTruth->
Scale(scaleFactor);
160 TH2 *histProbability=unfold.GetProbabilityMatrix(
"histProbability");
162 TH1 *histGlobalCorr=unfold.GetRhoItotal(
"histGlobalCorr",0,0,0,
kFALSE);
163 TH1 *histGlobalCorrScan=unfold.GetRhoItotal
164 (
"histGlobalCorrScan",0,SCAN_DISTRIBUTION,SCAN_AXISSTEERING,
kFALSE);
165 TH2 *histCorrCoeff=unfold.GetRhoIJtotal(
"histCorrCoeff",0,0,0,
kFALSE);
167 TCanvas *canvas =
new TCanvas();
168 canvas->Print(
"testUnfold5.ps[");
180 histDataReco->
Draw(
"E");
182 histMCReco->
Draw(
"SAME HIST");
185 histProbability->
Draw(
"BOX");
189 histDataUnfold->
Draw(
"E");
191 histDataTruth->
Draw(
"SAME HIST");
193 histMCTruth->
Draw(
"SAME HIST");
198 bestRhoLogTau->SetMarkerColor(
kRed);
199 bestRhoLogTau->Draw(
"*");
204 histGlobalCorrScan->
Draw(
"HIST");
208 bestLCurve->SetMarkerColor(
kRed);
209 bestLCurve->Draw(
"*");
212 canvas->Print(
"testUnfold5.ps");
214 canvas->Print(
"testUnfold5.ps]");
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
Base class for spline implementation containing the Draw/Paint methods //.
virtual void SetMinimum(Double_t minimum=-1111)
virtual Int_t GetNbinsX() const
static void SetDefaultSumw2(Bool_t sumw2=kTRUE)
static function.
TH1D * ProjectionX(const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const
Project a 2-D histogram into a 1-D histogram along X.
TH1D * ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const
Project a 2-D histogram into a 1-D histogram along Y.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void SetLineColor(Color_t lcolor)
Service class for 2-Dim histogram classes.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
virtual void GetKnot(Int_t i, Double_t &x, Double_t &y) const =0
This class serves as a container of analysis bins analysis bins are specified by defining the axes of...
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual Int_t GetNbinsY() const