Geant4  10.00.p01
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: G4UnknownDecay.cc 71045 2013-06-10 09:34:33Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------
31 // GEANT 4 class implementation file
32 //
33 // ------------------------------------------------------------
34 //
35 
36 #include "G4UnknownDecay.hh"
37 
38 #include "G4PhysicalConstants.hh"
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
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
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 ){
103  // Kill the parent particle
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;
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
170  }
171  delete products;
172 
173  // Kill the parent particle
176  fParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime );
177  // reset NumberOfInteractionLengthLeft
179 
180  return &fParticleChangeForDecay ;
181 }
182 
183 
184 
185 
186 
187 
static const double cm
Definition: G4SIunits.hh:106
static const double MeV
Definition: G4SIunits.hh:193
G4int GetVerboseLevel() const
virtual G4VParticleChange * DecayIt(const G4Track &aTrack, const G4Step &aStep)
CLHEP::Hep3Vector G4ThreeVector
G4double GetTotalEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4double z
Definition: TRTMaterials.hh:39
const G4ThreeVector & GetPosition() const
virtual G4bool IsApplicable(const G4ParticleDefinition &)
const G4DecayProducts * GetPreAssignedDecayProducts() const
G4ParticleChangeForDecay fParticleChangeForDecay
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4ParticleDefinition * GetDefinition() const
void Boost(G4double totalEnergy, const G4ThreeVector &momentumDirection)
void ClearNumberOfInteractionLengthLeft()
Definition: G4VProcess.hh:447
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
virtual void Initialize(const G4Track &)
G4GLOB_DLL std::ostream G4cout
static char * currentPosition
G4double GetMass() const
bool G4bool
Definition: G4Types.hh:79
void DumpInfo() const
const G4ThreeVector & GetMomentumDirection() const
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
Definition: G4Step.hh:76
G4double GetGlobalTime() const
void AddSecondary(G4Track *aSecondary)
const G4TouchableHandle & GetTouchableHandle() const
virtual G4double GetMeanFreePath(const G4Track &aTrack, G4double previousStepSize, G4ForceCondition *condition)
virtual ~G4UnknownDecay()
void SetNumberOfSecondaries(G4int totSecondaries)
G4DynamicParticle * PopProducts()
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
G4UnknownDecay(const G4String &processName="UnknownDecay")
#define DBL_MIN
Definition: templates.hh:75
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
#define G4endl
Definition: G4ios.hh:61
G4int entries() const
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
G4ForceCondition
G4double GetPreAssignedDecayProperTime() const
#define ns
Definition: xmlparse.cc:597
void SetGoodForTrackingFlag(G4bool value=true)