How to set "gate" in root?

I think setting a gate on part of the data in every event is a common way in data anlysis. I am writing a DAQ but I don’t know how to set gates. I hope someone could tell me how to do it.

I guess you know what I mean about gate. But I think it’s better to explain it clearly:
In every event, the data(the leaves) are related to each other. I use one leaf or two to draw a histogram, then in the histogram, I see many lines (if 1 dimension) or many polygon shapes (if two dimension). I know only some of them make sense to me. So I use mouse or keyboard to draw several ranges or several contours on certain lines or shapes and they are saved to some objects (if there are a special class for gate). When I continue to read events or re-read the data, I can use other leaves to draw other spectrums with the constraint of the gates.

For example, I get data member 1 in every event to draw histogram1 and I set gates on the lines or polygon shapes. Then I re-read the data file. I get data member 2 in every event to draw histogram2. But if in a event data member 1 is not inside the gates I set, then the data member 2 in the same event is put away and will not be drawn onto histogram2.

I hope I don’t confuse you.

Thank you very much!

Use a TCutG object (see