#ifndef _utl_VRandomSampler_h_ #define _utl_VRandomSampler_h_ #include #include typedef CLHEP::HepRandomEngine HepEngine; namespace utl { /** \class VRandomSampler VRandomSampler.h "utl/VRandomSampler.h" \brief Class to shoot random numbers given by a user-defined distribution function. \author Javier Gonzalez \date 22 Oct 2004 Major refactoring of the class \author Ralf Ulrich \date 27 Aug 2008 Another major refactoring of the class \author Darko Veberic \date 27 Aug 2009 \ingroup math */ class VRandomSampler { public: virtual ~VRandomSampler() { } /// Method to shoot random values using a given engine by-passing the static generator. double shoot(HepEngine& engine) const { return MapRandom(engine.flat()); } /// Method to shoot random values using a given engine by-passing the static generator. void shootArray(HepEngine& engine, const unsigned int size, double* const vect) const { double rand[size]; engine.flatArray(size, rand); for (unsigned int i = 0; i < size; ++i) vect[i] = MapRandom(rand[i]); } protected: virtual double MapRandom(const double rand) const = 0; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. -k" // End: