From: Ding Hengtong <dinght_at_iopp.ccnu.edu.cn>

Date: Wed, 19 Apr 2006 10:06:48 +0800 (CST)

const Int_t n = 999999;

Double_t x[n], y[n];

for (Int_t i=0;i<n;i++) {

my >> x[i] >> y[i];

}

TGraph *gr = new TGraph(n,x,y);

}

Date: Wed, 19 Apr 2006 10:06:48 +0800 (CST)

Hi Rooters,

I want to plot a data file which has 999999 lines, I used TGraph class in ROOT but I can't get a figure but just a canvas with axis instead.

My code is listed below and according to ROOT Guide, Int_t is 4 Bytes, ranges from -2^{31} to 2^{31}-1 and 999999 is actually in this range. And I also tried "Long64_t", by which I still can't get the figure I wanted. I don't know what's wrong.

{

gROOT->Reset();

TCanvas *c1 = new TCanvas("c1"," ",200,10,700,500);
TH1F *hr = c1->DrawFrame(0.0001,0.00001,1,100);

c1->SetLogx(); c1->SetLogy(); ifstream my("test.dat");

const Int_t n = 999999;

Double_t x[n], y[n];

for (Int_t i=0;i<n;i++) {

my >> x[i] >> y[i];

}

TGraph *gr = new TGraph(n,x,y);

gr->SetLineWidth(2); gr->GetXaxis()->SetTitle("x"); gr->GetYaxis()->SetTitle("f(x)"); gr->Draw("CP");

}

Thanks for any help.

Regards,

Hengtong

-- ************************************************Received on Wed Apr 19 2006 - 04:00:43 MEST

* Hengtong Ding *

* *

* Address: Institute of Particle Physics, *

* Central China Normal University *

* Wuhan, 430079, P. R. China *

* Tel: 0086 27 6786 7946 (lab) *

* 0086 27 8715 0351 (dormitory) *

* Fax: 0086 27 6786 3213 *

* Email: dinght_at_iopp.ccnu.edu.cn *

* dinghengtong_at_hotmail.com * ************************************************

*
This archive was generated by hypermail 2.2.0
: Mon Jan 01 2007 - 16:31:58 MET
*