71 lines
2.6 KiB
C++
Executable File
71 lines
2.6 KiB
C++
Executable File
#ifndef INJECTOR_H
|
|
#define INJECTOR_H
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <random>
|
|
#include <vector>
|
|
|
|
#include "simulation/coordinates.h"
|
|
|
|
// defined in "simulation/drift_velocity.h"
|
|
class DriftVelocity;
|
|
// defined in "simulation/veloctiy_distribution.h"
|
|
class VelocityDistribution;
|
|
|
|
// defined in "simulation/particle.h"
|
|
namespace particle {
|
|
class Particle;
|
|
}
|
|
|
|
// defined in "simulation/species.h"
|
|
namespace species {
|
|
class Specie;
|
|
class TrackedSpecie;
|
|
} // namespace species
|
|
|
|
// defined in "simulation/event_position_distribution.h"
|
|
class EventPositionDistribution;
|
|
|
|
// structure storing information about particles that are injected by the injector
|
|
// conains the TrackedSpecie of the particle and its veloctiy distribution
|
|
struct InjectorInfo {
|
|
public:
|
|
std::shared_ptr<species::TrackedSpecie> created_specie;
|
|
std::shared_ptr<VelocityDistribution> creation_velocity_distribution;
|
|
};
|
|
|
|
// class handling injection of event particles (i.e. particles from the tritium beta decay)
|
|
class Injector {
|
|
public:
|
|
// Constructor: takes a vector of InjectorInfo objects defining the particles that are supposed to be injected at invocation of the Injector object
|
|
// the activity of the simulation volume (units 1/s) defines the "timestep" (i.e. 1/activity)
|
|
// an EventPositionDistribution defining the valid space of the simulation domain where particles can be created
|
|
// a DriftVelocity object defining the bulk motion the injected particles are created with (regardless of specie), can be null
|
|
Injector(std::vector<InjectorInfo>& injector_info,
|
|
double activity,
|
|
std::shared_ptr<EventPositionDistribution> position_distribution,
|
|
std::shared_ptr<DriftVelocity> mother_drift_velocity);
|
|
|
|
// return a vector with the particles defined in the InjectorInfo vector using the random engine object
|
|
std::vector<particle::Particle> rollNewParticles(std::mt19937* engine);
|
|
// return average time between events (1/activity)
|
|
double timePassed() const;
|
|
|
|
private:
|
|
std::vector<InjectorInfo> injector_infos_;
|
|
const double activity_;
|
|
std::shared_ptr<EventPositionDistribution> position_distribution_;
|
|
std::shared_ptr<DriftVelocity> mother_drift_velocity_;
|
|
|
|
// draw a single particle of species created_specie with a velocity distribution creation_velocity_distribution
|
|
// at the Coordinate position using the random engine engine
|
|
particle::Particle rollNewParticle(
|
|
std::mt19937* engine,
|
|
const Coordinate& position,
|
|
std::shared_ptr<species::TrackedSpecie> created_specie,
|
|
std::shared_ptr<VelocityDistribution> creation_velocity_distribution);
|
|
};
|
|
|
|
#endif /* INJECTOR_H */
|