Re: Drawing the leafs of TTrees

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 21 Aug 2008 09:57:32 -0500


Hi Ilya,

Humm ... indeed you can not use the goff option. Instead try:

gROOT->SetBatch(kTRUE);
TCanvas *c = new TCanvas;
ntuple->Draw("px:py>>myg","","");
TGraph* gr_tmp = (TGraph*) c->FindObject("Graph"); // Use gr_tmp
delete c; // This will delete the canvas and the Graph gROOT->SetBatch(kFALSE);

Cheers,
Philippe

Ilya Orlov wrote:
> Hello Philippe,
>
> Since I do not need the graphics output in a script, I use "groff"
> option in Draw() and gPad is not being created (gPad==NULL).
> So it doesn't work...
>
> Moreover, even if I'm really drawing the plot (without "groff"
> option), the FindObject("Graph") for unknown reason returns NULL.
>
>
>
>> Replace
>> TGraph* gr_tmp = (TGraph*) gDirectory->Get("graph1");
>> with
>> TGraph* gr_tmp = (TGraph*) gPad->FindObject("Graph");
>>
>> Where the name "Graph" is hard coded (and not dependent at all on the name
>> you gave in the TTree::Draw command).
>>
>
> --
> Best regards,
> Ilya Orlov.
>
> ATLAS experiment, CERN
> Electromagnetic LAr end-cap calorimeter group
>
Received on Thu Aug 21 2008 - 16:57:40 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 21 2008 - 17:50:01 CEST