Cut a TTree using a string or char


I’ve built myself a very simple TTree using the following:

my_tree->ReadFile("input_file.txt", "x:y:z:volume/C")
Is it/how is it possible to plot x:y:z while restraining a volume name? I.e. something like

would be my first guess, but it isn’t recognized as a valid input. I’ve tried a few other ways I could think of to try to cut on strings or char*s (tossing strcmp in there, using apostrophes instead of escaped quotes, etc.) but nothing has worked. Thanks for any thoughts.

If you notice in my last post, there was a simple formatting error:

my_tree->Draw("x:y:z", "volume==\"OuterShell\")

should have been

my_tree->Draw("x:y:z", "volume==\"OuterShell\"")

This is the proper syntax for checking of a string or char or Char_t in a Tree. :blush:

Must have just hit a low spot in my google skills. Adding “roottalk” to a google query brought up a few relavent references like

[url]Cut on TTree variable that is a string?

which illustrates how to use strstr to look for partial string occurances, which was exactly what I was looking for.