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