Logo ROOT   6.14/05
Reference Guide
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | List of all members
TRatioPlot Class Reference

Class for displaying ratios, differences and fit residuals.

TRatioPlot has two constructors, one which accepts two histograms, and is responsible for setting up the calculation of ratios and differences. This calculation is in part delegated to TEfficiency. A single option can be given as a parameter, that is used to determine which procedure is chosen. The remaining option string is then passed through to the calculation, if applicable. The other constructor uses a fitted histogram to calculate the fit residual and plot it with the histogram and the fit function.

Ratios and differences

The simplest case is passing two histograms without specifying any options. This defaults to using TGraphAsymmErrors::Divide. The option variable is passed through, as are the parameters c1 and c2, that you can set via TRatioPlot::SetC1 and TRatioPlot::SetC1. If you set the option to divsym the method TH1::Divide will be used instead, also receiving all the parameters.

Using the option diff or diffsig, both histograms will be subtracted, and in the case of diffsig, the difference will be divided by the uncertainty. c1 and c2 will only be used to scale the histograms using TH1::Scale prior to subtraction.

Available options are for option:

Option Description
divsym uses the histogram TH1::Divide method, yields symmetric errors
diff subtracts the histograms
diffsig subtracts the histograms and divides by the uncertainty
void ratioplot1() {
auto c1 = new TCanvas("c1", "A ratio example");
auto h1 = new TH1D("h1", "h1", 50, 0, 10);
auto h2 = new TH1D("h2", "h2", 50, 0, 10);
auto f1 = new TF1("f1", "exp(- x/[0] )");
f1->SetParameter(0, 3);
h1->FillRandom("f1", 1900);
h2->FillRandom("f1", 2000);
h1->Sumw2();
h2->Scale(1.9 / 2.);
h1->GetXaxis()->SetTitle("x");
h1->GetYaxis()->SetTitle("y");
auto rp = new TRatioPlot(h1, h2);
c1->SetTicks(0, 1);
rp->Draw();
rp->GetLowYaxis()->SetNdivisions(505);
c1->Update();
}
pict1_TRatioPlot_001.png

Fit residuals

A second constructor only accepts a single histogram, but expects it to have a fitted function. The function is used to calculate the residual between the fit and the histogram. Here, it is expected that h1 has a fit function in it's list of functions. The class calculates the difference between the histogram and the fit function at each point and divides it by the uncertainty. There are a few option to steer which error is used (as is the case for diffsig). The default is to use the statistical uncertainty from h1 using TH1::GetBinError. If the option string contains errasym, asymmetric errors will be used. The type of error can be steered by TH1::SetBinErrorOption. The corresponding error will be used, depending on if the function is below or above the bin content. The third option errfunc uses the square root of the function value as the error.

void ratioplot2() {
auto c1 = new TCanvas("c1", "fit residual simple");
auto h1 = new TH1D("h1", "h1", 50, -5, 5);
h1->FillRandom("gaus", 2000);
h1->Fit("gaus");
h1->GetXaxis()->SetTitle("x");
c1->Clear(); // Fit does not draw into correct pad
auto rp1 = new TRatioPlot(h1);
rp1->Draw();
rp1->GetLowerRefYaxis()->SetTitle("ratio");
rp1->GetUpperRefYaxis()->SetTitle("entries");
c1->Update();
}
pict1_TRatioPlot_002.png

Error options for difference divided by uncertainty and fit residual

The uncertainty that is used in the calculation can be steered by providing options to the option argument.

Option Description
errasym Uses calculated asymmetric errors from TH1::GetBinErrorUp/TH1::GetBinErrorLow. Note that you need to set TH1::SetBinErrorOption first
errfunc Uses \( \sqrt{f(x)} \) as the error

The asymmetric error case uses the upper or lower error depending on the relative size of the bin contents, or the bin content and the function value.

Access to internal parts

You can access the internal objects that are used to construct the plot via a series of methods. TRatioPlot::GetUpperPad and TRatioPlot::GetLowerPad can be used to draw additional elements on top of the existing ones. TRatioPlot::GetLowerRefGraph returns a reference to the lower pad's graph that is responsible for the range, which enables you to modify the range.

gpad_ratioplot.png

Definition at line 44 of file TRatioPlot.h.

Public Member Functions

 TRatioPlot ()
 TRatioPlot default constructor. More...
 
 TRatioPlot (TH1 *h1, TH1 *h2, Option_t *option="pois")
 Constructor for two histograms. More...
 
 TRatioPlot (THStack *st, TH1 *h2, Option_t *option="pois")
 Constructor which accepts a THStack and a histogram. More...
 
 TRatioPlot (TH1 *h1, Option_t *option="", TFitResult *fitres=0)
 Constructor for one histogram and a fit. More...
 
virtual ~TRatioPlot ()
 Destructor. More...
 
virtual void Browse (TBrowser *b)
 Browse. More...
 
virtual void Draw (Option_t *chopt="")
 Default Draw method for all objects. More...
 
TGraphGetCalculationOutputGraph () const
 Get the output of the calculation in the form of a graph. More...
 
TGraphErrorsGetConfidenceInterval1 () const
 Returns the graph for the 1 sigma confidence interval in the fit residual case. More...
 
TGraphErrorsGetConfidenceInterval2 () const
 Returns the graph for the 2 sigma confidence interval in the fit residual case. More...
 
TPadGetLowerPad () const
 
virtual TGraphGetLowerRefGraph () const
 
TAxisGetLowerRefXaxis () const
 Shortcut for: More...
 
TAxisGetLowerRefYaxis () const
 Shortcut for: More...
 
TAxisGetLowYaxis () const
 
Float_t GetSeparationMargin () const
 
TPadGetUpperPad () const
 
virtual TObjectGetUpperRefObject () const
 
TAxisGetUpperRefXaxis () const
 
TAxisGetUpperRefYaxis () const
 
TAxisGetUpYaxis () const
 
TAxisGetXaxis () const
 
virtual void Paint (Option_t *opt="")
 This method must be overridden if a class wants to paint itself. More...
 
void RangeAxisChanged ()
 
void SetC1 (Double_t c1)
 
void SetC2 (Double_t c2)
 
void SetConfidenceIntervalColors (Color_t ci1=kGreen, Color_t ci2=kYellow)
 
void SetConfidenceLevels (Double_t cl1, Double_t cl2)
 
void SetFitDrawOpt (Option_t *opt)
 Sets the drawing option for the fit in the fit residual case. More...
 
void SetFitResult (TFitResultPtr fitres)
 Explicitly specify the fit result that is to be used for fit residual calculation. More...
 
void SetGraphDrawOpt (Option_t *opt)
 Sets the drawing option for the lower graph. More...
 
virtual void SetGridlines (Double_t *gridlines, Int_t numGridlines)
 
virtual void SetGridlines (std::vector< double > gridlines)
 
void SetH1DrawOpt (Option_t *opt)
 Sets the drawing option for h1. More...
 
void SetH2DrawOpt (Option_t *opt)
 Sets the drawing option for h2. More...
 
void SetInsetWidth (Double_t width)
 
void SetLeftMargin (Float_t margin)
 Sets the left margin of both pads. More...
 
void SetLowBottomMargin (Float_t margin)
 Sets the bottom margin of the lower pad. More...
 
void SetLowTopMargin (Float_t margin)
 Sets the top margin of the lower pad. More...
 
void SetRightMargin (Float_t margin)
 Sets the right margin of both pads. More...
 
void SetSeparationMargin (Float_t)
 
void SetSplitFraction (Float_t sf)
 
void SetUpBottomMargin (Float_t margin)
 Sets the bottom margin of the upper pad. More...
 
void SetUpTopMargin (Float_t margin)
 Sets the top margin of the upper pad. More...
 
void SubPadResized ()
 
void UnZoomed ()
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor. More...
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
ULong_t CheckedHash ()
 Checked and record whether for this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad). More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
Bool_t HasInconsistentHash () const
 Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More...
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
virtual Bool_t IsSortable () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
void SetBit (UInt_t f)
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 

Protected Member Functions

Int_t BuildLowerPlot ()
 
void CreateGridline ()
 
virtual void CreateVisualAxes ()
 
void ImportAxisAttributes (TGaxis *gaxis, TAxis *axis)
 
virtual void Init (TH1 *h1, TH1 *h2, Option_t *option="")
 Internal method that shares constructor logic. More...
 
Bool_t IsDrawn ()
 
void SetPadMargins ()
 
virtual void SetupPads ()
 Setup the pads. More...
 
virtual void SyncAxesRanges ()
 
virtual Bool_t SyncPadMargins ()
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 
void MakeZombie ()
 

Protected Attributes

Double_t fC1 = 1.
 Stores the scale factor for h1 (or THStack sum) More...
 
Double_t fC2 = 1.
 Stores the scale factor for h2. More...
 
Color_t fCi1Color = kGreen
 Stores the color for the 1 sigma band. More...
 
Color_t fCi2Color = kYellow
 Stores the color for the 2 sigma band. More...
 
Double_t fCl1 = 0.6827
 Stores the confidence level for the inner confidence interval band. More...
 
Double_t fCl2 = 0.9545
 Stores the confidence level for the outer confidence interval band. More...
 
TGraphErrorsfConfidenceInterval1 = 0
 Stores the graph for the 1 sigma band. More...
 
TGraphErrorsfConfidenceInterval2 = 0
 Stores the graph for the 2 sigma band. More...
 
Int_t fErrorMode = TRatioPlot::ErrorMode::kErrorSymmetric
 Stores the error mode, sym, asym or func. More...
 
TString fFitDrawOpt = ""
 Stores draw option for the fit function in the fit residual case. More...
 
TFitResultfFitResult = 0
 Stores the explicit fit result given in the fit residual case. Can be 0. More...
 
TString fGraphDrawOpt = ""
 Stores draw option for the lower plot graph given in constructor. More...
 
std::vector< double > fGridlinePositions
 Stores the y positions for the gridlines. More...
 
std::vector< TLine * > fGridlines
 Keeps TLine objects for the gridlines. More...
 
TH1fH1 = 0
 Stores the primary histogram. More...
 
TString fH1DrawOpt = ""
 Stores draw option for h1 given in constructor. More...
 
TH1fH2 = 0
 Stores the secondary histogram, if there is one. More...
 
TString fH2DrawOpt = ""
 Stores draw option for h2 given in constructor. More...
 
Int_t fHideLabelMode = TRatioPlot::HideLabelMode::kHideLow
 Stores which label to hide if the margin is to narrow, if at all. More...
 
TObjectfHistDrawProxy = 0
 The object which is actually drawn, this might be TH1 or THStack. More...
 
Float_t fInsetWidth = 0.0025
 
Bool_t fIsPadUpdating = kFALSE
 Keeps track whether pads are updating during resizing. More...
 
Bool_t fIsUpdating = kFALSE
 Keeps track of whether its currently updating to reject other calls until done. More...
 
Float_t fLeftMargin = 0.1
 Stores the common left margin of both pads. More...
 
Float_t fLowBottomMargin = 0.3
 Stores the bottom margin of the lower pad. More...
 
TGaxisfLowerGXaxis = 0
 Lower graphical x axis. More...
 
TGaxisfLowerGXaxisMirror = 0
 Lower mirror of the x axis. More...
 
TGaxisfLowerGYaxis = 0
 Lower graphical y axis. More...
 
TGaxisfLowerGYaxisMirror = 0
 Lower mirror of the y axis. More...
 
TPadfLowerPad = 0
 The pad which contains the calculated lower plot part. More...
 
Float_t fLowTopMargin = 0.05
 Stores the top margin of the lower pad. More...
 
TAxisfLowYaxis = 0
 Clone of the lower y axis. More...
 
Int_t fMode = 0
 Stores which calculation is supposed to be performed as specified by user option. More...
 
TString fOption = ""
 Stores the option which is given in the constructor as a string. More...
 
TVirtualPadfParentPad = 0
 Stores the pad the ratio plot was created in. More...
 
TGraphfRatioGraph = 0
 Stores the lower plot's graph. More...
 
Float_t fRightMargin = 0.1
 Stores the common right margin of both pads. More...
 
TAxisfSharedXAxis = 0
 X axis that stores the range for both plots. More...
 
Bool_t fShowConfidenceIntervals = kTRUE
 Stores whether to show the confidence interval bands. From Draw option. More...
 
Bool_t fShowGridlines = kTRUE
 Stores whether to show the gridlines at all. More...
 
Float_t fSplitFraction = 0.3
 Stores the fraction at which the upper and lower pads meet. More...
 
TPadfTopPad = 0
 The Pad that drawn on top on the others to have consistent coordinates. More...
 
Float_t fUpBottomMargin = 0.05
 Stores the bottom margin of the upper pad. More...
 
TGaxisfUpperGXaxis = 0
 Upper graphical x axis. More...
 
TGaxisfUpperGXaxisMirror = 0
 Upper mirror of the x axis. More...
 
TGaxisfUpperGYaxis = 0
 Upper graphical y axis. More...
 
TGaxisfUpperGYaxisMirror = 0
 Upper mirror of the y axis. More...
 
TPadfUpperPad = 0
 The pad which contains the upper plot part. More...
 
Float_t fUpTopMargin = 0.1
 Stores the top margin of the upper pad. More...
 
TAxisfUpYaxis = 0
 Clone of the upper y axis. More...
 

Private Types

enum  CalculationMode {
  kDivideHist = 1, kDivideGraph = 2, kDifference = 3, kFitResidual = 4,
  kDifferenceSign = 5
}
 
enum  ErrorMode { kErrorSymmetric = 1, kErrorAsymmetric = 2, kErrorFunc = 3 }
 
enum  HideLabelMode {
  kHideUp = 1, kHideLow = 2, kNoHide = 3, kForceHideUp = 4,
  kForceHideLow = 5
}
 

Private Member Functions

 TRatioPlot (const TRatioPlot &hrp)=delete
 
TRatioPlotoperator= (const TRatioPlot &)=delete
 

Additional Inherited Members

- Public Types inherited from TObject
enum  {
  kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kInconsistent = 0x08000000,
  kBitMask = 0x00ffffff
}
 
enum  { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = BIT(3) }
 
enum  EStatusBits {
  kCanDelete = BIT(0), kMustCleanup = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5),
  kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13)
}
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 

#include <TRatioPlot.h>

Inheritance diagram for TRatioPlot:
[legend]

Member Enumeration Documentation

◆ CalculationMode

Enumerator
kDivideHist 

Use TH1::Divide to create the ratio.

kDivideGraph 

Use TGraphAsymmErrors::Divide to create the ratio.

kDifference 

Calculate the difference between the histograms.

kFitResidual 

Calculate the fit residual between the histogram and a fit stored within it.

kDifferenceSign 

Calculate the difference divided by the error.

Definition at line 50 of file TRatioPlot.h.

◆ ErrorMode

enum TRatioPlot::ErrorMode
private
Enumerator
kErrorSymmetric 

Use the regular TH1::GetBinError as the error.

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.

Definition at line 58 of file TRatioPlot.h.

◆ HideLabelMode

Enumerator
kHideUp 

Hide the first label of the upper y axis when there is low space.

kHideLow 

Hide the last label of the lower y axis when there is low space.

kNoHide 

Do not hide labels when there is low space.

kForceHideUp 

Always hide the first label of the upper y axis.

kForceHideLow 

Always hide the last label of the lower y axis.

Definition at line 64 of file TRatioPlot.h.

Constructor & Destructor Documentation

◆ TRatioPlot() [1/5]

TRatioPlot::TRatioPlot ( const TRatioPlot hrp)
privatedelete

◆ TRatioPlot() [2/5]

TRatioPlot::TRatioPlot ( )

TRatioPlot default constructor.

Definition at line 122 of file TRatioPlot.cxx.

◆ ~TRatioPlot()

TRatioPlot::~TRatioPlot ( )
virtual

Destructor.

Definition at line 129 of file TRatioPlot.cxx.

◆ TRatioPlot() [3/5]

TRatioPlot::TRatioPlot ( TH1 h1,
TH1 h2,
Option_t option = "pois" 
)

Constructor for two histograms.

Parameters
h1First histogram
h2Second histogram
optionSteers the error calculation, as well as ratio / difference

Definition at line 218 of file TRatioPlot.cxx.

◆ TRatioPlot() [4/5]

TRatioPlot::TRatioPlot ( THStack st,
TH1 h2,
Option_t option = "pois" 
)

Constructor which accepts a THStack and a histogram.

Converts the stack to a regular sum of its containing histograms for processing.

Parameters
stThe THStack object
h2The other histogram
optionSteers the calculation of the lower plot

Definition at line 250 of file TRatioPlot.cxx.

◆ TRatioPlot() [5/5]

TRatioPlot::TRatioPlot ( TH1 h1,
Option_t option = "",
TFitResult fitres = 0 
)

Constructor for one histogram and a fit.

Parameters
h1The histogram
optionSteers the error calculation
fitresExplicit fit result to be used for calculation. Uses last fit if left empty

Definition at line 284 of file TRatioPlot.cxx.

Member Function Documentation

◆ Browse()

void TRatioPlot::Browse ( TBrowser b)
virtual

Browse.

Reimplemented from TObject.

Definition at line 443 of file TRatioPlot.cxx.

◆ BuildLowerPlot()

Int_t TRatioPlot::BuildLowerPlot ( )
protected

◆ CreateGridline()

void TRatioPlot::CreateGridline ( )
protected

◆ CreateVisualAxes()

virtual void TRatioPlot::CreateVisualAxes ( )
protectedvirtual

◆ Draw()

virtual void TRatioPlot::Draw ( Option_t option = "")
virtual

Default Draw method for all objects.

Reimplemented from TObject.

◆ GetCalculationOutputGraph()

TGraph* TRatioPlot::GetCalculationOutputGraph ( ) const
inline

Get the output of the calculation in the form of a graph.

The type of the return value depends on the input option that was given in the constructor.

Definition at line 218 of file TRatioPlot.h.

◆ GetConfidenceInterval1()

TGraphErrors* TRatioPlot::GetConfidenceInterval1 ( ) const
inline

Returns the graph for the 1 sigma confidence interval in the fit residual case.

Definition at line 223 of file TRatioPlot.h.

◆ GetConfidenceInterval2()

TGraphErrors* TRatioPlot::GetConfidenceInterval2 ( ) const
inline

Returns the graph for the 2 sigma confidence interval in the fit residual case.

Definition at line 228 of file TRatioPlot.h.

◆ GetLowerPad()

TPad* TRatioPlot::GetLowerPad ( ) const
inline

Definition at line 231 of file TRatioPlot.h.

◆ GetLowerRefGraph()

virtual TGraph* TRatioPlot::GetLowerRefGraph ( ) const
virtual

◆ GetLowerRefXaxis()

TAxis* TRatioPlot::GetLowerRefXaxis ( ) const
inline

Shortcut for:

rp->GetLowerRefGraph()->GetXaxis();

Definition at line 199 of file TRatioPlot.h.

◆ GetLowerRefYaxis()

TAxis* TRatioPlot::GetLowerRefYaxis ( ) const
inline

Shortcut for:

rp->GetLowerRefGraph()->GetYaxis();

Definition at line 208 of file TRatioPlot.h.

◆ GetLowYaxis()

TAxis* TRatioPlot::GetLowYaxis ( ) const
inline

Definition at line 188 of file TRatioPlot.h.

◆ GetSeparationMargin()

Float_t TRatioPlot::GetSeparationMargin ( ) const

◆ GetUpperPad()

TPad* TRatioPlot::GetUpperPad ( ) const
inline

Definition at line 230 of file TRatioPlot.h.

◆ GetUpperRefObject()

virtual TObject* TRatioPlot::GetUpperRefObject ( ) const
virtual

◆ GetUpperRefXaxis()

TAxis* TRatioPlot::GetUpperRefXaxis ( ) const

◆ GetUpperRefYaxis()

TAxis* TRatioPlot::GetUpperRefYaxis ( ) const

◆ GetUpYaxis()

TAxis* TRatioPlot::GetUpYaxis ( ) const
inline

Definition at line 187 of file TRatioPlot.h.

◆ GetXaxis()

TAxis* TRatioPlot::GetXaxis ( ) const
inline

Definition at line 186 of file TRatioPlot.h.

◆ ImportAxisAttributes()

void TRatioPlot::ImportAxisAttributes ( TGaxis gaxis,
TAxis axis 
)
protected

◆ Init()

void TRatioPlot::Init ( TH1 h1,
TH1 h2,
Option_t option = "" 
)
protectedvirtual

Internal method that shares constructor logic.

Definition at line 160 of file TRatioPlot.cxx.

◆ IsDrawn()

Bool_t TRatioPlot::IsDrawn ( )
protected

◆ operator=()

TRatioPlot& TRatioPlot::operator= ( const TRatioPlot )
privatedelete

◆ Paint()

virtual void TRatioPlot::Paint ( Option_t option = "")
virtual

This method must be overridden if a class wants to paint itself.

The difference between Paint() and Draw() is that when a object draws itself it is added to the display list of the pad in which it is drawn (and automatically redrawn whenever the pad is redrawn). While paint just draws the object without adding it to the pad display list.

Reimplemented from TObject.

◆ RangeAxisChanged()

void TRatioPlot::RangeAxisChanged ( )

◆ SetC1()

void TRatioPlot::SetC1 ( Double_t  c1)
inline

Definition at line 262 of file TRatioPlot.h.

◆ SetC2()

void TRatioPlot::SetC2 ( Double_t  c2)
inline

Definition at line 263 of file TRatioPlot.h.

◆ SetConfidenceIntervalColors()

void TRatioPlot::SetConfidenceIntervalColors ( Color_t  ci1 = kGreen,
Color_t  ci2 = kYellow 
)

◆ SetConfidenceLevels()

void TRatioPlot::SetConfidenceLevels ( Double_t  cl1,
Double_t  cl2 
)

◆ SetFitDrawOpt()

void TRatioPlot::SetFitDrawOpt ( Option_t opt)

Sets the drawing option for the fit in the fit residual case.

Definition at line 382 of file TRatioPlot.cxx.

◆ SetFitResult()

void TRatioPlot::SetFitResult ( TFitResultPtr  fitres)
inline

Explicitly specify the fit result that is to be used for fit residual calculation.

If it is not provided, the last fit registered in the global fitter is used. The fit result can also be specified in the constructor.

Parameters
fitresThe fit result coming from the fit function call

Definition at line 242 of file TRatioPlot.h.

◆ SetGraphDrawOpt()

void TRatioPlot::SetGraphDrawOpt ( Option_t opt)

Sets the drawing option for the lower graph.

Definition at line 374 of file TRatioPlot.cxx.

◆ SetGridlines() [1/2]

virtual void TRatioPlot::SetGridlines ( Double_t gridlines,
Int_t  numGridlines 
)
virtual

◆ SetGridlines() [2/2]

virtual void TRatioPlot::SetGridlines ( std::vector< double >  gridlines)
virtual

◆ SetH1DrawOpt()

void TRatioPlot::SetH1DrawOpt ( Option_t opt)

Sets the drawing option for h1.

Definition at line 354 of file TRatioPlot.cxx.

◆ SetH2DrawOpt()

void TRatioPlot::SetH2DrawOpt ( Option_t opt)

Sets the drawing option for h2.

Definition at line 362 of file TRatioPlot.cxx.

◆ SetInsetWidth()

void TRatioPlot::SetInsetWidth ( Double_t  width)

◆ SetLeftMargin()

void TRatioPlot::SetLeftMargin ( Float_t  margin)

Sets the left margin of both pads.

Parameters
marginThe new margin

Definition at line 497 of file TRatioPlot.cxx.

◆ SetLowBottomMargin()

void TRatioPlot::SetLowBottomMargin ( Float_t  margin)

Sets the bottom margin of the lower pad.

Parameters
marginThe new margin

Definition at line 487 of file TRatioPlot.cxx.

◆ SetLowTopMargin()

void TRatioPlot::SetLowTopMargin ( Float_t  margin)

Sets the top margin of the lower pad.

Parameters
marginThe new margin

Definition at line 476 of file TRatioPlot.cxx.

◆ SetPadMargins()

void TRatioPlot::SetPadMargins ( )
protected

◆ SetRightMargin()

void TRatioPlot::SetRightMargin ( Float_t  margin)

Sets the right margin of both pads.

Parameters
marginThe new margin

Definition at line 508 of file TRatioPlot.cxx.

◆ SetSeparationMargin()

void TRatioPlot::SetSeparationMargin ( Float_t  )

◆ SetSplitFraction()

void TRatioPlot::SetSplitFraction ( Float_t  sf)

◆ SetUpBottomMargin()

void TRatioPlot::SetUpBottomMargin ( Float_t  margin)

Sets the bottom margin of the upper pad.

Parameters
marginThe new margin

Definition at line 465 of file TRatioPlot.cxx.

◆ SetupPads()

void TRatioPlot::SetupPads ( )
protectedvirtual

Setup the pads.

Definition at line 390 of file TRatioPlot.cxx.

◆ SetUpTopMargin()

void TRatioPlot::SetUpTopMargin ( Float_t  margin)

Sets the top margin of the upper pad.

Parameters
marginThe new margin

Definition at line 454 of file TRatioPlot.cxx.

◆ SubPadResized()

void TRatioPlot::SubPadResized ( )

◆ SyncAxesRanges()

virtual void TRatioPlot::SyncAxesRanges ( )
protectedvirtual

◆ SyncPadMargins()

virtual Bool_t TRatioPlot::SyncPadMargins ( )
protectedvirtual

◆ UnZoomed()

void TRatioPlot::UnZoomed ( )

Member Data Documentation

◆ fC1

Double_t TRatioPlot::fC1 = 1.
protected

Stores the scale factor for h1 (or THStack sum)

Definition at line 105 of file TRatioPlot.h.

◆ fC2

Double_t TRatioPlot::fC2 = 1.
protected

Stores the scale factor for h2.

Definition at line 106 of file TRatioPlot.h.

◆ fCi1Color

Color_t TRatioPlot::fCi1Color = kGreen
protected

Stores the color for the 1 sigma band.

Definition at line 97 of file TRatioPlot.h.

◆ fCi2Color

Color_t TRatioPlot::fCi2Color = kYellow
protected

Stores the color for the 2 sigma band.

Definition at line 98 of file TRatioPlot.h.

◆ fCl1

Double_t TRatioPlot::fCl1 = 0.6827
protected

Stores the confidence level for the inner confidence interval band.

Definition at line 102 of file TRatioPlot.h.

◆ fCl2

Double_t TRatioPlot::fCl2 = 0.9545
protected

Stores the confidence level for the outer confidence interval band.

Definition at line 103 of file TRatioPlot.h.

◆ fConfidenceInterval1

TGraphErrors* TRatioPlot::fConfidenceInterval1 = 0
protected

Stores the graph for the 1 sigma band.

Definition at line 95 of file TRatioPlot.h.

◆ fConfidenceInterval2

TGraphErrors* TRatioPlot::fConfidenceInterval2 = 0
protected

Stores the graph for the 2 sigma band.

Definition at line 96 of file TRatioPlot.h.

◆ fErrorMode

Int_t TRatioPlot::fErrorMode = TRatioPlot::ErrorMode::kErrorSymmetric
protected

Stores the error mode, sym, asym or func.

Definition at line 85 of file TRatioPlot.h.

◆ fFitDrawOpt

TString TRatioPlot::fFitDrawOpt = ""
protected

Stores draw option for the fit function in the fit residual case.

Definition at line 90 of file TRatioPlot.h.

◆ fFitResult

TFitResult* TRatioPlot::fFitResult = 0
protected

Stores the explicit fit result given in the fit residual case. Can be 0.

Definition at line 108 of file TRatioPlot.h.

◆ fGraphDrawOpt

TString TRatioPlot::fGraphDrawOpt = ""
protected

Stores draw option for the lower plot graph given in constructor.

Definition at line 89 of file TRatioPlot.h.

◆ fGridlinePositions

std::vector<double> TRatioPlot::fGridlinePositions
protected

Stores the y positions for the gridlines.

Definition at line 124 of file TRatioPlot.h.

◆ fGridlines

std::vector<TLine*> TRatioPlot::fGridlines
protected

Keeps TLine objects for the gridlines.

Definition at line 123 of file TRatioPlot.h.

◆ fH1

TH1* TRatioPlot::fH1 = 0
protected

Stores the primary histogram.

Definition at line 80 of file TRatioPlot.h.

◆ fH1DrawOpt

TString TRatioPlot::fH1DrawOpt = ""
protected

Stores draw option for h1 given in constructor.

Definition at line 87 of file TRatioPlot.h.

◆ fH2

TH1* TRatioPlot::fH2 = 0
protected

Stores the secondary histogram, if there is one.

Definition at line 81 of file TRatioPlot.h.

◆ fH2DrawOpt

TString TRatioPlot::fH2DrawOpt = ""
protected

Stores draw option for h2 given in constructor.

Definition at line 88 of file TRatioPlot.h.

◆ fHideLabelMode

Int_t TRatioPlot::fHideLabelMode = TRatioPlot::HideLabelMode::kHideLow
protected

Stores which label to hide if the margin is to narrow, if at all.

Definition at line 126 of file TRatioPlot.h.

◆ fHistDrawProxy

TObject* TRatioPlot::fHistDrawProxy = 0
protected

The object which is actually drawn, this might be TH1 or THStack.

Definition at line 82 of file TRatioPlot.h.

◆ fInsetWidth

Float_t TRatioPlot::fInsetWidth = 0.0025
protected

Definition at line 138 of file TRatioPlot.h.

◆ fIsPadUpdating

Bool_t TRatioPlot::fIsPadUpdating = kFALSE
protected

Keeps track whether pads are updating during resizing.

Definition at line 141 of file TRatioPlot.h.

◆ fIsUpdating

Bool_t TRatioPlot::fIsUpdating = kFALSE
protected

Keeps track of whether its currently updating to reject other calls until done.

Definition at line 140 of file TRatioPlot.h.

◆ fLeftMargin

Float_t TRatioPlot::fLeftMargin = 0.1
protected

Stores the common left margin of both pads.

Definition at line 135 of file TRatioPlot.h.

◆ fLowBottomMargin

Float_t TRatioPlot::fLowBottomMargin = 0.3
protected

Stores the bottom margin of the lower pad.

Definition at line 133 of file TRatioPlot.h.

◆ fLowerGXaxis

TGaxis* TRatioPlot::fLowerGXaxis = 0
protected

Lower graphical x axis.

Definition at line 112 of file TRatioPlot.h.

◆ fLowerGXaxisMirror

TGaxis* TRatioPlot::fLowerGXaxisMirror = 0
protected

Lower mirror of the x axis.

Definition at line 116 of file TRatioPlot.h.

◆ fLowerGYaxis

TGaxis* TRatioPlot::fLowerGYaxis = 0
protected

Lower graphical y axis.

Definition at line 114 of file TRatioPlot.h.

◆ fLowerGYaxisMirror

TGaxis* TRatioPlot::fLowerGYaxisMirror = 0
protected

Lower mirror of the y axis.

Definition at line 118 of file TRatioPlot.h.

◆ fLowerPad

TPad* TRatioPlot::fLowerPad = 0
protected

The pad which contains the calculated lower plot part.

Definition at line 77 of file TRatioPlot.h.

◆ fLowTopMargin

Float_t TRatioPlot::fLowTopMargin = 0.05
protected

Stores the top margin of the lower pad.

Definition at line 132 of file TRatioPlot.h.

◆ fLowYaxis

TAxis* TRatioPlot::fLowYaxis = 0
protected

Clone of the lower y axis.

Definition at line 121 of file TRatioPlot.h.

◆ fMode

Int_t TRatioPlot::fMode = 0
protected

Stores which calculation is supposed to be performed as specified by user option.

Definition at line 84 of file TRatioPlot.h.

◆ fOption

TString TRatioPlot::fOption = ""
protected

Stores the option which is given in the constructor as a string.

Definition at line 86 of file TRatioPlot.h.

◆ fParentPad

TVirtualPad* TRatioPlot::fParentPad = 0
protected

Stores the pad the ratio plot was created in.

Definition at line 75 of file TRatioPlot.h.

◆ fRatioGraph

TGraph* TRatioPlot::fRatioGraph = 0
protected

Stores the lower plot's graph.

Definition at line 94 of file TRatioPlot.h.

◆ fRightMargin

Float_t TRatioPlot::fRightMargin = 0.1
protected

Stores the common right margin of both pads.

Definition at line 136 of file TRatioPlot.h.

◆ fSharedXAxis

TAxis* TRatioPlot::fSharedXAxis = 0
protected

X axis that stores the range for both plots.

Definition at line 110 of file TRatioPlot.h.

◆ fShowConfidenceIntervals

Bool_t TRatioPlot::fShowConfidenceIntervals = kTRUE
protected

Stores whether to show the confidence interval bands. From Draw option.

Definition at line 100 of file TRatioPlot.h.

◆ fShowGridlines

Bool_t TRatioPlot::fShowGridlines = kTRUE
protected

Stores whether to show the gridlines at all.

Definition at line 125 of file TRatioPlot.h.

◆ fSplitFraction

Float_t TRatioPlot::fSplitFraction = 0.3
protected

Stores the fraction at which the upper and lower pads meet.

Definition at line 92 of file TRatioPlot.h.

◆ fTopPad

TPad* TRatioPlot::fTopPad = 0
protected

The Pad that drawn on top on the others to have consistent coordinates.

Definition at line 78 of file TRatioPlot.h.

◆ fUpBottomMargin

Float_t TRatioPlot::fUpBottomMargin = 0.05
protected

Stores the bottom margin of the upper pad.

Definition at line 131 of file TRatioPlot.h.

◆ fUpperGXaxis

TGaxis* TRatioPlot::fUpperGXaxis = 0
protected

Upper graphical x axis.

Definition at line 111 of file TRatioPlot.h.

◆ fUpperGXaxisMirror

TGaxis* TRatioPlot::fUpperGXaxisMirror = 0
protected

Upper mirror of the x axis.

Definition at line 115 of file TRatioPlot.h.

◆ fUpperGYaxis

TGaxis* TRatioPlot::fUpperGYaxis = 0
protected

Upper graphical y axis.

Definition at line 113 of file TRatioPlot.h.

◆ fUpperGYaxisMirror

TGaxis* TRatioPlot::fUpperGYaxisMirror = 0
protected

Upper mirror of the y axis.

Definition at line 117 of file TRatioPlot.h.

◆ fUpperPad

TPad* TRatioPlot::fUpperPad = 0
protected

The pad which contains the upper plot part.

Definition at line 76 of file TRatioPlot.h.

◆ fUpTopMargin

Float_t TRatioPlot::fUpTopMargin = 0.1
protected

Stores the top margin of the upper pad.

Definition at line 130 of file TRatioPlot.h.

◆ fUpYaxis

TAxis* TRatioPlot::fUpYaxis = 0
protected

Clone of the upper y axis.

Definition at line 120 of file TRatioPlot.h.

Libraries for TRatioPlot:
[legend]

The documentation for this class was generated from the following files: