Proposal for direct sampling from histogram
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:
- Load a 2D histogram (info vs. oneOverP) from a ROOT TFile in LamarrData
- Every profile of the 2D histogram at fixed oneOverP is considered as an independent 1D histogram (and named a "row")
- For each row, compute the cumulative distribution
C
- For
nSamples
values ofc \in [0,1)
, find the valuex
ofinfo
for whichC(x) = c
. Store them asC^{-1}(c}
.
At run time:
- Given oneOverP, find and load the corresponding
row
. - Throw a random number
r
from a uniform distribution between 0 and 1 - Among the
nSamples
values ofc
, find the maximalc_1
and the minimalc_2
for whichc_1 < r < c_2
- Retrieve
C^{-1}(c_1)
andC^{-1}(c_2)
and obtainC^{-1}(r)
by interpolation.
Edited by Lucio Anderlini