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.
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 |
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.
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.
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.
Definition at line 43 of file TRatioPlot.h.
Public Member Functions | |
TRatioPlot () | |
TRatioPlot default constructor. | |
TRatioPlot (TH1 *h1, Option_t *option="", TFitResult *fitres=nullptr) | |
Constructor for one histogram and a fit. | |
TRatioPlot (TH1 *h1, TH1 *h2, Option_t *option="pois") | |
Constructor for two histograms. | |
TRatioPlot (THStack *st, TH1 *h2, Option_t *option="pois") | |
Constructor which accepts a THStack and a histogram. | |
~TRatioPlot () override | |
Destructor. | |
void | Browse (TBrowser *b) override |
Browse. | |
void | Draw (Option_t *chopt="") override |
Draws the ratio plot to the currently active pad. | |
TGraph * | GetCalculationOutputGraph () const |
Get the output of the calculation in the form of a graph. | |
TGraphErrors * | GetConfidenceInterval1 () const |
Returns the graph for the 1 sigma confidence interval in the fit residual case. | |
TGraphErrors * | GetConfidenceInterval2 () const |
Returns the graph for the 2 sigma confidence interval in the fit residual case. | |
TPad * | GetLowerPad () const |
virtual TGraph * | GetLowerRefGraph () const |
Returns the reference graph for the lower pad, which means the graph that is responsible for setting the coordinate system. | |
TAxis * | GetLowerRefXaxis () const |
Shortcut for: | |
TAxis * | GetLowerRefYaxis () const |
Shortcut for: | |
TAxis * | GetLowYaxis () const |
Float_t | GetSeparationMargin () const |
Return the separation margin value. | |
TPad * | GetUpperPad () const |
virtual TObject * | GetUpperRefObject () const |
Return the reference object. | |
TAxis * | GetUpperRefXaxis () const |
Gets the x axis of the object returned by TRatioPlot::GetUpperRefObject . | |
TAxis * | GetUpperRefYaxis () const |
Gets the y axis of the object returned by TRatioPlot::GetUpperRefObject . | |
TAxis * | GetUpYaxis () const |
TAxis * | GetXaxis () const |
TClass * | IsA () const override |
void | Paint (Option_t *opt="") override |
Creates the visual axes when painting. | |
void | RangeAxisChanged () |
Slot that receives the RangeAxisChanged signal from any of the pads and reacts correspondingly. | |
void | SetC1 (Double_t c1) |
void | SetC2 (Double_t c2) |
void | SetConfidenceIntervalColors (Color_t ci1=kYellow, Color_t ci2=kGreen) |
Set the confidence interval colors. | |
void | SetConfidenceLevels (Double_t cl1, Double_t cl2) |
Sets the confidence levels used to calculate the bands in the fit residual case. | |
void | SetFitDrawOpt (Option_t *opt) |
Sets the drawing option for the fit in the fit residual case. | |
void | SetFitResult (TFitResultPtr fitres) |
Explicitly specify the fit result that is to be used for fit residual calculation. | |
void | SetGraphDrawOpt (Option_t *opt) |
Sets the drawing option for the lower graph. | |
virtual void | SetGridlines (Double_t *gridlines, Int_t numGridlines) |
Set where horizontal, dashed lines are drawn on the lower pad. | |
virtual void | SetGridlines (std::vector< double > gridlines) |
Set where horizontal, dashed lines are drawn on the lower pad. | |
void | SetH1DrawOpt (Option_t *opt) |
Sets the drawing option for h1. | |
void | SetH2DrawOpt (Option_t *opt) |
Sets the drawing option for h2. | |
void | SetInsetWidth (Double_t width) |
Set the inset on the outer sides of all the pads. | |
void | SetLeftMargin (Float_t margin) |
Sets the left margin of both pads. | |
void | SetLowBottomMargin (Float_t margin) |
Sets the bottom margin of the lower pad. | |
void | SetLowTopMargin (Float_t margin) |
Sets the top margin of the lower pad. | |
void | SetRightMargin (Float_t margin) |
Sets the right margin of both pads. | |
void | SetSeparationMargin (Float_t) |
Sets the margin that separates the two pads. | |
void | SetSplitFraction (Float_t sf) |
Set the fraction of the parent pad, at which the to sub pads should meet. | |
void | SetUpBottomMargin (Float_t margin) |
Sets the bottom margin of the upper pad. | |
void | SetUpTopMargin (Float_t margin) |
Sets the top margin of the upper pad. | |
void | Streamer (TBuffer &) override |
Stream an object of class TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
void | SubPadResized () |
Slot that handles common resizing of upper and lower pad. | |
void | UnZoomed () |
Slot for the UnZoomed signal that was introduced to TAxis. | |
Public Member Functions inherited from TObject | |
TObject () | |
TObject constructor. | |
TObject (const TObject &object) | |
TObject copy ctor. | |
virtual | ~TObject () |
TObject destructor. | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. | |
ULong_t | CheckedHash () |
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. | |
virtual void | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. | |
virtual void | Copy (TObject &object) const |
Copy this to obj. | |
virtual void | Delete (Option_t *option="") |
Delete this object. | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1) . | |
virtual void | Dump () const |
Dump contents of object on stdout. | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. | |
virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
Execute method on this object with the given parameter string, e.g. | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
Execute method on this object with parameters stored in the TObjArray. | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. | |
virtual const char * | GetIconName () const |
Returns mime type name of object. | |
virtual const char * | GetName () const |
Returns name of object. | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). | |
virtual Option_t * | GetOption () const |
virtual const char * | GetTitle () const |
Returns title of object. | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. | |
virtual ULong_t | Hash () const |
Return hash value for this object. | |
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. | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. | |
void | InvertBit (UInt_t f) |
Bool_t | IsDestructed () const |
IsDestructed. | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
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. | |
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). | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification (the base implementation is no-op). | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. | |
void | operator delete (void *ptr) |
Operator delete. | |
void | operator delete (void *ptr, void *vp) |
Only called by placement new when throwing an exception. | |
void | operator delete[] (void *ptr) |
Operator delete []. | |
void | operator delete[] (void *ptr, void *vp) |
Only called by placement new[] when throwing an exception. | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. | |
virtual void | Print (Option_t *option="") const |
This method must be overridden when a class wants to print itself. | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". | |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. | |
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. | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. | |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TObject | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_t | GetDtorOnly () |
Return destructor only flag. | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. | |
Protected Member Functions | |
Int_t | BuildLowerPlot () |
Build the lower plot according to which constructor was called, and which options were passed. | |
void | CreateGridline () |
Create a grid line. | |
virtual void | CreateVisualAxes () |
(Re-)Creates the TGAxis objects that are used for consistent display of the axes. | |
void | ImportAxisAttributes (TGaxis *gaxis, TAxis *axis) |
Internal method to import TAxis attributes to a TGaxis. | |
virtual void | Init (TH1 *h1, TH1 *h2, Option_t *option="") |
Internal method that shares constructor logic. | |
Bool_t | IsDrawn () |
Check if ... is drawn. | |
void | SetPadMargins () |
Sets the margins of all the pads to the value specified in class members. | |
virtual void | SetupPads () |
Setup the pads. | |
virtual void | SyncAxesRanges () |
Syncs the axes ranges from the shared ones to the actual ones. | |
virtual Bool_t | SyncPadMargins () |
Figures out which pad margin has deviated from the stored ones, to figure out what the new nominal is and set the other pad to it subsequently. | |
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). | |
void | MakeZombie () |
Protected Attributes | |
Double_t | fC1 = 1. |
Stores the scale factor for h1 (or THStack sum) | |
Double_t | fC2 = 1. |
Stores the scale factor for h2. | |
Color_t | fCi1Color = kYellow |
Stores the color for the 1 sigma band. | |
Color_t | fCi2Color = kGreen |
Stores the color for the 2 sigma band. | |
Double_t | fCl1 = 0.6827 |
Stores the confidence level for the inner confidence interval band. | |
Double_t | fCl2 = 0.9545 |
Stores the confidence level for the outer confidence interval band. | |
TGraphErrors * | fConfidenceInterval1 = nullptr |
Stores the graph for the 1 sigma band. | |
TGraphErrors * | fConfidenceInterval2 = nullptr |
Stores the graph for the 2 sigma band. | |
Int_t | fErrorMode = TRatioPlot::ErrorMode::kErrorSymmetric |
Stores the error mode, sym, asym or func. | |
TString | fFitDrawOpt = "" |
Stores draw option for the fit function in the fit residual case. | |
TFitResult * | fFitResult = nullptr |
Stores the explicit fit result given in the fit residual case. Can be 0. | |
TString | fGraphDrawOpt = "" |
Stores draw option for the lower plot graph given in constructor. | |
std::vector< double > | fGridlinePositions |
Stores the y positions for the gridlines. | |
std::vector< TLine * > | fGridlines |
Keeps TLine objects for the gridlines. | |
TH1 * | fH1 = nullptr |
Stores the primary histogram. | |
TString | fH1DrawOpt = "" |
Stores draw option for h1 given in constructor. | |
TH1 * | fH2 = nullptr |
Stores the secondary histogram, if there is one. | |
TString | fH2DrawOpt = "" |
Stores draw option for h2 given in constructor. | |
Int_t | fHideLabelMode = TRatioPlot::HideLabelMode::kHideLow |
Stores which label to hide if the margin is to narrow, if at all. | |
TObject * | fHistDrawProxy = nullptr |
The object which is actually drawn, this might be TH1 or THStack. | |
Float_t | fInsetWidth = 0.0025 |
Bool_t | fIsPadUpdating = kFALSE |
Keeps track whether pads are updating during resizing. | |
Bool_t | fIsUpdating = kFALSE |
Keeps track of whether its currently updating to reject other calls until done. | |
Float_t | fLeftMargin = 0.1 |
Stores the common left margin of both pads. | |
Float_t | fLowBottomMargin = 0.3 |
Stores the bottom margin of the lower pad. | |
TGaxis * | fLowerGXaxis = nullptr |
Lower graphical x axis. | |
TGaxis * | fLowerGXaxisMirror = nullptr |
Lower mirror of the x axis. | |
TGaxis * | fLowerGYaxis = nullptr |
Lower graphical y axis. | |
TGaxis * | fLowerGYaxisMirror = nullptr |
Lower mirror of the y axis. | |
TPad * | fLowerPad = nullptr |
The pad which contains the calculated lower plot part. | |
Float_t | fLowTopMargin = 0.05 |
Stores the top margin of the lower pad. | |
TAxis * | fLowYaxis = nullptr |
Clone of the lower y axis. | |
Int_t | fMode = 0 |
Stores which calculation is supposed to be performed as specified by user option. | |
TString | fOption = "" |
Stores the option which is given in the constructor as a string. | |
TVirtualPad * | fParentPad = nullptr |
Stores the pad the ratio plot was created in. | |
TGraph * | fRatioGraph = nullptr |
Stores the lower plot's graph. | |
Float_t | fRightMargin = 0.1 |
Stores the common right margin of both pads. | |
TAxis * | fSharedXAxis = nullptr |
X axis that stores the range for both plots. | |
Bool_t | fShowConfidenceIntervals = kTRUE |
Stores whether to show the confidence interval bands. From Draw option. | |
Bool_t | fShowGridlines = kTRUE |
Stores whether to show the gridlines at all. | |
Float_t | fSplitFraction = 0.3 |
Stores the fraction at which the upper and lower pads meet. | |
TPad * | fTopPad = nullptr |
The Pad that drawn on top on the others to have consistent coordinates. | |
Float_t | fUpBottomMargin = 0.05 |
Stores the bottom margin of the upper pad. | |
TGaxis * | fUpperGXaxis = nullptr |
Upper graphical x axis. | |
TGaxis * | fUpperGXaxisMirror = nullptr |
Upper mirror of the x axis. | |
TGaxis * | fUpperGYaxis = nullptr |
Upper graphical y axis. | |
TGaxis * | fUpperGYaxisMirror = nullptr |
Upper mirror of the y axis. | |
TPad * | fUpperPad = nullptr |
The pad which contains the upper plot part. | |
Float_t | fUpTopMargin = 0.1 |
Stores the top margin of the upper pad. | |
TAxis * | fUpYaxis = nullptr |
Clone of the upper y axis. | |
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 &)=delete | |
TRatioPlot & | operator= (const TRatioPlot &)=delete |
Additional Inherited Members | |
Public Types inherited from TObject | |
enum | { kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 , kBitMask = 0x00ffffff } |
enum | { kSingleKey = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) } |
enum | EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) } |
enum | EStatusBits { kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) , kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 )) } |
Protected Types inherited from TObject | |
enum | { kOnlyPrepStep = (1ULL << ( 3 )) } |
#include <TRatioPlot.h>
|
private |
Enumerator | |
---|---|
kDivideHist | Use |
kDivideGraph | Use |
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 49 of file TRatioPlot.h.
|
private |
Enumerator | |
---|---|
kErrorSymmetric | Use the regular |
kErrorAsymmetric | Use |
kErrorFunc | Use the square root of the function value as the error. |
Definition at line 57 of file TRatioPlot.h.
|
private |
Definition at line 63 of file TRatioPlot.h.
|
privatedelete |
TRatioPlot::TRatioPlot | ( | ) |
TRatioPlot default constructor.
Definition at line 102 of file TRatioPlot.cxx.
|
override |
Destructor.
Definition at line 109 of file TRatioPlot.cxx.
Constructor for two histograms.
h1 | First histogram |
h2 | Second histogram |
option | Steers the error calculation, as well as ratio / difference |
Definition at line 202 of file TRatioPlot.cxx.
Constructor which accepts a THStack
and a histogram.
Converts the stack to a regular sum of its containing histograms for processing.
st | The THStack object |
h2 | The other histogram |
option | Steers the calculation of the lower plot |
Definition at line 234 of file TRatioPlot.cxx.
TRatioPlot::TRatioPlot | ( | TH1 * | h1, |
Option_t * | option = "" , |
||
TFitResult * | fitres = nullptr |
||
) |
Constructor for one histogram and a fit.
h1 | The histogram |
option | Steers the error calculation |
fitres | Explicit fit result to be used for calculation. Uses last fit if left empty |
Definition at line 268 of file TRatioPlot.cxx.
|
overridevirtual |
|
protected |
Build the lower plot according to which constructor was called, and which options were passed.
Definition at line 859 of file TRatioPlot.cxx.
|
static |
|
inlinestaticconstexpr |
Definition at line 264 of file TRatioPlot.h.
|
protected |
Create a grid line.
Definition at line 763 of file TRatioPlot.cxx.
|
protectedvirtual |
(Re-)Creates the TGAxis objects that are used for consistent display of the axes.
Definition at line 1102 of file TRatioPlot.cxx.
|
inlinestatic |
Definition at line 264 of file TRatioPlot.h.
|
overridevirtual |
Draws the ratio plot to the currently active pad.
Therefore it requires that a TCanvas has been created first.
It takes the following options
Option | Description |
---|---|
grid / nogrid | enable (default) or disable drawing of dashed lines on lower plot |
hideup | hides the first label of the upper axis if there is not enough space |
fhideup | always hides the first label of the upper axis |
hidelow (default) | hides the last label of the lower axis if there is not enough space |
fhidelow | always hides the last label of the lower axis |
nohide | does not hide a label if there is not enough space |
noconfint | does not draw the confidence interval bands in the fit residual case |
confint | draws the confidence interval bands in the fit residual case (default) |
Reimplemented from TObject.
Definition at line 544 of file TRatioPlot.cxx.
|
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 217 of file TRatioPlot.h.
|
inline |
Returns the graph for the 1 sigma confidence interval in the fit residual case.
Definition at line 222 of file TRatioPlot.h.
|
inline |
Returns the graph for the 2 sigma confidence interval in the fit residual case.
Definition at line 227 of file TRatioPlot.h.
|
inline |
Definition at line 230 of file TRatioPlot.h.
|
virtual |
Returns the reference graph for the lower pad, which means the graph that is responsible for setting the coordinate system.
It is the first graph added to the primitive list of the lower pad. This reference can be used to set the minimum and maximum of the lower pad. Note that TRatioPlot::Draw
needs to have been called first, since the graphs are only created then.
Definition at line 673 of file TRatioPlot.cxx.
|
inline |
|
inline |
|
inline |
Definition at line 187 of file TRatioPlot.h.
Float_t TRatioPlot::GetSeparationMargin | ( | ) | const |
Return the separation margin value.
Definition at line 519 of file TRatioPlot.cxx.
|
inline |
Definition at line 229 of file TRatioPlot.h.
|
virtual |
Return the reference object.
Its the first TH1 or THStack type object in the upper pads list of primitives. Note that it returns a TObject
, so you need to test and cast it to use it.
Definition at line 707 of file TRatioPlot.cxx.
TAxis * TRatioPlot::GetUpperRefXaxis | ( | ) | const |
Gets the x axis of the object returned by TRatioPlot::GetUpperRefObject
.
Definition at line 725 of file TRatioPlot.cxx.
TAxis * TRatioPlot::GetUpperRefYaxis | ( | ) | const |
Gets the y axis of the object returned by TRatioPlot::GetUpperRefObject
.
Definition at line 744 of file TRatioPlot.cxx.
|
inline |
Definition at line 186 of file TRatioPlot.h.
|
inline |
Definition at line 185 of file TRatioPlot.h.
Internal method to import TAxis attributes to a TGaxis.
Copied from TGaxis::ImportAxisAttributes
Definition at line 1709 of file TRatioPlot.cxx.
Internal method that shares constructor logic.
Definition at line 144 of file TRatioPlot.cxx.
|
inlineoverridevirtual |
Reimplemented from TObject.
Definition at line 264 of file TRatioPlot.h.
|
protected |
Check if ... is drawn.
Definition at line 1600 of file TRatioPlot.cxx.
|
privatedelete |
|
overridevirtual |
Creates the visual axes when painting.
Reimplemented from TObject.
Definition at line 827 of file TRatioPlot.cxx.
void TRatioPlot::RangeAxisChanged | ( | ) |
Slot that receives the RangeAxisChanged signal from any of the pads and reacts correspondingly.
Definition at line 1460 of file TRatioPlot.cxx.
|
inline |
Definition at line 261 of file TRatioPlot.h.
|
inline |
Definition at line 262 of file TRatioPlot.h.
Set the confidence interval colors.
ci1 | Color of the 1 sigma band |
ci2 | Color of the 2 sigma band Sets the color of the 1 and 2 sigma bands in the fit residual case. |
Definition at line 1699 of file TRatioPlot.cxx.
Sets the confidence levels used to calculate the bands in the fit residual case.
Defaults to 1 and 2 sigma.
Definition at line 1651 of file TRatioPlot.cxx.
void TRatioPlot::SetFitDrawOpt | ( | Option_t * | opt | ) |
Sets the drawing option for the fit in the fit residual case.
Definition at line 366 of file TRatioPlot.cxx.
|
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.
fitres | The fit result coming from the fit function call |
Definition at line 241 of file TRatioPlot.h.
void TRatioPlot::SetGraphDrawOpt | ( | Option_t * | opt | ) |
Sets the drawing option for the lower graph.
Definition at line 358 of file TRatioPlot.cxx.
Set where horizontal, dashed lines are drawn on the lower pad.
Can be used to override existing default lines (or disable them).
gridlines | Double_t array of y positions for the dashed lines |
numGridlines | Length of gridlines |
Definition at line 1680 of file TRatioPlot.cxx.
|
virtual |
Set where horizontal, dashed lines are drawn on the lower pad.
Can be used to override existing default lines (or disable them).
gridlines | Vector of y positions for the dashes lines |
Definition at line 1668 of file TRatioPlot.cxx.
void TRatioPlot::SetH1DrawOpt | ( | Option_t * | opt | ) |
Sets the drawing option for h1.
Definition at line 338 of file TRatioPlot.cxx.
void TRatioPlot::SetH2DrawOpt | ( | Option_t * | opt | ) |
Sets the drawing option for h2.
Definition at line 346 of file TRatioPlot.cxx.
void TRatioPlot::SetInsetWidth | ( | Double_t | width | ) |
Set the inset on the outer sides of all the pads.
It's used to make the outer pad draggable.
Definition at line 1630 of file TRatioPlot.cxx.
void TRatioPlot::SetLeftMargin | ( | Float_t | margin | ) |
Sets the left margin of both pads.
margin | The new margin |
Definition at line 481 of file TRatioPlot.cxx.
void TRatioPlot::SetLowBottomMargin | ( | Float_t | margin | ) |
Sets the bottom margin of the lower pad.
margin | The new margin |
Definition at line 471 of file TRatioPlot.cxx.
void TRatioPlot::SetLowTopMargin | ( | Float_t | margin | ) |
Sets the top margin of the lower pad.
margin | The new margin |
Definition at line 460 of file TRatioPlot.cxx.
|
protected |
Sets the margins of all the pads to the value specified in class members.
This one is called whenever those are changed, e.g. in setters
Definition at line 1374 of file TRatioPlot.cxx.
void TRatioPlot::SetRightMargin | ( | Float_t | margin | ) |
Sets the right margin of both pads.
margin | The new margin |
Definition at line 492 of file TRatioPlot.cxx.
void TRatioPlot::SetSeparationMargin | ( | Float_t | margin | ) |
Sets the margin that separates the two pads.
The margin is split according to the relative sizes of the pads
margin | The new margin |
Definition at line 508 of file TRatioPlot.cxx.
void TRatioPlot::SetSplitFraction | ( | Float_t | sf | ) |
Set the fraction of the parent pad, at which the to sub pads should meet.
Definition at line 1609 of file TRatioPlot.cxx.
void TRatioPlot::SetUpBottomMargin | ( | Float_t | margin | ) |
Sets the bottom margin of the upper pad.
margin | The new margin |
Definition at line 449 of file TRatioPlot.cxx.
|
protectedvirtual |
Setup the pads.
Definition at line 374 of file TRatioPlot.cxx.
void TRatioPlot::SetUpTopMargin | ( | Float_t | margin | ) |
Sets the top margin of the upper pad.
margin | The new margin |
Definition at line 438 of file TRatioPlot.cxx.
|
overridevirtual |
|
inline |
Definition at line 264 of file TRatioPlot.h.
void TRatioPlot::SubPadResized | ( | ) |
Slot that handles common resizing of upper and lower pad.
Definition at line 1562 of file TRatioPlot.cxx.
|
protectedvirtual |
Syncs the axes ranges from the shared ones to the actual ones.
Definition at line 839 of file TRatioPlot.cxx.
|
protectedvirtual |
Figures out which pad margin has deviated from the stored ones, to figure out what the new nominal is and set the other pad to it subsequently.
Definition at line 1391 of file TRatioPlot.cxx.
void TRatioPlot::UnZoomed | ( | ) |
Slot for the UnZoomed signal that was introduced to TAxis.
Unzoom both pads
Definition at line 1546 of file TRatioPlot.cxx.
|
protected |
Stores the scale factor for h1 (or THStack sum)
Definition at line 104 of file TRatioPlot.h.
|
protected |
Stores the scale factor for h2.
Definition at line 105 of file TRatioPlot.h.
Stores the color for the 1 sigma band.
Definition at line 96 of file TRatioPlot.h.
Stores the color for the 2 sigma band.
Definition at line 97 of file TRatioPlot.h.
|
protected |
Stores the confidence level for the inner confidence interval band.
Definition at line 101 of file TRatioPlot.h.
|
protected |
Stores the confidence level for the outer confidence interval band.
Definition at line 102 of file TRatioPlot.h.
|
protected |
Stores the graph for the 1 sigma band.
Definition at line 94 of file TRatioPlot.h.
|
protected |
Stores the graph for the 2 sigma band.
Definition at line 95 of file TRatioPlot.h.
|
protected |
Stores the error mode, sym, asym or func.
Definition at line 84 of file TRatioPlot.h.
|
protected |
Stores draw option for the fit function in the fit residual case.
Definition at line 89 of file TRatioPlot.h.
|
protected |
Stores the explicit fit result given in the fit residual case. Can be 0.
Definition at line 107 of file TRatioPlot.h.
|
protected |
Stores draw option for the lower plot graph given in constructor.
Definition at line 88 of file TRatioPlot.h.
|
protected |
Stores the y positions for the gridlines.
Definition at line 123 of file TRatioPlot.h.
|
protected |
Keeps TLine objects for the gridlines.
Definition at line 122 of file TRatioPlot.h.
|
protected |
Stores the primary histogram.
Definition at line 79 of file TRatioPlot.h.
|
protected |
Stores draw option for h1 given in constructor.
Definition at line 86 of file TRatioPlot.h.
|
protected |
Stores the secondary histogram, if there is one.
Definition at line 80 of file TRatioPlot.h.
|
protected |
Stores draw option for h2 given in constructor.
Definition at line 87 of file TRatioPlot.h.
|
protected |
Stores which label to hide if the margin is to narrow, if at all.
Definition at line 125 of file TRatioPlot.h.
|
protected |
The object which is actually drawn, this might be TH1 or THStack.
Definition at line 81 of file TRatioPlot.h.
|
protected |
Definition at line 137 of file TRatioPlot.h.
Keeps track whether pads are updating during resizing.
Definition at line 140 of file TRatioPlot.h.
Keeps track of whether its currently updating to reject other calls until done.
Definition at line 139 of file TRatioPlot.h.
|
protected |
Stores the common left margin of both pads.
Definition at line 134 of file TRatioPlot.h.
|
protected |
Stores the bottom margin of the lower pad.
Definition at line 132 of file TRatioPlot.h.
|
protected |
Lower graphical x axis.
Definition at line 111 of file TRatioPlot.h.
|
protected |
Lower mirror of the x axis.
Definition at line 115 of file TRatioPlot.h.
|
protected |
Lower graphical y axis.
Definition at line 113 of file TRatioPlot.h.
|
protected |
Lower mirror of the y axis.
Definition at line 117 of file TRatioPlot.h.
|
protected |
The pad which contains the calculated lower plot part.
Definition at line 76 of file TRatioPlot.h.
|
protected |
Stores the top margin of the lower pad.
Definition at line 131 of file TRatioPlot.h.
|
protected |
Clone of the lower y axis.
Definition at line 120 of file TRatioPlot.h.
|
protected |
Stores which calculation is supposed to be performed as specified by user option.
Definition at line 83 of file TRatioPlot.h.
|
protected |
Stores the option which is given in the constructor as a string.
Definition at line 85 of file TRatioPlot.h.
|
protected |
Stores the pad the ratio plot was created in.
Definition at line 74 of file TRatioPlot.h.
|
protected |
Stores the lower plot's graph.
Definition at line 93 of file TRatioPlot.h.
|
protected |
Stores the common right margin of both pads.
Definition at line 135 of file TRatioPlot.h.
|
protected |
X axis that stores the range for both plots.
Definition at line 109 of file TRatioPlot.h.
Stores whether to show the confidence interval bands. From Draw option.
Definition at line 99 of file TRatioPlot.h.
Stores whether to show the gridlines at all.
Definition at line 124 of file TRatioPlot.h.
|
protected |
Stores the fraction at which the upper and lower pads meet.
Definition at line 91 of file TRatioPlot.h.
|
protected |
The Pad that drawn on top on the others to have consistent coordinates.
Definition at line 77 of file TRatioPlot.h.
|
protected |
Stores the bottom margin of the upper pad.
Definition at line 130 of file TRatioPlot.h.
|
protected |
Upper graphical x axis.
Definition at line 110 of file TRatioPlot.h.
|
protected |
Upper mirror of the x axis.
Definition at line 114 of file TRatioPlot.h.
|
protected |
Upper graphical y axis.
Definition at line 112 of file TRatioPlot.h.
|
protected |
Upper mirror of the y axis.
Definition at line 116 of file TRatioPlot.h.
|
protected |
The pad which contains the upper plot part.
Definition at line 75 of file TRatioPlot.h.
|
protected |
Stores the top margin of the upper pad.
Definition at line 129 of file TRatioPlot.h.
|
protected |
Clone of the upper y axis.
Definition at line 119 of file TRatioPlot.h.