Updating a weight branch while `hadd`ing

I have a number of files I want to hadd and the trees include a weight branch.
They also each have a TParameter<double> containing the sum of weights (from a prior stage in the analysis), and I want to correct the normalization of the weight branch by multiplying by (sum_weights for that file / sum(sum_weights) for all files).

What’s the easiest way to do this?

Hi,

would RDataFrame be an option? Knowing the entries range per file, you can edit the weight branch with the factor associated to the file.

Cheers,
D

It’s an option, yes. How would I determine which file an entry is from, though?

Hi,

knowing how many entries each tree has for example.

Cheers,
D

Does this mean I have to do this in single-threaded mode? If I’m reading the documentation correctly, I can’t do this in multithreaded mode, since the rdfentry_ numbers are in an unspecified order, so it might break down at file boundaries.

Hi,

if you want to chain the trees, yes.

Cheers,
D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.