Re: Displaying graphs before main() returns

From: Ding Hengtong <dinght_at_iopp.ccnu.edu.cn>
Date: Tue, 30 May 2006 08:46:14 +0800 (CST)

 Hi Alex,

    I can not reproduce your problem on my machine whose kernel is

2.4.20-8smp #1 SMP, gcc version 3.2.2,root version 5.11/01.

    I named the following file "main.C", and typed ".x main.C" at Root prompt. And then historgram and canvas poped out. Maybe, I guess, there is something wrong with your exec method.

    Best wishes,

 Hengtong

On Mon, 29 May 2006, Alex Mott wrote:

> Hi,
>
> I am trying to simply display a set of graphs in a some canvases, and
> then prompt the user to save the file. I create the TCanvases using
> TCanvas *mycanv = new TCanvas("mycanv","name");
> and then draw to it using the Draw() method from a TH1F, and nothing
> is displayed (the Canvas isn't even created. Even if the canvas is
> previously created in a different instance of the program, nothing is
> drawn to it. Only once the program has finished, and the main loop
> has returned are the canvases created and the TGraphs plotted to the
> canvases. If anyone knows how to fix that, it would be much
> appreciated.
>
> Here is some code which generates the problem (this should compile on
> any build as far as I know):
> #include <iostream>
> #include "TROOT.h"
> #include "TH1.h"
> #include "TCanvas.h"
>
> int main(){
> char save='n';
> TH1F *qw = new TH1F("qw","test",100,0,5);
> for(int i=0;i<100;i++)
> qw->Fill(1);
> TCanvas *qe = new TCanvas("qe","");
> qw->Draw();
> cout << endl << "Save?: (y/n)";
> cin >> save;
> return 0;
> }
>
>
>
>
> Alexander Mott
> armott_at_mit.edu
> Undergraduate
> Department of Physics
> Massachusetts Institute of Technology
>
>
>

-- 
************************************************
 *             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 Tue May 30 2006 - 02:40:31 MEST

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