Is there any way to transform TCut in bool type?


I want to transform TCut in bool type, but I don’t know how to do this.
The next code illustrates my problem:

//create and fill chain
TChain chain("t1");

//Set branches
Double_t a;
TMultiGraph* graph = 0;

chain.SetBranchAddress("a", &a);
chain.SetBranchAddress("gr", &graph);

//Create cut and draw "a"
TCut cut = "a > 0";
chain.Draw("a", cut);

//Create Hlist in order to save graphs
TObjArray Hlist(0);

for (int i = 0; i < chain.GetEntries(); ++i)
	bool cut_bool = a > 0; //It is very conveniently to transform "cut" variable in bool type. But how to do this? 
	if(cut_bool )

//save graphs
TFile ofile("D:\\graphs.root", "RECREATE");

So, it will be very conveniently to transform “cut” variable in bool type because in real program I have complex conditions I don’t want to use copy-paste technique.

Coud you help me?
Thank you in advance.

The doc says:

“A specialized string object used for TTree selections.”

In your loop I do not see where you are using the TCut .
You have a normal boolean “cut_bool”… which is fine .


I want to draw “a” variable and save graphs with equal cut conditions at the same time.
As I undestand, I have to use loop if I want to save graphs.
Yes, I can move draw method in the loop, but maybe there is a more simple solution.

The graph is generated by the TTree::Draw() method.
In your macro you have only one call to Draw().
So will have on one graph.