[ROOT] Writing a root file...

From: zaldy (zaldy@neutrino.kek.jp)
Date: Sat Jul 19 2003 - 23:12:34 MEST


Dear ROOT Users,


In using the methods tree_ptr->Write() and file_ptr->Write(), how does the 
TTree object communicates with the TFile object?

For instance in writing a root file, I noticed the ff. steps from the 
tutorial(filename: tree*.C) or manual (Users Man. 3.05, pp.212-214):

	1. a declaration of the form
              TFile * firstFILEinput = new TFile("INPUT.root",MODE);
              TTree * myTree= new TTree("T","Oak Tree");
            
        2. Creating branches;
              myTree->Branch(.......arguments.......);
              .......

        3. Filling the branches with data;
              branchName = data_one;
              ............. 
              myTree->Fill();

        4. actual writing;
              myTree->Write();  
              (sometimes: fileOUT->Write(); ) 
 
Now what about if one has to create another TFile object

  TFile * anotherFileOUTPUT = new TFile("OUTPUT.root",MODE), 

how will the TTree select which TFile's to direct? 
(Or, how intelligent this tree is to choose w/c from the two files to 
write?)

I did not see an explicit 
declaration on the part of TTree that it has to write to a specific file. 
So far in the manual, we are told that it is for writing or reading 
through its MODE.

In otherwords, is it INPUT.root or UTPUT.root ?
Are we assured that it will not overwrite, for instance, the file
"INPUT.root" with mode=>READ?

My apology for the many questions.

Thanks.

-- 

--------------------------------------------------------
                   Zaldy A. Nawang 
                   PS Users Room 2
                   Yon Gokan, 
                   E362, Neutrino Group, 
                   IPNS, KEK, 
                   Japan 
                    
                   e-mail: zaldy@neutrino.kek.jp
                   Tel. No. : (81) 029864 - 5387
--------------------------------------------------------



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