Hello,

I have a tree with std::vector of coordinates (x,y,z,px,py,pz, pdgID, parentID etc). The size of the vector varies from event to event. I would like to use TTree::Draw to histogram the number of values in the vector matching my selection. I see the Length$ variable and Length$(formula) in the manual. I’ve tried the following but with no success:

// this works -> just length of vector in each event - fine - but need the selection

tree->Draw(“Length$(x)”, “”)

// I only have one ‘primary’ with parentID==0 so this should be one in each event, but is the same as before

tree->Draw(“Length$(x)”, “pz>0&&parentID==0”)

// similarly doesn’t work

tree->Draw(“Length$(x)*(pz>0&&parentID==0)”, “”")

As an example, in event 0 there are 32 values in each vector of coordinates. 12 are electrons. If I use my selection pdgID==11, I would like a single file of the histogram with the value 12.

Is this possible?

Many thanks,

Laurie

*ROOT Version:* 6.18

*Platform:* Mac OSX 10.14.6

*Compiler:* Apple LLVM version 10.0.1 (clang-1001.0.46.4)