Hello!
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");
chain.Add("D:\\tree.root");
//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);
Hlist.SetOwner(kTRUE);
for (int i = 0; i < chain.GetEntries(); ++i)
{
chain.GetEntry(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 )
{
Hlist.Add(graph->Clone());
}
}
//save graphs
TFile ofile("D:\\graphs.root", "RECREATE");
Hlist.Write();
ofile.Close();
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.