37 #include "rl_DielectricData.h" 46 #define EFFECTIVELY_ZERO 1.0e-30 55 if ( decrement_ ) {
delete [] decrement_; }
61 : nelts_( other.nelts_ )
63 , emin_( other.emin_ )
64 , emax_( other.emax_ )
65 , bulkdensity_( other.bulkdensity_ )
66 , interp_mode_( other.interp_mode_ )
68 memcpy( decrement_, other.decrement_,
79 init( diel, num_pts, interp_mode, bulk_density );
90 interp_mode_ = interp_mode;
93 emax_ = diel[num_pts-1].
energy_;
95 bulkdensity_ = bulk_density;
103 e.set_rethrow_message( __FILE__, __LINE__ );
110 for ( n = 0 ; n < nelts_ ; ++n )
126 switch ( interp_mode_ ) {
132 for ( n = 0 ; n < nelts_ ; ++n )
134 decrement_[n].
lo_.
energy_ = log(decrement_[n].lo_.energy_);
135 decrement_[n].
hi_.
energy_ = log(decrement_[n].hi_.energy_);
140 for ( n = 0 ; n < nelts_ ; ++n )
142 decrement_[n].
lo_.
alpha_ = log(decrement_[n].lo_.alpha_);
143 decrement_[n].
hi_.
alpha_ = log(decrement_[n].hi_.alpha_);
144 decrement_[n].
lo_.
gamma_ = log(decrement_[n].lo_.gamma_);
145 decrement_[n].
hi_.
gamma_ = log(decrement_[n].hi_.gamma_);
150 for ( n = 0 ; n < nelts_ ; ++n )
152 decrement_[n].
lo_.
energy_ = log(decrement_[n].lo_.energy_);
153 decrement_[n].
hi_.
energy_ = log(decrement_[n].hi_.energy_);
154 decrement_[n].
lo_.
alpha_ = log(decrement_[n].lo_.alpha_);
155 decrement_[n].
hi_.
alpha_ = log(decrement_[n].hi_.alpha_);
156 decrement_[n].
lo_.
gamma_ = log(decrement_[n].lo_.gamma_);
157 decrement_[n].
hi_.
gamma_ = log(decrement_[n].hi_.gamma_);
168 static int diel_compare(
void const* ck,
void const* ce );
180 switch ( interp_mode_ )
190 if ( en < decrement_[0].lo_.energy_ )
193 if ( en > decrement_[nelts_-1].hi_.energy_ )
197 if ( en < decrement_[nelts_-1].hi_.energy_ )
211 diel = &decrement_[nelts_-1];
220 #if defined (TEST_ALPHA_GAMMA) 221 fprintf( stdout,
"___ ALPHA_GAMMA ___\n" );
222 fprintf( stdout,
"E %.15e\n", en );
223 fprintf( stdout,
"E alpha gamma lo %.15e %.15e %.15e\n",
225 fprintf( stdout,
"E alpha gamma hi %.15e %.15e %.15e\n",
227 fprintf( stdout,
"w %.15e\n", w );
228 fprintf( stdout,
"alpha gamma %.15e %.15e\n",
232 switch ( interp_mode_ )
256 int diel_compare(
void const* ck,
260 double *pk = (
double*) ck;
265 if ( *pk < pe->lo_.energy_ )
rl_Traits::rl_DielectricPOD lo_
lower edge of energy bin
~rl_DielectricData()
Non-virtual detructor.
void init(rl_Traits::rl_DielectricPOD const *diel, size_t num_pts, rl_Traits::EInterpMode interp_mode, double bulk_density=1.0)
Initialization function.
linear in energy, linear in optical constants.
log in energy, log in optical constants.
rl_DielectricData()
Default constructor.
linear in energy, log in optical constants.
double alpha_
dielectric decrement, real part
The exception thrown by the rl_RayLib and rl_RaySupLib libraries.
double gamma_
dielectric decrement, imag part
log in energy, linear in optical constants.
int alpha_gamma(double energy, double &alpha, double &gamma)
Evaluate the dielectric decrements, alpha and gamma, at the given energy.
double energy_
energy (keV)
rl_Traits::rl_DielectricPOD hi_
upper edge of energy bin
A class encapsulating the dielectric data (alpha, gamma) as a function of energy.
EInterpMode
Enumeration specifying the interpolation of the optical constants.
A POD describing the lower and upper edge of an energy bin.