Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::EnergyMesh Class Reference

#include <EnergyMesh.h>

+ Inheritance diagram for Heed::EnergyMesh:

Public Member Functions

 EnergyMesh (void)
 
 EnergyMesh (double femin, double femax, long fq)
 
 EnergyMesh (DynLinArr< double > fec)
 
long get_q () const
 
double get_emin () const
 
double get_emax () const
 
double get_e (long n) const
 
double get_ec (long n) const
 
const double * get_ae (void) const
 
const double * get_aec (void) const
 
long get_interval_number (double ener)
 
long get_interval_number_between_centers (double ener)
 
virtual void print (std::ostream &file, int l) const
 
 macro_copy_total (EnergyMesh)
 
virtual ~EnergyMesh ()
 

Friends

std::ostream & operator<< (std::ostream &file, EnergyMesh &f)
 

Detailed Description

Definition at line 44 of file EnergyMesh.h.

Constructor & Destructor Documentation

◆ EnergyMesh() [1/3]

Heed::EnergyMesh::EnergyMesh ( void  )
inline

Definition at line 46 of file EnergyMesh.h.

46: q(0), emin(0.0), emax(0.0) {}

◆ EnergyMesh() [2/3]

Heed::EnergyMesh::EnergyMesh ( double  femin,
double  femax,
long  fq 
)

Definition at line 8 of file EnergyMesh.cpp.

9 : q(fq), emin(femin), emax(femax) {
10 mfunname("EnergyMesh::EnergyMesh(double femin, double femax, long fq)");
11 check_econd21(q, < 0 ||, > pqener - 1, mcerr);
12
13 double rk = pow(emax / emin, (1.0 / double(q)));
14 double er = emin;
15 e[0] = er;
16 for (long n = 1; n < q + 1; n++) {
17 e[n] = er * rk;
18 ec[n - 1] = (e[n - 1] + e[n]) * 0.5;
19 er = e[n];
20 }
21 //pcm_e = PointCoorMesh< double, double[pqener] >( q, &e);
22 //pcm_ec = PointCoorMesh< double, double[pqener-1] >( q-1, &ec);
23 //mcout<<"EnergyMesh is done"<<endl;
24}
DoubleAc pow(const DoubleAc &f, double p)
Definition: DoubleAc.cpp:336
#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream)
Definition: FunNameStack.h:428
#define mfunname(string)
Definition: FunNameStack.h:67
const int pqener
Definition: EnergyMesh.h:39
#define mcerr
Definition: prstream.h:135

◆ EnergyMesh() [3/3]

Heed::EnergyMesh::EnergyMesh ( DynLinArr< double >  fec)

Definition at line 26 of file EnergyMesh.cpp.

26 : q(fec.get_qel()) {
27 mfunname("DynLinArr< double > fec");
28 check_econd21(q, < 0 ||, > pqener - 1, mcerr);
29 check_econd11(q, != 1, mcerr); // otherwise problems with emin/emax
30 if (q > 0) {
31 emin = fec[0] - (fec[1] - fec[0]) / 2.0;
32 emax = fec[q - 1] + (fec[q - 1] - fec[q - 2]) / 2.0;
33 e[0] = emin;
34 e[q] = emax;
35
36 for (long n = 0; n < q; n++) {
37 ec[n] = fec[n];
38 }
39 for (long n = 1; n < q; n++) {
40 e[n] = 0.5 * (fec[n - 1] + fec[n]);
41 }
42 } else {
43 emin = 0.0;
44 emax = 0.0;
45 }
46 //pcm_e = PointCoorMesh< double, double[pqener] >( q, &e);
47 //pcm_ec = PointCoorMesh< double, double[pqener-1] >( q-1, &ec);
48}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366
long get_qel(void) const
Definition: AbsArr.h:420

◆ ~EnergyMesh()

virtual Heed::EnergyMesh::~EnergyMesh ( )
inlinevirtual

Definition at line 75 of file EnergyMesh.h.

75{}

Member Function Documentation

◆ get_ae()

const double * Heed::EnergyMesh::get_ae ( void  ) const
inline

Definition at line 60 of file EnergyMesh.h.

60 {
61 return e;
62 } // left sides

◆ get_aec()

const double * Heed::EnergyMesh::get_aec ( void  ) const
inline

Definition at line 63 of file EnergyMesh.h.

63{ return ec; }

◆ get_e()

double Heed::EnergyMesh::get_e ( long  n) const
inline

Definition at line 54 of file EnergyMesh.h.

54 {
55 return e[n];
56 } // left side of interval

◆ get_ec()

double Heed::EnergyMesh::get_ec ( long  n) const
inline

Definition at line 57 of file EnergyMesh.h.

57 {
58 return ec[n];
59 } // center of interval

Referenced by Heed::HeedDeltaElectron::physics_after_new_speed(), and Heed::HeedDeltaElectron::physics_mrange().

◆ get_emax()

double Heed::EnergyMesh::get_emax ( ) const
inline

Definition at line 53 of file EnergyMesh.h.

53{ return emax; }

◆ get_emin()

double Heed::EnergyMesh::get_emin ( ) const
inline

Definition at line 52 of file EnergyMesh.h.

52{ return emin; }

◆ get_interval_number()

long Heed::EnergyMesh::get_interval_number ( double  ener)

Definition at line 75 of file EnergyMesh.cpp.

75 {
76 if (ener < emin) return -1;
77 if (ener > emax) return q;
78
79 long n1 = 0;
80 long n2 = q; // right side of last
81 long n3 = n1;
82 while (n2 - n1 > 1) {
83 n3 = n1 + (n2 - n1) / 2;
84 if (ener < e[n3]) {
85 n2 = n3;
86 } else {
87 n1 = n3;
88 }
89 }
90 return n1;
91}

◆ get_interval_number_between_centers()

long Heed::EnergyMesh::get_interval_number_between_centers ( double  ener)

Definition at line 93 of file EnergyMesh.cpp.

93 {
94 if (ener < ec[0]) return -1;
95 if (ener > ec[q - 1]) return q;
96
97 long n1 = 0;
98 long n2 = q - 1; // right side of last
99 long n3 = n1;
100 while (n2 - n1 > 1) {
101 n3 = n1 + (n2 - n1) / 2;
102 if (ener < ec[n3]) {
103 n2 = n3;
104 } else {
105 n1 = n3;
106 }
107 }
108 return n1;
109}

Referenced by Heed::HeedDeltaElectron::physics_after_new_speed(), and Heed::HeedDeltaElectron::physics_mrange().

◆ get_q()

long Heed::EnergyMesh::get_q ( ) const
inline

◆ macro_copy_total()

Heed::EnergyMesh::macro_copy_total ( EnergyMesh  )

◆ print()

void Heed::EnergyMesh::print ( std::ostream &  file,
int  l 
) const
virtual

Definition at line 129 of file EnergyMesh.cpp.

129 {
130 if (l <= 0) return;
131 Ifile << "EnergyMesh (l=" << l << "): \n";
132 indn.n += 2;
133 Ifile << "emin=" << emin << " emax=" << emax << " quantity of intervals=" << q
134 << '\n' << " maximal possible quantity of intervals=" << pqener << '\n';
135 if (l > 1) {
136 Ifile << " number left side center right side widht\n";
137 for (int n = 0; n < q; n++) {
138 Ifile << std::setw(5) << n << std::setw(15) << e[n] << std::setw(15)
139 << ec[n] << std::setw(15) << e[n + 1] << std::setw(15)
140 << (e[n + 1] - e[n]) << '\n';
141 }
142 }
143 indn.n -= 2;
144}
indentation indn
Definition: prstream.cpp:13
#define Ifile
Definition: prstream.h:207

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  file,
EnergyMesh f 
)
friend

Definition at line 111 of file EnergyMesh.cpp.

111 {
112 Ifile << "EnergyMesh: \n";
113 indn.n += 2;
114 Ifile << "emin=" << f.emin << " emax=" << f.emax
115 << " quantity of intervals=" << f.q << '\n'
116 << " maximal possible quantity of intervals=" << pqener << '\n';
117 Ifile << " number left side center right side widht\n";
118 for (int n = 0; n < f.q; n++) {
119 Ifile << std::setw(5) << n << std::setw(15) << f.e[n] << std::setw(15)
120 << f.ec[n] << std::setw(15) << f.e[n + 1] << std::setw(15)
121 << (f.e[n + 1] - f.e[n]) << '\n';
122 }
123 //f.pcm_e.print(mcout);
124 //f.pcm_ec.print(mcout);
125 indn.n -= 2;
126 return file;
127}

The documentation for this class was generated from the following files: