Problem in updating the values

Hello everyone! I am facing a small problem in updating my values in a loop.
My aim is to get Kinetic energy in the end. The equation I have used is KE = Total E- mass.
The mass is a constant variable. The total energy (Total E) is in a TTree, so I need to access the values from the TTree and need to subtract mass from each entry. The total energy in TTree is labelled as DM_e. My code is yielding only 1 value. I am attaching the snippet of my code for clarity.

Any help will be appreciated.


you have the

double prev_EnergyBranch = DM_e;

only once, outside the loop. So how is it supposed to get updated within the loop then?

Sorry I could not follow you. If you mean that I must have pre_EnergyBranch=DM_e inside the loop so, it is there.
I am sorry if I sound mad to you.

@Hanane_Amrani, what are you talking about?

Thanks for quick response, Looking for same issue and i found lots of information here, Really appreciate for help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.