RE: Large array size problem in TGraph

From: Fine, Valeri <fine_at_bnl.gov>
Date: Wed, 19 Apr 2006 00:53:30 -0400


Dear Hengtong,

Excuse me, I'll check the code tomorrow morning only. Mean time, can you explain what kind of display you are going to use to see your 999999 points long graph? The regular very good monitor is about 1600 pixels wide. One needs 600 monitors to be able to see your figure.

Can you reduce slightly the number of the points just to be able to see it. It may help significantly.

My best regards, Valeri

From: Ding Hengtong
Sent: Tue 4/18/2006 10:06 PM
To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] Large array size problem in TGraph

 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

-- 
 ************************************************

* 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 * ************************************************
Received on Wed Apr 19 2006 - 06:53:39 MEST

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