Accessing size of vectors in tree

dear experts,

i’m trying to access a vector in a tree, say JetsPt, which contains various numbers of jets depending on the event and the Pt for each of them.

Directly from the command line in root, I can access say JetsPt[0] and plot it fine with


I can also, from the command line, do tree->Draw("@JetsPt.size()") and this returns the number of jets in each event.

Trying to do this in pyroot though does not seem to work. I can draw JetsPt[0] but not the size… Is there a way to do this properly?

Thanks in advance!

Sorry, I just realised that it does indeed work.

I was drawing the variable to a histogram (Draw("@PFJetsPt.size >> …")) and I had by default left the histogram name the same as the branch name… which obviously caused issues.

Thanks anyway!