#ifndef _utl_Probability_h_ #define _utl_Probability_h_ /** \file Utility class to provide often used probability distributions in radio reconstruction. In addition this singleton class can return random variables. Currently only Fisher is implemented. \author Christian Glaser \ingroup radio */ #include #include #include #include namespace utl { /** \class Probability \brief Utility class to provide often used probability distributions in radio reconstruction. In addition this singleton class can return random variables. Currently only Fisher is implemented. \author Christian Glaser */ class Probability : public Singleton { public: // optionally set seed of random generator, by default the seed is chosen // randomly, so use this option only if you want a reproducible result void SetSeed(const unsigned int seed); /// evaluates the Rayleigh PDF of sigma at position x static double GetRayleighPDF(const double x, const double sigma); /// evaluates the Rayleigh CDF of sigma at position x static double GetRayleighCDF(const double x, const double sigma); // evaluates the normal pdf with mu and sigma at position x static double GetNormalPDF(const double x, const double mu, const double sigma); /* Evaluates the von Mises pdf with kappa at position x * κ is a measure of concentration (a reciprocal measure of dispersion, so 1/κ is analogous to σ^2). * If κ is zero, the distribution is uniform, and for small κ, it is close to uniform. * If κ is large, the distribution becomes very concentrated about the angle μ * with κ being a measure of the concentration. In fact, as κ increases, * the distribution approaches a normal distribution in x with mean μ and variance 1/κ. */ static long double GetVonMisesPDF(const double x, const double mu, const double kappa); // evaluates the Fisher pdf with kappa at position x static double GetFisherPDF(const double x, const double kappa); // evaluates the Fisher CDF with kappa at position x static double GetFisherCDF(const double x, const double kappa); /// returns a Rayleigh distributed random variable double GetRandomRayleigh(const double sigma); /// returns a Fisher distributed random variable double GetRandomFisher(const double k); /// returns a Fisher distributed vector, this is the angle between returned /// and given vector is Fisher distributed utl::Vector GetRandomFisher(const utl::Vector& meanDirection, const double k); /// returns a random vector that has an angle alpha wrt the given vector utl::Vector GetFisher(const utl::Vector& meanDirection, const double alpha); private: Probability(); TVector3 GetRandomVectorOnSphere(); TRandom3 fRand; friend class Singleton; }; } #endif