Added option for initial weights in the injector

This commit is contained in:
2024-07-31 10:35:14 +02:00
parent 961f1a2a8e
commit 4301c4453b
7 changed files with 36 additions and 12 deletions
+9 -3
View File
@@ -21,14 +21,16 @@ Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
const Coordinate& position,
const Vector& velocity,
const double time_birth)
const double time_birth,
const double weight)
: specie_(specie),
position_(position),
velocity_(velocity, position),
id_(this->last_id_),
time_alive_s_(time_birth),
time_in_bin_s_(0.),
interaction_counter_(0) {
interaction_counter_(0),
weight_(weight) {
last_id_++;
}
@@ -100,7 +102,7 @@ double Particle::timeAlive() const {
}
void Particle::increaseTimeInBin(double time_s) {
time_in_bin_s_ += time_s;
time_in_bin_s_ += time_s*weight_;
}
void Particle::resetTimeInBin() {
@@ -115,4 +117,8 @@ long int Particle::ID() const {
return id_;
}
double Particle::weight() const {
return weight_;
}
} // namespace particle