Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4UnknownDecay.cc,v 1.2 2004/10/19 00:56:34 kurasige Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 27 // 26 // 28 // 27 // 29 // ------------------------------------------- 28 // -------------------------------------------------------------- 30 // GEANT 4 class implementation file 29 // GEANT 4 class implementation file 31 // 30 // 32 // ------------------------------------------- 31 // ------------------------------------------------------------ 33 // 32 // 34 33 35 #include "G4UnknownDecay.hh" 34 #include "G4UnknownDecay.hh" 36 << 37 #include "G4PhysicalConstants.hh" << 38 #include "G4SystemOfUnits.hh" << 39 #include "G4DynamicParticle.hh" 35 #include "G4DynamicParticle.hh" 40 #include "G4DecayProducts.hh" 36 #include "G4DecayProducts.hh" 41 #include "G4PhysicsLogVector.hh" 37 #include "G4PhysicsLogVector.hh" 42 #include "G4ParticleChangeForDecay.hh" 38 #include "G4ParticleChangeForDecay.hh" 43 #include "G4DecayProcessType.hh" << 44 39 45 // constructor 40 // constructor 46 G4UnknownDecay::G4UnknownDecay(const G4String& 41 G4UnknownDecay::G4UnknownDecay(const G4String& processName) 47 :G4VDiscretePro 42 :G4VDiscreteProcess(processName, fDecay), 48 verboseLevel(1), 43 verboseLevel(1), 49 HighestValue(2 44 HighestValue(20.0) 50 { 45 { 51 // set Process Sub Type << 52 SetProcessSubType(static_cast<int>(DECAY_Unk << 53 << 54 #ifdef G4VERBOSE 46 #ifdef G4VERBOSE 55 if (GetVerboseLevel()>1) { 47 if (GetVerboseLevel()>1) { 56 G4cout << "G4UnknownDecay constructor " < << 48 G4cerr << "G4UnknownDecay constructor " << " Name:" << processName << G4endl; 57 } 49 } 58 #endif 50 #endif 59 pParticleChange = &fParticleChangeForDecay; 51 pParticleChange = &fParticleChangeForDecay; 60 } 52 } 61 53 62 G4UnknownDecay::~G4UnknownDecay() 54 G4UnknownDecay::~G4UnknownDecay() 63 { 55 { 64 } 56 } 65 57 66 G4bool G4UnknownDecay::IsApplicable(const G4Pa 58 G4bool G4UnknownDecay::IsApplicable(const G4ParticleDefinition& aParticleType) 67 { 59 { 68 if(aParticleType.GetParticleName()=="unknown 60 if(aParticleType.GetParticleName()=="unknown") return true; 69 return false; 61 return false; 70 } 62 } 71 63 72 G4double G4UnknownDecay::GetMeanFreePath(const 64 G4double G4UnknownDecay::GetMeanFreePath(const G4Track& /*aTrack*/,G4double, G4ForceCondition*) 73 { 65 { 74 return 0.0; << 66 // // get particle >> 67 // const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); >> 68 // >> 69 // // returns the mean free path in GEANT4 internal units >> 70 // G4double pathlength; >> 71 // G4double pTime = aParticle->GetPreAssignedDecayProperTime(); >> 72 // if(pTime<0.) pTime = DBL_MIN; >> 73 // G4double aCtau = c_light * pTime; >> 74 // G4double aMass = aParticle->GetMass(); >> 75 // >> 76 // G4double rKineticEnergy = aParticle->GetKineticEnergy()/aMass; >> 77 // if ( rKineticEnergy > HighestValue) { >> 78 // // gamma >> 1 >> 79 // pathlength = ( rKineticEnergy + 1.0)* aCtau; >> 80 // } else if ( rKineticEnergy < DBL_MIN ) { >> 81 // // too slow particle >> 82 // pathlength = DBL_MIN; >> 83 // } else { >> 84 // pathlength = (aParticle->GetTotalMomentum())/aMass*aCtau ; >> 85 // } >> 86 // return pathlength; >> 87 return DBL_MIN; 75 } 88 } 76 89 77 void G4UnknownDecay::BuildPhysicsTable(const G 90 void G4UnknownDecay::BuildPhysicsTable(const G4ParticleDefinition&) 78 { 91 { 79 return; 92 return; 80 } 93 } 81 94 82 G4VParticleChange* G4UnknownDecay::DecayIt(con 95 G4VParticleChange* G4UnknownDecay::DecayIt(const G4Track& aTrack, const G4Step& ) 83 { 96 { 84 // The DecayIt() method returns by pointer a 97 // The DecayIt() method returns by pointer a particle-change object. 85 // Units are expressed in GEANT4 internal un 98 // Units are expressed in GEANT4 internal units. 86 99 87 // Initialize ParticleChange 100 // Initialize ParticleChange 88 // all members of G4VParticleChange are 101 // all members of G4VParticleChange are set to equal to 89 // corresponding member in G4Track 102 // corresponding member in G4Track 90 fParticleChangeForDecay.Initialize(aTrack); 103 fParticleChangeForDecay.Initialize(aTrack); 91 104 92 // get particle 105 // get particle 93 const G4DynamicParticle* aParticle = aTrack. 106 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle(); 94 107 95 //check if thePreAssignedDecayProducts exist 108 //check if thePreAssignedDecayProducts exists 96 const G4DecayProducts* o_products = (aPartic 109 const G4DecayProducts* o_products = (aParticle->GetPreAssignedDecayProducts()); 97 G4bool isPreAssigned = (o_products != nullpt << 110 G4bool isPreAssigned = (o_products != 0); 98 G4DecayProducts* products = nullptr; << 111 G4DecayProducts* products = 0; 99 112 100 if (!isPreAssigned ){ 113 if (!isPreAssigned ){ 101 fParticleChangeForDecay.SetNumberOfSeconda 114 fParticleChangeForDecay.SetNumberOfSecondaries(0); 102 // Kill the parent particle 115 // Kill the parent particle 103 fParticleChangeForDecay.ProposeTrackStatus 116 fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ; 104 fParticleChangeForDecay.ProposeLocalEnergy 117 fParticleChangeForDecay.ProposeLocalEnergyDeposit(0.0); 105 118 106 ClearNumberOfInteractionLengthLeft(); 119 ClearNumberOfInteractionLengthLeft(); 107 return &fParticleChangeForDecay ; 120 return &fParticleChangeForDecay ; 108 } 121 } 109 122 110 // copy decay products 123 // copy decay products 111 products = new G4DecayProducts(*o_products); 124 products = new G4DecayProducts(*o_products); 112 125 113 // get parent particle information ......... 126 // get parent particle information ................................... 114 G4double ParentEnergy = aParticle->GetTot 127 G4double ParentEnergy = aParticle->GetTotalEnergy(); 115 G4double ParentMass = aParticle->GetMas << 116 if (ParentEnergy < ParentMass) { << 117 ParentEnergy = ParentMass; << 118 #ifdef G4VERBOSE << 119 if (GetVerboseLevel()>1) { << 120 G4cout << "G4UnknownDecay::DoIt : Total << 121 G4cout << " Particle: " << aParticle->Ge << 122 G4cout << " Energy:" << ParentEnergy/ << 123 G4cout << " Mass:" << ParentMass/MeV << 124 G4cout << G4endl; << 125 } << 126 #endif << 127 } << 128 G4ThreeVector ParentDirection(aParticle->Get 128 G4ThreeVector ParentDirection(aParticle->GetMomentumDirection()); 129 129 130 G4double energyDeposit = 0.0; 130 G4double energyDeposit = 0.0; 131 G4double finalGlobalTime = aTrack.GetGlobalT 131 G4double finalGlobalTime = aTrack.GetGlobalTime(); 132 //boost all decay products to laboratory fra 132 //boost all decay products to laboratory frame 133 //if the particle has traveled 133 //if the particle has traveled 134 if(aParticle->GetPreAssignedDecayProperTime( << 134 if(aParticle->GetPreAssignedDecayProperTime()>0.) { 135 products->Boost( ParentEnergy, ParentDirec 135 products->Boost( ParentEnergy, ParentDirection); 136 } 136 } 137 137 138 //add products in fParticleChangeForDecay 138 //add products in fParticleChangeForDecay 139 G4int numberOfSecondaries = products->entrie 139 G4int numberOfSecondaries = products->entries(); 140 fParticleChangeForDecay.SetNumberOfSecondari 140 fParticleChangeForDecay.SetNumberOfSecondaries(numberOfSecondaries); 141 #ifdef G4VERBOSE 141 #ifdef G4VERBOSE 142 if (GetVerboseLevel()>1) { 142 if (GetVerboseLevel()>1) { 143 G4cout << "G4UnknownDecay::DoIt : Decay v << 143 G4cerr << "G4UnknownDecay::DoIt : Decay vertex :"; 144 G4cout << " Time: " << finalGlobalTime/ns << 144 G4cerr << " Time: " << finalGlobalTime/ns << "[ns]"; 145 G4cout << " X:" << (aTrack.GetPosition()). << 145 G4cerr << " X:" << (aTrack.GetPosition()).x() /cm << "[cm]"; 146 G4cout << " Y:" << (aTrack.GetPosition()). << 146 G4cerr << " Y:" << (aTrack.GetPosition()).y() /cm << "[cm]"; 147 G4cout << " Z:" << (aTrack.GetPosition()). << 147 G4cerr << " Z:" << (aTrack.GetPosition()).z() /cm << "[cm]"; 148 G4cout << G4endl; << 148 G4cerr << G4endl; 149 G4cout << "G4UnknownDecay::DoIt : decay p << 149 G4cerr << "G4UnknownDecay::DoIt : decay products in Lab. Frame" << G4endl; 150 products->DumpInfo(); 150 products->DumpInfo(); 151 } 151 } 152 #endif 152 #endif 153 G4int index; 153 G4int index; 154 G4ThreeVector currentPosition; 154 G4ThreeVector currentPosition; 155 const G4TouchableHandle thand = aTrack.GetTo 155 const G4TouchableHandle thand = aTrack.GetTouchableHandle(); 156 for (index=0; index < numberOfSecondaries; i << 156 for (index=0; index < numberOfSecondaries; index++) 157 // get current position of the track << 157 { 158 currentPosition = aTrack.GetPosition(); << 158 // get current position of the track 159 // create a new track object << 159 currentPosition = aTrack.GetPosition(); 160 G4Track* secondary = new G4Track( products << 160 // create a new track object >> 161 G4Track* secondary = new G4Track( products->PopProducts(), 161 finalGlobalTime , 162 finalGlobalTime , 162 currentPosition ); 163 currentPosition ); 163 // switch on good for tracking flag << 164 // switch on good for tracking flag 164 secondary->SetGoodForTrackingFlag(); << 165 secondary->SetGoodForTrackingFlag(); 165 secondary->SetTouchableHandle(thand); << 166 secondary->SetTouchableHandle(thand); 166 // add the secondary track in the List << 167 // add the secondary track in the List 167 fParticleChangeForDecay.AddSecondary(secon << 168 fParticleChangeForDecay.AddSecondary(secondary); 168 } 169 } 169 delete products; 170 delete products; 170 << 171 171 // Kill the parent particle 172 // Kill the parent particle 172 fParticleChangeForDecay.ProposeTrackStatus( 173 fParticleChangeForDecay.ProposeTrackStatus( fStopAndKill ) ; 173 fParticleChangeForDecay.ProposeLocalEnergyDe 174 fParticleChangeForDecay.ProposeLocalEnergyDeposit(energyDeposit); 174 fParticleChangeForDecay.ProposeGlobalTime( f 175 fParticleChangeForDecay.ProposeGlobalTime( finalGlobalTime ); 175 // reset NumberOfInteractionLengthLeft 176 // reset NumberOfInteractionLengthLeft 176 ClearNumberOfInteractionLengthLeft(); 177 ClearNumberOfInteractionLengthLeft(); 177 178 178 return &fParticleChangeForDecay ; 179 return &fParticleChangeForDecay ; 179 } 180 } 180 181 181 void G4UnknownDecay::ProcessDescription(std::o << 182 { << 183 outFile << GetProcessName() << 184 << ": Decay of 'unknown' particles. \n" << 185 << "kinematics of daughters are dertermine << 186 << "by PreAssignedDecayProducts. \n"; << 187 } << 188 182 189 183 190 184 191 185 192 186 193 187