Hey guys…
I am currently working on analyzing a ROOT file containing a large TTree with multiple branches, and I am running into some trouble when using the TTree::Draw method with conditional branch selection.
Specifically, I need to apply a condition to select events where one branch (let’s call it BranchA) satisfies a specific range, and then plot the corresponding values of another branch (BranchB). Here’s a simplified version of the code I’m using:
TFile* file = TFile::Open("data.root");
TTree* tree = (TTree*)file->Get("myTree");
tree->Draw("BranchB", "BranchA > 10 && BranchA < 50");
While this works for some of my datasets, I occasionally encounter unexpected results—plots that appear empty even though I know the condition is satisfied for several entries. I’ve double-checked the branch names and values in the TTree Viewer, and everything seems fine.
I have not found any solution. Has anyone else experienced similar issues? Could it be related to the way the branches are stored or some internal optimization in TTree::Draw
? Any advice on debugging this further or alternative approaches would be greatly appreciated.
Thanks in advance!