Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMultiGraph.h
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 12/10/2000
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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#ifndef ROOT_TMultiGraph
13#define ROOT_TMultiGraph
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TMultiGraph //
19// //
20// A collection of TGraph objects //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TNamed.h"
25#include "TCollection.h"
26#include "TFitResultPtr.h"
27
28class TH1F;
29class TAxis;
30class TBrowser;
31class TGraph;
32class TF1;
33
34class TMultiGraph : public TNamed {
35
36protected:
37 TList *fGraphs{nullptr}; ///< Pointer to list of TGraphs
38 TList *fFunctions{nullptr}; ///< Pointer to list of functions (fits and user)
39 TH1F *fHistogram{nullptr}; ///< Pointer to histogram used for drawing axis
40 Double_t fMaximum{-1111}; ///< Maximum value for plotting along y
41 Double_t fMinimum{-1111}; ///< Minimum value for plotting along y
42
43 TMultiGraph(const TMultiGraph&) = delete;
45
46public:
48 TMultiGraph(const char *name, const char *title);
49 ~TMultiGraph() override;
50
51 virtual void Add(TGraph *graph, Option_t *chopt = "");
52 virtual void Add(TMultiGraph *multigraph, Option_t *chopt = "");
53 void Browse(TBrowser *b) override;
54 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
55 void Draw(Option_t *chopt = "") override;
56 virtual TFitResultPtr Fit(const char *formula ,Option_t *option="" ,Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0);
57 virtual TFitResultPtr Fit(TF1 *f1 ,Option_t *option="" ,Option_t *goption="", Axis_t rxmin=0, Axis_t rxmax=0);
58 virtual void FitPanel(); // *MENU*
59 virtual Option_t *GetGraphDrawOption(const TGraph *gr) const;
60 virtual void LeastSquareLinearFit(Int_t ndata, Double_t &a0, Double_t &a1, Int_t &ifail, Double_t xmin, Double_t xmax);
62 virtual void InitPolynom(Double_t xmin, Double_t xmax);
63 virtual void InitExpo(Double_t xmin, Double_t xmax);
64 virtual void InitGaus(Double_t xmin, Double_t xmax);
65 virtual Int_t IsInside(Double_t x, Double_t y) const;
67 TF1 *GetFunction(const char *name) const;
68 TList *GetListOfGraphs() const { return fGraphs; }
69 TIter begin() const;
70 TIter end() const { return TIter::End(); }
71 TList *GetListOfFunctions(); // non const method (create list if empty)
72 const TList *GetListOfFunctions() const { return fFunctions; }
73 TAxis *GetXaxis();
74 TAxis *GetYaxis();
75 void Paint(Option_t *chopt = "") override;
76 void PaintPads(Option_t *chopt = "");
77 void PaintPolyLine3D(Option_t *chopt = "");
78 void PaintReverse(Option_t *chopt = "");
79 void Print(Option_t *chopt="") const override;
80 void RecursiveRemove(TObject *obj) override;
81 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
82 virtual void SetMaximum(Double_t maximum=-1111);
83 virtual void SetMinimum(Double_t minimum=-1111);
84
85 ClassDefOverride(TMultiGraph,2) // A collection of TGraph objects
86};
87
88#endif
#define b(i)
Definition RSha256.hxx:100
#define a(i)
Definition RSha256.hxx:99
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
float xmin
float xmax
Class to manage histogram axis.
Definition TAxis.h:31
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
1-Dim function class
Definition TF1.h:233
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:621
static TIter End()
Pointing to the element after the last - to a nullptr value in our case.
A doubly linked list.
Definition TList.h:38
A TMultiGraph is a collection of TGraph (or derived) objects.
Definition TMultiGraph.h:34
Double_t fMinimum
Minimum value for plotting along y.
Definition TMultiGraph.h:41
TH1F * fHistogram
Pointer to histogram used for drawing axis.
Definition TMultiGraph.h:39
TMultiGraph()
TMultiGraph default constructor.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
Fit this graph with function with name fname.
void Paint(Option_t *chopt="") override
Paint all the graphs of this multigraph.
TList * GetListOfGraphs() const
Definition TMultiGraph.h:68
TList * fGraphs
Pointer to list of TGraphs.
Definition TMultiGraph.h:37
TMultiGraph & operator=(const TMultiGraph &)=delete
TIter end() const
Definition TMultiGraph.h:70
virtual void Add(TGraph *graph, Option_t *chopt="")
Add a new graph to the list of graphs.
Double_t fMaximum
Maximum value for plotting along y.
Definition TMultiGraph.h:40
virtual void SetMinimum(Double_t minimum=-1111)
Set multigraph minimum.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to each graph.
void Browse(TBrowser *b) override
Browse multigraph.
TH1F * GetHistogram()
Returns a pointer to the histogram used to draw the axis.
TF1 * GetFunction(const char *name) const
Return pointer to function with name.
virtual void LeastSquareFit(Int_t m, Double_t *a, Double_t xmin, Double_t xmax)
Least squares lpolynomial fitting without weights.
virtual void InitPolynom(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for a polynom.
void PaintPolyLine3D(Option_t *chopt="")
Paint all the graphs of this multigraph as 3D lines.
virtual void InitExpo(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for an exponential.
virtual void FitPanel()
Display a panel with all histogram fit options.
void RecursiveRemove(TObject *obj) override
Recursively remove this object from a list.
void Print(Option_t *chopt="") const override
Print the list of graphs.
TMultiGraph(const TMultiGraph &)=delete
TIter begin() const
Get iterator over internal graphs list.
virtual void LeastSquareLinearFit(Int_t ndata, Double_t &a0, Double_t &a1, Int_t &ifail, Double_t xmin, Double_t xmax)
Least square linear fit without weights.
const TList * GetListOfFunctions() const
Definition TMultiGraph.h:72
~TMultiGraph() override
TMultiGraph destructor.
void PaintPads(Option_t *chopt="")
Divides the active pad and draws all Graphs in the Multigraph separately.
virtual Option_t * GetGraphDrawOption(const TGraph *gr) const
Return the draw option for the TGraph gr in this TMultiGraph.
TAxis * GetYaxis()
Get y axis of the graph.
virtual void InitGaus(Double_t xmin, Double_t xmax)
Compute Initial values of parameters for a gaussian.
virtual Int_t IsInside(Double_t x, Double_t y) const
Return 1 if the point (x,y) is inside one of the graphs 0 otherwise.
TList * GetListOfFunctions()
Return pointer to list of functions.
virtual void SetMaximum(Double_t maximum=-1111)
Set multigraph maximum.
void PaintReverse(Option_t *chopt="")
Paint all the graphs of this multigraph reverting values along X and/or Y axis.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
TList * fFunctions
Pointer to list of functions (fits and user)
Definition TMultiGraph.h:38
TAxis * GetXaxis()
Get x axis of the graph.
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TGraphErrors * gr
Definition legend1.C:25
TF1 * f1
Definition legend1.C:11
Definition graph.py:1
th1 Draw()
TMarker m
Definition textangle.C:8