Garfield++ 4.0
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#include <vector>
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
17namespace Heed {
18
19/// Generates random numbers according to array.
20/// This class generates random numbers
21/// according to a pointwise distribution, with linear interpolation
22/// between given points and also with linear extrapolation.
23
24class PointsRan {
25 private:
26 double xmin; // is changed internally
27 double xmax; // is changed internally
28
29 // x[0] is changed to xmin or that of zero interpolated y,
30 // x[q-1] to xmax or similarly zero y.
31 // y[0] and y[q-1] are recalculated correspondingly
32 std::vector<double> x;
33 std::vector<double> y;
34
35 /// Integrated minus initial level at xmin
36 std::vector<double> iy;
37 std::vector<double> a;
38 double integ_total;
39 double integ_active;
40 double integ_start;
41 int n_start;
42 double integ_finish;
43 int n_finish;
44
45 public:
47
48 /** Constructor
49 * \param fx
50 x values
51 * \param fy
52 y values
53 * \param fxmin
54 Minimum of generated distribution. If less then x[0],
55 extend the distribution by linear extrapolation.
56 If the extrapolated line crosses zero, the extension stops there.
57 Otherwise it stops at fxmin.
58 * \param fxmax
59 Maximum of generated distribution. If greater than x[q-1],
60 extend the distribution by linear extrapolation.
61 **/
62 PointsRan(const std::vector<double>& fx, const std::vector<double>& fy,
63 double fxmin, double fxmax);
64
65 double ran(double flat_ran) const;
66 double get_integ_total() const { return integ_total; }
67 // actual integral of active distribution
68 double get_integ_active() const { return integ_active; }
69 void print(std::ostream& file) const;
70};
71}
72
73#endif
double get_integ_active() const
Definition: PointsRan.h:68
void print(std::ostream &file) const
Definition: PointsRan.cpp:120
double ran(double flat_ran) const
Definition: PointsRan.cpp:91
double get_integ_total() const
Definition: PointsRan.h:66
Definition: BGMesh.cpp:6