CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
Matrix
CLHEP
Random
Matrix/CLHEP/Random/RandBreitWigner.h
Go to the documentation of this file.
1
// $Id: RandBreitWigner.h,v 1.5 2010/06/16 17:24:53 garren Exp $
2
// -*- C++ -*-
3
//
4
// -----------------------------------------------------------------------
5
// HEP Random
6
// --- RandBreitWigner ---
7
// class header file
8
// -----------------------------------------------------------------------
9
// This file is part of Geant4 (simulation toolkit for HEP).
10
//
11
// Class defining methods for shooting numbers according to the
12
// Breit-Wigner distribution algorithms (plain or mean^2).
13
// Default values are set: mean=1, gamma=.2, cut=1.
14
// Plain algorithm is used for shootArray() and fireArray().
15
// Plain algorithm with default values is used for operator()().
16
17
// =======================================================================
18
// Gabriele Cosmo - Created: 5th September 1995
19
// - Added methods to shoot arrays: 28th July 1997
20
// J.Marraffino - Added default arguments as attributes and
21
// operator() with arguments: 16th Feb 1998
22
// M Fischler - put and get to/from streams 12/10/04
23
// =======================================================================
24
25
#ifndef RandBreitWigner_h
26
#define RandBreitWigner_h 1
27
28
#include "CLHEP/Random/defs.h"
29
#include "CLHEP/Random/RandFlat.h"
30
#include "CLHEP/Utility/memory.h"
31
32
namespace
CLHEP {
33
38
class
RandBreitWigner
:
public
HepRandom
{
39
40
public
:
41
42
inline
RandBreitWigner
(
HepRandomEngine
& anEngine,
double
a
=1.0,
43
double
b
=0.2 );
44
inline
RandBreitWigner
(
HepRandomEngine
* anEngine,
double
a
=1.0,
45
double
b
=0.2 );
46
// These constructors should be used to instantiate a RandBreitWigner
47
// distribution object defining a local engine for it.
48
// The static generator will be skipped using the non-static methods
49
// defined below.
50
// If the engine is passed by pointer the corresponding engine object
51
// will be deleted by the RandBreitWigner destructor.
52
// If the engine is passed by reference the corresponding engine object
53
// will not be deleted by the RandBreitWigner destructor.
54
55
virtual
~RandBreitWigner
();
56
// Destructor
57
58
// Static methods to shoot random values using the static generator
59
60
static
double
shoot
(
double
a
=1.0,
double
b
=0.2 );
61
62
static
double
shoot
(
double
a
,
double
b
,
double
c );
63
64
static
double
shootM2
(
double
a=1.0,
double
b=0.2 );
65
66
static
double
shootM2
(
double
a,
double
b,
double
c );
67
68
static
void
shootArray
(
const
int
size,
double
* vect);
69
70
static
void
shootArray
(
const
int
size,
double
* vect,
71
double
a,
double
b );
72
73
static
void
shootArray
(
const
int
size,
double
* vect,
74
double
a,
double
b,
double
c );
75
76
// Static methods to shoot random values using a given engine
77
// by-passing the static generator.
78
79
static
double
shoot
(
HepRandomEngine
* anEngine,
double
a=1.0,
80
double
b=0.2 );
81
static
double
shoot
(
HepRandomEngine
* anEngine,
double
a,
82
double
b,
double
c );
83
static
double
shootM2
(
HepRandomEngine
* anEngine,
double
a=1.0,
84
double
b=0.2 );
85
static
double
shootM2
(
HepRandomEngine
* anEngine,
double
a,
86
double
b,
double
c );
87
static
void
shootArray
(
HepRandomEngine
* anEngine,
88
const
int
size,
double
* vect );
89
static
void
shootArray
(
HepRandomEngine
* anEngine,
90
const
int
size,
double
* vect,
91
double
a,
double
b );
92
static
void
shootArray
(
HepRandomEngine
* anEngine,
93
const
int
size,
double
* vect,
94
double
a,
double
b,
double
c );
95
96
// Methods using the localEngine to shoot random values, by-passing
97
// the static generator. These methods respect distribution parameters
98
// passed by the user at instantiation unless superseded by actual
99
// arguments in the call.
100
101
double
fire
();
102
103
double
fire
(
double
a,
double
b );
104
105
double
fire
(
double
a,
double
b,
double
c );
106
107
double
fireM2
();
108
109
double
fireM2
(
double
a,
double
b );
110
111
double
fireM2
(
double
a,
double
b,
double
c );
112
113
void
fireArray
(
const
int
size,
double
* vect);
114
115
void
fireArray
(
const
int
size,
double
* vect,
116
double
a,
double
b );
117
118
void
fireArray
(
const
int
size,
double
* vect,
119
double
a,
double
b,
double
c );
120
double
operator()
();
121
double
operator()
(
double
a,
double
b );
122
double
operator()
(
double
a,
double
b,
double
c );
123
124
// Save and restore to/from streams
125
126
std::ostream &
put
( std::ostream & os )
const
;
127
std::istream &
get
( std::istream & is );
128
129
std::string
name
()
const
;
130
HepRandomEngine
&
engine
();
131
132
static
std::string
distributionName
() {
return
"RandBreitWigner"
;}
133
// Provides the name of this distribution class
134
135
private
:
136
137
shared_ptr<HepRandomEngine>
localEngine;
138
double
defaultA;
139
double
defaultB;
140
141
};
142
143
}
// namespace CLHEP
144
145
#ifdef ENABLE_BACKWARDS_COMPATIBILITY
146
// backwards compatibility will be enabled ONLY in CLHEP 1.9
147
using namespace
CLHEP;
148
#endif
149
150
#include "CLHEP/Random/RandBreitWigner.icc"
151
152
#endif
Generated on Sun Jun 17 2012 08:08:27 for CLHEP by
1.8.1.1