Get partial data from TTree

Dear ROOT Experts,

I would like to get the BranchAddress from a TTree.
For example, when I click on a branch, it draws the distribution with title:
edmHepMCProduct_generator__HLT.obj.evt_->m_signal_process_vertex->m_position.m_x

I can also do

Events->Draw("edmHepMCProduct_generator__HLT.obj.evt_->m_signal_process_vertex->m_position.m_x");
My question is, how can I get “m_x” of each entry individually?
I would like to make an ntuple of m_x, m_y, m_z and so on.

What about Branch like this:
edmHepMCProduct_generator__ANA.obj.evt_->m_signal_process_vertex->@m_particles_out.size()

Thanks,
Quan

ROOT User’s Guide - Chapter 12. Trees and the class TTree description
ROOT User’s Guide - Chapter 12. Trees - Using TTree::MakeClass and the TTree::MakeClass description
ROOT User’s Guide - Chapter 12. Trees - Using TTree::MakeSelector and the TTree::MakeSelector description
ROOT Tutorials: Trees I/O, Queries, Graphics

Hi Wile,

From MakeClass:

edm::HepMCProduct edmHepMCProduct_generator__ANA_obj;
ch.SetBranchAddress("edmHepMCProduct_generator__ANA.obj",&edmHepMCProduct_generator__ANA_obj);

However, after ch.GetEntry(0), I got:
root [2] edmHepMCProduct_generator__ANA_obj.GetEvent()
(const class HepMC::GenEvent*)0x0

I know GenEvent is there, but I can’t access it.
Do you have any suggestions?

Thanks,

[quote=“betterwang”]Hi Wile,

From MakeClass:

edm::HepMCProduct edmHepMCProduct_generator__ANA_obj;
ch.SetBranchAddress("edmHepMCProduct_generator__ANA.obj",&edmHepMCProduct_generator__ANA_obj);

However, after ch.GetEntry(0), I got:
root [2] edmHepMCProduct_generator__ANA_obj.GetEvent()
(const class HepMC::GenEvent*)0x0

I know GenEvent is there, but I can’t access it.
Do you have any suggestions?

Thanks,[/quote]

Found the reason, I have to use ch.SetMakeClass(1);

-= removed =-