Discussion:
[ROOT] saving a graph into a root file
Luis March Ruiz
2004-06-10 14:14:25 UTC
Permalink
Hi rooters,

I have created a few graphs that they have been saved into a root file :

for example,

c1 = new TCanvas("c1","Graph Example",200,10,700,500);
gr = new TGraph(n_bin,bin_x,bins_comp);
gr -> SetTitle("(difference between test and norm ref histos)/sigma");
gr -> SetMarkerStyle(21);
gr -> SetMarkerColor(3);
gr -> SetLineColor(3);
gr -> SetMarkerSize(0.5);
gr -> Draw("AP");
line_1 = new TLine(range_start,0.0,range_end,0.0);
line_1 -> SetLineWidth(0.5);
line_1 -> SetLineStyle(3);
line_1 -> Draw();
//c1 -> SaveAs("diff_histos.ps");
c1 -> Update();
//c1 -> Modified();


The problem is when I open the root file ... the graph has been saved
with other Draw() options ... the graph is plotted with a line between
dots, as the option Draw("ALP") ... I don't understand it, histograms have
been saved as well, but they have the Draw() options that I selected,
Draw("AP").

I'm working with an old version, is it a problem ?
What am I doing wrong ?

RedHat Linux 7.3 2.96-112, ROOT Version 3.04/02.

Thanks.

Best regards,

Luis
Rene Brun
2004-06-10 16:51:47 UTC
Permalink
It is diffiucult to understand what you mean. I see no statement writing
to a ROOT file.
Please send the shorted possible running script showing your problem.

Rene Brun

On
Post by Luis March Ruiz
Hi rooters,
for example,
c1 = new TCanvas("c1","Graph Example",200,10,700,500);
gr = new TGraph(n_bin,bin_x,bins_comp);
gr -> SetTitle("(difference between test and norm ref histos)/sigma");
gr -> SetMarkerStyle(21);
gr -> SetMarkerColor(3);
gr -> SetLineColor(3);
gr -> SetMarkerSize(0.5);
gr -> Draw("AP");
line_1 = new TLine(range_start,0.0,range_end,0.0);
line_1 -> SetLineWidth(0.5);
line_1 -> SetLineStyle(3);
line_1 -> Draw();
//c1 -> SaveAs("diff_histos.ps");
c1 -> Update();
//c1 -> Modified();
The problem is when I open the root file ... the graph has been saved
with other Draw() options ... the graph is plotted with a line between
dots, as the option Draw("ALP") ... I don't understand it, histograms have
been saved as well, but they have the Draw() options that I selected,
Draw("AP").
I'm working with an old version, is it a problem ?
What am I doing wrong ?
RedHat Linux 7.3 2.96-112, ROOT Version 3.04/02.
Thanks.
Best regards,
Luis
Luis March Ruiz
2004-06-10 17:35:20 UTC
Permalink
Hi Rene,

maybe it's better if you can have a look at it here:

http://atlas.web.cern.ch/Atlas/GROUPS/PHYSICS/SOFT_VALID/KitValidation/macro_2.html

here it's the macro.

Some graphs and histograms have been saved into a root file, I plot
them (both, graphs and histos) with the same Draw options, but when I open
the root file the graphs are plotted with different options (histos are
OK).

What am I doing wrong ?

Thanks.

Best regards,

Luis
Post by Rene Brun
It is diffiucult to understand what you mean. I see no statement writing
to a ROOT file.
Please send the shorted possible running script showing your problem.
Rene Brun
On
Post by Luis March Ruiz
Hi rooters,
for example,
c1 = new TCanvas("c1","Graph Example",200,10,700,500);
gr = new TGraph(n_bin,bin_x,bins_comp);
gr -> SetTitle("(difference between test and norm ref histos)/sigma");
gr -> SetMarkerStyle(21);
gr -> SetMarkerColor(3);
gr -> SetLineColor(3);
gr -> SetMarkerSize(0.5);
gr -> Draw("AP");
line_1 = new TLine(range_start,0.0,range_end,0.0);
line_1 -> SetLineWidth(0.5);
line_1 -> SetLineStyle(3);
line_1 -> Draw();
//c1 -> SaveAs("diff_histos.ps");
c1 -> Update();
//c1 -> Modified();
The problem is when I open the root file ... the graph has been saved
with other Draw() options ... the graph is plotted with a line between
dots, as the option Draw("ALP") ... I don't understand it, histograms have
been saved as well, but they have the Draw() options that I selected,
Draw("AP").
I'm working with an old version, is it a problem ?
What am I doing wrong ?
RedHat Linux 7.3 2.96-112, ROOT Version 3.04/02.
Thanks.
Best regards,
Luis
Philippe Canal
2004-06-10 17:29:40 UTC
Permalink
Hi Luis,

If you double click in the browser on a TGraph is draw by default using the option "ALP".
The drawing option of the TGraph is not part of the TGraph object but of the Pad and/or
canvas. If you want to prefer the visual aspect, save the canvas instead of the graph.

Cheers,
Philippe.

-----Original Message-----
From: owner-***@pcroot.cern.ch
[mailto:owner-***@pcroot.cern.ch]On Behalf Of Luis March Ruiz
Sent: Thursday, June 10, 2004 9:14 AM
To: ***@cern.ch
Subject: [ROOT] saving a graph into a root file



Hi rooters,

I have created a few graphs that they have been saved into a root file :

for example,

c1 = new TCanvas("c1","Graph Example",200,10,700,500);
gr = new TGraph(n_bin,bin_x,bins_comp);
gr -> SetTitle("(difference between test and norm ref histos)/sigma");
gr -> SetMarkerStyle(21);
gr -> SetMarkerColor(3);
gr -> SetLineColor(3);
gr -> SetMarkerSize(0.5);
gr -> Draw("AP");
line_1 = new TLine(range_start,0.0,range_end,0.0);
line_1 -> SetLineWidth(0.5);
line_1 -> SetLineStyle(3);
line_1 -> Draw();
//c1 -> SaveAs("diff_histos.ps");
c1 -> Update();
//c1 -> Modified();


The problem is when I open the root file ... the graph has been saved
with other Draw() options ... the graph is plotted with a line between
dots, as the option Draw("ALP") ... I don't understand it, histograms have
been saved as well, but they have the Draw() options that I selected,
Draw("AP").

I'm working with an old version, is it a problem ?
What am I doing wrong ?

RedHat Linux 7.3 2.96-112, ROOT Version 3.04/02.

Thanks.

Best regards,

Luis
Loading...