Incorrect Printed Values

Dear Experts,

I’m trying to plot some quantities from my tree for “electron PID == 11.” However, when I print the values,
I find unexpected results (too small) for some variables like Py, Pz, and E, while the values for Px appear to be as expected.

Could you please provide a solution to this issue?

Here is my macro which also contains the Tree Branches.
Lepton_Theta.cc (13.4 KB)

Thank you.

Hi,

Thanks for the post. Have you checked that the values in the ROOT file are written correctly, e.g. with RDataFrame or TBrowser?

Best,
D

Hi,
I have checked those variables using TBrowser, and they have values as shown in these plots:
particle_E
particle_Py
particle_Px

Hi,

and this is what you expect? What happens if you plot them with your code? If the values in the files are good, perhaps with debugging you can find the problem in your code…

Best,
D

Hi,
For energy (E), Py or Pz, it gave me zero, so they may not be read from the tree. However, for other variables like Px, it gave me the same value I obtained using TBrowser, which confuses me.

Hi,

So for Px everything is fine, right? If yes, I think some debugging should be needed to figure out what changes for the other values perhaps.

Cheers,
D

Maybe the issue is somwehre in your special code to get the branch (TClonesArray *branch = treeReader->UseBranch("Particle");, so check what’s happening there. Also, it could be an alignment issue; maybe you can try changing the order of variables in your class, from bigger to smaller (in bytes):

class Particle_Class {
public:
    Double_t E;
    Double_t Pz;
    Double_t Py;
    Double_t Px;
    UInt_t fUniqueID;
    Int_t PID;
    //... etc

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