Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with hadd when first file has empty tree #12510

Open
rankunlin opened this issue Mar 20, 2023 · 4 comments
Open

Issue with hadd when first file has empty tree #12510

rankunlin opened this issue Mar 20, 2023 · 4 comments
Assignees

Comments

@rankunlin
Copy link

Describe the bug

It seems hadd is confused by the zero length TTree as a first file. Pls find dummy root files in the attached ZIP to reproduce the issue. In dummyFile0.root, there're 1000 events in the dummyTree; While in dummyFile1.root, the tree is empty. So when hadd 2 files, like

hadd dummyFile01.root dummyFile0.root dummyFile1.root

Everything is okay. While if you do like

hadd dummyFile10.root dummyFile1.root dummyFile0.root

And you open the merged dummyFile10.root to get entries like

root [1] dummyTree->GetEntries()
(long long) 1000

It looks okay. But if you show the first event, like

root [1] dummyTree->Show(0)
======> EVENT:0
 index           = 0
 dummyVariable   = 2.13654e-306

The dummyVariable is definitely non-sense. It should be 0.261287 as it is in the dummyFile0.root. I guess if put the empty tree at the first in merging, ROOT is trying get a variable from an empty pointer?

Expected behavior

root [1] dummyTree->Show(0)
======> EVENT:0
 index           = 0
 dummyVariable   = 0.261287

Setup

  1. ROOT version: 6.26/06
  2. Operating system: macosx64

dummyFiles.zip

@pcanal
Copy link
Member

pcanal commented Mar 28, 2023

So far I can not reproduce this issue. I tried master on macos, 6.20 on macos. master on Linux and 6.26.06 on Linux.

Would be able to try with a newer version of ROOT? Or can you try on Linux? If neither are an option, can you provide the file dummyFile??.root that you can produce?

@rankunlin
Copy link
Author

I tried ROOT Version: 6.28/00 on Linux and the issue is still there. So I attached the merged root files here.
dummyFiles.zip

@dpiparo
Copy link
Member

dpiparo commented Feb 28, 2024

Related to #14558 . A good solution is to intervene directly in the Merge function of TTree.

@ferdymercury ferdymercury changed the title Issue with hadd Issue with hadd when first file has empty tree May 30, 2024
@MoAly98
Copy link

MoAly98 commented Jun 20, 2024

@dpiparo We are running into this problem and were wondering If there is an example on how to change the merge function for TTree to avoid the corrupt target file? Our issue is that the files we Hadd contain many trees, so it is not guaranteed that we always find a file where all the trees are non-empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants