Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4eSingleCoulombScatteringModel.cc 26 // G4eSingleCoulombScatteringModel.cc 27 // ------------------------------------------- 27 // ------------------------------------------------------------------- 28 // 28 // 29 // GEANT4 Class header file 29 // GEANT4 Class header file 30 // 30 // 31 // File name: G4eSingleCoulombScatteringMod 31 // File name: G4eSingleCoulombScatteringModel 32 // 32 // 33 // Author: Cristina Consolandi 33 // Author: Cristina Consolandi 34 // 34 // 35 // Creation date: 20.10.2012 35 // Creation date: 20.10.2012 36 // 36 // 37 // Class Description: 37 // Class Description: 38 // Single Scattering model for electron-nucle 38 // Single Scattering model for electron-nuclei interaction. 39 // Suitable for high energy electrons and low 39 // Suitable for high energy electrons and low scattering angles. 40 // 40 // 41 // 41 // 42 // Reference: 42 // Reference: 43 // M.J. Boschini et al. "Non Ionizing Ene 43 // M.J. Boschini et al. "Non Ionizing Energy Loss induced by Electrons 44 // in the Space Environment" Proc. of the 44 // in the Space Environment" Proc. of the 13th International Conference 45 // on Particle Physics and Advanced Techn 45 // on Particle Physics and Advanced Technology 46 // 46 // 47 // (13th ICPPAT, Como 3-7/10/2011), World Sci 47 // (13th ICPPAT, Como 3-7/10/2011), World Scientific (Singapore). 48 // Available at: http://arxiv.org/abs/1111.40 48 // Available at: http://arxiv.org/abs/1111.4042v4 49 // 49 // 50 // 50 // 51 // ------------------------------------------- 51 // ------------------------------------------------------------------- 52 // 52 // 53 //....oooOO0OOooo........oooOO0OOooo........oo 53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 54 54 55 55 56 #include "G4eSingleCoulombScatteringModel.hh" 56 #include "G4eSingleCoulombScatteringModel.hh" 57 #include "G4PhysicalConstants.hh" 57 #include "G4PhysicalConstants.hh" 58 #include "G4SystemOfUnits.hh" 58 #include "G4SystemOfUnits.hh" 59 #include "Randomize.hh" 59 #include "Randomize.hh" 60 #include "G4ParticleChangeForGamma.hh" 60 #include "G4ParticleChangeForGamma.hh" 61 #include "G4Proton.hh" 61 #include "G4Proton.hh" 62 #include "G4ProductionCutsTable.hh" 62 #include "G4ProductionCutsTable.hh" 63 #include "G4NucleiProperties.hh" 63 #include "G4NucleiProperties.hh" 64 #include "G4NistManager.hh" 64 #include "G4NistManager.hh" 65 #include "G4ParticleTable.hh" 65 #include "G4ParticleTable.hh" 66 #include "G4IonTable.hh" 66 #include "G4IonTable.hh" 67 67 68 #include "G4UnitsTable.hh" 68 #include "G4UnitsTable.hh" 69 #include "G4EmParameters.hh" 69 #include "G4EmParameters.hh" 70 70 71 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 72 72 73 using namespace std; 73 using namespace std; 74 74 75 G4eSingleCoulombScatteringModel::G4eSingleCoul 75 G4eSingleCoulombScatteringModel::G4eSingleCoulombScatteringModel(const G4String& nam) 76 : G4VEmModel(nam), 76 : G4VEmModel(nam), 77 cosThetaMin(1.0) 77 cosThetaMin(1.0) 78 { 78 { 79 fNistManager = G4NistManager::Instance(); 79 fNistManager = G4NistManager::Instance(); 80 theIonTable = G4ParticleTable::GetParticleTa 80 theIonTable = G4ParticleTable::GetParticleTable()->GetIonTable(); 81 fParticleChange = nullptr; 81 fParticleChange = nullptr; 82 82 83 pCuts=nullptr; 83 pCuts=nullptr; 84 currentMaterial = nullptr; 84 currentMaterial = nullptr; 85 currentElement = nullptr; 85 currentElement = nullptr; 86 currentCouple = nullptr; 86 currentCouple = nullptr; 87 87 88 lowEnergyLimit = 0*keV; 88 lowEnergyLimit = 0*keV; 89 recoilThreshold = 0.*eV; 89 recoilThreshold = 0.*eV; 90 XSectionModel = 1; << 91 FormFactor = 0; 90 FormFactor = 0; 92 particle = nullptr; 91 particle = nullptr; 93 mass=0.0; 92 mass=0.0; 94 currentMaterialIndex = -1; 93 currentMaterialIndex = -1; 95 94 96 Mottcross = new G4ScreeningMottCrossSection( 95 Mottcross = new G4ScreeningMottCrossSection(); 97 //G4cout <<"## G4eSingleCoulombScatteringMod << 98 } 96 } 99 97 100 //....oooOO0OOooo........oooOO0OOooo........oo 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 101 99 102 G4eSingleCoulombScatteringModel::~G4eSingleCou 100 G4eSingleCoulombScatteringModel::~G4eSingleCoulombScatteringModel() 103 { 101 { 104 //G4cout <<"## G4eSingleCoulombScatteringMod << 102 delete Mottcross; 105 delete Mottcross; << 106 } 103 } 107 104 108 //....oooOO0OOooo........oooOO0OOooo........oo 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 109 106 110 void G4eSingleCoulombScatteringModel::Initiali 107 void G4eSingleCoulombScatteringModel::Initialise(const G4ParticleDefinition* p, 111 const G4DataVector& cuts) 108 const G4DataVector& cuts) 112 { 109 { 113 G4EmParameters* param = G4EmParameters::Inst 110 G4EmParameters* param = G4EmParameters::Instance(); 114 111 115 SetupParticle(p); 112 SetupParticle(p); 116 currentCouple = nullptr; 113 currentCouple = nullptr; 117 currentMaterialIndex = -1; 114 currentMaterialIndex = -1; 118 //cosThetaMin = cos(PolarAngleLimit()); 115 //cosThetaMin = cos(PolarAngleLimit()); 119 Mottcross->Initialise(p,cosThetaMin); 116 Mottcross->Initialise(p,cosThetaMin); 120 117 121 pCuts = &cuts; 118 pCuts = &cuts; 122 //G4ProductionCutsTable::GetProductionCutsTa 119 //G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(3); 123 120 124 /* 121 /* 125 G4cout << "!!! G4eSingleCoulombScatteringMod 122 G4cout << "!!! G4eSingleCoulombScatteringModel::Initialise for " 126 << part->GetParticleName() << " cos( 123 << part->GetParticleName() << " cos(TetMin)= " << cosThetaMin 127 << " cos(TetMax)= " << cosThetaMax < 124 << " cos(TetMax)= " << cosThetaMax <<G4endl; 128 G4cout << "cut= " << (*pCuts)[0] << " cut1= 125 G4cout << "cut= " << (*pCuts)[0] << " cut1= " << (*pCuts)[1] << G4endl; 129 */ 126 */ 130 127 131 if(!fParticleChange) { 128 if(!fParticleChange) { 132 fParticleChange = GetParticleChangeForGamm 129 fParticleChange = GetParticleChangeForGamma(); 133 } 130 } 134 131 135 if(IsMaster()) { 132 if(IsMaster()) { 136 InitialiseElementSelectors(p,cuts); 133 InitialiseElementSelectors(p,cuts); 137 } 134 } 138 135 139 FormFactor=param->NuclearFormfactorType(); 136 FormFactor=param->NuclearFormfactorType(); 140 137 141 //G4cout<<"NUCLEAR FORM FACTOR: "<<FormFacto 138 //G4cout<<"NUCLEAR FORM FACTOR: "<<FormFactor<<G4endl; 142 } 139 } 143 140 144 //....oooOO0OOooo........oooOO0OOooo........oo << 141 void G4eSingleCoulombScatteringModel::InitialiseLocal(const G4ParticleDefinition*, 145 << 142 G4VEmModel* masterModel) 146 void << 147 G4eSingleCoulombScatteringModel::InitialiseLoc << 148 << 149 { 143 { 150 SetElementSelectors(masterModel->GetElementS 144 SetElementSelectors(masterModel->GetElementSelectors()); 151 } 145 } 152 << 153 //....oooOO0OOooo........oooOO0OOooo........oo << 154 << 155 void G4eSingleCoulombScatteringModel::SetXSect << 156 { << 157 if(model == "Fast" || model == "fast") << 158 else if(model == "Precise" || model == "prec << 159 else { << 160 G4cout<<"G4eSingleCoulombScatteringModel W << 161 <<" is not a valid model name"<<G4endl; << 162 } << 163 } << 164 << 165 //....oooOO0OOooo........oooOO0OOooo........oo 146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 166 147 167 G4double G4eSingleCoulombScatteringModel::Comp 148 G4double G4eSingleCoulombScatteringModel::ComputeCrossSectionPerAtom( 168 const G4Partic 149 const G4ParticleDefinition* p, 169 G4double kinEnergy, 150 G4double kinEnergy, 170 G4double Z, 151 G4double Z, 171 G4double , 152 G4double , 172 G4double, 153 G4double, 173 G4double ) 154 G4double ) 174 { 155 { 175 SetupParticle(p); 156 SetupParticle(p); 176 157 177 G4double cross =0.0; 158 G4double cross =0.0; 178 if(kinEnergy < lowEnergyLimit) return cross; 159 if(kinEnergy < lowEnergyLimit) return cross; 179 160 180 DefineMaterial(CurrentCouple()); 161 DefineMaterial(CurrentCouple()); 181 162 182 //Total Cross section 163 //Total Cross section 183 Mottcross->SetupKinematic(kinEnergy, Z); 164 Mottcross->SetupKinematic(kinEnergy, Z); 184 cross = Mottcross->NuclearCrossSection(FormF << 165 cross = Mottcross->NuclearCrossSection(FormFactor); 185 166 186 //cout<< "Compute Cross Section....cross "<< 167 //cout<< "Compute Cross Section....cross "<<G4BestUnit(cross,"Surface") << " cm2 "<< cross/cm2 <<" Z: "<<Z<<" kinEnergy: "<<kinEnergy<<endl; 187 << 188 //G4cout<<"Energy: "<<kinEnergy/MeV<<" Total << 189 return cross; 168 return cross; 190 } 169 } 191 170 192 //....oooOO0OOooo........oooOO0OOooo........oo 171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 193 172 194 void G4eSingleCoulombScatteringModel::SampleSe 173 void G4eSingleCoulombScatteringModel::SampleSecondaries( 195 std::vector<G4DynamicParticle*>* 174 std::vector<G4DynamicParticle*>* fvect, 196 const G4MaterialCutsCouple* coupl 175 const G4MaterialCutsCouple* couple, 197 const G4DynamicParticle* dp, 176 const G4DynamicParticle* dp, 198 G4double cutEnergy, 177 G4double cutEnergy, 199 G4double) 178 G4double) 200 { 179 { 201 G4double kinEnergy = dp->GetKineticEnergy(); 180 G4double kinEnergy = dp->GetKineticEnergy(); 202 //cout<<"--- kinEnergy "<<kinEnergy<<endl; 181 //cout<<"--- kinEnergy "<<kinEnergy<<endl; 203 182 204 if(kinEnergy < lowEnergyLimit) return; 183 if(kinEnergy < lowEnergyLimit) return; 205 184 206 DefineMaterial(couple); 185 DefineMaterial(couple); 207 SetupParticle(dp->GetDefinition()); 186 SetupParticle(dp->GetDefinition()); 208 187 209 // Choose nucleus 188 // Choose nucleus 210 //last two :cutEnergy= min e kinEnergy=max 189 //last two :cutEnergy= min e kinEnergy=max 211 currentElement = SelectTargetAtom(couple, pa << 190 currentElement = SelectRandomAtom(couple,particle, 212 dp->GetLogKinet << 191 kinEnergy,cutEnergy,kinEnergy); 213 G4int iz = currentElement->GetZasInt(); << 192 >> 193 G4double Z = currentElement->GetZ(); >> 194 G4int iz = G4int(Z); 214 G4int ia = SelectIsotopeNumber(currentElemen 195 G4int ia = SelectIsotopeNumber(currentElement); 215 G4double mass2 = G4NucleiProperties::GetNucl 196 G4double mass2 = G4NucleiProperties::GetNuclearMass(ia, iz); 216 197 217 //G4cout<<"..Z: "<<Z<<" ..iz: "<<iz<<" ..ia: 198 //G4cout<<"..Z: "<<Z<<" ..iz: "<<iz<<" ..ia: "<<ia<<" ..mass2: "<<mass2<<G4endl; 218 199 219 Mottcross->SetupKinematic(kinEnergy, iz); << 200 Mottcross->SetupKinematic(kinEnergy, Z); 220 G4double cross= Mottcross->NuclearCrossSecti << 201 G4double cross= Mottcross->NuclearCrossSection(FormFactor); //MODIFY TO LOAD TABLE 221 if(cross == 0.0) { return; } 202 if(cross == 0.0) { return; } 222 //cout<< "Energy: "<<kinEnergy/MeV<<" Z: "<< 203 //cout<< "Energy: "<<kinEnergy/MeV<<" Z: "<<Z<<"....cross "<<G4BestUnit(cross,"Surface") << " cm2 "<< cross/cm2 <<endl; 223 204 224 G4double z1 = Mottcross->GetScatteringAngle( << 205 G4double z1 = Mottcross->GetScatteringAngle(); 225 G4double sint = sin(z1); 206 G4double sint = sin(z1); 226 G4double cost = cos(z1); << 207 G4double cost = sqrt(1.0 - sint*sint); 227 G4double phi = twopi* G4UniformRand(); 208 G4double phi = twopi* G4UniformRand(); 228 209 229 // kinematics in the Lab system 210 // kinematics in the Lab system 230 G4double ptot = sqrt(kinEnergy*(kinEnergy + << 211 G4double ptot = dp->GetTotalMomentum(); 231 G4double e1 = mass + kinEnergy; << 212 G4double e1 = dp->GetTotalEnergy(); 232 << 233 // Lab. system kinematics along projectile d 213 // Lab. system kinematics along projectile direction 234 G4LorentzVector v0 = G4LorentzVector(0, 0, p << 214 G4LorentzVector v0 = G4LorentzVector(0, 0, ptot, e1); 235 G4LorentzVector v1 = G4LorentzVector(0, 0, p << 215 G4double bet = ptot/(v0.e() + mass2); 236 G4ThreeVector bst = v0.boostVector(); << 216 G4double gam = 1.0/sqrt((1.0 - bet)*(1.0 + bet)); 237 v1.boost(-bst); << 217 238 // CM projectile << 218 //CM Projectile 239 G4double momCM = v1.pz(); << 219 G4double momCM = gam*(ptot - bet*e1); 240 << 220 G4double eCM = gam*(e1 - bet*ptot); 241 // Momentum after scattering of incident par << 221 //energy & momentum after scattering of incident particle 242 v1.setX(momCM*sint*cos(phi)); << 222 G4double pxCM = momCM*sint*cos(phi); 243 v1.setY(momCM*sint*sin(phi)); << 223 G4double pyCM = momCM*sint*sin(phi); 244 v1.setZ(momCM*cost); << 224 G4double pzCM = momCM*cost; 245 225 246 // CM--->Lab << 226 //CM--->Lab 247 v1.boost(bst); << 227 G4LorentzVector v1(pxCM , pyCM, gam*(pzCM + bet*eCM), gam*(eCM + bet*pzCM)); 248 228 249 // Rotate to global system 229 // Rotate to global system 250 G4ThreeVector dir = dp->GetMomentumDirection 230 G4ThreeVector dir = dp->GetMomentumDirection(); 251 G4ThreeVector newDirection = v1.vect().unit( 231 G4ThreeVector newDirection = v1.vect().unit(); 252 newDirection.rotateUz(dir); 232 newDirection.rotateUz(dir); 253 233 254 fParticleChange->ProposeMomentumDirection(ne 234 fParticleChange->ProposeMomentumDirection(newDirection); 255 235 256 // recoil 236 // recoil 257 v0 -= v1; 237 v0 -= v1; 258 G4double trec = std::max(v0.e() - mass2, 0.0 << 238 G4double trec = v0.e(); 259 G4double edep = 0.0; 239 G4double edep = 0.0; 260 240 261 G4double tcut = recoilThreshold; 241 G4double tcut = recoilThreshold; 262 242 263 //G4cout<<" Energy Transfered: "<<trec/eV<<G 243 //G4cout<<" Energy Transfered: "<<trec/eV<<G4endl; 264 244 265 if(pCuts) { 245 if(pCuts) { 266 tcut= std::max(tcut,(*pCuts)[currentMateri 246 tcut= std::max(tcut,(*pCuts)[currentMaterialIndex]); 267 //G4cout<<"Cuts: "<<(*pCuts)[currentMateri << 268 //G4cout<<"Threshold: "<<tcut/eV<<" eV"<<G << 269 } 247 } 270 248 271 if(trec > tcut) { 249 if(trec > tcut) { 272 G4ParticleDefinition* ion = theIonTable->G 250 G4ParticleDefinition* ion = theIonTable->GetIon(iz, ia, 0); 273 newDirection = v0.vect().unit(); 251 newDirection = v0.vect().unit(); 274 newDirection.rotateUz(dir); 252 newDirection.rotateUz(dir); 275 auto newdp = new G4DynamicParticle(ion, n << 253 G4DynamicParticle* newdp = new G4DynamicParticle(ion, newDirection, trec); 276 fvect->push_back(newdp); 254 fvect->push_back(newdp); 277 } else if(trec > 0.0) { 255 } else if(trec > 0.0) { 278 edep = trec; 256 edep = trec; 279 fParticleChange->ProposeNonIonizingEnergyD 257 fParticleChange->ProposeNonIonizingEnergyDeposit(edep); 280 } 258 } 281 259 282 // finelize primary energy and energy balanc 260 // finelize primary energy and energy balance 283 G4double finalT = v1.e() - mass; 261 G4double finalT = v1.e() - mass; 284 //G4cout<<"Final Energy: "<<finalT/eV<<G4end 262 //G4cout<<"Final Energy: "<<finalT/eV<<G4endl; 285 if(finalT <= lowEnergyLimit) { 263 if(finalT <= lowEnergyLimit) { 286 edep += finalT; 264 edep += finalT; 287 finalT = 0.0; 265 finalT = 0.0; 288 } 266 } 289 edep = std::max(edep, 0.0); 267 edep = std::max(edep, 0.0); 290 fParticleChange->SetProposedKineticEnergy(fi 268 fParticleChange->SetProposedKineticEnergy(finalT); 291 fParticleChange->ProposeLocalEnergyDeposit(e 269 fParticleChange->ProposeLocalEnergyDeposit(edep); 292 270 293 } 271 } 294 272 295 //....oooOO0OOooo........oooOO0OOooo........oo 273 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 296 274