Energy split drawing implemented;
Debugging output still present, energy split hard coded
This commit is contained in:
@@ -31,6 +31,7 @@ class DynamicDensityField : public DensityField {
|
||||
|
||||
double density(const Coordinate& position);
|
||||
double density(const Coordinate& position, double energy_eV);
|
||||
double density(const Coordinate& position, double energy_split, bool above);
|
||||
|
||||
bool changedPositionBin(const Coordinate& old_position,
|
||||
const Coordinate& new_position) const;
|
||||
@@ -48,6 +49,11 @@ class DynamicDensityField : public DensityField {
|
||||
|
||||
// return the particle number stored in the density of this object
|
||||
double particleNumber();
|
||||
// return the particle number stored for energies higher than E_thresh
|
||||
// (above = true) or for energies below (above = false)
|
||||
// The energy bin, in which E_thresh is located, will be included in the
|
||||
// 'above=true' case (and excluded in the other case)
|
||||
double particleNumber(double E_thresh, bool above);
|
||||
|
||||
// returns true if the old pitch angle and the new pitch angle are in different bins
|
||||
// of the pitch angle binning
|
||||
@@ -59,9 +65,10 @@ class DynamicDensityField : public DensityField {
|
||||
blitz::Array<long int, 5> deletedParticlesArray() const;
|
||||
blitz::Array<double, 3> binVolumeArray() const;
|
||||
|
||||
blitz::Array<double, 3> densityArray(double energy_split, bool above);
|
||||
|
||||
// return an array of the density values at the Coordinate position (only energy
|
||||
// direction left); over and underflow bin are removed
|
||||
// (might not be good, since then the underflow particles are lost...)
|
||||
// direction left); overbin is removed
|
||||
blitz::Array<double, 1> sliceSpectrumArray(const Coordinate& position) const;
|
||||
|
||||
// return an array of the time in bin at the Coordinate position and the energy
|
||||
|
||||
@@ -46,15 +46,21 @@ class PositionDistributionFromDensity {
|
||||
|
||||
// draw a position from the density provided at construction using the rejection method
|
||||
CylinderCoordinate drawPosition(std::mt19937* engine);
|
||||
|
||||
CylinderCoordinate drawPosition(std::mt19937* engine, double energy_split, bool above);
|
||||
// sets the maximum density value needed for the rejection method
|
||||
// should not be called frequently, since during each call the density field is
|
||||
// recalculated from scratch by the DynamicDensityField object
|
||||
void setMaximumDensity();
|
||||
void setMaximumDensityAboveAndBelow(double energy_split);
|
||||
|
||||
private:
|
||||
// variable storing the maximum value of the density
|
||||
double maximum_density_ = 1.;
|
||||
|
||||
double maximum_density_below_ = 1.;
|
||||
double maximum_density_above_ = 1.;
|
||||
|
||||
std::shared_ptr<DynamicDensityField> density_;
|
||||
|
||||
// distributions for the spatial directions and for the density
|
||||
|
||||
@@ -60,9 +60,15 @@ class Injector {
|
||||
|
||||
double timePassed() const;
|
||||
|
||||
void fillParticleNumbers(std::shared_ptr<species::TrackedSpecie> specie);
|
||||
|
||||
double energySplit() const;
|
||||
|
||||
private:
|
||||
std::vector<InjectorInfo> injector_infos_;
|
||||
const double activity_;
|
||||
double energySplit_;
|
||||
std::map<std::string, std::vector<double>> particleNumbersMap_;
|
||||
std::shared_ptr<EventPositionDistribution> position_distribution_;
|
||||
std::shared_ptr<DriftVelocity> mother_drift_velocity_;
|
||||
std::uniform_real_distribution<double> injection_time_distribution_;
|
||||
@@ -74,6 +80,13 @@ class Injector {
|
||||
std::shared_ptr<VelocityDistribution> creation_velocity_distribution,
|
||||
const double time_birth,
|
||||
const double weight);
|
||||
|
||||
particle::Particle drawNewDensityParticleAboveOrBelow(std::mt19937* engine,
|
||||
std::shared_ptr<species::TrackedSpecie> specie,
|
||||
std::shared_ptr<MagneticField> field,
|
||||
const double weight,
|
||||
const double injection_time,
|
||||
const bool above);
|
||||
};
|
||||
|
||||
#endif /* INJECTOR_H */
|
||||
|
||||
@@ -55,6 +55,23 @@ class VelocityDistributionFromDensityField : public VelocityDistribution {
|
||||
CartesianVector rollVelocity(
|
||||
const Coordinate& position, std::mt19937* engine,
|
||||
std::shared_ptr<MagneticField> magnetic_field);
|
||||
|
||||
// returns a velocity vector drawn from the energy and pitch angle distributions
|
||||
// use the given magnetic field at the provided position to determine the
|
||||
// direction of velocity from the pitch angle
|
||||
// the direction of the perpendicular part of the velocity vector is drawn isotropically
|
||||
// draw from the distribution below the threshold energy if above = false
|
||||
// and from above otherwise
|
||||
CartesianVector rollVelocity(
|
||||
const Coordinate& position, std::mt19937* engine,
|
||||
std::shared_ptr<MagneticField> magnetic_field,
|
||||
const int E_th_bin,
|
||||
const bool above);
|
||||
|
||||
CartesianVector rollVelocity(
|
||||
const Coordinate& position, std::mt19937* engine,
|
||||
const int E_th_bin,
|
||||
const bool above);
|
||||
private:
|
||||
// mass of the species of which the density field is a part of
|
||||
const double mass_kg_;
|
||||
|
||||
Reference in New Issue
Block a user