Project CMSSW displayed by LXR

File indexing completed on 2023-03-17 11:01:02

```0001 #ifndef FastSimulation_Utilities_LandauFluctuationGenerator_H
0002 #define FastSimulation_Utilities_LandauFluctuationGenerator_H
0003
0004 #include "FastSimulation/Utilities/interface/BaseNumericalRandomGenerator.h"
0005
0006 #include <cmath>
0007
0008 /** Numerical Random Generator for Landau Fluctuations.
0009  * The constructor integrates and inverses the Ersaztz for the
0010  * Landau fluctuation density probability parametrization, and
0011  * the method landau() randomly a number according to this
0012  * density probability
0013  *
0014  * \author Patrick Janot, CERN
0015  * \$Date 8-Jan-2004
0016  */
0017
0018 class RandomEngineAndDistribution;
0019
0020 class LandauFluctuationGenerator : public BaseNumericalRandomGenerator {
0021 public:
0022   /// Constructor : initialization of the Random Generator
0023   LandauFluctuationGenerator() : BaseNumericalRandomGenerator(-3.5, 25.) { initialize(); }
0024
0025   /// Default destructor
0026   ~LandauFluctuationGenerator() override {}
0027
0028   /// Random generator of the dE/dX spread (Landau function)
0029   double landau(RandomEngineAndDistribution const* random) const { return generate(random); }
0030
0031   /// The probability density function implementation
0032   double function(double x) override { return ersatzt(x); }
0033
0034 private:
0035   /// Ersatzt for Landau Fluctuations (very good approximation)
0036   double ersatzt(double x) { return std::exp(-0.5 * (x + std::exp(-x))) / std::sqrt(2. * M_PI); }
0037 };
0038 #endif```