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/*
4Generates random numbers according to array. See comments to this file/
5
6
7Copyright (c) 2001 I. B. Smirnov
8
9Permission to use, copy, modify, distribute and sell this file
10and its documentation for any purpose is hereby granted without fee,
11provided that the above copyright notice, this permission notice,
12and notices about any modifications of the original text
13appear in all copies and in supporting documentation.
14It is provided "as is" without express or implied warranty.
15*/
16
18
19/*
20As far as I remember, this class generates random numbers
21according to pointwise distribution, with linear interpolation
22between given points and also with linear extrapolation
23*/
24
25class 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
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
double get_integ_total(void) const
Definition: PointsRan.h:56
double ran(double flat_ran) const
Definition: PointsRan.cpp:114
PointsRan(void)
Definition: PointsRan.h:43
double get_integ_active(void) const
Definition: PointsRan.h:57
void print(std::ostream &file) const
Definition: PointsRan.cpp:143