Re: TGraph constructor

Rene Brun (Rene.Brun@cern.ch)
Fri, 15 May 1998 10:04:08 +0200


Wouter Hulsbergen wrote:
>
> Dear all,
> I have got a question with regard to the TGraph constructor:
>
> TGraph::TGraph(Int_t n, Float_t *x, Float_t *y)
> : TNamed("Graph","Graph"), TAttLine(), TAttFill(), TAttMarker()
> {
> //*-*-*-*-*-*-*-*-*-*-*Graph normal
> constructor-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> //*-* ========================
>
> if (n <= 0) {
> Error("TGraph", "illegal number of points (%d)", n);
> return;
> }
>
> fFunctions = new TList(this);
> fHistogram = 0;
> fNpoints = n;
> fX = new Float_t[n];
> fY = new Float_t[n];
> fMaximum = -1111;
> fMinimum = -1111;
> if (!x || !y) return;
> for (Int_t i=0;i<n;i++) {
> fX[i] = x[i];
> fY[i] = y[i];
> }
> }
>
> It looks to me as if the contructor checks if `x' and `y' are NULL
> pointers (?). This would be quite nice if they were also default
> arguments, such that I can construct a TGraph, without given x and y.
> However, in the header file I cannot find the default arguments. Is there
> something wrong? Is it alright if I just add default arguments in the
> headerfile ?
>
> Regards,
> Wouter

I had already made this change in the development version.
This version 2.00/06 will appear late today or tomorrow morning.

Rene Brun