Re: [5.28.00a] GetBranch/SetAddress not working for TChains w/ multiple files ?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 9 Mar 2011 07:46:11 -0600


Hi,

Any action done directly to a TBranch object is explicitly lost because the liftetime of the TBranch objects is exactly the same as the TTree object (i.e. and the same as each file in the TChain).

Cheers,
Philippe.

On 3/9/11 7:40 AM, Sebastien Binet wrote:
> On Wed, 9 Mar 2011 14:27:54 +0100, Rene Brun<Rene.Brun_at_cern.ch> wrote:
>> use TChain::SetBranchAddress and TChain::SetBranchStatus
> so this code just happens to work for the special case of a TChain with
> one file (I was careful to check the methods I was calling on the TTree
> were virtual ;))...
>
>>> void MyClass::init_branches(TTree *t)
>>> {
>>> TBranch *b = t->GetBranch("some_br_name");
>>> if (!b) { panic(); }
>>> b->SetAddress(&this->m_some_var);
>>> b->SetStatus(1);
>>> }
> -s
>
Received on Wed Mar 09 2011 - 14:46:49 CET

This archive was generated by hypermail 2.2.0 : Wed Mar 09 2011 - 17:50:01 CET