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: G4CoulombScattering.cc 107365 2017-11-09 10:54:29Z gcosmo $ 26 // 27 // 27 // ------------------------------------------- 28 // ------------------------------------------------------------------- 28 // 29 // 29 // GEANT4 Class file 30 // GEANT4 Class file 30 // 31 // 31 // 32 // 32 // File name: G4CoulombScattering 33 // File name: G4CoulombScattering 33 // 34 // 34 // Author: Vladimir Ivanchenko 35 // Author: Vladimir Ivanchenko 35 // 36 // 36 // Creation date: 22.08.2004 37 // Creation date: 22.08.2004 37 // 38 // 38 // Modifications: 39 // Modifications: 39 // 01.08.06 V.Ivanchenko add choice between G4 40 // 01.08.06 V.Ivanchenko add choice between G4eCoulombScatteringModel and 40 // G4CoulombScatteringModel 41 // G4CoulombScatteringModel 41 // 42 // 42 43 43 // 44 // 44 // ------------------------------------------- 45 // ------------------------------------------------------------------- 45 // 46 // 46 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 49 49 #include "G4CoulombScattering.hh" 50 #include "G4CoulombScattering.hh" 50 #include "G4SystemOfUnits.hh" 51 #include "G4SystemOfUnits.hh" 51 #include "G4eCoulombScatteringModel.hh" 52 #include "G4eCoulombScatteringModel.hh" 52 #include "G4IonCoulombScatteringModel.hh" 53 #include "G4IonCoulombScatteringModel.hh" 53 #include "G4Proton.hh" 54 #include "G4Proton.hh" 54 #include "G4EmParameters.hh" 55 #include "G4EmParameters.hh" 55 56 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 57 58 58 G4CoulombScattering::G4CoulombScattering(const << 59 using namespace std; 59 : G4VEmProcess(nam), << 60 60 q2Max(CLHEP::TeV*CLHEP::TeV), << 61 G4CoulombScattering::G4CoulombScattering(const G4String& name) 61 isCombined(comb) << 62 : G4VEmProcess(name),q2Max(TeV*TeV),isInitialised(false) 62 { 63 { >> 64 // G4cout << "G4CoulombScattering constructor "<< G4endl; 63 SetBuildTableFlag(true); 65 SetBuildTableFlag(true); 64 SetStartFromNullFlag(false); 66 SetStartFromNullFlag(false); 65 SetSplineFlag(false); << 67 SetIntegral(true); 66 SetCrossSectionType(fEmOnePeak); << 67 SetSecondaryParticle(G4Proton::Proton()); 68 SetSecondaryParticle(G4Proton::Proton()); 68 SetProcessSubType(fCoulombScattering); 69 SetProcessSubType(fCoulombScattering); 69 } 70 } 70 71 71 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 72 73 73 G4CoulombScattering::G4CoulombScattering(const << 74 G4CoulombScattering::~G4CoulombScattering() 74 : G4CoulombScattering(nam, true) << 75 {} << 76 << 77 //....oooOO0OOooo........oooOO0OOooo........oo << 78 << 79 G4CoulombScattering::G4CoulombScattering(G4boo << 80 : G4CoulombScattering("CoulombScat", comb) << 81 {} 75 {} 82 << 83 //....oooOO0OOooo........oooOO0OOooo........oo << 84 << 85 G4CoulombScattering::~G4CoulombScattering() = << 86 76 87 //....oooOO0OOooo........oooOO0OOooo........oo 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 88 78 89 G4bool G4CoulombScattering::IsApplicable(const 79 G4bool G4CoulombScattering::IsApplicable(const G4ParticleDefinition& p) 90 { 80 { 91 return (p.GetPDGCharge() != 0.0); << 81 return (p.GetPDGCharge() != 0.0 && !p.IsShortLived()); 92 } 82 } 93 83 94 //....oooOO0OOooo........oooOO0OOooo........oo 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 95 85 96 void G4CoulombScattering::InitialiseProcess(co 86 void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition* p) 97 { 87 { 98 // second initialisation not allowed for the 88 // second initialisation not allowed for the time being 99 // this means that polar angle limit change 89 // this means that polar angle limit change will not be appled 100 // after first initialisation 90 // after first initialisation 101 if(isInitialised) { return; } 91 if(isInitialised) { return; } 102 92 103 G4EmParameters* param = G4EmParameters::Inst 93 G4EmParameters* param = G4EmParameters::Instance(); 104 G4double a = param->FactorForAngleLimit()*CL 94 G4double a = param->FactorForAngleLimit()*CLHEP::hbarc/CLHEP::fermi; 105 q2Max = 0.5*a*a; 95 q2Max = 0.5*a*a; 106 G4double theta = param->MscThetaLimit(); 96 G4double theta = param->MscThetaLimit(); 107 97 108 // restricted or non-restricted cross sectio 98 // restricted or non-restricted cross section table 109 if(isCombined) { << 99 G4bool yes = false; 110 if(theta == CLHEP::pi) { << 100 if(theta == CLHEP::pi) { yes = true; } 111 // for restriced single scattering chang << 101 SetStartFromNullFlag(yes); 112 SetCrossSectionType(fEmIncreasing); << 102 /* 113 SetStartFromNullFlag(true); << 103 G4cout << "### G4CoulombScattering::InitialiseProcess: " 114 } << 104 << p->GetParticleName() 115 } else { << 105 << " Emin(MeV)= " << MinKinEnergy()/MeV 116 SetSplineFlag(true); << 106 << " Emax(TeV)= " << MaxKinEnergy()/TeV 117 SetCrossSectionType(fEmDecreasing); << 107 << " nbins= " << LambdaBinning() 118 } << 108 << " theta= " << theta >> 109 << G4endl; >> 110 */ >> 111 119 isInitialised = true; 112 isInitialised = true; 120 G4double mass = p->GetPDGMass(); 113 G4double mass = p->GetPDGMass(); 121 G4String name = p->GetParticleName(); 114 G4String name = p->GetParticleName(); 122 << 115 //G4cout << name << " type: " << p->GetParticleType() 123 G4bool ion = false; << 116 //<< " mass= " << mass << G4endl; 124 if (mass > CLHEP::GeV || p->GetParticleType( << 117 yes = true; >> 118 if (mass > GeV || p->GetParticleType() == "nucleus") { 125 SetBuildTableFlag(false); 119 SetBuildTableFlag(false); 126 ion = true; << 120 yes = false; 127 if(name != "GenericIon") { SetVerboseLevel 121 if(name != "GenericIon") { SetVerboseLevel(0); } 128 } else { 122 } else { 129 if(name != "e-" && name != "e+" && 123 if(name != "e-" && name != "e+" && 130 name != "mu+" && name != "mu-" && name 124 name != "mu+" && name != "mu-" && name != "pi+" && 131 name != "kaon+" && name != "proton" ) { 125 name != "kaon+" && name != "proton" ) { SetVerboseLevel(0); } 132 } 126 } 133 /* << 127 134 G4cout << "### G4CoulombScattering::Initiali << 128 if(!EmModel(0)) { 135 << p->GetParticleName() << 129 if(yes) { SetEmModel(new G4eCoulombScatteringModel()); } 136 << " Emin(MeV)= " << MinKinEnergy()/MeV << 130 else { SetEmModel(new G4IonCoulombScatteringModel()); } 137 << " Emax(TeV)= " << MaxKinEnergy()/TeV << 138 << " nbins= " << LambdaBinning() << 139 << " theta= " << theta << 140 << " mass(MeV)= " << mass << 141 << " isCombined=" << isCombined << 142 << " ion=" << ion << 143 << G4endl; << 144 */ << 145 if(nullptr == EmModel(0)) { << 146 if(ion) { SetEmModel(new G4IonCoulombScatt << 147 else { SetEmModel(new G4eCoulombScattering << 148 } 131 } 149 G4VEmModel* model = EmModel(0); 132 G4VEmModel* model = EmModel(0); 150 G4double emin = std::max(param->MinKinEnergy 133 G4double emin = std::max(param->MinKinEnergy(),model->LowEnergyLimit()); 151 G4double emax = std::min(param->MaxKinEnergy 134 G4double emax = std::min(param->MaxKinEnergy(),model->HighEnergyLimit()); 152 model->SetPolarAngleLimit(theta); 135 model->SetPolarAngleLimit(theta); 153 model->SetLowEnergyLimit(emin); 136 model->SetLowEnergyLimit(emin); 154 model->SetHighEnergyLimit(emax); 137 model->SetHighEnergyLimit(emax); 155 AddEmModel(1, model); 138 AddEmModel(1, model); 156 } 139 } 157 140 158 //....oooOO0OOooo........oooOO0OOooo........oo 141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 159 142 160 G4double G4CoulombScattering::MinPrimaryEnergy 143 G4double G4CoulombScattering::MinPrimaryEnergy(const G4ParticleDefinition* part, 161 const G4Material* mat) 144 const G4Material* mat) 162 { 145 { 163 // Pure Coulomb scattering 146 // Pure Coulomb scattering 164 G4double emin = 0.0; 147 G4double emin = 0.0; 165 148 166 // Coulomb scattering combined with multiple 149 // Coulomb scattering combined with multiple or hadronic scattering 167 G4double theta = G4EmParameters::Instance()- 150 G4double theta = G4EmParameters::Instance()->MscThetaLimit(); 168 151 169 if(0.0 < theta) { 152 if(0.0 < theta) { 170 G4double p2 = q2Max*mat->GetIonisation()-> << 153 G4double p2 = q2Max*mat->GetIonisation()->GetInvA23()/(1.0 - cos(theta)); 171 G4double mass = part->GetPDGMass(); 154 G4double mass = part->GetPDGMass(); 172 emin = p2/(std::sqrt(p2 + mass*mass) + mas << 155 emin = sqrt(p2 + mass*mass) - mass; 173 } 156 } 174 157 175 return emin; 158 return emin; 176 } 159 } 177 160 178 //....oooOO0OOooo........oooOO0OOooo........oo 161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 179 162 180 void G4CoulombScattering::StreamProcessInfo(st << 163 void G4CoulombScattering::StreamProcessInfo(std::ostream& outFile, >> 164 G4String endOfLine) const 181 { 165 { 182 G4double tetmin = G4EmParameters::Instance() << 166 G4double tetmin = G4EmParameters::Instance()->MscThetaLimit()/degree; 183 outFile << " "; 167 outFile << " "; 184 if(tetmin > 179.) { outFile << "ThetaMin(p)" 168 if(tetmin > 179.) { outFile << "ThetaMin(p)"; } 185 else { outFile << tetmin; } 169 else { outFile << tetmin; } 186 outFile << " < Theta(degree) < 180"; 170 outFile << " < Theta(degree) < 180"; 187 171 188 if(q2Max < DBL_MAX) { << 172 if(q2Max < DBL_MAX) { outFile << "; pLimit(GeV^1)= " << sqrt(q2Max)/GeV; } 189 outFile << ", pLimit(GeV^1)= " << std::sqr << 173 outFile << endOfLine; 190 } << 191 outFile << G4endl; << 192 } 174 } 193 175 194 //....oooOO0OOooo........oooOO0OOooo........oo 176 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 195 177 196 void G4CoulombScattering::ProcessDescription(s 178 void G4CoulombScattering::ProcessDescription(std::ostream& out) const 197 { 179 { 198 out << 180 out << 199 " Coulomb scattering. Simulation of elastic << 181 "<strong>Coulomb scattering</strong>. Simulation of elastic scattering <br>" 200 " events individually. May be used in com << 182 "events individually. May be used in combination with multiple<br>" 201 " scattering, where Coulomb scattering is << 183 "scattering, where Coulomb scattering is used for hard (large angle)<br>" 202 " collisions and multiple scattering for << 184 "collisions and multiple scattering for soft collisions."; 203 G4VEmProcess::ProcessDescription(out); 185 G4VEmProcess::ProcessDescription(out); 204 } 186 } 205 187 206 //....oooOO0OOooo........oooOO0OOooo........oo 188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 207 189