I processed an ntuple with RDataFrame and now my ntuple has the bin kEntriesReshuffled set. From the documentation of RDataFrame, I understood that I can reset this bin with : ResetBit(EStatusBits::kEntriesReshuffled)
if I know what I’m doing. Well, I sorted my Friend tree such that the entries match so I believe it should be ok.
However, I’m using pyroot, and I don’t manage to reset this bin since the command given in the documentation is for c++. Do you know how to translate that command to python ?
Thanks for your quick reply ! The code accepts this command but it does not seem to have any effect. I still get the following error message :
Error in : Tree ‘DecayTree’ has the kEntriesReshuffled bit set, and cannot be used as friend nor can be added as a friend unless the main tree has a TTreeIndex on the friend tree ‘sweights’. You can also unset the bit manually if you know what you are doing.
Ok, that’s very interesting. So there are two things and btw I’m also on ROOT v6.22.
First, I was using a TChain to load my ntuple and if I check the value of the bit it’s already “False”. I modified a bit your example to reproduce this. So this might be a bug in TChain.
Second, if I load the ntuple with TFile and TTree and reset the bin correclty, I can add the Friend tree. However, if I load the ntuple with the friendtree in a RDataFrame, as it is suggested in the documentation, I get again the error message :
Error in : Tree ‘t’ has the kEntriesReshuffled bit set, and cannot be used as friend nor can be added as a friend unless the main tree has a TTreeIndex on the friend tree ‘t2’. You can also unset the bit manually if you know what you are doing.
So this might be a bug in RDataFrame. I also modified a bit your example to reproduce this.
The TChain output is misleading because it’s telling you what the bit value is for the TChain object itself, not for the underlying TTrees which it will load as it runs over entries.
The last three lines are also tricky. If you add a ROOT.DisableImplicitMT() in front, things are fine.
The reason is similar to what happens with TChain: the tree/friend pair that is actually processed is actually different in each thread and the trees are re-read from file.
A possible solution is to change the value of the bit on disk.