Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UnknownDecay.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29//
30// --------------------------------------------------------------
31// GEANT 4 class implementation file
32//
33// ------------------------------------------------------------
34//
35
36#include "G4UnknownDecay.hh"
37
39#include "G4SystemOfUnits.hh"
40#include "G4DynamicParticle.hh"
41#include "G4DecayProducts.hh"
42#include "G4PhysicsLogVector.hh"
44#include "G4DecayProcessType.hh"
45
46// constructor
48 :G4VDiscreteProcess(processName, fDecay),
49 verboseLevel(1),
50 HighestValue(20.0)
51{
52 // set Process Sub Type
53 SetProcessSubType(static_cast<int>(DECAY_Unknown));
54
55#ifdef G4VERBOSE
56 if (GetVerboseLevel()>1) {
57 G4cout << "G4UnknownDecay constructor " << " Name:" << processName << G4endl;
58 }
59#endif
60 pParticleChange = &fParticleChangeForDecay;
61}
62
64{
65}
66
68{
69 if(aParticleType.GetParticleName()=="unknown") return true;
70 return false;
71}
72
74{
75 return DBL_MIN;
76}
77
79{
80 return;
81}
82
84{
85 // The DecayIt() method returns by pointer a particle-change object.
86 // Units are expressed in GEANT4 internal units.
87
88 // Initialize ParticleChange
89 // all members of G4VParticleChange are set to equal to
90 // corresponding member in G4Track
91 fParticleChangeForDecay.Initialize(aTrack);
92
93 // get particle
94 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
95
96 //check if thePreAssignedDecayProducts exists
97 const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts());
98 G4bool isPreAssigned = (o_products != 0);
99 G4DecayProducts* products = 0;
100
101 if (!isPreAssigned ){
102 fParticleChangeForDecay.SetNumberOfSecondaries(0);
103 // Kill the parent particle
104 fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
105 fParticleChangeForDecay.ProposeLocalEnergyDeposit(0.0);
106
108 return &fParticleChangeForDecay ;
109 }
110
111 // copy decay products
112 products = new G4DecayProducts(*o_products);
113
114 // get parent particle information ...................................
115 G4double ParentEnergy = aParticle->GetTotalEnergy();
116 G4double ParentMass = aParticle->GetMass();
117 if (ParentEnergy < ParentMass) {
118 ParentEnergy = ParentMass;
119#ifdef G4VERBOSE
120 if (GetVerboseLevel()>1) {
121 G4cout << "G4UnknownDecay::DoIt : Total Energy is less than its mass" << G4endl;
122 G4cout << " Particle: " << aParticle->GetDefinition()->GetParticleName();
123 G4cout << " Energy:" << ParentEnergy/MeV << "[MeV]";
124 G4cout << " Mass:" << ParentMass/MeV << "[MeV]";
125 G4cout << G4endl;
126 }
127#endif
128 }
129 G4ThreeVector ParentDirection(aParticle->GetMomentumDirection());
130
131 G4double energyDeposit = 0.0;
132 G4double finalGlobalTime = aTrack.GetGlobalTime();
133 //boost all decay products to laboratory frame
134 //if the particle has traveled
135 if(aParticle->GetPreAssignedDecayProperTime()>0.) {
136 products->Boost( ParentEnergy, ParentDirection);
137 }
138
139 //add products in fParticleChangeForDecay
140 G4int numberOfSecondaries = products->entries();
141 fParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries);
142#ifdef G4VERBOSE
143 if (GetVerboseLevel()>1) {
144 G4cout << "G4UnknownDecay::DoIt : Decay vertex :";
145 G4cout << " Time: " << finalGlobalTime/ns << "[ns]";
146 G4cout << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]";
147 G4cout << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]";
148 G4cout << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]";
149 G4cout << G4endl;
150 G4cout << "G4UnknownDecay::DoIt : decay products in Lab. Frame" << G4endl;
151 products->DumpInfo();
152 }
153#endif
154 G4int index;
155 G4ThreeVector currentPosition;
156 const G4TouchableHandle thand = aTrack.GetTouchableHandle();
157 for (index=0; index < numberOfSecondaries; index++)
158 {
159 // get current position of the track
160 currentPosition = aTrack.GetPosition();
161 // create a new track object
162 G4Track* secondary = new G4Track( products->PopProducts(),
163 finalGlobalTime ,
164 currentPosition );
165 // switch on good for tracking flag
166 secondary->SetGoodForTrackingFlag();
167 secondary->SetTouchableHandle(thand);
168 // add the secondary track in the List
169 fParticleChangeForDecay.AddSecondary(secondary);
170 }
171 delete products;
172
173 // Kill the parent particle
174 fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ;
175 fParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit);
176 fParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime );
177 // reset NumberOfInteractionLengthLeft
179
180 return &fParticleChangeForDecay ;
181}
182
183
184
185
186
187
@ DECAY_Unknown
G4ForceCondition
@ fDecay
@ fStopAndKill
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
void DumpInfo() const
G4int entries() const
G4DynamicParticle * PopProducts()
void Boost(G4double totalEnergy, const G4ThreeVector &momentumDirection)
G4double GetMass() const
const G4ThreeVector & GetMomentumDirection() const
const G4DecayProducts * GetPreAssignedDecayProducts() const
G4ParticleDefinition * GetDefinition() const
G4double GetTotalEnergy() const
G4double GetPreAssignedDecayProperTime() const
virtual void Initialize(const G4Track &)
const G4String & GetParticleName() const
Definition: G4Step.hh:78
const G4ThreeVector & GetPosition() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4double GetGlobalTime() const
const G4DynamicParticle * GetDynamicParticle() const
const G4TouchableHandle & GetTouchableHandle() const
void SetGoodForTrackingFlag(G4bool value=true)
G4UnknownDecay(const G4String &processName="UnknownDecay")
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
G4int GetVerboseLevel() const
virtual G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
virtual G4bool IsApplicable(const G4ParticleDefinition &)
virtual ~G4UnknownDecay()
virtual G4VParticleChange * DecayIt(const G4Track &aTrack, const G4Step &aStep)
void ProposeTrackStatus(G4TrackStatus status)
void AddSecondary(G4Track *aSecondary)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetNumberOfSecondaries(G4int totSecondaries)
void ClearNumberOfInteractionLengthLeft()
Definition: G4VProcess.hh:418
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:403
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
#define DBL_MIN
Definition: templates.hh:75
#define ns
Definition: xmlparse.cc:597