njeong
1
Hello, ROOT Team
Now I am trying to read the variable like this.
{
TChain chain(“CollectionTree”);
chain.Add(“2.root”);
TChain* ch;
ch = &chain;
Int_t entries=ch->GetEntries();
cout<<endl;
cout <<"entries: " << entries << endl;
Float_t px;
ch->SetBranchAddress(“m_px”,&px);
}
However I receive
entries: 2000
Error in TChain::SetBranchAddress: unknown branch -> m_px
I mean, I can receive the result “entries” but I can not receive the “px” value.
Help me 
Thank you
-Nam
dpiparo
2
Hi Nam,
does the tree have a branch called “m_px”?
Cheers,
Danilo
njeong
3
Dear Danilo
Please refer to the image. Could you help me?
-Nam
dpiparo
4
Hi,
the branch is then m_genParticles.m_px.
Did you consider using TTreeReader for analysing your chain?
root.cern.ch/doc/master/classTTreeReader.html
Cheers,
D
njeong
5
Dear Danilo
Thank you for your reply.
However it is not working, I received same error.
entries: 2000
Error in TChain::SetBranchAddress: unknown branch -> m_genParticles.m_px
Do you have any idea?
-Nam
dpiparo
6
Before proceeding, why not moving to TTreeReader?
I did not notice that this is hanging from McEventCollection_p5_GEN_EVENT.
Please go for “McEventCollection_p5_GEN_EVENT.m_genParticles.m_px”.
Cheers,
D