-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
bugexperimentAffects an experiment / reported by its software & computimng expertsAffects an experiment / reported by its software & computimng expertsin:TTree
Description
Check duplicate issues.
- Checked for duplicates
Description
Found while working on #20033 for the CMS DAS framework. in case one wants to print events via TTree::Scan starting from a certain entry greater than zero, if the default argument value for the nentries argument is used, i.e. TTree::kMaxEntries, then Scan doesn't even start the event loop. This is due to an integer overflow happening in the for loop condition
root/tree/treeplayer/src/TTreePlayer.cxx
Line 2715 in a1c112f
| entry<(firstentry+nentries) && !exitloop; |
$: ./ttree_scan_int_overflow.out
************************************
* Row * index * value *
************************************
************************************
Reproducer
#include <TChain.h>
#include <TFile.h>
#include <TTree.h>
#include <memory>
#include <iostream>
void make_step_zero_file(const char *name, const char *treename, int first, int last)
{
auto file = std::make_unique<TFile>(name, "RECREATE");
auto tree = std::make_unique<TTree>(treename, treename);
int index{};
int value{};
tree->Branch("index", &index);
tree->Branch("value", &value);
for (index = first; index < last; ++index)
{
value = 2 * index;
tree->Fill();
}
file->Write();
}
int main()
{
make_step_zero_file("friends-hybrid-step0-0.root", "stepzerotree", 0, 10);
auto file = std::make_unique<TFile>("friends-hybrid-step0-0.root");
std::unique_ptr<TTree> tree{file->Get<TTree>("stepzerotree")};
tree->Scan("index:value", "", "", TTree::kMaxEntries, 3);
}
ROOT version
Any
Installation method
Any
Operating system
Any
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugexperimentAffects an experiment / reported by its software & computimng expertsAffects an experiment / reported by its software & computimng expertsin:TTree
Type
Projects
Status
No status