Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
chisran.h
Go to the documentation of this file.
1#ifndef CHISRAN_H
2#define CHISRAN_H
3#include <vector>
4
5// Remake of CERN's subroutine hisran for generation of random numbers
6// according to histogram
7// I. B. Smirnov, 2003.
8
9// This is old programs.
10// The new ones are in wcpplib/math/tline.h
11// They are more generic, although the old ones should be working as well.
12
13namespace Heed {
14
15float chispre(float *x, float *p, float *f, long q);
16// here x is a left side of interval on which
17// function p is a constant.
18// last point x[q] is the end of last interval.
19// p and f must have dimensions q.
20// x must have dimension q + 1
21// f is return array.
22// f[n] is normalized integral till the end of n'th interval or till
23// x[n+1].
24// Normalization is such that f[q-1]=1.0;
25// Return value is the true integral.
26
27float chisran(float flat_random_number, float *x, float *f, long q);
28
29double chispre(std::vector<double> &f, int s_allow_zero_f = 0);
30// here intervals are unit
31// function p is a constant along these intervals.
32// last point x[q] is the end of last interval.
33// p and f must have dimensions q.
34// f is return array.
35// f[n] is normalized integral till the end of n'th interval or till
36// x[n+1].
37// Normalization is such that f[q-1]=1.0;
38// Return value is the true integral.
39// Sun of f should be always more than zero.
40// if s_allow_zero_f = 1, some values of f are allowed to be
41// negative and they are made zero with diagnostic printed.
42// (this have sence only for debug.)
43
44double chisran(double flat_random_number, const std::vector<double> &f);
45}
46
47#endif
Definition: BGMesh.cpp:6
float chispre(float *x, float *p, float *f, long q)
Definition: chisran.cpp:8
float chisran(float flat_random_number, float *x, float *f, long q)
Definition: chisran.cpp:22