Re: Drawing the leafs of TTrees

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


Hi Ilya,

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).

Cheers,
Philippe

Ilya Orlov wrote:
> Hello ROOT people,
>
> I'm trying to generate a 2D plot based on the contents of TTree by calling
> tree->Draw("Amplitude:Time>>graph1","<some conditions>");
>
> Everything is perfect, the line on the plot is wonderful :)
>
> But then I'm trying to save the generated plot to a file from a C
> function by calling
> tree->Draw("Amplitude:Time>>graph1","<some conditions>","groff");
> TGraph* gr_tmp = (TGraph*) gDirectory->Get("graph1"); f
> TGraph* gr1 = (TGraph*) gr_tmp->Clone("ampl_time");
>
> In this case in my output file I see the ampl_time object being of
> type TH2D and the plot became "diffused" - instead of single line I
> have the filling of the rectangular regions like in simple 2D histo.
>
> (How) Can I save my plot with the initial parameters so that it could
> be drawn as a graph but not a histo?
>
> Thanks in advance!
>
> --
> Best regards,
> Ilya Orlov.
>
> ATLAS experiment, CERN
> Electromagnetic LAr end-cap calorimeter group
>
>
Received on Thu Aug 21 2008 - 16:21:41 CEST

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