Support running PRW on events that contain partial info
Currently, the PileupReweightingTool
will throw a warning and return if it sees that RandomRunNumber
is already present on the event info object when apply(...)
is called. This presents a problem in cases where a subset of the variables set by this function already exist: current mc20 PHYSLITE samples for example contain a pre-computed RandomRunNumber
but not a PileupWeight
, meaning the tool refuses to compute the latter.
This MR adjusts the behavior such that apply(...)
will set any of the relevant variables that aren't already present regardless of whether others already exist. Any pre-computed variables (e.g. random run number) will be read in and used rather than generating a fresh one, to ensure consistency. I've also changed the order of operations such that the pileup weight is calculated after the random run number is set, to avoid redundant generation of the random run number.