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 // $Id$ 26 // 27 // 27 // ------------------------------------------- 28 // ------------------------------------------------------------------- 28 // 29 // 29 // GEANT4 Class file 30 // GEANT4 Class file 30 // 31 // 31 // 32 // 32 // File name: G4eCoulombScatteringModel 33 // File name: G4eCoulombScatteringModel 33 // 34 // 34 // Author: Vladimir Ivanchenko 35 // Author: Vladimir Ivanchenko 35 // 36 // 36 // Creation date: 22.08.2005 37 // Creation date: 22.08.2005 37 // 38 // 38 // Modifications: V.Ivanchenko << 39 // Modifications: 39 // 40 // >> 41 // 01.08.06 V.Ivanchenko extend upper limit of table to TeV and review the >> 42 // logic of building - only elements from G4ElementTable >> 43 // 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim >> 44 // 19.08.06 V.Ivanchenko add inline function ScreeningParameter >> 45 // 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e- >> 46 // 09.06.08 V.Ivanchenko add SelectIsotope and sampling of the recoil ion >> 47 // 16.06.09 C.Consolandi fixed computation of effective mass >> 48 // 27.05.10 V.Ivanchenko added G4WentzelOKandVIxSection class to >> 49 // compute cross sections and sample scattering angle 40 // 50 // 41 // 51 // 42 // Class Description: 52 // Class Description: 43 // 53 // 44 // ------------------------------------------- 54 // ------------------------------------------------------------------- 45 // 55 // 46 //....oooOO0OOooo........oooOO0OOooo........oo 56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 47 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 58 49 #include "G4eCoulombScatteringModel.hh" 59 #include "G4eCoulombScatteringModel.hh" 50 #include "G4PhysicalConstants.hh" 60 #include "G4PhysicalConstants.hh" 51 #include "G4SystemOfUnits.hh" 61 #include "G4SystemOfUnits.hh" 52 #include "Randomize.hh" 62 #include "Randomize.hh" 53 #include "G4DataVector.hh" 63 #include "G4DataVector.hh" 54 #include "G4ElementTable.hh" 64 #include "G4ElementTable.hh" 55 #include "G4ParticleChangeForGamma.hh" 65 #include "G4ParticleChangeForGamma.hh" 56 #include "G4Proton.hh" 66 #include "G4Proton.hh" 57 #include "G4ParticleTable.hh" 67 #include "G4ParticleTable.hh" 58 #include "G4IonTable.hh" << 59 #include "G4ProductionCutsTable.hh" 68 #include "G4ProductionCutsTable.hh" 60 #include "G4NucleiProperties.hh" 69 #include "G4NucleiProperties.hh" 61 #include "G4Pow.hh" 70 #include "G4Pow.hh" >> 71 #include "G4LossTableManager.hh" >> 72 #include "G4LossTableBuilder.hh" 62 #include "G4NistManager.hh" 73 #include "G4NistManager.hh" 63 74 64 //....oooOO0OOooo........oooOO0OOooo........oo 75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 65 76 66 using namespace std; 77 using namespace std; 67 78 68 G4eCoulombScatteringModel::G4eCoulombScatterin << 79 G4eCoulombScatteringModel::G4eCoulombScatteringModel(const G4String& nam) 69 : G4VEmModel("eCoulombScattering"), isCombin << 80 : G4VEmModel(nam), >> 81 cosThetaMin(1.0), >> 82 cosThetaMax(-1.0), >> 83 isInitialised(false) 70 { 84 { >> 85 fParticleChange = 0; 71 fNistManager = G4NistManager::Instance(); 86 fNistManager = G4NistManager::Instance(); 72 theIonTable = G4ParticleTable::GetParticleT << 87 theParticleTable = G4ParticleTable::GetParticleTable(); 73 theProton = G4Proton::Proton(); << 88 theProton = G4Proton::Proton(); >> 89 currentMaterial = 0; 74 90 75 wokvi = new G4WentzelOKandVIxSection(isCombi << 91 pCuts = 0; 76 92 77 mass = CLHEP::proton_mass_c2; << 93 lowEnergyThreshold = 1*keV; // particle will be killed for lower energy >> 94 recoilThreshold = 0.*keV; // by default does not work >> 95 >> 96 particle = 0; >> 97 currentCouple = 0; >> 98 wokvi = new G4WentzelOKandVIxSection(); >> 99 >> 100 currentMaterialIndex = 0; >> 101 >> 102 cosTetMinNuc = 1.0; >> 103 cosTetMaxNuc = -1.0; >> 104 elecRatio = 0.0; >> 105 mass = proton_mass_c2; 78 } 106 } 79 107 80 //....oooOO0OOooo........oooOO0OOooo........oo 108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 81 109 82 G4eCoulombScatteringModel::~G4eCoulombScatteri 110 G4eCoulombScatteringModel::~G4eCoulombScatteringModel() 83 { 111 { 84 delete wokvi; 112 delete wokvi; 85 } 113 } 86 114 87 //....oooOO0OOooo........oooOO0OOooo........oo 115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 88 116 89 void G4eCoulombScatteringModel::Initialise(con << 117 void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p, 90 const G4DataVector& cuts) 118 const G4DataVector& cuts) 91 { 119 { 92 SetupParticle(part); << 120 SetupParticle(p); 93 currentCouple = nullptr; << 121 currentCouple = 0; 94 << 122 cosThetaMin = cos(PolarAngleLimit()); 95 G4double tet = PolarAngleLimit(); << 123 wokvi->Initialise(p, cosThetaMin); 96 << 124 /* 97 // defined theta limit between single and mu << 125 G4cout << "G4eCoulombScatteringModel: " << particle->GetParticleName() 98 if(isCombined) { << 126 << " 1-cos(ThetaLimit)= " << 1 - cosThetaMin 99 if(tet >= CLHEP::pi) { cosThetaMin = -1.0; << 127 << " cos(thetaMax)= " << cosThetaMax 100 else if(tet > 0.0) { cosThetaMin = std::co << 128 << G4endl; 101 << 129 */ 102 // single scattering without multiple << 130 pCuts = G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(3); 103 } else if(tet > 0.0) { << 104 cosThetaMin = std::cos(std::min(tet, CLHEP << 105 } << 106 << 107 wokvi->Initialise(part, cosThetaMin); << 108 pCuts = &cuts; << 109 /* 131 /* 110 G4cout << "G4eCoulombScatteringModel::Initia << 132 G4cout << "!!! G4eCoulombScatteringModel::Initialise for " 111 << part->GetParticleName() << " 1-cos(Tet << 133 << p->GetParticleName() << " cos(TetMin)= " << cosThetaMin 112 << " 1-cos(TetMax)= " << 1. - cosThetaMax << 134 << " cos(TetMax)= " << cosThetaMax <<G4endl; 113 G4cout << "cut[0]= " << (*pCuts)[0] << G4end << 135 G4cout << "cut0= " << cuts[0] << " cut1= " << cuts[1] << G4endl; 114 */ 136 */ 115 if(nullptr == fParticleChange) { << 137 if(!isInitialised) { >> 138 isInitialised = true; 116 fParticleChange = GetParticleChangeForGamm 139 fParticleChange = GetParticleChangeForGamma(); 117 } 140 } 118 if(IsMaster() && mass < GeV && part->GetPart << 141 if(mass < GeV) { 119 InitialiseElementSelectors(part, cuts); << 142 InitialiseElementSelectors(p,cuts); 120 } << 121 } << 122 << 123 //....oooOO0OOooo........oooOO0OOooo........oo << 124 << 125 void G4eCoulombScatteringModel::InitialiseLoca << 126 G4VEmModel* masterModel) << 127 { << 128 SetElementSelectors(masterModel->GetElementS << 129 } << 130 << 131 //....oooOO0OOooo........oooOO0OOooo........oo << 132 << 133 G4double << 134 G4eCoulombScatteringModel::MinPrimaryEnergy(co << 135 const G4ParticleDefinition* part << 136 G4double) << 137 { << 138 SetupParticle(part); << 139 << 140 // define cut using cuts for proton << 141 G4double cut = << 142 std::max(recoilThreshold, (*pCuts)[Current << 143 << 144 // find out lightest element << 145 const G4ElementVector* theElementVector = ma << 146 std::size_t nelm = material->GetNumberOfElem << 147 << 148 // select lightest element << 149 G4int Z = 300; << 150 for (std::size_t j=0; j<nelm; ++j) { << 151 Z = std::min(Z,(*theElementVector)[j]->Get << 152 } 143 } 153 G4int A = G4lrint(fNistManager->GetAtomicMas << 154 G4double targetMass = G4NucleiProperties::Ge << 155 G4double t = std::max(cut, 0.5*(cut + sqrt(2 << 156 << 157 return t; << 158 } 144 } 159 145 160 //....oooOO0OOooo........oooOO0OOooo........oo 146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 161 147 162 G4double G4eCoulombScatteringModel::ComputeCro 148 G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom( 163 const G4ParticleDefinition* p, 149 const G4ParticleDefinition* p, 164 G4double kinEnergy, 150 G4double kinEnergy, 165 G4double Z, G4double, 151 G4double Z, G4double, 166 G4double cutEnergy, G4double) 152 G4double cutEnergy, G4double) 167 { 153 { 168 /* << 154 //G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom for " 169 G4cout << "### G4eCoulombScatteringModel::Co << 155 // << p->GetParticleName()<<" Z= "<<Z<<" e(MeV)= "<< kinEnergy/MeV << G4endl; 170 << p->GetParticleName()<<" Z= "<<Z<<" e(MeV << 171 << G4endl; << 172 */ << 173 G4double cross = 0.0; 156 G4double cross = 0.0; 174 elecRatio = 0.0; << 175 if(p != particle) { SetupParticle(p); } 157 if(p != particle) { SetupParticle(p); } 176 158 177 // cross section is set to zero to avoid pro 159 // cross section is set to zero to avoid problems in sample secondary 178 if(kinEnergy <= 0.0) { return cross; } 160 if(kinEnergy <= 0.0) { return cross; } 179 DefineMaterial(CurrentCouple()); 161 DefineMaterial(CurrentCouple()); 180 G4double costmin = wokvi->SetupKinematic(kin << 162 cosTetMinNuc = wokvi->SetupKinematic(kinEnergy, currentMaterial); 181 << 163 if(cosThetaMax < cosTetMinNuc) { 182 //G4cout << "cosThetaMax= "<<cosThetaMax<<" << 164 G4int iz = G4int(Z); 183 << 165 cosTetMinNuc = wokvi->SetupTarget(iz, cutEnergy); 184 if(cosThetaMax < costmin) { << 166 cosTetMaxNuc = cosThetaMax; 185 G4int iz = G4lrint(Z); << 167 if(iz == 1 && cosTetMaxNuc < 0.0 && particle == theProton) { 186 G4double cut = (0.0 < fixedCut) ? fixedCut << 168 cosTetMaxNuc = 0.0; 187 costmin = wokvi->SetupTarget(iz, cut); << 188 //G4cout << "SetupTarget: Z= " << iz << " << 189 // << costmin << G4endl; << 190 G4double costmax = (1 == iz && particle == << 191 ? 0.0 : cosThetaMax; << 192 if(costmin > costmax) { << 193 cross = wokvi->ComputeNuclearCrossSectio << 194 + wokvi->ComputeElectronCrossSection(c << 195 } 169 } 196 /* << 170 cross = wokvi->ComputeNuclearCrossSection(cosTetMinNuc, cosTetMaxNuc); 197 if(p->GetParticleName() == "e-") << 171 elecRatio = wokvi->ComputeElectronCrossSection(cosTetMinNuc, cosThetaMax); 198 G4cout << "Z= " << Z << " e(MeV)= " << kin << 172 cross += elecRatio; 199 << " cross(b)= " << cross/barn << " 1-cos << 173 if(cross > 0.0) { elecRatio /= cross; } 200 << " 1-costmax= " << 1-costmax << 201 << " 1-cosThetaMax= " << 1-cosThetaMax << 202 << " " << currentMaterial->GetName() << 203 << G4endl; << 204 */ << 205 } 174 } 206 //G4cout << "====== cross= " << cross << G4e << 175 /* >> 176 if(p->GetParticleName() == "e-") >> 177 G4cout << "e(MeV)= " << kinEnergy/MeV << " cross(b)= " << cross/barn >> 178 << " 1-cosTetMinNuc= " << 1-cosTetMinNuc >> 179 << " 1-cosTetMaxNuc= " << 1-cosTetMaxNuc >> 180 << G4endl; >> 181 */ 207 return cross; 182 return cross; 208 } 183 } 209 184 210 //....oooOO0OOooo........oooOO0OOooo........oo 185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 211 186 212 void G4eCoulombScatteringModel::SampleSecondar 187 void G4eCoulombScatteringModel::SampleSecondaries( 213 std::vector<G4DynamicParticle* 188 std::vector<G4DynamicParticle*>* fvect, 214 const G4MaterialCutsCouple* couple, 189 const G4MaterialCutsCouple* couple, 215 const G4DynamicParticle* dp, 190 const G4DynamicParticle* dp, 216 G4double cutEnergy, 191 G4double cutEnergy, 217 G4double) 192 G4double) 218 { 193 { 219 G4double kinEnergy = dp->GetKineticEnergy(); 194 G4double kinEnergy = dp->GetKineticEnergy(); >> 195 >> 196 // absorb particle below low-energy limit to avoid situation >> 197 // when a particle has no energy loss >> 198 if(kinEnergy < lowEnergyThreshold) { >> 199 fParticleChange->SetProposedKineticEnergy(0.0); >> 200 fParticleChange->ProposeLocalEnergyDeposit(kinEnergy); >> 201 fParticleChange->ProposeNonIonizingEnergyDeposit(kinEnergy); >> 202 return; >> 203 } 220 SetupParticle(dp->GetDefinition()); 204 SetupParticle(dp->GetDefinition()); 221 DefineMaterial(couple); 205 DefineMaterial(couple); 222 /* 206 /* 223 G4cout << "G4eCoulombScatteringModel::Sample 207 G4cout << "G4eCoulombScatteringModel::SampleSecondaries e(MeV)= " 224 << kinEnergy << " " << particle->GetPart 208 << kinEnergy << " " << particle->GetParticleName() 225 << " cut= " << cutEnergy<< G4endl; 209 << " cut= " << cutEnergy<< G4endl; 226 */ 210 */ 227 // Choose nucleus 211 // Choose nucleus 228 G4double cut = (0.0 < fixedCut) ? fixedCut : << 212 const G4Element* currentElement = >> 213 SelectRandomAtom(couple,particle,kinEnergy,cutEnergy,kinEnergy); 229 214 230 wokvi->SetupKinematic(kinEnergy, currentMate << 215 G4double Z = currentElement->GetZ(); 231 216 232 const G4Element* currentElement = SelectTarg << 217 if(ComputeCrossSectionPerAtom(particle,kinEnergy, Z, 233 dp->Get << 218 kinEnergy, cutEnergy, kinEnergy) == 0.0) 234 G4int iz = currentElement->GetZasInt(); << 219 { return; } 235 << 236 G4double costmin = wokvi->SetupTarget(iz, cu << 237 G4double costmax = (1 == iz && particle == t << 238 ? 0.0 : cosThetaMax; << 239 if(costmin <= costmax) { return; } << 240 << 241 G4double cross = wokvi->ComputeNuclearCrossS << 242 G4double ecross = wokvi->ComputeElectronCros << 243 G4double ratio = ecross/(cross + ecross); << 244 220 >> 221 G4int iz = G4int(Z); 245 G4int ia = SelectIsotopeNumber(currentElemen 222 G4int ia = SelectIsotopeNumber(currentElement); 246 G4double targetMass = G4NucleiProperties::Ge 223 G4double targetMass = G4NucleiProperties::GetNuclearMass(ia, iz); 247 wokvi->SetTargetMass(targetMass); 224 wokvi->SetTargetMass(targetMass); 248 225 249 G4ThreeVector newDirection = 226 G4ThreeVector newDirection = 250 wokvi->SampleSingleScattering(costmin, cos << 227 wokvi->SampleSingleScattering(cosTetMinNuc, cosThetaMax, elecRatio); 251 G4double cost = newDirection.z(); 228 G4double cost = newDirection.z(); 252 /* << 229 253 G4cout << "SampleSec: e(MeV)= " << kinEn << 254 << " 1-costmin= " << 1-costmin << 255 << " 1-costmax= " << 1-costmax << 256 << " 1-cost= " << 1-cost << 257 << " ratio= " << ratio << 258 << G4endl; << 259 */ << 260 G4ThreeVector direction = dp->GetMomentumDir 230 G4ThreeVector direction = dp->GetMomentumDirection(); 261 newDirection.rotateUz(direction); 231 newDirection.rotateUz(direction); 262 232 263 fParticleChange->ProposeMomentumDirection(ne 233 fParticleChange->ProposeMomentumDirection(newDirection); 264 234 265 // recoil sampling assuming a small recoil 235 // recoil sampling assuming a small recoil 266 // and first order correction to primary 4-m 236 // and first order correction to primary 4-momentum 267 G4double mom2 = wokvi->GetMomentumSquare(); 237 G4double mom2 = wokvi->GetMomentumSquare(); 268 G4double trec = mom2*(1.0 - cost) << 238 G4double trec = mom2*(1.0 - cost)/(targetMass + (mass + kinEnergy)*(1.0 - cost)); 269 /(targetMass + (mass + kinEnergy)*(1.0 - c << 270 << 271 // the check likely not needed << 272 trec = std::min(trec, kinEnergy); << 273 G4double finalT = kinEnergy - trec; 239 G4double finalT = kinEnergy - trec; 274 G4double edep = 0.0; << 240 //G4cout<<"G4eCoulombScatteringModel: finalT= "<<finalT<<" Trec= "<<trec<<G4endl; 275 /* << 241 if(finalT <= lowEnergyThreshold) { 276 G4cout<<"G4eCoulombScatteringModel: finalT << 242 trec = kinEnergy; 277 <<trec << " Z= " << iz << " A= " << ia << 243 finalT = 0.0; 278 << " tcut(keV)= " << (*pCuts)[currentMater << 244 } 279 */ << 245 >> 246 fParticleChange->SetProposedKineticEnergy(finalT); 280 G4double tcut = recoilThreshold; 247 G4double tcut = recoilThreshold; 281 if(pCuts) { tcut= std::max(tcut,(*pCuts)[cur 248 if(pCuts) { tcut= std::max(tcut,(*pCuts)[currentMaterialIndex]); } 282 249 283 if(trec > tcut) { 250 if(trec > tcut) { 284 G4ParticleDefinition* ion = theIonTable->G << 251 G4ParticleDefinition* ion = theParticleTable->GetIon(iz, ia, 0.0); 285 G4ThreeVector dir = (direction*sqrt(mom2) 252 G4ThreeVector dir = (direction*sqrt(mom2) - 286 newDirection*sqrt(finalT*(2*mass + fina 253 newDirection*sqrt(finalT*(2*mass + finalT))).unit(); 287 auto newdp = new G4DynamicParticle(ion, di << 254 G4DynamicParticle* newdp = new G4DynamicParticle(ion, dir, trec); 288 fvect->push_back(newdp); 255 fvect->push_back(newdp); 289 } else { 256 } else { 290 edep = trec; << 257 fParticleChange->ProposeLocalEnergyDeposit(trec); 291 fParticleChange->ProposeNonIonizingEnergyD << 258 fParticleChange->ProposeNonIonizingEnergyDeposit(trec); 292 } 259 } 293 << 260 294 // finelize primary energy and energy bala << 261 return; 295 // this threshold may be applied only beca << 296 // e+e- msc model is applied << 297 if(finalT < 0.0) { << 298 edep += finalT; << 299 finalT = 0.0; << 300 } << 301 edep = std::max(edep, 0.0); << 302 fParticleChange->SetProposedKineticEnergy(fi << 303 fParticleChange->ProposeLocalEnergyDeposit(e << 304 } 262 } 305 263 306 //....oooOO0OOooo........oooOO0OOooo........oo 264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 265 >> 266 307 267