Root Draw class with branch


ROOT Version: 6
Platform: Scientific 6.10
Compiler: Not Provided


Dear experts,

I am wondering if there is the way to select events which has different entries by using draw method.
For example, Tree has branches : “MET”, “n_jets”, “track_pt”. Then I want to draw “track_pt” and I could do this :
Tree->Draw("track_pt", "MET>100 && n_jets>0 && track_pt >30")

The thing I wonder is : “MET” and “n_jets” are event-level variable(1 value per event), but “track_pt” is vector(several tracks per event), so number of entries are different between “MET” and “track_pt”.
What method I can get correctly filled “track_pt” in this case?
Not necessarily Draw method.

Thanks! Sang-il

This should be fine except that you may suffer from (recently discovered):

Hi Wile, I’m sorry that I couldn’t understand yet. What was solution? I read thread and saw the bug was fixed. But still I don’t get how to fill vector variable with selecting event-level variable.

Your “Draw” command will do exactly what you want (unless @couet disagrees).

Just take some recently “fixed version”, i.e. ROOT 6.10/10, 6.12/08, 6.14/10, 6.16/02 or best 6.18/00.

I agree. The bug mentioned before is fixed in the listed versions above. Better use one of those. To make sure the bug is fixed in your version you may try the reproducer mentioned in the Jira ticket

Interesting! Then which “track_pt” will be selected"? Let’s say the first event has 3 tracks, only 2 tracks >30.
Tree->Draw(‘track_pt”, “MET>100 && n_jets>0 && track_pt >30”)
Is this command shows 2 entries in histogram? Or just first track is checked and others are not considered?

Learning by doing :thinking:
Trial and error :wink:

Actually I’ve tested 3 cases:

  1. Tree->Draw(‘track_pt”, “MET>100”)
  2. Tree->Draw(‘track_pt”, “track_pt>0”)
  3. Tree->Draw(‘track_pt”, “MET>100 && track_pt>0”)

Case 1 and 3 gave same entries in histogram but case 2 has much more entries. If my logic is correct, case 2 and 3 should be same and have more entries than case 1. Let me investigate a bit more.
Thank you for your kind help. Sang-il

So, try also (I assume that the “MET” is a “scalar”, i.e. one value per entry) Tree->Draw("track_pt", "MET<=100") and Tree->Draw("track_pt", "MET<=100 && track_pt>0").

Dear Wile,

I tried several tests and got conclusion : ‘Draw’ choose minimum loop of branch entries.

test1:"MET>=100"
test2:"MET>=100 && tracks_pt>0"

Draw
If you see legend, there is entries number. If mixture of variable(test2 case), then event loop seems to choose minimum value, so MET entries are decreased.
And I have searched “Draw” reference(here) and found this sentence : " In summary, TTree::Draw loops through all unspecified dimensions. To figure out the range of each loop, we match each unspecified dimension from left to right (ignoring ALL dimensions for which an index has been specified), in the equivalent loop matched dimensions use the same index and are restricted to the smallest range (of only the matched dimensions). When involving variable arrays, the range can of course be different for each entry of the tree."

I’m not sure it is explaining my case.
Cheers, Sang-il

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