Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored and ManuelHu committed Apr 11, 2024
1 parent d4aa805 commit 3a8ffe2
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/RMGSteppingAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#include "RMGSteppingAction.hh"

#include "G4GenericMessenger.hh"
#include "G4Step.hh"
#include "G4Ions.hh"
#include "G4Step.hh"

#include "RMGLog.hh"
#include "RMGEventAction.hh"
#include "RMGLog.hh"

RMGSteppingAction::RMGSteppingAction(RMGEventAction* eventaction) : fEventAction(eventaction) {

Expand All @@ -36,15 +36,16 @@ void RMGSteppingAction::UserSteppingAction(const G4Step* step) {
auto track = step->GetTrack();
auto particle_type = track->GetDefinition()->GetParticleType();

if (particle_type == "nucleus" && track->GetParentID() > 0 && track->GetKineticEnergy() < 0.1*CLHEP::keV) {
if (particle_type == "nucleus" && track->GetParentID() > 0 &&
track->GetKineticEnergy() < 0.1 * CLHEP::keV) {
auto ion = static_cast<G4Ions*>(track->GetDefinition());
double lifetime = ion->GetPDGLifeTime();
double excitation = ion->GetExcitationEnergy();

// inspired by G4RadioactiveDecay::IsApplicable
if (lifetime > fDaughterKillLifetime && excitation <= 0) {
RMGLog::OutFormat(RMGLog::debug, "Killing daughter nucleus {} (lifetime={} us)",
ion->GetParticleName(), lifetime/CLHEP::us);
ion->GetParticleName(), lifetime / CLHEP::us);

// note: UserSteppingAction is not called after step 0. Secondaries might be generated if
// RadioactiveDecay takes place at step 1.
Expand All @@ -60,8 +61,8 @@ void RMGSteppingAction::SetDaughterKillLifetime(double max_lifetime) {
fDaughterKillLifetime = max_lifetime;
if (fDaughterKillLifetime > 0) {
RMGLog::OutFormat(RMGLog::summary,
"Enabled killing of daughter nuclei with a lifetime longer than {} us.",
fDaughterKillLifetime/CLHEP::us);
"Enabled killing of daughter nuclei with a lifetime longer than {} us.",
fDaughterKillLifetime / CLHEP::us);
}
}

Expand All @@ -70,9 +71,13 @@ void RMGSteppingAction::DefineCommands() {
fMessenger = std::make_unique<G4GenericMessenger>(this, "/RMG/Processes/Stepping/",
"Commands for controlling physics processes");

fMessenger->DeclareMethodWithUnit("DaughterNucleusMaxLifetime", "us", &RMGSteppingAction::SetDaughterKillLifetime)
.SetGuidance("Determines which unstable daughter nuclei will be killed, if they are at rest, depending on their lifetime.")
.SetGuidance("This applies to the defined lifetime of the nucleus, and not on the sampled actual halflife of the simulated particle.")
fMessenger
->DeclareMethodWithUnit("DaughterNucleusMaxLifetime", "us",
&RMGSteppingAction::SetDaughterKillLifetime)
.SetGuidance("Determines which unstable daughter nuclei will be killed, if they are at rest, "
"depending on their lifetime.")
.SetGuidance("This applies to the defined lifetime of the nucleus, and not on the sampled "
"actual halflife of the simulated particle.")
.SetGuidance("Set to -1 to disable this feature.")
.SetParameterName("max_lifetime", false)
.SetDefaultValue("-1")
Expand Down

0 comments on commit 3a8ffe2

Please sign in to comment.