suppose i have a TTree in a file. this TTree has a LOT of entries and a LOT of different branches. all i want to do is to add a single float branch to it, and that branch has the same numeric value for all entries in that tree. the only way i know how to do this is (in C++):
It is slow because you are doing more than just adding a new branch, you are cloning the whole tree. Fortunately once it’s done, the branch shouldn’t take up too much space because TFiles are compressed pretty well.
your solution unfortunately won’t work, as i plan to hadd these files later on in the analysis. and as different files might have different values of that branch (even if for a given file all entries have the same value) i want to retain the event <-> branch mapping. you see what i mean?
eg.:
file1 has 100k entries, for which xsect=13
file2 has 300k entries, for which xsect=19
if i then hadd these files i want the first 100k entries to have xsect=13 and the second 300k to have xsect=19