Loading src/modules/DepositionGeant4/GeneratorActionG4.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -272,7 +272,9 @@ GeneratorActionG4::GeneratorActionG4(const Configuration& config) single_source->SetNumberOfParticles(1); single_source->SetParticleDefinition(particle); // Set the primary track's start time in for the current event to zero: single_source->SetParticleTime(0.0); time_ = config_.get<double>("source_time", Units::get(0.0, "ns")); time_window_ = config_.get<double>("source_time_window", Units::get(0.0, "ns")); single_source->SetParticleTime(time_); } // Set energy parameters Loading Loading @@ -337,8 +339,6 @@ void GeneratorActionG4::GeneratePrimaries(G4Event* event) { // Set global parameters of the source single_source->SetNumberOfParticles(1); single_source->SetParticleDefinition(particle); // Set the primary track's start time in for the current event to zero: single_source->SetParticleTime(0.0); // mark the initialization done initialize_ion_as_particle_ = false; Loading @@ -350,6 +350,12 @@ void GeneratorActionG4::GeneratePrimaries(G4Event* event) { } } // Set the time of the particle source within the time window if(time_window_ > 0) { double event_time = time_ + G4UniformRand() * time_window_; particle_source_->SetParticleTime(event_time); } particle_source_->GeneratePrimaryVertex(event); } Loading src/modules/DepositionGeant4/GeneratorActionG4.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,10 @@ namespace allpix { std::string particle_type_; bool initialize_ion_as_particle_{false}; double time_{0.0}; double time_window_{0.0}; }; /** Loading Loading
src/modules/DepositionGeant4/GeneratorActionG4.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -272,7 +272,9 @@ GeneratorActionG4::GeneratorActionG4(const Configuration& config) single_source->SetNumberOfParticles(1); single_source->SetParticleDefinition(particle); // Set the primary track's start time in for the current event to zero: single_source->SetParticleTime(0.0); time_ = config_.get<double>("source_time", Units::get(0.0, "ns")); time_window_ = config_.get<double>("source_time_window", Units::get(0.0, "ns")); single_source->SetParticleTime(time_); } // Set energy parameters Loading Loading @@ -337,8 +339,6 @@ void GeneratorActionG4::GeneratePrimaries(G4Event* event) { // Set global parameters of the source single_source->SetNumberOfParticles(1); single_source->SetParticleDefinition(particle); // Set the primary track's start time in for the current event to zero: single_source->SetParticleTime(0.0); // mark the initialization done initialize_ion_as_particle_ = false; Loading @@ -350,6 +350,12 @@ void GeneratorActionG4::GeneratePrimaries(G4Event* event) { } } // Set the time of the particle source within the time window if(time_window_ > 0) { double event_time = time_ + G4UniformRand() * time_window_; particle_source_->SetParticleTime(event_time); } particle_source_->GeneratePrimaryVertex(event); } Loading
src/modules/DepositionGeant4/GeneratorActionG4.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,10 @@ namespace allpix { std::string particle_type_; bool initialize_ion_as_particle_{false}; double time_{0.0}; double time_window_{0.0}; }; /** Loading