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

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 9 Mar 2011 14:50:39 +0100


Sebastien,

I am surprised by this remark. A TChain is a TTree but a TTree is not a TChain.
If your case it worked for the first Tree in the TChain because this Tree was already loaded at the time of the call. I strongly suggest to use a TSelector based analysis instead of reinventing once more the wheel ::)
This will take care of the changes of files and Trees in the TChain and in addition you will be ready to run on parallel architectures too.

Rene

On 09/03/2011 14:40, 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:50:43 CET

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