Adding different number of entries in a same tree

Hi,

I am trying to add aprocess generated by pythia in a tree. I want to list variables like Pt, E etc in a tree named '‘data’. But with that I want to add number of events generated (Nevents) in the process in same tree.

Of course number of entries in Nevents and all other variables like Pt, E will be different and it is giving me error while combining these two things.

I have tried using AddFriend, MergeTrees, AddBranch, TList etc. but nothing is working.

If adding different number of entries in different branches of same tree is not possible, then please tell me how the attached file is generated ?

Thank you.
single_top.root (490 KB)

CMS HEP Tutorial

[root.cern.ch/phpBB3/viewtopic.p … 499#p82499](How to store and plot an array embedded into a vector
[root.cern.ch/phpBB3/viewtopic.p … 004#p80004](Data Structure Question - Storing Data per Event

Dear Wile,

Done !!

Thank you.