1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef FastSimulation_Utilities_LandauFluctuationGenerator_H
#define FastSimulation_Utilities_LandauFluctuationGenerator_H
#include "FastSimulation/Utilities/interface/BaseNumericalRandomGenerator.h"
#include <cmath>
/** Numerical Random Generator for Landau Fluctuations.
* The constructor integrates and inverses the Ersaztz for the
* Landau fluctuation density probability parametrization, and
* the method landau() randomly a number according to this
* density probability
*
* \author Patrick Janot, CERN
* $Date 8-Jan-2004
*/
class RandomEngineAndDistribution;
class LandauFluctuationGenerator : public BaseNumericalRandomGenerator {
public:
/// Constructor : initialization of the Random Generator
LandauFluctuationGenerator() : BaseNumericalRandomGenerator(-3.5, 25.) { initialize(); }
/// Default destructor
~LandauFluctuationGenerator() override {}
/// Random generator of the dE/dX spread (Landau function)
double landau(RandomEngineAndDistribution const* random) const { return generate(random); }
/// The probability density function implementation
double function(double x) override { return ersatzt(x); }
private:
/// Ersatzt for Landau Fluctuations (very good approximation)
double ersatzt(double x) { return std::exp(-0.5 * (x + std::exp(-x))) / std::sqrt(2. * M_PI); }
};
#endif
|