Files
karl/include/simulation/injector.h
csendlinger 51877687b1 Energy split drawing implemented;
Debugging output still present, energy split hard coded
2025-02-28 17:13:34 +01:00

93 lines
2.9 KiB
C++
Executable File

#ifndef INJECTOR_H
#define INJECTOR_H
#include <map>
#include <memory>
#include <random>
#include <vector>
#include "simulation/coordinates.h"
class DriftVelocity;
class VelocityDistribution;
class DynamicDensityField;
class MagneticField;
namespace particle {
class Particle;
}
namespace species {
class Specie;
class TrackedSpecie;
} // namespace species
class EventPositionDistribution;
struct InjectorInfo {
public:
std::shared_ptr<species::TrackedSpecie> created_specie;
std::shared_ptr<VelocityDistribution> creation_velocity_distribution;
// int multiplicity;
};
class Injector {
public:
Injector(std::vector<InjectorInfo>& injector_info,
double activity,
std::shared_ptr<EventPositionDistribution> position_distribution,
std::shared_ptr<DriftVelocity> mother_drift_velocity);
std::vector<particle::Particle> rollNewParticles(std::mt19937* engine,
const double current_time,
const double beta_particle_weight);
// draw new particles from the DynamicDensityField of the provided specie
// the new particles are then appened to the vector queue
// the magnetic field is necessary for the determination of the direction of the
// injected particles
// the weight scales the time a particle contributes to a certain bin
// and the injection time specifies the time the particle is injected (has to be
// between T, T+\DeltaT)
void drawNewParticleFromDensityField(std::mt19937* engine,
std::shared_ptr<species::TrackedSpecie> specie,
std::vector<particle::Particle>& queue,
std::shared_ptr<MagneticField> field,
const double weight,
const double injection_time);
void initInjectionTimeDistribution(double delta_t);
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_;
particle::Particle rollNewParticle(
std::mt19937* engine,
const Coordinate& position,
std::shared_ptr<species::TrackedSpecie> created_specie,
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 */