Garfield++
v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
PointsRan.h
Go to the documentation of this file.
1
#ifndef POINTSRAN_H
2
#define POINTSRAN_H
3
/*
4
Generates random numbers according to array. See comments to this file/
5
6
7
Copyright (c) 2001 I. B. Smirnov
8
9
Permission to use, copy, modify, distribute and sell this file
10
and its documentation for any purpose is hereby granted without fee,
11
provided that the above copyright notice, this permission notice,
12
and notices about any modifications of the original text
13
appear in all copies and in supporting documentation.
14
It is provided "as is" without express or implied warranty.
15
*/
16
17
#include "
wcpplib/safetl/AbsArr.h
"
18
19
/*
20
As far as I remember, this class generates random numbers
21
according to pointwise distribution, with linear interpolation
22
between given points and also with linear extrapolation
23
*/
24
25
class
PointsRan
{
26
private
:
27
double
xmin;
// is changed internally
28
double
xmax;
// is changed internally
29
DynLinArr<double>
x;
// x[0] is changed to xmin or that of zero
30
// intepolated y,
31
// x[q-1] to xmax or similarly zero y
32
DynLinArr<double>
y;
// y[0] and y[q-1] are recalculated correspondingly
33
DynLinArr<double>
iy;
// integrated minus initial level at xmin
34
DynLinArr<double>
a;
35
double
integ_total;
36
double
integ_active;
37
double
integ_start;
38
int
n_start;
39
double
integ_finish;
40
int
n_finish;
41
42
public
:
43
PointsRan
(
void
) { ; }
44
PointsRan
(
DynLinArr<double>
fx,
// passed by values, changed inside
45
DynLinArr<double>
fy,
// passed by values, changed inside
46
double
fxmin,
// minimum of generated distribution
47
double
fxmax);
// maximum of generated distribution
48
// If minimum is less then x[0], the distribution is extended
49
// by linear extraterpolation.
50
// If the extrapolated line crosses zero, the extension stops right there.
51
// Otherwise it stops at fxmin.
52
// The same is done when xmax is more than x[q-1].
53
// Thus xmin and xmax affects the shape of distribution and its integral.
54
55
double
ran
(
double
flat_ran)
const
;
56
double
get_integ_total
(
void
)
const
{
return
integ_total; }
57
double
get_integ_active
(
void
)
const
{
return
integ_active; }
58
// actual integral of active distribution
59
void
print
(std::ostream& file)
const
;
60
};
61
62
#endif
AbsArr.h
DynLinArr
Definition:
AbsArr.h:156
PointsRan
Definition:
PointsRan.h:25
PointsRan::get_integ_total
double get_integ_total(void) const
Definition:
PointsRan.h:56
PointsRan::ran
double ran(double flat_ran) const
Definition:
PointsRan.cpp:114
PointsRan::PointsRan
PointsRan(void)
Definition:
PointsRan.h:43
PointsRan::get_integ_active
double get_integ_active(void) const
Definition:
PointsRan.h:57
PointsRan::print
void print(std::ostream &file) const
Definition:
PointsRan.cpp:143
garfieldpp-v1r0
Heed
wcpplib
random
PointsRan.h
Generated by
1.9.6