I am trying to merge multiple TTrees for different datasets and apply a global tree weight to each merged tree (the script computes the weight by reading metadata stored in an external text file). I am on version 6.02.12-x86_64-slc6-gcc48-opt
In order to do this, I am using a PyROOT script (not written by me) that - for a given dataset type - basically works like this for the merging part:
TTree::Clone()for the tree in the first file processed, and store the cloned object in a cache
for the following files, take the TTree object and merge it to the cached tree via a call to
However, I am getting the following error message for every entry in the tree under question
Error in <TBranchElement::Fill>: attempt to fill branch muon_isTight while addresss is not set
both when cloning the first tree and when calling Merge() subsequently. Just fyi, ‘muon_isTight’ is a vector branch.
I guess that Clone() and Merge internally call
TBranchElement::Fill(), but I couldn’t find where this call is nested. Do you have an idea of where the problem might stem from?
Despite this, the script seems to eventually succeed at merging the trees, and that branch looks fine in the merged tree. I am however concerned about potential losses of events during the merging which could get out of my control.
I have tried also a simple hadd (which however does not suit my needs as I have to apply a weight to the merged tree as well), and I do not get that error.
Any help at debugging this would be much appreciated!
PS please find my pyROOT macro in attachment
MergeOutput.py (8.93 KB)