Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
BGMesh.cpp
Go to the documentation of this file.
2
3namespace Heed {
4
5BGMesh::BGMesh(double fxmin, double fxmax, long fq)
6 : xmin(fxmin), xmax(fxmax), q(fq) {
7 x = make_log_mesh(fxmin, fxmax, fq);
8}
9
10void BGMesh::print(std::ostream& file, int l) const {
11 if (l <= 0) return;
12 Ifile << "BGMesh (l=" << l << "): \n";
13 indn.n += 2;
14 Ifile << "xmin=" << xmin << " xmax=" << xmax << " quantity of intervals=" << q
15 << '\n';
16 if (l > 1) {
17 Iprintn(mcout, x);
18 }
19 indn.n -= 2;
20}
21
22std::ostream& operator<<(std::ostream& file, const BGMesh& bgm) {
23 Ifile << "operator<<(std::ostream& file, const BGMesh& bgm):\n";
24 bgm.print(file, 2);
25 return file;
26}
27
28DynLinArr<double> make_log_mesh(double fxmin, double fxmax, long fq) {
30 "DynLinArr< double > make_log_mesh(double fxmin, double fxmax, long fq)");
31
32 check_econd11(fq, <= 1, mcerr); // minimum one interval and two points
33
34 double rk = pow(fxmax / fxmin, (1.0 / double(fq - 1)));
35
37 x[0] = fxmin;
38 x[fq - 1] = fxmax;
39
40 double xr = fxmin;
41 for (long n = 1; n < fq - 1; n++) {
42 xr = xr * rk;
43 x[n] = xr;
44 }
45 return x;
46}
47
48}
DoubleAc pow(const DoubleAc &f, double p)
Definition: DoubleAc.cpp:336
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366
#define mfunname(string)
Definition: FunNameStack.h:67
BGMesh(void)
Definition: BGMesh.h:13
virtual void print(std::ostream &file, int l) const
Definition: BGMesh.cpp:10
long q
Definition: BGMesh.h:17
double xmin
Definition: BGMesh.h:15
double xmax
Definition: BGMesh.h:16
DynLinArr< double > x
Definition: BGMesh.h:18
Definition: BGMesh.cpp:3
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:22
DynLinArr< double > make_log_mesh(double fxmin, double fxmax, long fq)
Definition: BGMesh.cpp:28
indentation indn
Definition: prstream.cpp:13
#define mcout
Definition: prstream.h:133
#define Ifile
Definition: prstream.h:207
#define mcerr
Definition: prstream.h:135
#define Iprintn(file, name)
Definition: prstream.h:216