Skip to content

Commit 2d2899a

Browse files
committed
[treeplayer] Add warnings if histograms/event lists cannot be found.
When users ask to append to an existing histogram or event list in a TTree::Draw expression, but the histogram/event list is not in the current directory, issue a warning that object->SetDirectory() might have been forgotten.
1 parent 4a3e250 commit 2d2899a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tree/treeplayer/src/TSelectorDraw.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ void TSelectorDraw::Begin(TTree *tree)
378378
Abort(abrt);
379379
return;
380380
}
381+
if (!fOldHistogram && hnameplus) {
382+
Warning("TSelectorDraw",
383+
"TTree::Draw was asked to fill the histogram '%s', but it was not found in the current directory."
384+
"Did you forget to call histogram->SetDirectory(gDirectory) or similar?",
385+
hname);
386+
}
381387
if (fOldHistogram && !hnameplus) fOldHistogram->Reset(); // reset unless adding is wanted
382388

383389
if (mustdelete) {

0 commit comments

Comments
 (0)