CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
RandomObjects
CLHEP
RandomObjects
CLHEP/RandomObjects/RandomVector.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// -----------------------------------------------------------------------
4
// HEP Random
5
// --- HepRandomVector ---
6
// class header file
7
// -----------------------------------------------------------------------
8
// This file is part of CLHEP, extended to match the distributions in RPP.
9
//
10
// It's exactly analogous to HepRandom except that the return types for
11
// the fire() and related methods are std::vector<double> instead of
12
// double.
13
//
14
// Distribution classes returning HepVectors of results inherit from
15
// HepRandomVector instead of HepRandom.
16
//
17
// HepVector is used instead of the more modern looking
18
// std::vector<double> because the motivating sub-class
19
// RandMultiGauss uses HepMatrix to supply the correlation
20
// matrix S anyway. Given that, we might as well stick to
21
// HepVector when a vector of numbers is needed, as well.
22
//
23
// =======================================================================
24
// Mark Fischler - Created: 19 Oct, 1998
25
// 10/20/98 - Removed all shoot-related material
26
// =======================================================================
27
28
#ifndef HepRandomVector_h
29
#define HepRandomVector_h 1
30
31
#include "
CLHEP/RandomObjects/defs.h
"
32
#include "CLHEP/Random/RandomEngine.h"
33
#include "CLHEP/Matrix/Vector.h"
34
35
namespace
CLHEP {
36
41
class
HepRandomVector
{
42
43
public
:
44
45
HepRandomVector
();
46
HepRandomVector
(
long
seed);
47
// Contructors with and without a seed using a default engine
48
// (JamesRandom) which is instantiated for use of this distribution
49
// instance. If the seed is omitted, multiple instantiations will
50
// each get unique seeds.
51
52
HepRandomVector
(
HepRandomEngine
& engine);
53
HepRandomVector
(
HepRandomEngine
* engine);
54
// Constructor taking an alternative engine as argument. If a pointer is
55
// given the corresponding object will be deleted by the HepRandom
56
// destructor.
57
58
virtual
~HepRandomVector
();
59
// Destructor
60
61
inline
HepVector
flat
();
62
// Returns vector of flat values ( interval ]0.1[ ).
63
64
inline
HepVector
flat
(
HepRandomEngine
* theNewEngine);
65
// Returns a vector of flat values, given a defined Random Engine.
66
67
inline
void
flatArray
(
const
int
size,
HepVector
* vect);
68
// Fills "vect" array of flat random values, given the size.
69
// Included for consistency with the HepRandom class.
70
71
inline
void
flatArray
(
HepRandomEngine
* theNewEngine,
72
const
int
size,
HepVector
* vect);
73
// Fills "vect" array of flat random values, given the size
74
// and a defined Random Engine.
75
76
77
virtual
HepVector
operator()
();
78
// To get a flat random number using the operator ().
79
80
81
private
:
// -------- Private methods ---------
82
83
inline
void
setSeed(
long
seed,
int
lux);
84
// (Re)Initializes the generator with a seed.
85
86
inline
long
getSeed()
const
;
87
// Gets the current seed of the current generator.
88
89
inline
void
setSeeds(
const
long
* seeds,
int
aux);
90
// (Re)Initializes the generator with a zero terminated list of seeds.
91
92
inline
const
long
* getSeeds ()
const
;
93
// Gets the current array of seeds of the current generator.
94
95
void
setEngine (
HepRandomEngine
* engine) {
theEngine
= engine; }
96
// To set the underlying algorithm object
97
98
HepRandomEngine
* getEngine()
const
{
return
theEngine
; }
99
// Returns a pointer to the underlying algorithm object.
100
101
void
saveStatus(
const
char
filename[] =
"Config.conf"
)
const
;
102
// Saves to file the current status of the current engine.
103
104
void
restoreStatus(
const
char
filename[] =
"Config.conf"
);
105
// Restores a saved status (if any) for the current engine.
106
107
void
showStatus()
const
;
108
// Dumps the current engine status on screen.
109
110
protected
:
// -------- Data members ---------
111
112
HepRandomEngine
*
theEngine
;
113
// The corresponding algorithm.
114
115
private
:
// -------- Data members ---------
116
117
bool
deleteEngine;
118
// True if the engine should be deleted on destruction.
119
120
};
121
122
}
// namespace CLHEP
123
124
#include "CLHEP/RandomObjects/RandomVector.icc"
125
126
#ifdef ENABLE_BACKWARDS_COMPATIBILITY
127
// backwards compatibility will be enabled ONLY in CLHEP 1.9
128
using namespace
CLHEP;
129
#endif
130
131
#endif
Generated on Sun Jun 17 2012 08:08:27 for CLHEP by
1.8.1.1