Re: [ROOT] How to view "myCanvas.C" ?

From: Frankland John (frankland@ganil.fr)
Date: Tue Aug 19 2003 - 13:57:29 MEST


Hi Zaldy,

If you SaveAs "*.C", ROOT will generate a macro script that will 
regenerate the
canvas in its current state if you execute it (".x myCanvas.C"). Note 
however
that if e.g. you open a ROOT file and plot a histogram contained in that 
file,
then save the canvas as myCanvas.C, this script will not contain code to 
open
the file and get the histogram in question then plot it. Rather, it will 
create a
histogram from scratch with e.g. bin contents that are exactly the same 
as the
histogram you plotted from your file.

If you SaveAs "*.root" then the canvas (or rather, the TCanvas object) 
will be
streamed into a ROOT file, along with all of the objects it contains: 
TH*, TFrame,
TPaveStats, etc. etc. To continue with the previous example of plotting 
a histogram,
in this case when you regenerate the canvas you drew (by e.g. opening 
myCanvas.root
in a TBrowser and double-clicking the TCanvas object it contains) the 
histogram you
see is once again an exact copy of the one in your original file.

The usefulness of these two options is that if you create a figure and 
then later on
decide that you want to change the presentation, if you have a .C or a 
.root then you
can do it easily, just open the file or execute the macro and start from 
where you left
off. In the case of the .C you have the bonus of some (possibly) 
reusable code for e.g.
positioning text or symbols etc. etc.

Hope this helps
John

zaldy wrote:

>Dear ROOTers,
>
>Sorry if this is too easy.
>
>But I have never used the saving of the 
>Canvas or Pad as "myCanvas.C". 
>Usually, SaveAs "*.ps", "*.eps", or "gif". But I didnt save yet as ".root"
>or "*.C"
>
>I just want to explore the use of this.
>When is the feature (*.C or *.root) useful?
>
>If the canvas is save as "myCanvas.C",
>how (what is the command) do we view the original picture using the 
>myCanvas.C?
>
>Thanks
>  
>

-- 

ganil logo <http://www.ganil.fr>
John D. Frankland <mailto:frankland@ganil.fr>
Beam Coordinator
GANIL
B.P. 55027
14076 CAEN Cedex 05

*tel:* +33 (0)231454628
*fax:* +33 (0)231454665



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET