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