Hi Enric,
That clarifies a lot, thank you!
When I run the code
import ROOT
from ROOT import TTree
file = TFile('myFile.root')
tree = file.TCluster
entries = 0
clustEntries = 0
for entry in tree:
entries += 1
for jj in entry.clustADCs:
clustEntries += 1
And then return the values for each, I get entries = 199978
and clustEntries = 3358152
. The value of clustEntries
matches the number of entries in the histogram. So this is an easy fix then: just run a loop that returns both the number of entries in the tree and the leaf of interest. In order to extract the data I followed the tutorial at http://lcgapp.cern.ch/project/pi/Examples/PyAIDAProxy/examples/hippoDemo.html, but it appears that this link is no longer working. The code is very similar to the code reproduced in this post: Reading Values using PyROOT, which was based on code at a similar link (http://lcgapp.cern.ch/project/pi/Examples/PyAIDAProxy/examples/readTree.py, which is also no longer working). From your previous comments, each event does contain a variable array with multiple entries, and the number of clusters for each event are specified in the nclust
leaf in the tree. I have been looking for a solution but have found no simple way to run a loop to extract the array of values in the clustADCs
branch when running the loop over the events. For instance, the .GetValue()
function only returns the first element of the array stored for each event. Is there a way to simply extract the array with a function?
Thank you,
Stephen