Graphical and variable cuts in TTree->Draw()

I added a printf in the code. I build root myself. It seems when the graphical comes 2nd then cut is not the right one

Still investigating. I found that if I add an other selection then it works.

   tree->Scan("z:theta","CUTG && z>-20","",14,4);
   tree->Scan("z:theta","z>-20 && theta>20 && CUTG","",14,4);

theta>20 in the second line does nothing but make it work… :frowning:

I found some kind of “fix” … but I do not like it. At least with that the two plots are the same:

I made a PR with the fix I found: https://github.com/root-project/root/pull/3591

Thank you for all your hard work on this issue! For clarification, was either of the cuts “correct”? Does the solution you’ve found match either order of cuts from before? Here’s what I mean:

“CUTG && z > -20” gives answer A
“z > -20 && CUTG” gives answer B
Your solution gives answer C

Is C equal to either A or B?

The one having the most entries is correct:

{
   auto file = new TFile("ptmac.root");
   auto C = new TCanvas();
   C->Divide(2,1);

   TCutG *gcut = new TCutG("CUTG",5);
   gcut->SetVarX("z");
   gcut->SetVarY("theta");
   gcut->SetPoint(0,-30,2);
   gcut->SetPoint(1,-10,5);
   gcut->SetPoint(2,-5,40);
   gcut->SetPoint(3,-50,25);
   gcut->SetPoint(4,-30,2);


   C->cd(1); tree->Draw("z","z>-20 && CUTG","",10000); /// wrong
   C->cd(2); tree->Draw("z","CUTG && z>-20","",10000); /// correct
}

The problem should be solved by https://github.com/root-project/root/pull/3591 which has been merge in the master branch.

Thank you both @couet and @pcanal!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.