Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TRatioPlot.cxx
Go to the documentation of this file.
1// @(#)root/gpad:$Id$
2// Author: Paul Gessinger 25/08/2016
3
4/*************************************************************************
5 * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TRatioPlot.h"
13#include "TROOT.h"
14#include "TBrowser.h"
15#include "TH1.h"
16#include "TF1.h"
17#include "TPad.h"
18#include "TString.h"
19#include "TMath.h"
20#include "TGraphAsymmErrors.h"
21#include "TGraphErrors.h"
22#include "TGaxis.h"
23#include "TLine.h"
24#include "TVirtualFitter.h"
25#include "TFitResult.h"
26#include "THStack.h"
27
28/** \class TRatioPlot
29 \ingroup gpad
30Class for displaying ratios, differences and fit residuals.
31
32TRatioPlot has two constructors, one which accepts two histograms, and is responsible
33for setting up the calculation of ratios and differences. This calculation is in part
34delegated to `TEfficiency`. A single option can be given as a parameter, that is
35used to determine which procedure is chosen. The remaining option string is then
36passed through to the calculation, if applicable. The other constructor uses a
37fitted histogram to calculate the fit residual and plot it with the histogram
38and the fit function.
39
40## Ratios and differences
41The simplest case is passing two histograms without specifying any options. This defaults to using
42`TGraphAsymmErrors::Divide`. The `option` variable is passed through, as are the parameters
43`c1` and `c2`, that you can set via `TRatioPlot::SetC1` and `TRatioPlot::SetC1`. If you set the
44`option` to `divsym` the method `TH1::Divide` will be used instead, also receiving all the parameters.
45
46Using the `option` `diff` or `diffsig`, both histograms will be subtracted, and in the case of diffsig,
47the difference will be divided by the uncertainty. `c1` and `c2` will only be used to
48scale the histograms using `TH1::Scale` prior to subtraction.
49
50Available options are for `option`:
51| Option | Description |
52| ---------- | ------------------------------------------------------------ |
53| divsym | uses the histogram `TH1::Divide` method, yields symmetric errors |
54| diff | subtracts the histograms |
55| diffsig | subtracts the histograms and divides by the uncertainty |
56
57Begin_Macro(source)
58../../../tutorials/hist/ratioplot1.C
59End_Macro
60
61## Fit residuals
62A second constructor only accepts a single histogram, but expects it to have a fitted
63function. The function is used to calculate the residual between the fit and the
64histogram. Here, it is expected that h1 has a fit function in it's list of functions. The class calculates the
65difference between the histogram and the fit function at each point and divides it by the uncertainty. There
66are a few option to steer which error is used (as is the case for `diffsig`). The default is to use
67the statistical uncertainty from h1 using `TH1::GetBinError`. If the `option` string contains `errasym`, asymmetric
68errors will be used. The type of error can be steered by `TH1::SetBinErrorOption`. The corresponding error will be used,
69depending on if the function is below or above the bin content. The third option `errfunc` uses the square root of
70the function value as the error.
71
72
73Begin_Macro(source)
74../../../tutorials/hist/ratioplot2.C
75End_Macro
76
77## Error options for difference divided by uncertainty and fit residual
78The uncertainty that is used in the calculation can be steered by providing
79options to the `option` argument.
80
81| Option | Description |
82| ---------- | ------------------------------------------------------------ |
83| errasym | Uses calculated asymmetric errors from `TH1::GetBinErrorUp`/`TH1::GetBinErrorLow`. Note that you need to set `TH1::SetBinErrorOption` first |
84| errfunc | Uses \f$ \sqrt{f(x)} \f$ as the error |
85
86The asymmetric error case uses the upper or lower error depending on the relative size
87of the bin contents, or the bin content and the function value.
88
89## Access to internal parts
90You can access the internal objects that are used to construct the plot via a series of
91methods. `TRatioPlot::GetUpperPad` and `TRatioPlot::GetLowerPad` can be used to draw additional
92elements on top of the existing ones.
93`TRatioPlot::GetLowerRefGraph` returns a reference to the lower pad's graph that
94is responsible for the range, which enables you to modify the range.
95
96\image html gpad_ratioplot.png
97*/
98
99////////////////////////////////////////////////////////////////////////////////
100/// TRatioPlot default constructor
101
103{
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Destructor
108
110{
111
112 gROOT->GetListOfCleanups()->Remove(this);
113
117
118 for (unsigned int i=0;i<fGridlines.size();++i) {
119 delete (fGridlines[i]);
120 }
121
131
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// Internal method that shares constructor logic
138
139void TRatioPlot::Init(TH1* h1, TH1* h2,Option_t *option)
140{
141
142 fH1 = h1;
143 fH2 = h2;
144
145 SetupPads();
146
147 TString optionString = TString(option);
148
149 if (optionString.Contains("divsym")) {
150 optionString.ReplaceAll("divsym", "");
152 } else if (optionString.Contains("diffsig")) {
153 optionString.ReplaceAll("diffsig", "");
155
156 // determine which error style
157 if (optionString.Contains("errasym")) {
159 optionString.ReplaceAll("errasym", "");
160 }
161
162 if (optionString.Contains("errfunc")) {
164 optionString.ReplaceAll("errfunc", "");
165 }
166 } else if (optionString.Contains("diff")) {
167 optionString.ReplaceAll("diff", "");
169 } else {
171 }
172
173 fOption = optionString;
174
175
176 fH1DrawOpt = "hist";
177 fH2DrawOpt = "E";
178 fGraphDrawOpt = "AP";
179
180
181 // build ratio, everything is ready
182 if (!BuildLowerPlot()) return;
183
184 // taking x axis information from h1 by cloning it x axis
185 fSharedXAxis = (TAxis*)(fH1->GetXaxis()->Clone());
186 fUpYaxis = (TAxis*)(fH1->GetYaxis()->Clone());
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Constructor for two histograms
192///
193/// \param h1 First histogram
194/// \param h2 Second histogram
195/// \param option Steers the error calculation, as well as ratio / difference
196
198 : fGridlines()
199{
200 gROOT->GetListOfCleanups()->Add(this);
201
202 if (!h1 || !h2) {
203 Warning("TRatioPlot", "Need two histograms.");
204 return;
205 }
206
207 Bool_t h1IsTH1=h1->IsA()->InheritsFrom(TH1::Class());
208 Bool_t h2IsTH1=h2->IsA()->InheritsFrom(TH1::Class());
209
210 if (!h1IsTH1 && !h2IsTH1) {
211 Warning("TRatioPlot", "Need two histograms deriving from TH2 or TH3.");
212 return;
213 }
214
216
217 Init(h1, h2, option);
218
219}
220
221////////////////////////////////////////////////////////////////////////////////
222/// Constructor which accepts a `THStack` and a histogram. Converts the
223/// stack to a regular sum of its containing histograms for processing.
224///
225/// \param st The THStack object
226/// \param h2 The other histogram
227/// \param option Steers the calculation of the lower plot
228
230{
231 if (!st || !h2) {
232 Warning("TRatioPlot", "Need a histogram and a stack");
233 return;
234 }
235
236 TList *stackHists = st->GetHists();
237
238 if (stackHists->GetSize() == 0) {
239 Warning("TRatioPlot", "Stack does not have histograms");
240 return;
241 }
242
243 TH1* tmpHist = (TH1*)stackHists->At(0)->Clone();
244 tmpHist->Reset();
245
246 for (int i=0;i<stackHists->GetSize();++i) {
247 tmpHist->Add((TH1*)stackHists->At(i));
248 }
249
250 fHistDrawProxy = st;
251
252 Init(tmpHist, h2, option);
253
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// Constructor for one histogram and a fit.
258///
259/// \param h1 The histogram
260/// \param option Steers the error calculation
261/// \param fitres Explicit fit result to be used for calculation. Uses last fit if left empty
262
264 : fH1(h1),
265 fGridlines()
266{
267 gROOT->GetListOfCleanups()->Add(this);
268
269 if (!fH1) {
270 Warning("TRatioPlot", "Need a histogram.");
271 return;
272 }
273
274 Bool_t h1IsTH1=fH1->IsA()->InheritsFrom(TH1::Class());
275
276 if (!h1IsTH1) {
277 Warning("TRatioPlot", "Need a histogram deriving from TH2 or TH3.");
278 return;
279 }
280
281 TList *h1Functions = fH1->GetListOfFunctions();
282
283 if (h1Functions->GetSize() < 1) {
284 Warning("TRatioPlot", "Histogram given needs to have a (fit) function associated with it");
285 return;
286 }
287
288
290
291 fFitResult = fitres;
292
294
295 TString optionString = TString(option);
296
297 // determine which error style
298 if (optionString.Contains("errasym")) {
300 optionString.ReplaceAll("errasym", "");
301 }
302
303 if (optionString.Contains("errfunc")) {
305 optionString.ReplaceAll("errfunc", "");
306 }
307
308 fOption = optionString;
309
310 if (!BuildLowerPlot()) return;
311
312 // emulate option behaviour of TH1
313 if (fH1->GetSumw2N() > 0) {
314 fH1DrawOpt = "E";
315 } else {
316 fH1DrawOpt = "hist";
317 }
318 fGraphDrawOpt = "LX"; // <- default
319
320 fSharedXAxis = (TAxis*)(fH1->GetXaxis()->Clone());
321 fUpYaxis = (TAxis*)(fH1->GetYaxis()->Clone());
323
324 //SyncAxesRanges();
325
326 SetupPads();
327
328}
329
330////////////////////////////////////////////////////////////////////////////////
331/// Sets the drawing option for h1
332
334{
335 fH1DrawOpt = opt;
336}
337
338////////////////////////////////////////////////////////////////////////////////
339/// Sets the drawing option for h2
340
342{
343 TString optString = TString(opt);
344 optString.ReplaceAll("same", "");
345 optString.ReplaceAll("SAME", "");
346
347 fH2DrawOpt = optString;
348}
349
350////////////////////////////////////////////////////////////////////////////////
351/// Sets the drawing option for the lower graph
352
354{
355 fGraphDrawOpt = opt;
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Sets the drawing option for the fit in the fit residual case
360
362{
363 fFitDrawOpt = opt;
364}
365
366////////////////////////////////////////////////////////////////////////////////
367/// Setup the pads.
368
370
371 // this method will delete all the pads before recreating them
372
373 if (fUpperPad != 0) {
374 delete fUpperPad;
375 fUpperPad = 0;
376 }
377
378 if (fLowerPad != 0) {
379 delete fLowerPad;
380 fLowerPad = 0;
381 }
382
383 if (!gPad) {
384 Error("SetupPads", "need to create a canvas first");
385 return;
386 }
387
388 double pm = fInsetWidth;
389 double width = gPad->GetWNDC();
390 double height = gPad->GetHNDC();
391 double f = height/width;
392
393 fUpperPad = new TPad("upper_pad", "", pm*f, fSplitFraction, 1.-pm*f, 1.-pm);
394 fLowerPad = new TPad("lower_pad", "", pm*f, pm, 1.-pm*f, fSplitFraction);
395
397
398 // connect to the pads signal
399 fUpperPad->Connect("RangeAxisChanged()", "TRatioPlot", this, "RangeAxisChanged()");
400 fLowerPad->Connect("RangeAxisChanged()", "TRatioPlot", this, "RangeAxisChanged()");
401
402 fUpperPad->Connect("UnZoomed()", "TRatioPlot", this, "UnZoomed()");
403 fLowerPad->Connect("UnZoomed()", "TRatioPlot", this, "UnZoomed()");
404
405 fUpperPad->Connect("Resized()", "TRatioPlot", this, "SubPadResized()");
406 fLowerPad->Connect("Resized()", "TRatioPlot", this, "SubPadResized()");
407
408 if (fTopPad != 0) {
409 delete fTopPad;
410 fTopPad = 0;
411 }
412
413 fTopPad = new TPad("top_pad", "", pm*f, pm, 1-pm*f, 1-pm);
414
416
417}
418
419////////////////////////////////////////////////////////////////////////////////
420/// Browse.
421
423{
424 Draw(b ? b->GetDrawOption() : "");
425 gPad->Update();
426}
427
428////////////////////////////////////////////////////////////////////////////////
429/// Sets the top margin of the upper pad.
430///
431/// \param margin The new margin
432
434{
435 fUpTopMargin = margin;
437}
438
439////////////////////////////////////////////////////////////////////////////////
440/// Sets the bottom margin of the upper pad.
441///
442/// \param margin The new margin
443
445{
446 fUpBottomMargin = margin;
448}
449
450////////////////////////////////////////////////////////////////////////////////
451/// Sets the top margin of the lower pad.
452///
453/// \param margin The new margin
454
456{
457 fLowTopMargin = margin;
459}
460
461////////////////////////////////////////////////////////////////////////////////
462/// Sets the bottom margin of the lower pad.
463///
464/// \param margin The new margin
465
467{
468 fLowBottomMargin = margin;
470}
471
472////////////////////////////////////////////////////////////////////////////////
473/// Sets the left margin of both pads.
474/// \param margin The new margin
475
477{
478 fLeftMargin = margin;
480}
481
482////////////////////////////////////////////////////////////////////////////////
483/// Sets the right margin of both pads.
484///
485/// \param margin The new margin
486
488{
489 fRightMargin = margin;
491}
492
493////////////////////////////////////////////////////////////////////////////////
494/// Sets the margin that separates the two pads. The margin is split according
495/// to the relative sizes of the pads
496///
497/// \param margin The new margin
498///
499/// Begin_Macro(source)
500/// ../../../tutorials/hist/ratioplot6.C
501/// End_Macro
502
504{
506 fUpBottomMargin = margin/2./(1-sf);
507 fLowTopMargin = margin/2./sf;
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// Return the separation margin value.
513
515{
517 Float_t up = fUpBottomMargin * (1-sf);
518 Float_t down = fLowTopMargin * sf;
519 return up+down;
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// Draws the ratio plot to the currently active pad. Therefore it requires that
524/// a TCanvas has been created first.
525///
526/// It takes the following options
527///
528/// | Option | Description |
529/// | ---------- | ------------------------------------------------------------ |
530/// | grid / nogrid | enable (default) or disable drawing of dashed lines on lower plot |
531/// | hideup | hides the first label of the upper axis if there is not enough space |
532/// | fhideup | always hides the first label of the upper axis |
533/// | hidelow (default) | hides the last label of the lower axis if there is not enough space |
534/// | fhidelow | always hides the last label of the lower axis |
535/// | nohide | does not hide a label if there is not enough space |
536/// | noconfint | does not draw the confidence interval bands in the fit residual case |
537/// | confint | draws the confidence interval bands in the fit residual case (default) |
538
540{
541
542 TString drawOpt = option;
543
544 if (drawOpt.Contains("nogrid")) {
545 drawOpt.ReplaceAll("nogrid", "");
547 } else if (drawOpt.Contains("grid")) {
548 drawOpt.ReplaceAll("grid", "");
550 }
551
552 if (drawOpt.Contains("noconfint")) {
553 drawOpt.ReplaceAll("noconfint", "");
555 } else if (drawOpt.Contains("confint")) {
556 drawOpt.ReplaceAll("confint", "");
557 fShowConfidenceIntervals = kTRUE; // <- default
558 }
559
560 if (drawOpt.Contains("fhideup")) {
562 } else if (drawOpt.Contains("fhidelow")) {
564 } else if (drawOpt.Contains("hideup")) {
566 } else if (drawOpt.Contains("hidelow")) {
568 } else if (drawOpt.Contains("nohide")) {
570 } else {
572 }
573
574 if (!gPad) {
575 Error("Draw", "need to create a canvas first");
576 return;
577 }
578
579 TVirtualPad *padsav = gPad;
581
585
590
591 // we are a TPad
592
593 fUpperPad->Draw();
594 fLowerPad->Draw();
595
597 fTopPad->Draw();
598
599 fUpperPad->cd();
600
603
605 TF1 *func = dynamic_cast<TF1*>(fH1->GetListOfFunctions()->At(0));
606
607 if (func == 0) {
608 // this is checked in constructor and should thus not occur
609 Error("BuildLowerPlot", "h1 does not have a fit function");
610 return;
611 }
612
613 fH1->Draw("A"+fH1DrawOpt);
614 func->Draw(fFitDrawOpt+"same");
615
616 fLowerPad->cd();
617
622 } else {
623 fRatioGraph->Draw("IA"+fGraphDrawOpt+"SAME");
624 }
625 } else {
626
627 if (fHistDrawProxy) {
628 if (fHistDrawProxy->InheritsFrom(TH1::Class())) {
629 ((TH1*)fHistDrawProxy)->Draw("A"+fH1DrawOpt);
630 } else if (fHistDrawProxy->InheritsFrom(THStack::Class())) {
631 ((THStack*)fHistDrawProxy)->Draw("A"+fH1DrawOpt);
632 } else {
633 Warning("Draw", "Draw proxy not of type TH1 or THStack, not drawing it");
634 }
635 }
636
637 fH2->Draw("A"+fH2DrawOpt+"same");
638
639 fLowerPad->cd();
640
643
644 }
645
646 // assign same axis ranges to lower pad as in upper pad
647 // the visual axes will be created on paint
649
651
652 padsav->cd();
653 AppendPad();
654}
655
656////////////////////////////////////////////////////////////////////////////////
657/// Returns the reference graph for the lower pad, which means the graph that
658/// is responsible for setting the coordinate system. It is the first graph
659/// added to the primitive list of the lower pad.
660/// This reference can be used to set the minimum and maximum of the lower pad.
661/// Note that `TRatioPlot::Draw` needs to have been called first, since the
662/// graphs are only created then.
663///
664/// Begin_Macro(source)
665/// ../../../tutorials/hist/ratioplot3.C
666/// End_Macro
667
669{
670 if (fLowerPad == 0) {
671 Error("GetLowerRefGraph", "Lower pad has not been defined");
672 return 0;
673 }
674
675 TList *primlist = fLowerPad->GetListOfPrimitives();
676 if (primlist->GetSize() == 0) {
677 Error("GetLowerRefGraph", "Lower pad does not have primitives");
678 return 0;
679 }
680
681 TObjLink *lnk = primlist->FirstLink();
682
683 while (lnk) {
684 TObject *obj = lnk->GetObject();
685
686 if (obj->InheritsFrom(TGraph::Class())) {
687 return (TGraph*)obj;
688 }
689
690 lnk = lnk->Next();
691 }
692
693 Error("GetLowerRefGraph", "Did not find graph in list");
694 return 0;
695}
696
697////////////////////////////////////////////////////////////////////////////////
698/// Return the reference object. Its the first TH1 or THStack type object
699/// in the upper pads list of primitives.
700/// Note that it returns a `TObject`, so you need to test and cast it to use it.
701
703{
704 TList *primlist = fUpperPad->GetListOfPrimitives();
705 TObject *refobj = 0;
706 for (Int_t i=0;i<primlist->GetSize();++i) {
707 refobj = primlist->At(i);
708 if (refobj->InheritsFrom(TH1::Class()) || refobj->InheritsFrom(THStack::Class())) {
709 return refobj;
710 }
711 }
712
713 Error("GetUpperRefObject", "No upper ref object of TH1 or THStack type found");
714 return 0;
715}
716
717////////////////////////////////////////////////////////////////////////////////
718/// Gets the x axis of the object returned by `TRatioPlot::GetUpperRefObject`.
719
721{
722 TObject *refobj = GetUpperRefObject();
723
724 if (!refobj) return 0;
725
726 if (refobj->InheritsFrom(TH1::Class())) {
727 return ((TH1*)refobj)->GetXaxis();
728 } else if (refobj->InheritsFrom(THStack::Class())) {
729 return ((THStack*)refobj)->GetXaxis();
730 }
731
732 return 0;
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Gets the y axis of the object returned by `TRatioPlot::GetUpperRefObject`.
737
739{
740 TObject *refobj = GetUpperRefObject();
741
742 if (!refobj) return 0;
743
744 if (refobj->InheritsFrom(TH1::Class())) {
745 return ((TH1*)refobj)->GetYaxis();
746 } else if (refobj->InheritsFrom(THStack::Class())) {
747 return ((THStack*)refobj)->GetYaxis();
748 }
749
750 return 0;
751}
752
753////////////////////////////////////////////////////////////////////////////////
754/// Create a grid line
755
757{
758
759 if (!fShowGridlines) {
760 return; // don't draw them
761 }
762
763 TVirtualPad *padsav = gPad;
764
765 fLowerPad->cd();
766
767 unsigned int dest = fGridlinePositions.size();
768
769 Double_t lowYFirst = fLowerPad->GetUymin();
770 Double_t lowYLast = fLowerPad->GetUymax();
771
772 double y;
773 int outofrange = 0;
774 for (unsigned int i=0;i<fGridlinePositions.size();++i) {
775 y = fGridlinePositions.at(i);
776
777 if (y < lowYFirst || lowYLast < y) {
778 ++outofrange;
779 }
780
781 }
782
783 dest = dest - outofrange;
784
785 // clear all
786 for (unsigned int i=0;i<fGridlines.size();++i) {
787 delete fGridlines.at(i);
788 }
789
790 fGridlines.erase(fGridlines.begin(), fGridlines.end());
791
792 for (unsigned int i=0;i<dest;++i) {
793 TLine *newline = new TLine(0, 0, 0, 0);
794 newline->SetLineStyle(2);
795 newline->Draw();
796 fGridlines.push_back(newline);
797 }
798
801
802 TLine *line;
803 unsigned int skipped = 0;
804 for (unsigned int i=0;i<fGridlinePositions.size();++i) {
806
807 if (y < lowYFirst || lowYLast < y) {
808 // this is one of the ones that was out of range
809 ++skipped;
810 continue;
811 }
812
813 line = fGridlines.at(i-skipped);
814
815 line->SetX1(first);
816 line->SetX2(last);
817 line->SetY1(y);
818 line->SetY2(y);
819 }
820
821 padsav->cd();
822}
823
824////////////////////////////////////////////////////////////////////////////////
825/// Creates the visual axes when painting.
826
828{
829 // create the visual axes
832
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Syncs the axes ranges from the shared ones to the actual ones.
838
840{
841 // get ranges from the shared axis clone
844
845 // set range on computed graph, have to set it twice because
846 // TGraph's axis looks strange otherwise
847 TAxis *ref = GetLowerRefXaxis();
848 ref->SetLimits(first, last);
849 ref->SetRangeUser(first, last);
850
852
853}
854
855////////////////////////////////////////////////////////////////////////////////
856/// Build the lower plot according to which constructor was called, and
857/// which options were passed.
858
860{
861 // Clear and delete the graph if not exists
862 if (fRatioGraph != 0) {
863 fRatioGraph->IsA()->Destructor(fRatioGraph);
864 fRatioGraph = 0;
865 }
866
867 if (fConfidenceInterval1 == 0) {
869 }
870
871 if (fConfidenceInterval2 == 0) {
873 }
874
875 static Double_t divideGridlines[] = {0.7, 1.0, 1.3};
876 static Double_t diffGridlines[] = {0.0};
877 static Double_t signGridlines[] = {1.0, 0.0, -1.0};
878
879 // Determine the divide mode and create the lower graph accordingly
880 // Pass divide options given in constructor
882 // use TGraphAsymmErrors Divide method to create
883
884 SetGridlines(divideGridlines, 3);
885
886 TH1 *tmpH1 = (TH1*)fH1->Clone();
887 TH1 *tmpH2 = (TH1*)fH2->Clone();
888
889 tmpH1->Scale(fC1);
890 tmpH2->Scale(fC2);
891
892 TGraphAsymmErrors *ratioGraph = new TGraphAsymmErrors();
893 ratioGraph->Divide(tmpH1, tmpH2, fOption.Data());
894 fRatioGraph = ratioGraph;
895
896 delete tmpH1;
897 delete tmpH2;
898
900 SetGridlines(diffGridlines, 3);
901
902 TH1 *tmpHist = (TH1*)fH1->Clone();
903
904 tmpHist->Reset();
905
906 tmpHist->Add(fH1, fH2, fC1, -1*fC2);
907 fRatioGraph = new TGraphErrors(tmpHist);
908
909 delete tmpHist;
911
912 SetGridlines(signGridlines, 3);
913
915 Int_t ipoint = 0;
916 Double_t res;
917 Double_t error;
918
919 Double_t val;
920 Double_t val2;
921
922 for (Int_t i=0; i<=fH1->GetNbinsX();++i) {
923 val = fH1->GetBinContent(i);
924 val2 = fH2->GetBinContent(i);
925
927
928 Double_t errUp = fH1->GetBinErrorUp(i);
929 Double_t errLow = fH1->GetBinErrorLow(i);
930
931 if (val - val2 > 0) {
932 // h1 > h2
933 error = errLow;
934 } else {
935 // h1 < h2
936 error = errUp;
937 }
938
940 error = fH1->GetBinError(i);
941 } else {
942 Warning("BuildLowerPlot", "error mode is invalid");
943 error = 0;
944 }
945
946 if (error != 0) {
947
948 res = (val - val2) / error;
949
950 ((TGraphAsymmErrors*)fRatioGraph)->SetPoint(ipoint, fH1->GetBinCenter(i), res);
951 ((TGraphAsymmErrors*)fRatioGraph)->SetPointError(ipoint, fH1->GetBinWidth(i)/2., fH1->GetBinWidth(i)/2., 0.5, 0.5);
952
953 ++ipoint;
954
955 }
956 }
957
959
960 SetGridlines(signGridlines, 3);
961
962 TF1 *func = dynamic_cast<TF1*>(fH1->GetListOfFunctions()->At(0));
963
964 if (func == 0) {
965 // this is checked in constructor and should thus not occur
966 Error("BuildLowerPlot", "h1 does not have a fit function");
967 return 0;
968 }
969
971 Int_t ipoint = 0;
972
973 Double_t res;
974 Double_t error;
975
976 std::vector<double> ci1;
977 std::vector<double> ci2;
978
979 Double_t *x_arr = new Double_t[fH1->GetNbinsX()];
980 std::fill_n(x_arr, fH1->GetNbinsX(), 0);
981 Double_t *ci_arr1 = new Double_t[fH1->GetNbinsX()];
982 std::fill_n(ci_arr1, fH1->GetNbinsX(), 0);
983 Double_t *ci_arr2 = new Double_t[fH1->GetNbinsX()];
984 std::fill_n(ci_arr2, fH1->GetNbinsX(), 0);
985 for (Int_t i=0; i<fH1->GetNbinsX();++i) {
986 x_arr[i] = fH1->GetBinCenter(i+1);
987 }
988
989 Double_t cl1 = fCl1;
990 Double_t cl2 = fCl2;
991
992 if (fFitResult != 0) {
993 // use this to get conf int
994
995 fFitResult->GetConfidenceIntervals(fH1->GetNbinsX(), 1, 1, x_arr, ci_arr1, cl1);
996 for (Int_t i=1; i<=fH1->GetNbinsX();++i) {
997 ci1.push_back(ci_arr1[i-1]);
998 }
999
1000 fFitResult->GetConfidenceIntervals(fH1->GetNbinsX(), 1, 1, x_arr, ci_arr2, cl2);
1001 for (Int_t i=1; i<=fH1->GetNbinsX();++i) {
1002 ci2.push_back(ci_arr2[i-1]);
1003 }
1004 } else {
1005 (TVirtualFitter::GetFitter())->GetConfidenceIntervals(fH1->GetNbinsX(), 1, x_arr, ci_arr1, cl1);
1006 for (Int_t i=1; i<=fH1->GetNbinsX();++i) {
1007 ci1.push_back(ci_arr1[i-1]);
1008 }
1009 (TVirtualFitter::GetFitter())->GetConfidenceIntervals(fH1->GetNbinsX(), 1, x_arr, ci_arr2, cl2);
1010 for (Int_t i=1; i<=fH1->GetNbinsX();++i) {
1011 ci2.push_back(ci_arr2[i-1]);
1012 }
1013
1014 }
1015
1016 Double_t x;
1017 Double_t val;
1018
1019 for (Int_t i=0; i<=fH1->GetNbinsX();++i) {
1020 val = fH1->GetBinContent(i);
1021 x = fH1->GetBinCenter(i+1);
1022
1024
1025 Double_t errUp = fH1->GetBinErrorUp(i);
1026 Double_t errLow = fH1->GetBinErrorLow(i);
1027
1028 if (val - func->Eval(fH1->GetBinCenter(i)) > 0) {
1029 // h1 > fit
1030 error = errLow;
1031 } else {
1032 // h1 < fit
1033 error = errUp;
1034 }
1035
1037 error = fH1->GetBinError(i);
1039
1040 error = sqrt(func->Eval(x));
1041
1042 } else {
1043 Warning("BuildLowerPlot", "error mode is invalid");
1044 error = 0;
1045 }
1046
1047 if (error != 0) {
1048
1049 res = (fH1->GetBinContent(i)- func->Eval(fH1->GetBinCenter(i) ) ) / error;
1050 //__("x="<< x << " y=" << res << " err=" << error);
1051
1052 ((TGraphAsymmErrors*)fRatioGraph)->SetPoint(ipoint, fH1->GetBinCenter(i), res);
1053 ((TGraphAsymmErrors*)fRatioGraph)->SetPointError(ipoint, fH1->GetBinWidth(i)/2., fH1->GetBinWidth(i)/2., 0.5, 0.5);
1054
1055 fConfidenceInterval1->SetPoint(ipoint, x, 0);
1056 fConfidenceInterval1->SetPointError(ipoint, x, i < (Int_t)ci1.size() ? ci1[i] / error : 0);
1057 fConfidenceInterval2->SetPoint(ipoint, x, 0);
1058 fConfidenceInterval2->SetPointError(ipoint, x, i < (Int_t)ci2.size() ? ci2[i] / error : 0);
1059
1060 ++ipoint;
1061
1062 }
1063
1064 }
1065 delete [] x_arr;
1066 delete [] ci_arr1;
1067 delete [] ci_arr2;
1069 SetGridlines(divideGridlines, 3);
1070
1071 // Use TH1's Divide method
1072 TH1 *tmpHist = (TH1*)fH1->Clone();
1073 tmpHist->Reset();
1074
1075 tmpHist->Divide(fH1, fH2, fC1, fC2, fOption.Data());
1076 fRatioGraph = new TGraphErrors(tmpHist);
1077
1078 delete tmpHist;
1079 } else {
1080 // this should not occur
1081 Error("BuildLowerPlot", "Invalid fMode value");
1082 return 0;
1083 }
1084
1085 // need to set back to "" since recreation. we don't ever want
1086 // title on lower graph
1087
1088 if (fRatioGraph == 0) {
1089 Error("BuildLowerPlot", "Error creating lower graph");
1090 return 0;
1091 }
1092
1093 fRatioGraph->SetTitle("");
1096
1097 return 1;
1098}
1099
1100////////////////////////////////////////////////////////////////////////////////
1101/// (Re-)Creates the TGAxis objects that are used for consistent display of the
1102/// axes.
1103
1105{
1106 TVirtualPad *padsav = gPad;
1107 fTopPad->cd();
1108
1109 // this is for errors
1110 TString thisfunc = "CreateVisualAxes";
1111
1112 // figure out where the axis has to go.
1113 // Implicit assumption is, that the top pad spans the full other pads
1118
1119 Double_t lowTM = fLowerPad->GetTopMargin();
1121 Double_t lowLM = fLowerPad->GetLeftMargin();
1123
1126
1127 Double_t upYFirst = fUpperPad->GetUymin();
1128 Double_t upYLast = fUpperPad->GetUymax();
1129 Double_t lowYFirst = fLowerPad->GetUymin();
1130 Double_t lowYLast = fLowerPad->GetUymax();
1131
1133
1134 // check if gPad has the all sides axis set
1135 Bool_t mirroredAxes = fParentPad->GetFrameFillStyle() == 0;
1136 Bool_t axistop = fParentPad->GetTickx() == 1 || mirroredAxes;
1137 Bool_t axisright = fParentPad->GetTicky() == 1 || mirroredAxes;
1138
1139 Bool_t logx = fUpperPad->GetLogx() || fLowerPad->GetLogx();
1140 Bool_t uplogy = fUpperPad->GetLogy();
1141 Bool_t lowlogy = fLowerPad->GetLogy();
1142
1143 if (uplogy) {
1144
1145 upYFirst = TMath::Power(10, upYFirst);
1146 upYLast = TMath::Power(10, upYLast);
1147
1148 if (upYFirst <= 0 || upYLast <= 0) {
1149 Error(thisfunc, "Cannot set upper Y axis to log scale");
1150 }
1151 }
1152
1153 if (lowlogy) {
1154 lowYFirst = TMath::Power(10, lowYFirst);
1155 lowYLast = TMath::Power(10, lowYLast);
1156
1157 if (lowYFirst <= 0 || lowYLast <= 0) {
1158 Error(thisfunc, "Cannot set lower Y axis to log scale");
1159 }
1160
1161 }
1162
1163 // this is different than in y, y already has pad coords converted, x not...
1164 if (logx) {
1165 if (first <= 0 || last <= 0) {
1166 Error(thisfunc, "Cannot set X axis to log scale");
1167 }
1168 }
1169
1170 // determine axes options to create log axes if needed
1171 TString xopt = "";
1172 if (logx) xopt.Append("G");
1173 TString upyopt = "";
1174 if (uplogy) upyopt.Append("G");
1175 TString lowyopt = "";
1176 if (lowlogy) lowyopt.Append("G");
1177
1178 // only actually create them once, reuse otherwise b/c memory
1179 if (fUpperGXaxis == 0) {
1180 fUpperGXaxis = new TGaxis(0, 0, 1, 1, 0, 1, 510, "+U"+xopt);
1181 fUpperGXaxis->Draw();
1182 }
1183
1184 if (fUpperGYaxis == 0) {
1185 fUpperGYaxis = new TGaxis(0, 0, 1, 1, upYFirst, upYLast, 510, "S"+upyopt);
1186 fUpperGYaxis->Draw();
1187 }
1188
1189 if (fLowerGXaxis == 0) {
1190 fLowerGXaxis = new TGaxis(0, 0, 1, 1, first, last, 510, "+S"+xopt);
1191 fLowerGXaxis->Draw();
1192 }
1193
1194 if (fLowerGYaxis == 0) {
1195 fLowerGYaxis = new TGaxis(0, 0, 1, 1, lowYFirst, lowYLast, 510, "-S"+lowyopt);
1196 fLowerGYaxis->Draw();
1197 }
1198
1199 // import infos from TAxis
1204
1205 // lower x axis needs to get title from upper x
1207
1208 // (re)set all the axes properties to what we want them
1210
1211 fUpperGXaxis->SetX1(upLM);
1212 fUpperGXaxis->SetX2(1-upRM);
1213 fUpperGXaxis->SetY1(upBM*(1-sf)+sf);
1214 fUpperGXaxis->SetY2(upBM*(1-sf)+sf);
1216 fUpperGXaxis->SetWmax(last);
1217
1218 fUpperGYaxis->SetX1(upLM);
1219 fUpperGYaxis->SetX2(upLM);
1220 fUpperGYaxis->SetY1(upBM*(1-sf)+sf);
1221 fUpperGYaxis->SetY2( (1-upTM)*(1-sf)+sf );
1222 fUpperGYaxis->SetWmin(upYFirst);
1223 fUpperGYaxis->SetWmax(upYLast);
1224
1225 fLowerGXaxis->SetX1(lowLM);
1226 fLowerGXaxis->SetX2(1-lowRM);
1227 fLowerGXaxis->SetY1(lowBM*sf);
1228 fLowerGXaxis->SetY2(lowBM*sf);
1230 fLowerGXaxis->SetWmax(last);
1231
1232 fLowerGYaxis->SetX1(lowLM);
1233 fLowerGYaxis->SetX2(lowLM);
1234 fLowerGYaxis->SetY1(lowBM*sf);
1235 fLowerGYaxis->SetY2((1-lowTM)*sf);
1236 fLowerGYaxis->SetWmin(lowYFirst);
1237 fLowerGYaxis->SetWmax(lowYLast);
1238
1243
1244 fUpperGXaxis->SetOption("+U"+xopt);
1245 fUpperGYaxis->SetOption("S"+upyopt);
1246 fLowerGXaxis->SetOption("+S"+xopt);
1247 fLowerGYaxis->SetOption("-S"+lowyopt);
1248
1249 // normalize the tick sizes. y axis ticks should be consistent
1250 // even if their length is different
1251 Double_t ratio = ( (upBM-(1-upTM))*(1-sf) ) / ( (lowBM-(1-lowTM))*sf ) ;
1253 Double_t ticksize = fUpperGYaxis->GetTickSize()*ratio;
1254 fLowerGYaxis->SetTickSize(ticksize);
1255
1257
1258 fUpperGYaxis->ChangeLabel(1, -1, 0);
1259
1261
1262 fLowerGYaxis->ChangeLabel(-1, -1, 0);
1263
1264 } else {
1265 if (GetSeparationMargin() < 0.025) {
1266
1269 fUpperGYaxis->ChangeLabel(1, -1, 0);
1271 fLowerGYaxis->ChangeLabel(-1, -1, 0);
1272 }
1273 }
1274
1275 } else {
1276 // reset
1281 }
1282
1283 }
1284 }
1285
1286 // Create the axes on the other sides of the graphs
1287 // This is steered by an option on the containing pad or self
1288 if (axistop || axisright) {
1289
1290 // only actually create them once, reuse otherwise b/c memory
1291 if (fUpperGXaxisMirror == 0) {
1293 if (axistop) fUpperGXaxisMirror->Draw();
1294 }
1295
1296 if (fLowerGXaxisMirror == 0) {
1298 if (axistop) fLowerGXaxisMirror->Draw();
1299 }
1300
1301 if (fUpperGYaxisMirror == 0) {
1303 if (axisright) fUpperGYaxisMirror->Draw();
1304 }
1305
1306 if (fLowerGYaxisMirror == 0) {
1308 if (axisright) fLowerGYaxisMirror->Draw();
1309 }
1310
1311 // import attributes from shared axes
1316
1317 // remove titles
1322
1323 // move them about and set required positions
1325 fUpperGXaxisMirror->SetX2(1-upRM);
1326 fUpperGXaxisMirror->SetY1((1-upTM)*(1-sf)+sf);
1327 fUpperGXaxisMirror->SetY2((1-upTM)*(1-sf)+sf);
1330
1331 fUpperGYaxisMirror->SetX1(1-upRM);
1332 fUpperGYaxisMirror->SetX2(1-upRM);
1333 fUpperGYaxisMirror->SetY1(upBM*(1-sf)+sf);
1334 fUpperGYaxisMirror->SetY2( (1-upTM)*(1-sf)+sf );
1335 fUpperGYaxisMirror->SetWmin(upYFirst);
1336 fUpperGYaxisMirror->SetWmax(upYLast);
1337
1338 fLowerGXaxisMirror->SetX1(lowLM);
1339 fLowerGXaxisMirror->SetX2(1-lowRM);
1340 fLowerGXaxisMirror->SetY1((1-lowTM)*sf);
1341 fLowerGXaxisMirror->SetY2((1-lowTM)*sf);
1344
1345 fLowerGYaxisMirror->SetX1(1-lowRM);
1346 fLowerGYaxisMirror->SetX2(1-lowRM);
1347 fLowerGYaxisMirror->SetY1(lowBM*sf);
1348 fLowerGYaxisMirror->SetY2((1-lowTM)*sf);
1349 fLowerGYaxisMirror->SetWmin(lowYFirst);
1350 fLowerGYaxisMirror->SetWmax(lowYLast);
1351
1352 // also needs normalized tick size
1354
1355 fUpperGXaxisMirror->SetOption("-S"+xopt);
1356 fUpperGYaxisMirror->SetOption("+S"+upyopt);
1357 fLowerGXaxisMirror->SetOption("-S"+xopt);
1358 fLowerGYaxisMirror->SetOption("+S"+lowyopt);
1359
1364
1369 }
1370
1371 padsav->cd();
1372
1373}
1374
1375////////////////////////////////////////////////////////////////////////////////
1376/// Sets the margins of all the pads to the value specified in class members.
1377/// This one is called whenever those are changed, e.g. in setters
1378
1380{
1389}
1390
1391////////////////////////////////////////////////////////////////////////////////
1392/// Figures out which pad margin has deviated from the stored ones,
1393/// to figure out what the new nominal is and set the other pad to it
1394/// subsequently.
1395
1397{
1398
1399 Bool_t changed = kFALSE;
1400
1403 changed = kTRUE;
1404 }
1405 else if (fLowerPad->GetLeftMargin() != fLeftMargin) {
1407 changed = kTRUE;
1408 }
1409
1412 changed = kTRUE;
1413 }
1414 else if (fLowerPad->GetRightMargin() != fRightMargin) {
1416 changed = kTRUE;
1417 }
1418
1419 // only reset margins, if any of the margins changed
1420 if (changed) {
1421 SetPadMargins();
1422 }
1423
1424 Bool_t verticalChanged = kFALSE;
1425
1427
1428 verticalChanged = kTRUE;
1430
1431 }
1432
1434
1435 verticalChanged = kTRUE;
1437
1438 }
1439
1441
1443
1444 }
1445
1447
1449
1450 }
1451
1452 // only reset margins, if any of the margins changed
1453 if (verticalChanged) {
1454 SetPadMargins();
1455 }
1456
1457 return changed || verticalChanged;
1458
1459}
1460
1461////////////////////////////////////////////////////////////////////////////////
1462/// Slot that receives the RangeAxisChanged signal from any of the pads and
1463/// reacts correspondingly.
1464
1466{
1467 // check if the ratio plot is already drawn.
1468 if (!IsDrawn()) {
1469 // not drawn yet
1470 return;
1471 }
1472
1473 // Only run this concurrently once, in case it's called async
1474 if (fIsUpdating) {
1475 return;
1476 }
1477
1479
1480 // find out if logx has changed
1481 if (fParentPad->GetLogx()) {
1482 if (!fUpperPad->GetLogx() || !fLowerPad->GetLogx()) {
1484 }
1485 } else {
1486 if (fUpperPad->GetLogx() || fLowerPad->GetLogx()) {
1488 }
1489 }
1490
1491 // set log to pad
1494
1495 // get axis ranges for upper and lower
1496 TAxis *uprefx = GetUpperRefXaxis();
1497 Double_t upFirst = uprefx->GetBinLowEdge(uprefx->GetFirst());
1498 Double_t upLast = uprefx->GetBinUpEdge(uprefx->GetLast());
1499
1500 TAxis *lowrefx = GetLowerRefXaxis();
1501 Double_t lowFirst = lowrefx->GetBinLowEdge(lowrefx->GetFirst());
1502 Double_t lowLast = lowrefx->GetBinUpEdge(lowrefx->GetLast());
1503
1506
1507 Bool_t upChanged = kFALSE;
1508 Bool_t lowChanged = kFALSE;
1509
1510 // determine which one has changed
1511 if (upFirst != globFirst || upLast != globLast) {
1512 fSharedXAxis->SetRangeUser(upFirst, upLast);
1513 upChanged = kTRUE;
1514 }
1515 else if (lowFirst != globFirst || lowLast != globLast) {
1516 fSharedXAxis->SetRangeUser(lowFirst, lowLast);
1517 lowChanged = kTRUE;
1518 }
1519
1520 if (upChanged || lowChanged) {
1524
1525 // @TODO: Updating is not working when zooming on the lower plot. Axes update, but upper hist only on resize
1528 fTopPad->Modified();
1530 }
1531
1532 // sync the margins in case the user has dragged one of them
1533 Bool_t marginsChanged = SyncPadMargins();
1534
1535 if (marginsChanged) {
1538 fTopPad->Modified();
1540 }
1541
1545}
1546
1547////////////////////////////////////////////////////////////////////////////////
1548/// Slot for the UnZoomed signal that was introduced to TAxis.
1549/// Unzoom both pads
1550
1552{
1553 // this is what resets the range
1554 fSharedXAxis->SetRange(0, 0);
1556
1557 // Flushing
1560 fTopPad->Modified();
1562}
1563
1564////////////////////////////////////////////////////////////////////////////////
1565/// Slot that handles common resizing of upper and lower pad.
1566
1568{
1569
1570 if (fIsPadUpdating) {
1571 return;
1572 }
1573
1575
1576 Float_t upylow = fUpperPad->GetYlowNDC();
1577 Float_t lowylow = fLowerPad->GetYlowNDC();
1578 Float_t lowh = fLowerPad->GetHNDC();
1579 Float_t lowyup = lowylow + lowh;
1580
1581 Bool_t changed = kFALSE;
1582
1583 if (upylow != fSplitFraction) {
1584 // up changed
1585 SetSplitFraction(upylow);
1586 changed = kTRUE;
1587 }
1588 else if (lowyup != fSplitFraction) {
1589 // low changed
1590 SetSplitFraction(lowyup);
1591 changed = kTRUE;
1592 }
1593
1594 if (changed) {
1596 }
1597
1599
1600}
1601
1602////////////////////////////////////////////////////////////////////////////////
1603/// Check if ... is drawn.
1604
1606{
1607 TList *siblings = fParentPad->GetListOfPrimitives();
1608 return siblings->FindObject(this) != 0;
1609}
1610
1611////////////////////////////////////////////////////////////////////////////////
1612/// Set the fraction of the parent pad, at which the to sub pads should meet
1613
1615{
1616 if (fParentPad == 0) {
1617 Warning("SetSplitFraction", "Can only be used after TRatioPlot has been drawn.");
1618 return;
1619 }
1620
1621 fSplitFraction = sf;
1622 double pm = fInsetWidth;
1623 double width = fParentPad->GetWNDC();
1624 double height = fParentPad->GetHNDC();
1625 double f = height/width;
1626
1627 fUpperPad->SetPad(pm*f, fSplitFraction, 1.-pm*f, 1.-pm);
1628 fLowerPad->SetPad(pm*f, pm, 1.-pm*f, fSplitFraction);
1629}
1630
1631////////////////////////////////////////////////////////////////////////////////
1632/// Set the inset on the outer sides of all the pads. It's used to make the outer
1633/// pad draggable.
1634
1636{
1637 if (fParentPad == 0) {
1638 Warning("SetInsetWidth", "Can only be used after TRatioPlot has been drawn.");
1639 return;
1640 }
1641
1644
1645 double pm = fInsetWidth;
1646 double w = fParentPad->GetWNDC();
1647 double h = fParentPad->GetHNDC();
1648 double f = h/w;
1649 fTopPad->SetPad(pm*f, pm, 1-pm*f, 1-pm);
1650}
1651
1652////////////////////////////////////////////////////////////////////////////////
1653/// Sets the confidence levels used to calculate the bands in the fit residual
1654/// case. Defaults to 1 and 2 sigma.
1655
1657{
1658 fCl1 = c1;
1659 fCl2 = c2;
1660 if (!BuildLowerPlot()) return;
1661}
1662
1663////////////////////////////////////////////////////////////////////////////////
1664/// Set where horizontal, dashed lines are drawn on the lower pad.
1665/// Can be used to override existing default lines (or disable them).
1666///
1667/// \param gridlines Vector of y positions for the dashes lines
1668///
1669/// Begin_Macro(source)
1670/// ../../../tutorials/hist/ratioplot4.C
1671/// End_Macro
1672
1673void TRatioPlot::SetGridlines(std::vector<double> gridlines)
1674{
1675 fGridlinePositions = gridlines;
1676}
1677
1678////////////////////////////////////////////////////////////////////////////////
1679/// Set where horizontal, dashed lines are drawn on the lower pad.
1680/// Can be used to override existing default lines (or disable them).
1681///
1682/// \param gridlines Double_t array of y positions for the dashed lines
1683/// \param numGridlines Length of gridlines
1684
1685void TRatioPlot::SetGridlines(Double_t *gridlines, Int_t numGridlines)
1686{
1687 fGridlinePositions.clear();
1688
1689 for (Int_t i=0;i<numGridlines;++i) {
1690 fGridlinePositions.push_back(gridlines[i]);
1691 }
1692}
1693
1694////////////////////////////////////////////////////////////////////////////////
1695/// Set the confidence interval colors.
1696///
1697/// \param ci1 Color of the 1 sigma band
1698/// \param ci2 Color of the 2 sigma band
1699/// Sets the color of the 1 and 2 sigma bands in the fit residual case.
1700/// Begin_Macro(source)
1701/// ../../../tutorials/hist/ratioplot5.C
1702/// End_Macro
1703
1705{
1706 fCi1Color = ci1;
1707 fCi2Color = ci2;
1708}
1709
1710////////////////////////////////////////////////////////////////////////////////
1711/// Internal method to import TAxis attributes to a TGaxis. Copied from
1712/// `TGaxis::ImportAxisAttributes`
1713
1715{
1716 gaxis->SetLineColor(axis->GetAxisColor());
1717 gaxis->SetTextColor(axis->GetTitleColor());
1718 gaxis->SetTextFont(axis->GetTitleFont());
1719 gaxis->SetLabelColor(axis->GetLabelColor());
1720 gaxis->SetLabelFont(axis->GetLabelFont());
1721 gaxis->SetLabelSize(axis->GetLabelSize());
1722 gaxis->SetLabelOffset(axis->GetLabelOffset());
1723 gaxis->SetTickSize(axis->GetTickLength());
1724 gaxis->SetTitle(axis->GetTitle());
1725 gaxis->SetTitleOffset(axis->GetTitleOffset());
1726 gaxis->SetTitleSize(axis->GetTitleSize());
1734 if (axis->GetDecimals()) gaxis->SetBit(TAxis::kDecimals); //the bit is in TAxis::fAxis2
1735 gaxis->SetTimeFormat(axis->GetTimeFormat());
1736}
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
short Color_t
Definition RtypesCore.h:83
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
include TDocParser_001 C image html pict1_TDocParser_001 png width
double sqrt(double)
#define gROOT
Definition TROOT.h:406
#define gPad
void GetConfidenceIntervals(unsigned int n, unsigned int stride1, unsigned int stride2, const double *x, double *ci, double cl=0.95, bool norm=false) const
get confidence intervals for an array of n points x.
virtual Color_t GetTitleColor() const
Definition TAttAxis.h:46
virtual Color_t GetLabelColor() const
Definition TAttAxis.h:38
virtual Int_t GetNdivisions() const
Definition TAttAxis.h:36
virtual Color_t GetAxisColor() const
Definition TAttAxis.h:37
virtual Style_t GetTitleFont() const
Definition TAttAxis.h:47
virtual Float_t GetLabelOffset() const
Definition TAttAxis.h:40
virtual Style_t GetLabelFont() const
Definition TAttAxis.h:39
virtual Float_t GetTitleSize() const
Definition TAttAxis.h:44
virtual Float_t GetLabelSize() const
Definition TAttAxis.h:41
virtual Float_t GetTickLength() const
Definition TAttAxis.h:45
virtual Float_t GetTitleOffset() const
Definition TAttAxis.h:43
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:42
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition TAttPad.cxx:99
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
Definition TAttPad.cxx:109
Style_t GetFrameFillStyle() const
Definition TAttPad.h:55
Float_t GetLeftMargin() const
Definition TAttPad.h:44
Float_t GetBottomMargin() const
Definition TAttPad.h:43
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Definition TAttPad.cxx:119
Float_t GetRightMargin() const
Definition TAttPad.h:45
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
Definition TAttPad.cxx:129
Float_t GetTopMargin() const
Definition TAttPad.h:46
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
Definition TAttText.h:43
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition TAttText.h:45
Class to manage histogram axis.
Definition TAxis.h:30
@ kTickMinus
Definition TAxis.h:60
@ kCenterTitle
Definition TAxis.h:62
@ kRotateTitle
Definition TAxis.h:64
@ kNoExponent
Definition TAxis.h:66
@ kMoreLogLabels
Definition TAxis.h:72
@ kTickPlus
Definition TAxis.h:59
@ kDecimals
Definition TAxis.h:58
@ kCenterLabels
Definition TAxis.h:63
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition TAxis.cxx:518
Bool_t GetDecimals() const
Definition TAxis.h:116
Int_t GetLast() const
Return last bin on the axis i.e.
Definition TAxis.cxx:469
virtual void SetLimits(Double_t xmin, Double_t xmax)
Definition TAxis.h:154
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
Definition TAxis.cxx:946
virtual const char * GetTimeFormat() const
Definition TAxis.h:127
const char * GetTitle() const
Returns title of object.
Definition TAxis.h:129
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
Definition TAxis.cxx:920
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:528
Int_t GetFirst() const
Return first bin on the axis i.e.
Definition TAxis.cxx:458
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
1-Dim function class
Definition TF1.h:213
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition TF1.cxx:1322
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
Definition TF1.cxx:1434
Extends the ROOT::Fit::Result class with a TNamed inheritance providing easy possibility for I/O.
Definition TFitResult.h:34
The axis painter class.
Definition TGaxis.h:23
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
Definition TGaxis.cxx:2734
void SetTitleOffset(Float_t titleoffset=1)
Definition TGaxis.h:124
void SetLabelFont(Int_t labelfont)
Definition TGaxis.h:105
void SetTitleSize(Float_t titlesize)
Definition TGaxis.h:125
virtual void SetTitle(const char *title="")
Change the title of the axis.
Definition TGaxis.cxx:2707
void SetLabelOffset(Float_t labeloffset)
Definition TGaxis.h:106
virtual const char * GetTitle() const
Returns title of object.
Definition TGaxis.h:86
virtual void SetNdivisions(Int_t ndiv)
Definition TGaxis.h:114
void SetWmax(Double_t wmax)
Definition TGaxis.h:129
void ChangeLabel(Int_t labNum=0, Double_t labAngle=-1., Double_t labSize=-1., Int_t labAlign=-1, Int_t labColor=-1, Int_t labFont=-1, TString labText="")
Define new text attributes for the label number "labNum".
Definition TGaxis.cxx:2572
void SetLabelColor(Int_t labelcolor)
Definition TGaxis.h:104
Float_t GetTickSize() const
Definition TGaxis.h:91
void SetWmin(Double_t wmin)
Definition TGaxis.h:128
void SetTickSize(Float_t ticksize)
Definition TGaxis.h:118
void SetLabelSize(Float_t labelsize)
Definition TGaxis.h:107
void SetOption(Option_t *option="")
To set axis options.
Definition TGaxis.cxx:2699
TGraph with asymmetric error bars.
virtual void Divide(const TH1 *pass, const TH1 *total, Option_t *opt="cp")
Fill this TGraphAsymmErrors by dividing two 1-dimensional histograms pass/total.
A TGraphErrors is a TGraph with error bars.
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition TGraph.cxx:2284
virtual void SetTitle(const char *title="")
Change (i.e.
Definition TGraph.cxx:2339
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Definition TGraph.cxx:769
TAxis * GetYaxis() const
Get y axis of the graph.
Definition TGraph.cxx:1650
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
Definition TH1.cxx:8981
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
Definition TH1.cxx:8903
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Definition TH1.cxx:7069
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
Definition TH1.h:320
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition TH1.cxx:2740
virtual Int_t GetNbinsX() const
Definition TH1.h:296
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1 if errors are defined (see TH1::Sumw2),...
Definition TH1.cxx:822
TAxis * GetYaxis()
Definition TH1.h:321
virtual Double_t GetBinErrorLow(Int_t bin) const
Return lower error associated to bin number bin.
Definition TH1.cxx:8919
TList * GetListOfFunctions() const
Definition TH1.h:243
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition TH1.cxx:3073
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:4993
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width for 1D histogram.
Definition TH1.cxx:9003
virtual Double_t GetBinErrorUp(Int_t bin) const
Return upper error associated to bin number bin.
Definition TH1.cxx:8950
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
Definition TH1.cxx:6564
virtual Int_t GetSumw2N() const
Definition TH1.h:314
virtual Bool_t Divide(TF1 *f1, Double_t c1=1)
Performs the operation: this = this/(c1*f1) if errors are defined (see TH1::Sumw2),...
Definition TH1.cxx:2828
The Histogram stack class.
Definition THStack.h:38
TList * GetHists() const
Definition THStack.h:67
A simple line.
Definition TLine.h:22
virtual void SetY2(Double_t y2)
Definition TLine.h:68
virtual void SetX2(Double_t x2)
Definition TLine.h:66
virtual void SetX1(Double_t x1)
Definition TLine.h:65
virtual void SetY1(Double_t y1)
Definition TLine.h:67
A doubly linked list.
Definition TList.h:44
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition TList.cxx:578
virtual TObjLink * FirstLink() const
Definition TList.h:108
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:357
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition TNamed.cxx:74
Mother of all ROOT objects.
Definition TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:187
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition TObject.cxx:146
@ kNotDeleted
object has not been deleted
Definition TObject.h:78
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:879
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:107
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:696
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:445
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:893
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:197
@ kCannotPick
if object in a pad cannot be picked
Definition TObject.h:63
The most important graphics class in the ROOT system.
Definition TPad.h:26
void SetGridx(Int_t value=1) override
Definition TPad.h:328
Double_t GetUymax() const override
Returns the maximum y-coordinate value visible on the pad. If log axis the returned value is in decad...
Definition TPad.h:228
Double_t GetUymin() const override
Returns the minimum y-coordinate value visible on the pad. If log axis the returned value is in decad...
Definition TPad.h:224
TList * GetListOfPrimitives() const override
Definition TPad.h:239
void SetFillStyle(Style_t fstyle) override
Override TAttFill::FillStyle for TPad because we want to handle style=0 as style 4000.
Definition TPad.cxx:5921
void SetPad(const char *name, const char *title, Double_t xlow, Double_t ylow, Double_t xup, Double_t yup, Color_t color=35, Short_t bordersize=5, Short_t bordermode=-1) override
Set all pad parameters.
Definition TPad.cxx:6018
void Modified(Bool_t flag=1) override
Definition TPad.h:414
void SetLogy(Int_t value=1) override
Set Lin/Log scale for Y.
Definition TPad.cxx:5947
void SetGridy(Int_t value=1) override
Definition TPad.h:329
Double_t GetYlowNDC() const override
Definition TPad.h:207
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:603
Int_t GetLogy() const override
Definition TPad.h:251
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
Definition TPad.cxx:1299
void SetLogx(Int_t value=1) override
Set Lin/Log scale for X.
Definition TPad.cxx:5933
Int_t GetLogx() const override
Definition TPad.h:250
Double_t GetHNDC() const override
Get height of pad along Y in Normalized Coordinates (NDC)
Definition TPad.h:211
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:866
void SubPadResized()
Slot that handles common resizing of upper and lower pad.
@ kForceHideUp
Always hide the first label of the upper y axis.
Definition TRatioPlot.h:67
@ kHideUp
Hide the first label of the upper y axis when there is low space.
Definition TRatioPlot.h:64
@ kNoHide
Do not hide labels when there is low space.
Definition TRatioPlot.h:66
@ kHideLow
Hide the last label of the lower y axis when there is low space.
Definition TRatioPlot.h:65
@ kForceHideLow
Always hide the last label of the lower y axis.
Definition TRatioPlot.h:68
TGraphErrors * fConfidenceInterval2
Stores the graph for the 2 sigma band.
Definition TRatioPlot.h:95
TAxis * GetLowerRefXaxis() const
Shortcut for:
Definition TRatioPlot.h:198
Int_t fErrorMode
Stores the error mode, sym, asym or func.
Definition TRatioPlot.h:84
TAxis * GetLowerRefYaxis() const
Shortcut for:
Definition TRatioPlot.h:207
TGaxis * fUpperGXaxisMirror
Upper mirror of the x axis.
Definition TRatioPlot.h:114
TGaxis * fLowerGXaxisMirror
Lower mirror of the x axis.
Definition TRatioPlot.h:115
TAxis * GetUpperRefYaxis() const
Gets the y axis of the object returned by TRatioPlot::GetUpperRefObject.
Float_t fLowBottomMargin
Stores the bottom margin of the lower pad.
Definition TRatioPlot.h:132
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.
Definition TRatioPlot.h:130
TH1 * fH1
Stores the primary histogram.
Definition TRatioPlot.h:79
void SetH2DrawOpt(Option_t *opt)
Sets the drawing option for h2.
virtual void Draw(Option_t *chopt="")
Draws the ratio plot to the currently active pad.
TFitResult * fFitResult
Stores the explicit fit result given in the fit residual case. Can be 0.
Definition TRatioPlot.h:107
virtual Bool_t SyncPadMargins()
Figures out which pad margin has deviated from the stored ones, to figure out what the new nominal is...
Color_t fCi1Color
Stores the color for the 1 sigma band.
Definition TRatioPlot.h:96
TGaxis * fUpperGYaxis
Upper graphical y axis.
Definition TRatioPlot.h:112
Double_t fC2
Stores the scale factor for h2.
Definition TRatioPlot.h:105
void SetLowBottomMargin(Float_t margin)
Sets the bottom margin of the lower pad.
Bool_t IsDrawn()
Check if ... is drawn.
Double_t fC1
Stores the scale factor for h1 (or THStack sum)
Definition TRatioPlot.h:104
virtual void CreateVisualAxes()
(Re-)Creates the TGAxis objects that are used for consistent display of the axes.
Float_t fLowTopMargin
Stores the top margin of the lower pad.
Definition TRatioPlot.h:131
TString fH2DrawOpt
Stores draw option for h2 given in constructor.
Definition TRatioPlot.h:87
void SetUpTopMargin(Float_t margin)
Sets the top margin of the upper pad.
TGaxis * fLowerGXaxis
Lower graphical x axis.
Definition TRatioPlot.h:111
TRatioPlot()
TRatioPlot default constructor.
Bool_t fIsUpdating
Keeps track of whether its currently updating to reject other calls until done.
Definition TRatioPlot.h:139
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.
Definition TRatioPlot.h:101
virtual ~TRatioPlot()
Destructor.
@ kErrorAsymmetric
Use TH1::GetBinErrorUp and TH1::GetBinErrorLow for the error, depending on y values.
Definition TRatioPlot.h:59
@ kErrorFunc
Use the square root of the function value as the error.
Definition TRatioPlot.h:60
@ kErrorSymmetric
Use the regular TH1::GetBinError as the error.
Definition TRatioPlot.h:58
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.
Definition TRatioPlot.h:122
void SetPadMargins()
Sets the margins of all the pads to the value specified in class members.
void SetConfidenceIntervalColors(Color_t ci1=kGreen, Color_t ci2=kYellow)
Set the confidence interval colors.
TPad * fLowerPad
The pad which contains the calculated lower plot part.
Definition TRatioPlot.h:76
TAxis * fSharedXAxis
X axis that stores the range for both plots.
Definition TRatioPlot.h:109
TString fFitDrawOpt
Stores draw option for the fit function in the fit residual case.
Definition TRatioPlot.h:89
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.
Definition TRatioPlot.h:116
virtual void SetupPads()
Setup the pads.
TAxis * fUpYaxis
Clone of the upper y axis.
Definition TRatioPlot.h:119
TVirtualPad * fParentPad
Stores the pad the ratio plot was created in.
Definition TRatioPlot.h:74
Float_t fUpTopMargin
Stores the top margin of the upper pad.
Definition TRatioPlot.h:129
void SetH1DrawOpt(Option_t *opt)
Sets the drawing option for h1.
TGraph * fRatioGraph
Stores the lower plot's graph.
Definition TRatioPlot.h:93
virtual TGraph * GetLowerRefGraph() const
Returns the reference graph for the lower pad, which means the graph that is responsible for setting ...
virtual void Browse(TBrowser *b)
Browse.
Int_t fMode
Stores which calculation is supposed to be performed as specified by user option.
Definition TRatioPlot.h:83
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.
Definition TRatioPlot.h:81
Float_t fRightMargin
Stores the common right margin of both pads.
Definition TRatioPlot.h:135
TGaxis * fLowerGYaxisMirror
Lower mirror of the y axis.
Definition TRatioPlot.h:117
Int_t fHideLabelMode
Stores which label to hide if the margin is to narrow, if at all.
Definition TRatioPlot.h:125
void CreateGridline()
Create a grid line.
TPad * fTopPad
The Pad that drawn on top on the others to have consistent coordinates.
Definition TRatioPlot.h:77
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.
Definition TRatioPlot.h:52
@ kDivideHist
Use TH1::Divide to create the ratio.
Definition TRatioPlot.h:50
@ kFitResidual
Calculate the fit residual between the histogram and a fit stored within it.
Definition TRatioPlot.h:53
@ kDifferenceSign
Calculate the difference divided by the error.
Definition TRatioPlot.h:54
@ kDivideGraph
Use TGraphAsymmErrors::Divide to create the ratio.
Definition TRatioPlot.h:51
void UnZoomed()
Slot for the UnZoomed signal that was introduced to TAxis.
virtual void Paint(Option_t *opt="")
Creates the visual axes when painting.
Bool_t fIsPadUpdating
Keeps track whether pads are updating during resizing.
Definition TRatioPlot.h:140
TH1 * fH2
Stores the secondary histogram, if there is one.
Definition TRatioPlot.h:80
Double_t fCl2
Stores the confidence level for the outer confidence interval band.
Definition TRatioPlot.h:102
TAxis * fLowYaxis
Clone of the lower y axis.
Definition TRatioPlot.h:120
TString fOption
Stores the option which is given in the constructor as a string.
Definition TRatioPlot.h:85
TPad * fUpperPad
The pad which contains the upper plot part.
Definition TRatioPlot.h:75
Bool_t fShowConfidenceIntervals
Stores whether to show the confidence interval bands. From Draw option.
Definition TRatioPlot.h:99
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.
Float_t fInsetWidth
Definition TRatioPlot.h:137
void SetLeftMargin(Float_t margin)
Sets the left margin of both pads.
Float_t fLeftMargin
Stores the common left margin of both pads.
Definition TRatioPlot.h:134
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.
Definition TRatioPlot.h:91
virtual TObject * GetUpperRefObject() const
Return the reference object.
TGraphErrors * fConfidenceInterval1
Stores the graph for the 1 sigma band.
Definition TRatioPlot.h:94
TGaxis * fUpperGXaxis
Upper graphical x axis.
Definition TRatioPlot.h:110
std::vector< double > fGridlinePositions
Stores the y positions for the gridlines.
Definition TRatioPlot.h:123
TString fH1DrawOpt
Stores draw option for h1 given in constructor.
Definition TRatioPlot.h:86
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.
Definition TRatioPlot.h:124
TString fGraphDrawOpt
Stores draw option for the lower plot graph given in constructor.
Definition TRatioPlot.h:88
Color_t fCi2Color
Stores the color for the 2 sigma band.
Definition TRatioPlot.h:97
void SetRightMargin(Float_t margin)
Sets the right margin of both pads.
TGaxis * fLowerGYaxis
Lower graphical y axis.
Definition TRatioPlot.h:113
void SetConfidenceLevels(Double_t cl1, Double_t cl2)
Sets the confidence levels used to calculate the bands in the fit residual case.
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:692
TString & Append(const char *cs)
Definition TString.h:564
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:624
static TVirtualFitter * GetFitter()
static: return the current Fitter
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
virtual void Modified(Bool_t flag=1)=0
virtual void SetLogx(Int_t value=1)=0
virtual TList * GetListOfPrimitives() const =0
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual Bool_t GetGridx() const =0
virtual Int_t GetTicky() const =0
virtual Int_t GetLogy() const =0
virtual Double_t GetHNDC() const =0
virtual Double_t GetWNDC() const =0
virtual Int_t GetTickx() const =0
virtual Int_t GetLogx() const =0
virtual Bool_t GetGridy() const =0
TLine * line
return c1
Definition legend1.C:41
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TH1F * h1
Definition legend1.C:5
return c2
Definition legend2.C:14
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Definition TMath.h:735
Definition first.py:1
th1 Draw()
#define dest(otri, vertexptr)
Definition triangle.c:1040