TTree Draw selection difference

Hi all,
I noticed a thing which I cannot explain.
I have a chain and every event have many hits. hit_energy is a vector.

chain.Draw(“Max$(hit_energy*(hit_layer == 2))”)
chain.Draw(“Max$(hit_energy)”, “hit_layer == 2”)

I Would expect those two histograms to have the same number of entries. Equal the number of events in the chain.

First line give me this number of entries as expected = Nevents

But number of entries from 2nd line is MORE than number of events.

And it varies if I change layer (3,4,5…).

As I expected the Max$ should give me only 1 hit_max per event.
Though this is not the case.

Am I missing something?


ROOT Version: 6.18
Platform: Scientific Linux 7
Compiler: gcc 4.8.5

This is the expected behavior.
The first version is akin to:

foreach event/entry
   plot the maximum of hit_energy*(hit_layer == 2)

while the second is like:

foreach event/entry
   for each value of hit_layer
       if hit_layer is 2
           plot the maximum of hit_energy for that event/entry


1 Like

Oh, ok, thanks.
But 1 more question in:
plot the maximum of hit_energy for that event/entry

Will it take maximum of hit_energy[] (array)
or hit_energy[hit_layer.index()]

Because if I would like to do

tree.Draw("hit_energy", "hit_layer == 2")

I would like to expect hit_energy[hit_layer.index()], but not array every time selection is true

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