Adding different number of entries in a same tree


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

[ … 499#p82499](How to store and plot an array embedded into a vector
[ … 004#p80004](Data Structure Question - Storing Data per Event

Dear Wile,

Done !!

Thank you.