Getting values from a leaf

I have this root file. Here I have leafs Nx, Ny and Nz. I want to extract each of these values. If you scan the Nx, Ny and Nz values like I have done here

The row value changes after Instance is 393. So I have actually a loop running for row and another loop running for instance and I want to get these Nx, Ny and Nz values.

Please help. Thanks!

Hi @tanmaya_shree ,

see Trees - ROOT as well as ROOT: Tree tutorials for some documentation and tutorials on TTree.

To manipulate and process data in ROOT files, we recommend RDataFrame, but using it requires a shift in mindset. You will not retrieve the data, rather you will have to tell RDataFrame what it has to do with it. For example to fill a histogram with the square of Nx you would do:

ROOT::RDataFrame df("tr", "AuAu200GeV_SM_NT3_DecaysOff_0_20fm_file0.root");
auto h = df.Define("Nxsq", "Nx*Nx").Histo1D("Nxsq");


1 Like

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