Getting rid of some branches in ntpl files using h2root

I would like to get rid of some branches after conversion ntpl files to root using h2root because I need only PID numbers,first mothers and 4-momentums.
Actually I changed h2root code, except momentum branch they(Idhep,Nhep,Jsmhep) were ok.Momentums values were not a number(nan).I could not read those values
Also if possible, I want to decrease the number of particles per event to 30 which I only need.
Can anybody help me with these ?

see tutorials copytree2.C, copytree3.C