VRandomSampler.h
Go to the documentation of this file.
1 #ifndef _utl_VRandomSampler_h_
2 #define _utl_VRandomSampler_h_
3 
4 #include <utl/config.h>
5 #include <CLHEP/Random/Random.h>
6 
7 typedef CLHEP::HepRandomEngine HepEngine;
8 
9 
10 namespace utl {
11 
33 
34  public:
35  virtual ~VRandomSampler() { }
36 
38  double shoot(HepEngine& engine) const
39  { return MapRandom(engine.flat()); }
40 
42  void
43  shootArray(HepEngine& engine, const unsigned int size, double* const vect)
44  const
45  {
46  double rand[size];
47  engine.flatArray(size, rand);
48  for (unsigned int i = 0; i < size; ++i)
49  vect[i] = MapRandom(rand[i]);
50  }
51 
52  protected:
53  virtual double MapRandom(const double rand) const = 0;
54 
55  };
56 
57 }
58 
59 
60 #endif
61 
62 // Configure (x)emacs for this file ...
63 // Local Variables:
64 // mode: c++
65 // compile-command: "make -C .. -k"
66 // End:
virtual ~VRandomSampler()
double shoot(HepEngine &engine) const
Method to shoot random values using a given engine by-passing the static generator.
CLHEP::HepRandomEngine HepEngine
Definition: VRandomSampler.h:7
virtual double MapRandom(const double rand) const =0
Class to shoot random numbers given by a user-defined distribution function.

, generated on Tue Sep 26 2023.