Const char* varexp, const char* selection

Hi,

I’m trying to work out a selection on a hepevt ntuple, which will select every photon that comes from a W and plot its transverse momentum.

I’ve been playing around with different combinations but nothing seems to work.

I was hoping I would be able to type something like this:

h101->Draw(“Phep[][1]:Phep[][2]”,“Idhep[Jsmhep%16000000/4000-1]==24 && Idhep[]==22”))

Any suggestions would be appreciated?

Also - is there a complete guide on writing varexp and selection strings? In particular the hidden iteration variable seems to work different depending on whether you explicitly use empty square [] brackets? How can I specify Phep[][1] without doing this?

I’m not interested in solutions that involve copying to arrays.

Ben

The explanation in the TTree::Draw documentation should contain the information you are looking for.

There should be no difference between idhep and idhep[] but Phep[][1] and Phep[1] (or Phep[1][]) are completely different (The first one fix the value of the 2nd index while the second one fix the value of the 2nd index while iterating through a 2 dimension array).

Cheers,
Philippe.

Thanks, I’ll take note of that in future.

In anycase, problem solved.

I think it was just a matter of getting brackets in the right place.
The mother code conversion must be:
(Jsmhep%16000000)/4000-1

Also The variables are indexed starting from 0 and not 1.
i.e. px=Phep[][0], py=Phep[][1] …

.The correct expression was:
h101->Draw(“Phep[][0]:Phep[][1]”,“Idhep[(Jsmhep%16000000)/4000-1]==24 && Idhep==13”)

(I meant leptons from Ws, not photons)

Be