Skip to content
  • Enrico Bothmann's avatar
    Fix (limited) Gaussian random number generation · de30ff96
    Enrico Bothmann authored and Frank Krauss's avatar Frank Krauss committed
    ... for the primordial kT determination. The Marsaglia algorithm was
    wrongly implemented (and missed an opportunity for optimisation by not
    storing the second Gaussian random number for later use), and the
    LimitedWeight function did not rescale its hit-or-miss comparison
    function to a maximum of 1, which was extremely inefficient for low
    kTmax, where basically every kT candidate was unnecessarily rejected by
    LimitedWeight.
    
    Other changes
    ===
    
    The Gaussian random number algorithm is now implemented in Random.H and
    supersedes the previous one, which was less efficient. At that
    opportunity, I have also removed superfluous `inline` keyword uses in
    front of member function definitions.
    
    Observations in performance measurements
    ===
    
    - When running 10k events for Examples/CI/LO_Z, this will increase event
      generation speed by ~50% when using -O3. This measurement will vary
      strongly, because events with very low kTmax seem to occur only every
      few thousand events.
    
    - There is however a significant increase in Retried events from
      Hadron_Decays (before 9, after 38).
    
    Further remarks
    ===
    
    - Note that there is a chance that this fix renders previous tuning partly
      invalid.
    
    - Note that the Primordial kT generation using a Gaussian with a fixed
      width and an a-posteriori hit-or-miss Monte-Carlo that can have a
      width that is way smaller might still be very inefficient. The Gaussian
      generates a lot of large numbers before being accepted by the
      LimitedWeight. The Gaussian takes a kTmax argument but does not use it.
      This raises the question if perhaps this is not intended behaviour in
      the first place.
    de30ff96