12#ifndef ROOT_TRatioPlot
13#define ROOT_TRatioPlot
240 virtual void SetGridlines(std::vector<double> gridlines);
#define ClassDefOverride(name, id)
Class to manage histogram axis.
Using a TBrowser one can browse all ROOT objects.
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
TFitResult * Get() const
Return contained pointer.
Extends the ROOT::Fit::Result class with a TNamed inheritance providing easy possibility for I/O.
TGraph with asymmetric error bars.
A TGraphErrors is a TGraph with error bars.
A TGraph is an object made of two arrays X and Y with npoints each.
TH1 is the base class of all histogram classes in ROOT.
The Histogram stack class.
Use the TLine constructor to create a simple line.
Mother of all ROOT objects.
The most important graphics class in the ROOT system.
Class for displaying ratios, differences and fit residuals.
void SubPadResized()
Slot that handles common resizing of upper and lower pad.
@ kForceHideUp
Always hide the first label of the upper y axis.
@ kHideUp
Hide the first label of the upper y axis when there is low space.
@ kNoHide
Do not hide labels when there is low space.
@ kHideLow
Hide the last label of the lower y axis when there is low space.
@ kForceHideLow
Always hide the last label of the lower y axis.
TGraphErrors * fConfidenceInterval2
Stores the graph for the 2 sigma band.
TAxis * GetLowerRefXaxis() const
Gets the x axis of the lower ref graph.
TGraphErrors * GetConfidenceInterval2() const
Returns the graph for the 2 sigma confidence interval in the fit residual case.
TAxis * GetLowYaxis() const
Int_t fErrorMode
Stores the error mode, sym, asym or func.
TAxis * GetLowerRefYaxis() const
Gets the y axis of the lower ref graph.
TGaxis * fUpperGXaxisMirror
Upper mirror of the x axis.
TRatioPlot & operator=(const TRatioPlot &)=delete
TGaxis * fLowerGXaxisMirror
Lower mirror of the x axis.
TPad * GetLowerPad() const
TAxis * GetUpperRefYaxis() const
Gets the y axis of the object returned by TRatioPlot::GetUpperRefObject.
TAxis * GetUpYaxis() const
Float_t fLowBottomMargin
Stores the bottom margin of the lower pad.
void CreateGridlines()
Create a grid lines.
Int_t BuildLowerPlot()
Build the lower plot according to which constructor was called, and which options were passed.
void SetUpBottomMargin(Float_t margin)
Sets the bottom margin of the upper pad.
Float_t fUpBottomMargin
Stores the bottom margin of the upper pad.
TH1 * fH1
Stores the primary histogram.
void SetH2DrawOpt(Option_t *opt)
Sets the drawing option for h2.
TFitResult * fFitResult
Stores the explicit fit result given in the fit residual case. Can be 0.
virtual Bool_t SyncPadMargins()
Figures out which pad margin has deviated from the stored ones, to figure out what the new nominal is...
virtual void UpdateVisualAxes()
Update TGaxis attributes.
Color_t fCi1Color
Stores the color for the 1 sigma band.
TGaxis * fUpperGYaxis
Upper graphical y axis.
Double_t fC2
Stores the scale factor for h2.
void UpdateGridlines()
Update positions of grid lines.
void SetLowBottomMargin(Float_t margin)
Sets the bottom margin of the lower pad.
void SetConfidenceIntervalColors(Color_t ci1=kYellow, Color_t ci2=kGreen)
Set the confidence interval colors.
Double_t fC1
Stores the scale factor for h1 (or THStack sum)
virtual void CreateVisualAxes()
Creates the TGaxis objects that are used for consistent display of the axes.
Float_t fLowTopMargin
Stores the top margin of the lower pad.
TString fH2DrawOpt
Stores draw option for h2 given in constructor.
void SetUpTopMargin(Float_t margin)
Sets the top margin of the upper pad.
TGaxis * fLowerGXaxis
Lower graphical x axis.
TRatioPlot()
TRatioPlot default constructor.
Bool_t fIsUpdating
! Keeps track of whether its currently updating to reject other calls until done
void SetGraphDrawOpt(Option_t *opt)
Sets the drawing option for the lower graph.
Double_t fCl1
Stores the confidence level for the inner confidence interval band.
@ kErrorAsymmetric
Use TH1::GetBinErrorUp and TH1::GetBinErrorLow for the error, depending on y values.
@ kErrorFunc
Use the square root of the function value as the error.
@ kErrorSymmetric
Use the regular TH1::GetBinError as the error.
Float_t GetSeparationMargin() const
Return the separation margin value.
void ImportAxisAttributes(TGaxis *gaxis, TAxis *axis)
Internal method to import TAxis attributes to a TGaxis.
void SetFitDrawOpt(Option_t *opt)
Sets the drawing option for the fit in the fit residual case.
std::vector< TLine * > fGridlines
Keeps TLine objects for the gridlines.
void SetPadMargins()
Sets the margins of all the pads to the value specified in class members.
TPad * fLowerPad
The pad which contains the calculated lower plot part.
TAxis * fSharedXAxis
X axis that stores the range for both plots.
void SetFitResult(TFitResultPtr fitres)
Explicitly specify the fit result that is to be used for fit residual calculation.
TString fFitDrawOpt
Stores draw option for the fit function in the fit residual case.
virtual void SetGridlines(Double_t *gridlines, Int_t numGridlines)
Set where horizontal, dashed lines are drawn on the lower pad.
TGaxis * fUpperGYaxisMirror
Upper mirror of the y axis.
virtual void SetupPads()
Setup the pads.
TGraphErrors * GetConfidenceInterval1() const
Returns the graph for the 1 sigma confidence interval in the fit residual case.
TAxis * fUpYaxis
Clone of the upper y axis.
TVirtualPad * fParentPad
Stores the pad the ratio plot was created in.
Float_t fUpTopMargin
Stores the top margin of the upper pad.
TGraph * GetCalculationOutputGraph() const
Get the output of the calculation in the form of a graph.
void SetH1DrawOpt(Option_t *opt)
Sets the drawing option for h1.
TGraph * fRatioGraph
Stores the lower plot's graph.
virtual TGraph * GetLowerRefGraph() const
Returns the reference graph for the lower pad, which means the graph that is responsible for setting ...
TRatioPlot(const TRatioPlot &)=delete
virtual void ConnectPadsSignals()
Connect some signals from the pads to handle them Allows correctly work also after reading ratioplot ...
Int_t fMode
Stores which calculation is supposed to be performed as specified by user option.
void SetSplitFraction(Float_t sf)
Set the fraction of the parent pad, at which the to sub pads should meet.
TObject * fHistDrawProxy
The object which is actually drawn, this might be TH1 or THStack.
Float_t fRightMargin
Stores the common right margin of both pads.
TGaxis * fLowerGYaxisMirror
Lower mirror of the y axis.
Int_t fHideLabelMode
Stores which label to hide if the margin is to narrow, if at all.
TPad * fTopPad
The Pad that drawn on top on the others to have consistent coordinates.
void SetInsetWidth(Double_t width)
Set the inset on the outer sides of all the pads.
virtual void SyncAxesRanges()
Syncs the axes ranges from the shared ones to the actual ones.
void RangeAxisChanged()
Slot that receives the RangeAxisChanged signal from any of the pads and reacts correspondingly.
@ kDifference
Calculate the difference between the histograms.
@ kDivideHist
Use TH1::Divide to create the ratio.
@ kFitResidual
Calculate the fit residual between the histogram and a fit stored within it.
@ kDifferenceSign
Calculate the difference divided by the error.
@ kDivideGraph
Use TGraphAsymmErrors::Divide to create the ratio.
void UnZoomed()
Slot for the UnZoomed signal that was introduced to TPad.
TH1 * fH2
Stores the secondary histogram, if there is one.
Double_t fCl2
Stores the confidence level for the outer confidence interval band.
TAxis * fLowYaxis
Clone of the lower y axis.
TString fOption
Stores the option which is given in the constructor as a string.
TPad * fUpperPad
The pad which contains the upper plot part.
Bool_t fShowConfidenceIntervals
Stores whether to show the confidence interval bands. From Draw option.
void SetLowTopMargin(Float_t margin)
Sets the top margin of the lower pad.
void SetSeparationMargin(Float_t)
Sets the margin that separates the two pads.
Bool_t fHistDrawProxyStack
If stack was assigned as proxy.
void SetLeftMargin(Float_t margin)
Sets the left margin of both pads.
Float_t fLeftMargin
Stores the common left margin of both pads.
TAxis * GetUpperRefXaxis() const
Gets the x axis of the object returned by TRatioPlot::GetUpperRefObject.
Float_t fSplitFraction
Stores the fraction at which the upper and lower pads meet.
void Paint(Option_t *opt="") override
Update the visual axes and grid lines when painting.
virtual TObject * GetUpperRefObject() const
Return the reference object.
TGraphErrors * fConfidenceInterval1
Stores the graph for the 1 sigma band.
TGaxis * fUpperGXaxis
Upper graphical x axis.
std::vector< double > fGridlinePositions
Stores the y positions for the gridlines.
TString fH1DrawOpt
Stores draw option for h1 given in constructor.
virtual void Init(TH1 *h1, TH1 *h2, Option_t *option="")
Internal method that shares constructor logic.
Bool_t fShowGridlines
Stores whether to show the gridlines at all.
TString fGraphDrawOpt
Stores draw option for the lower plot graph given in constructor.
~TRatioPlot() override
Destructor.
Color_t fCi2Color
Stores the color for the 2 sigma band.
void SetRightMargin(Float_t margin)
Sets the right margin of both pads.
TGaxis * fLowerGYaxis
Lower graphical y axis.
void SetConfidenceLevels(Double_t cl1, Double_t cl2)
Sets the confidence levels used to calculate the bands in the fit residual case.
TPad * GetUpperPad() const
TVirtualPad is an abstract base class for the Pad and Canvas classes.