Re: histogram drawing from compiled program

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 21 Mar 2006 00:05:11 +0100 (MET)


You must have a TApplication object.
See examples in $ROOTSYS/test programs like hworld.cxx, stressgeom.cxx, etc

Rene Brun

On Mon, 20 Mar 2006, Kasper Peeters
wrote:

> Hi,
>
> I am trying to make a compiled program draw histograms. It contains
> the following code:
>
> TFile *output = new TFile("out.root", "RECREATE");
> TH1F *h_nele = new TH1F ("ele_n", "Number of electrons", 10, 0.0, 10.0);
>
> h_nele->Fill(2);
> h_nele->Draw();
>
>> From CINT, this works as expected (it shows the histogram). However,
> from a compiled program, it doesn't show the histogram window
> (sleeping after the last line also doesn't help, it just delays the
> program). I tried to manually create a TCanvas, but that didn't make
> any difference either. The out.root file gets filled correctly, and I
> can browse the histogram using a TBrowser, but I would like to make
> the histogram pop up automatically.
>
> What am I missing? (sorry if this is a FAQ).
>
> Thanks,
> Kasper
>
>
>
Received on Tue Mar 21 2006 - 00:05:15 MET

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