00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 // -------------------------------------------------------------- 00031 // GEANT 4 class implementation file 00032 // 00033 // ------------------------------------------------------------ 00034 // 00035 00036 #include "G4UnknownDecay.hh" 00037 00038 #include "G4PhysicalConstants.hh" 00039 #include "G4SystemOfUnits.hh" 00040 #include "G4DynamicParticle.hh" 00041 #include "G4DecayProducts.hh" 00042 #include "G4PhysicsLogVector.hh" 00043 #include "G4ParticleChangeForDecay.hh" 00044 #include "G4DecayProcessType.hh" 00045 00046 // constructor 00047 G4UnknownDecay::G4UnknownDecay(const G4String& processName) 00048 :G4VDiscreteProcess(processName, fDecay), 00049 verboseLevel(1), 00050 HighestValue(20.0) 00051 { 00052 // set Process Sub Type 00053 SetProcessSubType(static_cast<int>(DECAY_Unknown)); 00054 00055 #ifdef G4VERBOSE 00056 if (GetVerboseLevel()>1) { 00057 G4cout << "G4UnknownDecay constructor " << " Name:" << processName << G4endl; 00058 } 00059 #endif 00060 pParticleChange = &fParticleChangeForDecay; 00061 } 00062 00063 G4UnknownDecay::~G4UnknownDecay() 00064 { 00065 } 00066 00067 G4bool G4UnknownDecay::IsApplicable(const G4ParticleDefinition& aParticleType) 00068 { 00069 if(aParticleType.GetParticleName()=="unknown") return true; 00070 return false; 00071 } 00072 00073 G4double G4UnknownDecay::GetMeanFreePath(const G4Track& /*aTrack*/,G4double, G4ForceCondition*) 00074 { 00075 return DBL_MIN; 00076 } 00077 00078 void G4UnknownDecay::BuildPhysicsTable(const G4ParticleDefinition&) 00079 { 00080 return; 00081 } 00082 00083 G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step& ) 00084 { 00085 // The DecayIt() method returns by pointer a particle-change object. 00086 // Units are expressed in GEANT4 internal units. 00087 00088 // Initialize ParticleChange 00089 // all members of G4VParticleChange are set to equal to 00090 // corresponding member in G4Track 00091 fParticleChangeForDecay.Initialize(aTrack); 00092 00093 // get particle 00094 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); 00095 00096 //check if thePreAssignedDecayProducts exists 00097 const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts()); 00098 G4bool isPreAssigned = (o_products != 0); 00099 G4DecayProducts* products = 0; 00100 00101 if (!isPreAssigned ){ 00102 fParticleChangeForDecay.SetNumberOfSecondaries(0); 00103 // Kill the parent particle 00104 fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ; 00105 fParticleChangeForDecay.ProposeLocalEnergyDeposit(0.0); 00106 00107 ClearNumberOfInteractionLengthLeft(); 00108 return &fParticleChangeForDecay ; 00109 } 00110 00111 // copy decay products 00112 products = new G4DecayProducts(*o_products); 00113 00114 // get parent particle information ................................... 00115 G4double ParentEnergy = aParticle->GetTotalEnergy(); 00116 G4double ParentMass = aParticle->GetMass(); 00117 if (ParentEnergy < ParentMass) { 00118 ParentEnergy = ParentMass; 00119 #ifdef G4VERBOSE 00120 if (GetVerboseLevel()>1) { 00121 G4cout << "G4UnknownDecay::DoIt : Total Energy is less than its mass" << G4endl; 00122 G4cout << " Particle: " << aParticle->GetDefinition()->GetParticleName(); 00123 G4cout << " Energy:" << ParentEnergy/MeV << "[MeV]"; 00124 G4cout << " Mass:" << ParentMass/MeV << "[MeV]"; 00125 G4cout << G4endl; 00126 } 00127 #endif 00128 } 00129 G4ThreeVector ParentDirection(aParticle->GetMomentumDirection()); 00130 00131 G4double energyDeposit = 0.0; 00132 G4double finalGlobalTime = aTrack.GetGlobalTime(); 00133 //boost all decay products to laboratory frame 00134 //if the particle has traveled 00135 if(aParticle->GetPreAssignedDecayProperTime()>0.) { 00136 products->Boost( ParentEnergy, ParentDirection); 00137 } 00138 00139 //add products in fParticleChangeForDecay 00140 G4int numberOfSecondaries = products->entries(); 00141 fParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries); 00142 #ifdef G4VERBOSE 00143 if (GetVerboseLevel()>1) { 00144 G4cout << "G4UnknownDecay::DoIt : Decay vertex :"; 00145 G4cout << " Time: " << finalGlobalTime/ns << "[ns]"; 00146 G4cout << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]"; 00147 G4cout << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]"; 00148 G4cout << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]"; 00149 G4cout << G4endl; 00150 G4cout << "G4UnknownDecay::DoIt : decay products in Lab. Frame" << G4endl; 00151 products->DumpInfo(); 00152 } 00153 #endif 00154 G4int index; 00155 G4ThreeVector currentPosition; 00156 const G4TouchableHandle thand = aTrack.GetTouchableHandle(); 00157 for (index=0; index < numberOfSecondaries; index++) 00158 { 00159 // get current position of the track 00160 currentPosition = aTrack.GetPosition(); 00161 // create a new track object 00162 G4Track* secondary = new G4Track( products->PopProducts(), 00163 finalGlobalTime , 00164 currentPosition ); 00165 // switch on good for tracking flag 00166 secondary->SetGoodForTrackingFlag(); 00167 secondary->SetTouchableHandle(thand); 00168 // add the secondary track in the List 00169 fParticleChangeForDecay.AddSecondary(secondary); 00170 } 00171 delete products; 00172 00173 // Kill the parent particle 00174 fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ; 00175 fParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit); 00176 fParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime ); 00177 // reset NumberOfInteractionLengthLeft 00178 ClearNumberOfInteractionLengthLeft(); 00179 00180 return &fParticleChangeForDecay ; 00181 } 00182 00183 00184 00185 00186 00187