Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patches #39

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hist/hist/inc/TGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class TGraph : public TNamed, public TAttLine, public TAttFill, public TAttMarke
TGraph(const char *filename, const char *format="%lg %lg", Option_t *option="");
virtual ~TGraph();

virtual void AppendPoint(Double_t x, Double_t y);
virtual void Apply(TF1 *f);
virtual void Browse(TBrowser *b);
virtual Double_t Chisquare(TF1 *f1, Option_t *option="") const;
Expand Down Expand Up @@ -172,6 +173,7 @@ class TGraph : public TNamed, public TAttLine, public TAttFill, public TAttMarke
virtual void RecursiveRemove(TObject *obj);
virtual Int_t RemovePoint(); // *MENU*
virtual Int_t RemovePoint(Int_t ipoint);
virtual void RemoveAllPoints();
virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
virtual void SetEditable(Bool_t editable=kTRUE); // *TOGGLE* *GETTER=GetEditable
virtual void SetHistogram(TH1F *h) {fHistogram = h;}
Expand Down
22 changes: 22 additions & 0 deletions hist/hist/src/TGraph.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,11 @@ Double_t** TGraph::AllocateArrays(Int_t Narrays, Int_t arraySize)
return newarrays;
}

//______________________________________________________________________________
void TGraph::AppendPoint(Double_t x, Double_t y)
{
SetPoint(fNpoints, x, y);
}

//______________________________________________________________________________
void TGraph::Apply(TF1 *f)
Expand Down Expand Up @@ -2108,6 +2113,23 @@ Int_t TGraph::RemovePoint(Int_t ipoint)
return ipoint;
}

//______________________________________________________________________________
void TGraph::RemoveAllPoints()
{
if (fNpoints <= 0) {
return;
}

fNpoints = 0;
fMaxSize = 0;
delete[] fX;
fX = 0;
delete[] fY;
fY = 0;
if (gPad) {
gPad->Modified();
}
}

//______________________________________________________________________________
void TGraph::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
Expand Down