Re: Global variables list & 2 ROOT files example

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Aug 14 1998 - 16:06:31 MEST


Hi Alexander,

  for the moment the best way to get a list of all publicly
available global variables is to type .g at the root prompt and to
look for all symbols starting with a lowercase g followed by an 
uppercase letter. Eg:

root [0] .g
0x403a2334 TStyle* gStyle=0x85499f8
0x400e345c TClassTable* gClassTable=0x804ad78
0x400e5ae8 TObjectTable* gObjectTable=0x804ad98
0x400e62f4 Int_t gDebug=0
0x400e3788 TDirectory* gDirectory=0x8049cc4
0x400e62f8 TROOT* gROOT=0x8049cc4
0x400e3b8c TEnv* gEnv=0x805acb8
0x400e3f04 TFile* gFile=0x0
0x400e6d9c TSystem* gSystem=0x805aa40
0x400e62fc TRandom* gRandom=0x8548fc8
0x400e2d08 TBenchmark* gBenchmark=0x8560ca0

Concerning your question 2. There is no special magic having
two files open. Just remember, gFile is set to the last
opened file. This later can be changed by cd()'ing to another file.

TFile *fin = new TFile(...);  // gFile => fin
TFile *fout = new TFile(...); // gFile => fout
fin->cd();                    // gFile => fin
Tobject *obj = fin->Get(...);
fout->cd();                   // make fout current
obj->Write();                 // write to fout
delete fin
delete fout


Cheers, Fons.


A.V.Inyakin, IHEP, Protvino, Russia wrote:
> 
> Hi,
> 
> I have two questions.
> 
> 1. Is somewhere a list of global variables like gROOT, gFile, gDirectory ...
>    and existing functions for those?
> 
> 2. Is somewhere an example of program/macro that have an input ROOT file
>    and an output ROOT file? May be there are recommendations how to do
>    such program?
> 
> Best regards, Alexander Inyakin.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:36 MET