Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ratioplot6.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_hist
3/// \notebook
4/// Example showing a fit residual plot, where the separation margin has been set to 0.
5/// The last label of the lower plot's y axis is hidden automatically.
6///
7/// \macro_image
8/// \macro_code
9///
10/// \author Paul Gessinger
11
12void ratioplot6() {
13 gStyle->SetOptStat(0);
14 auto c1 = new TCanvas("c1", "fit residual simple");
15 gPad->SetFrameFillStyle(0);
16 auto h1 = new TH1D("h1", "h1", 50, -5, 5);
17 h1->FillRandom("gaus", 5000);
18 TFitResultPtr fitres = h1->Fit("gaus", "S0");
19 h1->Sumw2();
20 h1->GetXaxis()->SetTitle("x");
21 h1->GetYaxis()->SetTitle("y");
22 auto rp1 = new TRatioPlot(h1, "errfunc");
23 rp1->SetGraphDrawOpt("L");
24 rp1->SetSeparationMargin(0.0);
25 rp1->Draw();
26 rp1->GetLowerRefGraph()->SetMinimum(-2);
27 rp1->GetLowerRefGraph()->SetMaximum(2);
28}
R__EXTERN TStyle * gStyle
Definition TStyle.h:433
#define gPad
The Canvas class.
Definition TCanvas.h:23
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:669
Class for displaying ratios, differences and fit residuals.
Definition TRatioPlot.h:43
return c1
Definition legend1.C:41
TH1F * h1
Definition legend1.C:5