Re: [ROOT] TTree::Drawing members of a TRef'ed object

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Oct 08 2002 - 21:53:36 MEST


Hi Axel,

What you do should work if A is in memory when you
call B.somemethod(). If not, see my previous note about TRef
earlier today.
Note that return myA.GetObject()->somemethod() will not work.
You should cast the result of myA.GetObject() in order to call
the function somemethod.

Rene Brun

On Tue, 8 Oct 2002, Axel Naumann wrote:

>   Hi,
> 
> ROOT 3.03/07, Linux 2.4 (fermi distribution 
> /Linux-2-4/v3_03_07dKCC_4_0-exception-opt-thread)
> 
> Suppose you have classes A and B in the same tree, each B TRefs an A, 
> and B forwards somemethod to A:
> 
> class A: public TObject{
> public:
> Int_t somemethod(){ return 42;}
> };
> class B: public TObject{
> public:
> Int_t somemethod(){ return myA.GetObject()->somemethod();}
> private:
> TRef myA; // ref to an A
> };
> 
> Doing a
> ??? tree->Draw("A.somemethod()")
> works,
> ??? tree->Draw("B.somemethod()")
> doesn't (drawing uninitialized values).
> 
> Is that a known limitation? Is it possible to extend the TTree method 
> calling mechanism to include TRefs? Or is it already implemented and I'm 
> using a root too old?
> 
> Cheers, Axel.
> 
> -------- Original Message --------
> Subject: BCJets
> Date: Tue, 08 Oct 2002 10:20:28 -0500
> From: Serban Protopopescu <serban@fnal.gov>
> Reply-To: serban@bnl.gov
> Organization: BNL
> To: Axel Naumann <axel@fnal.gov>
> 
> 
> 
> Hi Axel,
> 
> I made a root file using t02.35.00 TMBAnalyze and tried looking at it
> using the TMBTreeClasses_C.so created with your procedures.
> The file is in cluedo
> ~serban/yaphank/test_p13/p11_12_235_ztau.root
> 
> the parent file is p11_12_235_ztau.tmb
> 
> If you use the head version of tmb_tree you will get a complaint
> about TMBMuon, that's ok, the file was made before TMBMuon was changed.
> 
> The usual quantities are ok, but if I try on the root line
> 
> root[] TMBTree->Draw("BCJets.px()")
> 
> I get nonsense and if I try something like
> TMBTree->Draw("BCJets.E()","abs(BCJets.E())<100.0");
> 
> I get a break on an illegal instruction. The above instructions work
> fine with other objects.
> 
>       Serban
> 
> 
> 
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:13 MET