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/RandPoissonT.h
Go to the documentation of this file.
1
// $Id: RandPoissonT.h,v 1.5 2010/06/16 17:24:53 garren Exp $
2
// -*- C++ -*-
3
//
4
// -----------------------------------------------------------------------
5
// HEP Random
6
// --- RandPoissonT ---
7
// class header file
8
// -----------------------------------------------------------------------
9
10
// Class defining methods for shooting numbers according to the Poisson
11
// distribution, given a mean. RandPoissonT is derived from RandPoisson
12
// and shares the identical user interface. RandPoissonT is always
13
// perfectly accurate for any value of mu.
14
15
// For mu > 100 the algorithm used is taken from the base class RandPoisson
16
// (Algorithm from "W.H.Press et al., Numerical Recipes in C, Second Edition".)
17
//
18
// For mu < 100, algorithm used is a table lookup based on [mu/K] for some
19
// smallish K, followed by an explicit series-drived poisson for the small
20
// remaining part of mu. This method is exact, and is substantially faster
21
// than the method used by the base class. The implementation of this method
22
// is in the RandPoissonQ class.
23
24
// =======================================================================
25
// M. Fischler - Created 26 Jan 2000
26
// M Fischler - put and get to/from streams 12/10/04
27
// =======================================================================
28
29
#ifndef RandPoissonT_h
30
#define RandPoissonT_h 1
31
32
#include "CLHEP/Random/defs.h"
33
#include "CLHEP/Random/RandPoisson.h"
34
35
namespace
CLHEP {
36
41
class
RandPoissonT
:
public
RandPoisson
{
42
43
public
:
44
45
RandPoissonT
(
HepRandomEngine
& anEngine,
double
m=1.0 );
46
RandPoissonT
(
HepRandomEngine
* anEngine,
double
m=1.0 );
47
// These constructors should be used to instantiate a RandPoissonT
48
// distribution object defining a local engine for it.
49
// The static generator will be skipped using the non-static methods
50
// defined below.
51
// If the engine is passed by pointer the corresponding engine object
52
// will be deleted by the RandPoissonT destructor.
53
// If the engine is passed by reference the corresponding engine object
54
// will not be deleted by the RandPoissonT destructor.
55
56
virtual
~RandPoissonT
();
57
// Destructor
58
59
// Save and restore to/from streams
60
61
std::ostream &
put
( std::ostream & os )
const
;
62
std::istream &
get
( std::istream & is );
63
64
// Static methods to shoot random values using the static generator
65
66
static
long
shoot
(
double
m=1.0 );
67
68
static
void
shootArray
(
const
int
size,
long
* vect,
double
m=1.0 );
69
70
// Static methods to shoot random values using a given engine
71
// by-passing the static generator.
72
73
static
long
shoot
(
HepRandomEngine
* anEngine,
double
m=1.0 );
74
75
static
void
shootArray
(
HepRandomEngine
* anEngine,
76
const
int
size,
long
* vect,
double
m=1.0 );
77
78
// Methods using the localEngine to shoot random values, by-passing
79
// the static generator.
80
81
long
fire
();
82
long
fire
(
double
m );
83
84
void
fireArray
(
const
int
size,
long
* vect );
85
void
fireArray
(
const
int
size,
long
* vect,
double
m);
86
87
double
operator()
();
88
double
operator()
(
double
m );
89
90
std::string
name
()
const
;
91
HepRandomEngine
&
engine
();
92
93
static
std::string
distributionName
() {
return
"RandPoissonT"
;}
94
// Provides the name of this distribution class
95
96
97
private
:
98
99
};
100
101
}
// namespace CLHEP
102
103
#ifdef ENABLE_BACKWARDS_COMPATIBILITY
104
// backwards compatibility will be enabled ONLY in CLHEP 1.9
105
using namespace
CLHEP;
106
#endif
107
108
#include "CLHEP/Random/RandPoissonT.icc"
109
110
#endif
Generated on Mon May 6 2013 04:04:11 for CLHEP by
1.8.1.2