Skip to content

Proposal for direct sampling from histogram

Lucio Anderlini requested to merge WIP_Lamarr_HistSampler into WIP_Lamarr

Please consider this idea of sampling the additional info of the track (chi2PerDoF, nDoF, likelihood and GhostProb) directly from 2D histograms via profiling.

The complexity of the algorithm is all in initialization, sampling has O(ln_2(Nbins)) complexity and does not affect significantly the timing of the propagator.

Interpolation is used to mitigate the dependence on the choice of binning.

.

Key idea of the algorithm:

  1. Load a 2D histogram (info vs. oneOverP) from a ROOT TFile in LamarrData
  2. Every profile of the 2D histogram at fixed oneOverP is considered as an independent 1D histogram (and named a "row")
  3. For each row, compute the cumulative distribution C
  4. For nSamples values of c \in [0,1), find the value x of info for which C(x) = c. Store them as C^{-1}(c}.

At run time:

  1. Given oneOverP, find and load the corresponding row.
  2. Throw a random number r from a uniform distribution between 0 and 1
  3. Among the nSamples values of c, find the maximal c_1 and the minimal c_2 for which c_1 < r < c_2
  4. Retrieve C^{-1}(c_1) and C^{-1}(c_2) and obtain C^{-1}(r) by interpolation.
Edited by Lucio Anderlini

Merge request reports

Loading