Diana Software
QGGraph.cc
Go to the documentation of this file.
1 #include "QGGraph.hh"
2 #include "TH1F.h"
3 #include "TList.h"
4 
6 
8 TGraph(), QGPlot()
9 {
10 }
11 
12 QGGraph::QGGraph(const QGGraph &graph) :
13 TGraph(graph), QGPlot(graph)
14 {
15 }
16 
18 {
19 }
20 
21 const char *QGGraph::GetName() const
22 {
23  return TGraph::GetName();
24 }
25 
27 {
28  SetPoints(0, 0, 0);
29 }
30 
31 void QGGraph::SetPoints(Int_t n, const Double_t *x, const Double_t *y)
32 {
33  // the following is copied from the TGraph destructor
34  delete [] fX;
35  fX = 0;
36  delete [] fY;
37  fY = 0;
38  if (fFunctions) {
39  fFunctions->SetBit(kInvalidObject);
40  TObject *obj;
41  while ((obj = fFunctions->First())) {
42  while (fFunctions->Remove(obj));
43  delete obj;
44  }
45  delete fFunctions;
46  fFunctions = 0;
47  }
48  delete fHistogram;
49  fHistogram = 0;
50 
51  // the following is copied from the TGraph constructor
52  if (!x || !y) {
53  fNpoints = 0;
54  } else {
55  fNpoints = n;
56  }
57  if (!CtorAllocate()) return;
58  n = fNpoints*sizeof(Double_t);
59  memcpy(fX, x, n);
60  memcpy(fY, y, n);
61 }
ClassImp(QGGraph) QGGraph
Definition: QGGraph.cc:5
Base class for scatter plots and pulses.
Definition: QGGraph.hh:14
virtual void Reset()
Reset the graph to an empty state.
Definition: QGGraph.cc:26
virtual ~QGGraph()
Destructor.
Definition: QGGraph.cc:17
QGGraph()
Default constructor.
virtual void SetPoints(Int_t n, const Double_t *x, const Double_t *y)
Set the points of the graph.
Definition: QGGraph.cc:31
virtual const char * GetName() const
Get graph name.
Definition: QGGraph.cc:21
Base class for GUI plots including histograms, scatter plots, pulses, and graphical cuts.
Definition: QGPlot.hh:21