RPCChargeGenerator.h
Go to the documentation of this file.
1 #ifndef _RPCChargeGenerator_h_
2 #define _RPCChargeGenerator_h_
3 
4 #include <vector>
5 #include <utl/Math.h>
6 #include <utl/RandomEngine.h>
7 #include <boost/math/special_functions/gamma.hpp>
8 
9 
10 namespace CLHEP {
11  class RandGeneral;
12 }
13 
14 namespace RPCSimulatorLX {
15 
16 
18 
19  public:
20 
21  RPCChargeGenerator(double k0, double theta0, double referenceAngle);
22  virtual ~RPCChargeGenerator();
23 
24  double GetCharge(double angle);
25 
26  private:
27 
28  double fK0;
29  double fTheta0;
31  double fMinSecTheta;
32  double fMaxSecTheta;
33 
34  unsigned int fNumberOfChargeBins;
35  unsigned int fNumberOfChargePDF;
36 
37  std::vector<CLHEP::RandGeneral *> fListChargePDF;
38  std::vector<double> fListMinCharge;
39  std::vector<double> fListMaxCharge;
40 
43 
44  private:
45 
46  void Initialize(void);
47 
48  inline double GammaDistribution(double x, double k, double theta) {
49  return (pow(x,k-1.0) * exp(-x/theta)/(exp(utl::LogGamma(k)) * pow(theta,k)));
50  };
51 
52  inline double CumulativeGammaDistribution(double x, double k, double theta) {
53  return (boost::math::gamma_p(k,x/theta));
54  // gamma_p(k,x) is incomplete upper gamma
55  };
56 
57  inline double InverseCumulativeGammaDistribution(double y, double k, double theta) {
58  return (theta*boost::math::gamma_p_inv(k, y));
59  };
60 
61 };
62 
63 } // End namespace RPCSimulatorLX
64 
65 #endif
66 
double GammaDistribution(double x, double k, double theta)
double pow(const double x, const unsigned int i)
double LogGamma(const double x)
Wraps the random number engine used to generate distributions.
Definition: RandomEngine.h:27
RPCChargeGenerator(double k0, double theta0, double referenceAngle)
double InverseCumulativeGammaDistribution(double y, double k, double theta)
std::vector< CLHEP::RandGeneral * > fListChargePDF
double CumulativeGammaDistribution(double x, double k, double theta)

, generated on Tue Sep 26 2023.