I’m trying to use data from a .root file in a macro. The file is organized as a TTree with all the leaves under one branch, like so:
-dstree
-x
-y
-z
To use the data, I create a TChain and add the data in from the file:
TString mainfile = "outrun_v2.root";
TChain* events = new TChain("dstree");
events->Add(mainfile);
I then try to “link” variables actually defined in my macro to the ones in the .root file, like so:
events->SetBranchStatus("dstree.x", 1);
events->SetBranchAddress("dstree.x", &e.x);
events->SetBranchStatus("dstree.y", 1);
events->SetBranchAddress("dstree.y", &e.y);
events->SetBranchStatus("dstree.z", 1);
events->SetBranchAddress("dstree.z", &e.z);
After this I don’t change the values of x, y, or z in any way. However, when I try to access the values I get numbers that don’t actually match what is in the root file. What could cause this?