RE: [ROOT] AddFriend of TChain

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Aug 14 2003 - 00:15:27 MEST


Hi,

Thanks for reporting this problem.  In the current code SetBranchStatus can
not be used to set the status of branch in a friend tree.  The fix will be
uploaded soon in the CVS repository.

In the meantime, you will need to use the friend tree object directly to set
its' status.

> root [13] t1.Draw("CBNT/h3780.aj_ncelllarem")

Then default name of the friend is only the last part of the path.  Try:
    t1.Draw("h3780.aj_ncelllarem")

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of
Junichi.Tanaka@cern.ch
Sent: Tuesday, August 12, 2003 4:37 PM
To: roottalk@pcroot.cern.ch
Cc: Junichi.Tanaka@cern.ch
Subject: [ROOT] AddFriend of TChain


Dear all,

I have two questions about "AddFriend" of TChain.
I'm using 3.05.05 and 3.05.07.

In CBNT/h3780, there are two variables,
   Int_t           aj_ncelllarem;
   Float_t         aj_ce_etalarem[35000];   //[aj_ncelllarem]
In CBNT/h3781, there are two variables,
   Int_t           aj_ncelllarem;
   Float_t         aj_ce_philarem[35000];   //[aj_ncelllarem]
The root file, "tau.root", was converted from ntuple by using h2root.

(1) I tried to turn on/off the status of all branches,
    even if the branches are added by "AddFriend".
    However I could get the status of branch "aj_ce_philarem"
    but I could not set the status of this branch.
    Is this correct? How should I do?

root [0] TChain t1("CBNT/h3780");
root [1] t1.Add("tau.root");
root [2] TChain t2("CBNT/h3781");
root [3] t2.Add("tau.root");
root [4] t1.AddFriend("CBNT/h3781");
root [5] t1.GetBranchStatus("aj_ce_etalarem")
(const Bool_t)1
root [6] t1.GetBranchStatus("aj_ce_philarem")
(const Bool_t)1
root [7] t1.SetBranchStatus("aj_ce_etalarem",0)
root [8] t1.SetBranchStatus("aj_ce_philarem",0)
Error in <TTree::SetBranchStatus>: unknown branch -> aj_ce_philarem

(2) In the Users Guide, there is a statemate that
we can access variables by "chainname.branchname.varname".
But I could not do this in some cases. How should I do?

root [9] t1.GetBranchStatus("CBNT/h3780.aj_ncelllarem")
(const Bool_t)0
root [10] t1.SetBranchStatus("CBNT/h3780.aj_ncelllarem",1)
Error in <TTree::SetBranchStatus>: unknown branch ->
CBNT/h3780.aj_ncelllarem
root [11] t1.SetBranchStatus("aj_ncelllarem",1)
root [12] t1.Draw("aj_ncelllarem")
root [13] t1.Draw("CBNT/h3780.aj_ncelllarem")

*ERROR 26 :
 Unknown name : "CBNT"

Best Regards,
Junichi.Tanaka@cern.ch


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



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