Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
EnergyMesh.h
Go to the documentation of this file.
1#ifndef ENERGYMESH_H
2#define ENERGYMESH_H
3
5
6/*
7Internal calculations in HEED is convenient to perform
8with some standard energy mesh. This mesh should be logarithmic
9or similar, with dense points at little energies and sparse at large energies.
10THe class below determines such mesh and some standard functions,
11namely getting center of energy interval get_ec(long n),
12left edge of interval get_e(long n) (right edge is left one for the next bin),
13and some other simple functions.
14There may be many meshes in program (but currently only one mesh
15is used in a single program, different mashes may be used for totally
16different matters and cross sections). The pointer
17to mesh should be given as tha parameter of class constructor,
18when a class depends on mesh.
19
20The class keeps the left sides of bins and their centers in arrays.
21Since the right side of interval is the left of the next one,
22the array keeping the left sides should be by one larger then
23the dimension of the mesh.
24
25For speed the internal arrays keep right sides of intervals
26and their centers are defined as simple arrays with dimension
27const int pqener = 1001.
28The actual size of mesh can be 1000 or less.
29The violation of boundaries triggers error and termination.
30
312003, I. Smirnov
32
33*/
34
35// Energies in MeV, as everywhere in HEED (unless otherwise specified)
36
37namespace Heed {
38
39const int pqener = 1001;
40// qener-1 is maximal possible quantity of bins
41// In principle it is not clear whether it is better to use DynLinArr instead
42// of simple arrays and maximal value
43
44class EnergyMesh : public RegPassivePtr {
45 public:
46 EnergyMesh(void) : q(0), emin(0.0), emax(0.0) {}
47 EnergyMesh(double femin, double femax, long fq);
48 //EnergyMesh(int fq, double fec[pqener]);
50 //EnergyMesh(const EnergyMesh& fem);
51 inline long get_q() const { return q; }
52 inline double get_emin() const { return emin; }
53 inline double get_emax() const { return emax; }
54 inline double get_e(long n) const {
55 return e[n];
56 } // left side of interval
57 inline double get_ec(long n) const {
58 return ec[n];
59 } // center of interval
60 inline const double* get_ae(void) const {
61 return e;
62 } // left sides
63 inline const double* get_aec(void) const { return ec; }
64 // array of left sides of intervals
65 long get_interval_number(double ener);
66 long get_interval_number_between_centers(double ener); // left
67 friend std::ostream& operator<<(std::ostream& file, EnergyMesh& f);
68 virtual void print(std::ostream& file, int l) const;
69
70 // For two folowing things we need to define copying
71 //PointCoorMesh< double, double[pqener] > pcm_e;
72 //PointCoorMesh< double, double[pqener-1] > pcm_ec;
73 //EnergyMesh& operator=(const EnergyMesh& fem);
75 virtual ~EnergyMesh() {}
76 ;
77
78 private:
79 // number of intervals
80 long q;
81 // left side of the first interval
82 double emin;
83 // right side of the last interval
84 double emax;
85 // left side of interval, q + 1 numbers
86 double e[pqener];
87 // center of interval, q numners
88 double ec[pqener - 1];
89
90};
91
92DynLinArr<double> make_log_mesh_ec(double emin, double emax, long q);
93
94}
95
96#endif
const double * get_ae(void) const
Definition: EnergyMesh.h:60
virtual void print(std::ostream &file, int l) const
Definition: EnergyMesh.cpp:129
virtual ~EnergyMesh()
Definition: EnergyMesh.h:75
double get_emin() const
Definition: EnergyMesh.h:52
long get_interval_number_between_centers(double ener)
Definition: EnergyMesh.cpp:93
macro_copy_total(EnergyMesh)
long get_q() const
Definition: EnergyMesh.h:51
friend std::ostream & operator<<(std::ostream &file, EnergyMesh &f)
Definition: EnergyMesh.cpp:111
double get_emax() const
Definition: EnergyMesh.h:53
const double * get_aec(void) const
Definition: EnergyMesh.h:63
double get_ec(long n) const
Definition: EnergyMesh.h:57
long get_interval_number(double ener)
Definition: EnergyMesh.cpp:75
double get_e(long n) const
Definition: EnergyMesh.h:54
Definition: BGMesh.cpp:3
DynLinArr< double > make_log_mesh_ec(double emin, double emax, long q)
Definition: EnergyMesh.cpp:146
const int pqener
Definition: EnergyMesh.h:39