Re: [ROOT] TGraph won't work!

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Aug 16 2002 - 21:55:44 MEST


Hi,

Simply replace:
  Int_t dum[24]
by
  Float_t dum[24]

The TGraph constructors accept all types, but not mixed types.

Rene Brun


On Fri, 16 Aug 2002, Ahmet Sedat Ayan wrote:

> Hi All,
>  I am having a problem that I do not really understand.
> I am trying to plot an array (Int_t dum[24]) against the other
> (Float_t le_ped[24]) and getting the following error:
> 
> ------------------
> Error: Can't call TGraph::TGraph(24,dum,le_ped) in current scope
> FILE:kings.C LINE:22
> Possible candidates are...
> filename       line:size busy function type and name  (in TGraph)
> (compiled)        0:0    0 public: TGraph TGraph(void);
> (compiled)        0:0    0 public: TGraph TGraph(Int_t n);
> (compiled)        0:0    0 public: TGraph TGraph(Int_t n,const Int_t*
> x,const Int_t* y);
> (compiled)        0:0    0 public: TGraph TGraph(Int_t n,const Float_t*
> x,const Float_t* y);
> (compiled)        0:0    0 public: TGraph TGraph(Int_t n,const Double_t*
> x,const Double_t* y);
> (compiled)        0:0    0 public: TGraph TGraph(const TVector& vx,const
> TVector& vy);
> (compiled)        0:0    0 public: TGraph TGraph(const TVectorD& vx,const
> TVectorD& vy);
> (compiled)        0:0    0 public: TGraph TGraph(const TH1* h);
> (compiled)        0:0    0 public: TGraph TGraph(TGraph&);
> filename       line:size busy function type and name  (in TNamed)
> filename       line:size busy function type and name  (in TObject)
> filename       line:size busy function type and name  (in TAttLine)
> filename       line:size busy function type and name  (in TAttFill)
> filename       line:size busy function type and name  (in TAttMarker)
> *** Interpreter error recovered ***
> -----------------------------------------------------
> 
> 
> And the code is :
> 
> ----------------------------------
> {
>    // reading file
>   Float_t re_ped[24],rh_ped[24],le_ped[24],lh_ped[24];
>   FILE *pedestalfile=fopen("ped410.dat","r");
>   Int_t n=0;  cout<<"Reading Pedestal Data"<<endl;
>   while
> (fscanf(pedestalfile,"%f%f%f%f",&re_ped[n],&rh_ped[n],&le_ped[n],&lh_ped[n])
> )
>     {
>       n++;   // counting number of entries for the graph
>       if (n == 24) break;
>     }
>   fclose(pedestalfile);
>   Int_t dum[24]
> ={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};
>   for(Int_t i=0;i<24;i++){
>   printf("%f,%f,%f,%f,%d\n",re_ped[i],rh_ped[i],le_ped[i],lh_ped[i],i);
>   }
> 
> 
> 
>   TGraph *gr = new TGraph(24,dum,le_ped);
> 
> 
>     gr->Draw("AP");
> 
> 
> 
> 
> 
>  }
> ------------------------------------------------------
> 
> Could anyone help me understand what I am doing wrong here?
> 
> thanks a lot,
> ahmet.
> 
> 
> 
> ***************
> 
> Ahmet Sedat Ayan
> 
> Physics & Astronomy Dept.
> Van Allen Hall
> University of Iowa
> Iowa City, IA, 52242
> 
> Voice      : (++ 1 319) 335-1941 (W) (GMT-6)
> Occupation : Ph.D Candidate (But still dreamer!)
> e-mail     : ayan@cms.physics.uiowa.edu
> web        : http://jazz.physics.uiowa.edu/~ayan
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:04 MET