Dear all.
I hope this question wasn’t posted before. Still I couldn’t find an answer
on the internet to this spending an approopriate amount of time. The
question is the following:
Suppose I have a ROOT file with a tree, say “tree”, that has 100-ish
branches. For simplicity, those branches shall be called “branch0”, …
“branch99”, etc. Suppose, there are a number of branches, branch0-4
for which every entry has a unique value (or the combination of values
in those branches is unique for every event). So, doing something like
tree->Draw("branch6", "branch0 == 0 && branch1 == 1 && branch2 == 2 && branch3 == 3 && branch4 == 4")
would draw the histogram for branch6 with exactly one entry as the
combination (0,1,2,3,4) corresponds to exactly one event. OK, anyway.
Let’s suppose this is the case.
What I want to do now is the following: I want to use a .txt file with all
the combinations of all the events that I am interested in. The text file
could look like this:
0:1:2:3:4
5:6:7:8:9
10:11:12:13:14
15:16:17:18:19
etc.
So I need to select the events (0,1,2,3,4), (5,6,7,8,9), (10,11,12,13,14), etc.
But I’m lazy and I do not want to do a TTree::Draw() or Scan or something for every
single event in order to look at their branch6 or such. I could write a code
that reads this txt file and produces the TTree::Draw selection string by combining
the values and the branches in the proper way.
However, I’d like to ask if there is something like this already in place.
Is there a built-in way to give a txt file to TTree and the branch names of
the different columns and then to use it for a selection?
Thank you and cheers,
heico