11#include <simulation/longlivedneutral/G4LongLivedNeutral.h>
12#include <simulation/longlivedneutral/G4LongLivedNeutralDecay.h>
14#include "G4PhysicalConstants.hh"
15#include "G4SystemOfUnits.hh"
16#include "G4DynamicParticle.hh"
17#include "G4PrimaryParticle.hh"
18#include "G4DecayProducts.hh"
19#include "G4DecayTable.hh"
20#include "G4VDecayChannel.hh"
21#include "G4PhysicsLogVector.hh"
22#include "G4ParticleChangeForDecay.hh"
29 : G4VRestDiscreteProcess(processName, fDecay),
32 fRemainderLifeTime(-1.0)
36 SetProcessSubType(
static_cast<int>(DECAY));
39 if (GetVerboseLevel() > 1) {
40 G4cout <<
"G4LongLivedNeutralDecay constructor " <<
" Name:" << processName << G4endl;
56 if (!aParticleType.GetPDGStable()) {
65 const G4DynamicParticle* dynamicParticle = aTrack.GetDynamicParticle();
66 const G4PrimaryParticle* primaryParticle = dynamicParticle->GetPrimaryParticle();
67 G4double pTime = primaryParticle->GetProperTime();
75 const G4DynamicParticle* dynamicParticle = aTrack.GetDynamicParticle();
76 const G4PrimaryParticle* primaryParticle = dynamicParticle->GetPrimaryParticle();
77 G4double pTime = primaryParticle->GetProperTime();
78 G4double aMass = primaryParticle->GetMass();
79 G4double aMomentum = primaryParticle->GetTotalMomentum();
80 return c_light * pTime * aMomentum / aMass;
100 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
101 const G4PrimaryParticle* aPrimaryParticle = aParticle->GetPrimaryParticle();
104 const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts());
105 G4bool isPreAssigned = (o_products !=
nullptr);
106 G4DecayProducts* products =
nullptr;
110 products =
new G4DecayProducts(*o_products);
113 G4ExceptionDescription ed;
114 ed <<
"LongLivedNeutral particle:"
115 <<
" decay probability exist but no pre-assigned decay products defined "
116 <<
"- the particle will be killed;\n";
117 G4Exception(
"G4LongLivedNeutralDecay::DecayIt ",
118 "DECAY101", JustWarning, ed);
125 ClearNumberOfInteractionLengthLeft();
130 G4double ParentEnergy = aPrimaryParticle->GetTotalEnergy();
131 G4double ParentMass = aPrimaryParticle->GetMass();
132 if (ParentEnergy < ParentMass) {
133 G4ExceptionDescription ed;
134 ed <<
"Total Energy is less than its mass - increased the energy"
135 <<
"\n Particle: " <<
"LongLivedNeutral"
136 <<
"\n Energy:" << ParentEnergy / MeV <<
"[MeV]"
137 <<
"\n Mass:" << ParentMass / MeV <<
"[MeV]";
138 G4Exception(
"G4LongLivedNeutralDecay::DecayIt ",
139 "DECAY102", JustWarning, ed);
140 ParentEnergy = ParentMass;
143 G4ThreeVector ParentDirection(aPrimaryParticle->GetMomentumDirection());
146 const G4DynamicParticle dParticle(aPrimaryParticle->GetParticleDefinition(),
147 aPrimaryParticle->GetMomentumDirection(),
148 aPrimaryParticle->GetKineticEnergy(),
149 aPrimaryParticle->GetMass());
151 products->SetParentParticle(dParticle);
153 G4double energyDeposit = 0.0;
154 G4double finalGlobalTime = aTrack.GetGlobalTime();
155 G4double finalLocalTime = aTrack.GetLocalTime();
156 if (aTrack.GetTrackStatus() == fStopButAlive) {
160 energyDeposit += aPrimaryParticle->GetKineticEnergy();
161 products->Boost(ParentEnergy, ParentDirection);
164 products->Boost(ParentEnergy, ParentDirection);
168 G4int numberOfSecondaries = products->entries();
171 if (GetVerboseLevel() > 1) {
172 G4cout <<
"G4LongLivedNeutralDecay::DoIt : Decay vertex :";
173 G4cout <<
" Time: " << finalGlobalTime / ns <<
"[ns]";
174 G4cout <<
" proper time: " << finalLocalTime / ns <<
"[ns]";
175 G4cout <<
" X:" << (aTrack.GetPosition()).getX() / cm <<
"[cm]";
176 G4cout <<
" Y:" << (aTrack.GetPosition()).getY() / cm <<
"[cm]";
177 G4cout <<
" Z:" << (aTrack.GetPosition()).getZ() / cm <<
"[cm]";
179 G4cout <<
"G4LongLivedNeutralDecay::DoIt : decay products in Lab. Frame" << G4endl;
180 products->DumpInfo();
185 G4ThreeVector currentPosition;
186 const G4TouchableHandle thand = aTrack.GetTouchableHandle();
187 for (index = 0; index < numberOfSecondaries; index++) {
189 currentPosition = aTrack.GetPosition();
191 G4Track* secondary =
new G4Track(products->PopProducts(),
195 secondary->SetGoodForTrackingFlag();
196 secondary->SetTouchableHandle(thand);
208 ClearNumberOfInteractionLengthLeft();
216 currentInteractionLength = -1.0;
217 ResetNumberOfInteractionLengthLeft();
226 ClearNumberOfInteractionLengthLeft();
228 currentInteractionLength = -1.0;
233 const G4Track& track,
234 G4double previousStepSize,
235 G4ForceCondition* condition
239 *condition = NotForced;
242 G4double pTime = track.GetDynamicParticle()->GetPrimaryParticle()->GetProperTime();
250 const G4DynamicParticle* dynamicParticle = track.GetDynamicParticle();
251 const G4PrimaryParticle* primaryParticle = dynamicParticle->GetPrimaryParticle();
252 G4double aMass = primaryParticle->GetMass();
253 G4double aMomentum = primaryParticle->GetTotalMomentum();
254 rvalue *= aMomentum / aMass;
259 return previousStepSize * DBL_MAX;
264 const G4Track& track,
265 G4ForceCondition* condition
269 *condition = NotForced;
270 G4double pTime = track.GetDynamicParticle()->GetPrimaryParticle()->GetProperTime();
284 const G4Track& aTrack,
288 if ((aTrack.GetTrackStatus() == fStopButAlive) ||
289 (aTrack.GetTrackStatus() == fStopAndKill)) {
virtual G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
G4VProcess::PostStepDoIt() implemention.
virtual G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition) override
GetMeanFreePath returns ctau*beta*gamma for decay in flight.
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
G4VProcess::PostStepGetPhysicalInteractionLength() implemention.
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &track, G4ForceCondition *condition) override
G4VProcess::AtRestGetPhysicalInteractionLength() implemention.
G4ParticleChangeForDecay fParticleChangeForDecay
ParticleChange for decay process.
G4LongLivedNeutralDecay(const G4String &processName="LongLivedNeutralDecay")
Constructor.
G4double fRemainderLifeTime
ParticleChange for decay process.
virtual void EndTracking() override
inform End of tracking for each track to the physics process
virtual G4VParticleChange * DecayIt(const G4Track &aTrack, const G4Step &aStep)
G4Decay::DecayIt() implemention.
virtual G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *condition) override
GetMeanLifeTime returns ctau for decay at rest.
virtual ~G4LongLivedNeutralDecay()
Destructor.
virtual G4bool IsApplicable(const G4ParticleDefinition &) override
returns "true" if the decay process can be applied to the particle type.
virtual void BuildPhysicsTable(const G4ParticleDefinition &) override
In G4Decay, thePhysicsTable stores values of beta * std::sqrt( 1 - beta*beta) as a function of normal...
virtual void StartTracking(G4Track *) override
inform Start of tracking for each track to the physics process
Abstract base class for different kinds of events.