Hi all, I have saved a graphical cut inside a C file (let’s say Cut.C) and now want to use these cut conditions in another macro that deals with importing and plotting tree variables. What I’m trying to do is to inside the tree->Draw() command in the second macro I wanna use the Cut.C file. something like this below:
tree->Draw("A", "CUT CONDITIONS from CUT.C", "colz");
Any suggestions on how to do that? Thanks!
CUT.C is attached to this post. CutG.C (577 Bytes)
void cut() {
gROOT->Macro("CutG.C");
auto h = new TH2D("h","h",40,3,3.4,40,2,9);
float px, py;
for (Int_t i = 0; i < 25000; i++) {
gRandom->Rannor(px,py);
h->Fill(3*px,4*py);
}
h->Draw("col [CUTG]");
}
This example shows how to use a graphical cut defined in an external macro. Here it is use to draw a 2D histogram, but of course, you can also use it in a TTree:Draw command.
Thanks a lot for this detailed explanation. It helped.
Inside the CutG.C if you see the cutg->SetVarX("aoq57 R61-74combined"); row the blank space between aoq57 and R61 was giving an error while compiling. Got rid of that space now and worked fine. However, interested to know what might be the reason for this. Thanks again!!