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 // 26 // 27 // ------------------------------------------- 27 // ------------------------------------------------------------------- 28 // 28 // 29 // GEANT4 Class header file 29 // GEANT4 Class header file 30 // 30 // 31 // 31 // 32 // File name: G4eeToHadronsModel 32 // File name: G4eeToHadronsModel 33 // 33 // 34 // Author: Vladimir Ivanchenko 34 // Author: Vladimir Ivanchenko 35 // 35 // 36 // Creation date: 12.08.2003 36 // Creation date: 12.08.2003 37 // 37 // 38 // Modifications: 38 // Modifications: 39 // 08-04-05 Major optimisation of internal int 39 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko) 40 // 18-05-05 Use optimized interfaces (V.Ivantc 40 // 18-05-05 Use optimized interfaces (V.Ivantchenko) 41 // 41 // 42 // 42 // 43 // ------------------------------------------- 43 // ------------------------------------------------------------------- 44 // 44 // 45 45 46 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 //....oooOO0OOooo........oooOO0OOooo........oo 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 49 49 50 #include "G4eeToHadronsModel.hh" 50 #include "G4eeToHadronsModel.hh" 51 #include "Randomize.hh" 51 #include "Randomize.hh" 52 #include "G4PhysicalConstants.hh" 52 #include "G4PhysicalConstants.hh" 53 #include "G4SystemOfUnits.hh" 53 #include "G4SystemOfUnits.hh" 54 #include "G4Electron.hh" 54 #include "G4Electron.hh" 55 #include "G4Gamma.hh" 55 #include "G4Gamma.hh" 56 #include "G4Positron.hh" 56 #include "G4Positron.hh" 57 #include "G4PionPlus.hh" 57 #include "G4PionPlus.hh" 58 #include "Randomize.hh" 58 #include "Randomize.hh" 59 #include "G4Vee2hadrons.hh" 59 #include "G4Vee2hadrons.hh" 60 #include "G4PhysicsVector.hh" 60 #include "G4PhysicsVector.hh" 61 #include "G4PhysicsLogVector.hh" 61 #include "G4PhysicsLogVector.hh" 62 #include "G4Log.hh" 62 #include "G4Log.hh" 63 #include "G4Exp.hh" 63 #include "G4Exp.hh" 64 64 65 //....oooOO0OOooo........oooOO0OOooo........oo 65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 66 66 67 using namespace std; 67 using namespace std; 68 68 69 G4eeToHadronsModel::G4eeToHadronsModel(G4Vee2h 69 G4eeToHadronsModel::G4eeToHadronsModel(G4Vee2hadrons* mod, G4int ver, 70 const G 70 const G4String& nam) 71 : G4VEmModel(nam), 71 : G4VEmModel(nam), 72 model(mod), 72 model(mod), >> 73 crossPerElectron(0), >> 74 crossBornPerElectron(0), >> 75 isInitialised(false), >> 76 nbins(100), 73 verbose(ver) 77 verbose(ver) 74 { 78 { 75 theGamma = G4Gamma::Gamma(); 79 theGamma = G4Gamma::Gamma(); 76 highKinEnergy = HighEnergyLimit(); 80 highKinEnergy = HighEnergyLimit(); 77 lowKinEnergy = LowEnergyLimit(); 81 lowKinEnergy = LowEnergyLimit(); 78 emin = lowKinEnergy; 82 emin = lowKinEnergy; 79 emax = highKinEnergy; 83 emax = highKinEnergy; 80 peakKinEnergy = highKinEnergy; 84 peakKinEnergy = highKinEnergy; 81 epeak = emax; 85 epeak = emax; 82 //verbose = 1; 86 //verbose = 1; 83 } 87 } 84 88 85 //....oooOO0OOooo........oooOO0OOooo........oo 89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 86 90 87 G4eeToHadronsModel::~G4eeToHadronsModel() 91 G4eeToHadronsModel::~G4eeToHadronsModel() 88 { 92 { 89 delete model; 93 delete model; 90 } 94 } 91 95 92 //....oooOO0OOooo........oooOO0OOooo........oo 96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 93 97 94 void G4eeToHadronsModel::Initialise(const G4Pa 98 void G4eeToHadronsModel::Initialise(const G4ParticleDefinition*, 95 const G4Da 99 const G4DataVector&) 96 { 100 { 97 if(isInitialised) { return; } 101 if(isInitialised) { return; } 98 isInitialised = true; 102 isInitialised = true; 99 103 100 // CM system 104 // CM system 101 emin = model->LowEnergy(); << 105 emin = model->LowEnergy(); 102 emax = model->HighEnergy(); << 106 emax = model->HighEnergy(); 103 107 104 // peak energy 108 // peak energy 105 epeak = std::min(model->PeakEnergy(), emax); 109 epeak = std::min(model->PeakEnergy(), emax); 106 110 107 if(verbose>0) { 111 if(verbose>0) { 108 G4cout << "G4eeToHadronsModel::Initialise: 112 G4cout << "G4eeToHadronsModel::Initialise: " << G4endl; 109 G4cout << "CM System: emin(MeV)= " << emin 113 G4cout << "CM System: emin(MeV)= " << emin/MeV 110 << " epeak(MeV)= " << epeak/MeV 114 << " epeak(MeV)= " << epeak/MeV 111 << " emax(MeV)= " << emax/MeV 115 << " emax(MeV)= " << emax/MeV 112 << G4endl; 116 << G4endl; 113 } 117 } 114 118 115 crossBornPerElectron = model->PhysicsVector( 119 crossBornPerElectron = model->PhysicsVector(); 116 crossPerElectron = model->PhysicsVector( 120 crossPerElectron = model->PhysicsVector(); 117 nbins = (G4int)crossPerElectron->GetVectorLe << 121 nbins = crossPerElectron->GetVectorLength(); 118 for(G4int i=0; i<nbins; ++i) { 122 for(G4int i=0; i<nbins; ++i) { 119 G4double e = crossPerElectron->Energy(i); 123 G4double e = crossPerElectron->Energy(i); 120 G4double cs = model->ComputeCrossSection(e 124 G4double cs = model->ComputeCrossSection(e); 121 crossBornPerElectron->PutValue(i, cs); 125 crossBornPerElectron->PutValue(i, cs); 122 } 126 } 123 ComputeCMCrossSectionPerElectron(); 127 ComputeCMCrossSectionPerElectron(); 124 128 125 if(verbose>1) { 129 if(verbose>1) { 126 G4cout << "G4eeToHadronsModel: Cross secti 130 G4cout << "G4eeToHadronsModel: Cross sections per electron" 127 << " nbins= " << nbins 131 << " nbins= " << nbins 128 << " emin(MeV)= " << emin/MeV 132 << " emin(MeV)= " << emin/MeV 129 << " emax(MeV)= " << emax/MeV 133 << " emax(MeV)= " << emax/MeV 130 << G4endl; 134 << G4endl; 131 for(G4int i=0; i<nbins; ++i) { 135 for(G4int i=0; i<nbins; ++i) { 132 G4double e = crossPerElectron->Energy(i 136 G4double e = crossPerElectron->Energy(i); 133 G4double s1 = crossPerElectron->Value(e) 137 G4double s1 = crossPerElectron->Value(e); 134 G4double s2 = crossBornPerElectron->Valu 138 G4double s2 = crossBornPerElectron->Value(e); 135 G4cout << "E(MeV)= " << e/MeV 139 G4cout << "E(MeV)= " << e/MeV 136 << " cross(nb)= " << s1/nanobarn 140 << " cross(nb)= " << s1/nanobarn 137 << " crossBorn(nb)= " << s2/nano 141 << " crossBorn(nb)= " << s2/nanobarn 138 << G4endl; 142 << G4endl; 139 } 143 } 140 } 144 } 141 } 145 } 142 146 143 //....oooOO0OOooo........oooOO0OOooo........oo 147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 144 148 145 G4double G4eeToHadronsModel::CrossSectionPerVo 149 G4double G4eeToHadronsModel::CrossSectionPerVolume( 146 const G4Material* mat, 150 const G4Material* mat, 147 const G4ParticleDefinition* p, 151 const G4ParticleDefinition* p, 148 G4double kineticEnergy, 152 G4double kineticEnergy, 149 G4double, G4double) 153 G4double, G4double) 150 { 154 { 151 return mat->GetElectronDensity()* 155 return mat->GetElectronDensity()* 152 ComputeCrossSectionPerElectron(p, kineticE 156 ComputeCrossSectionPerElectron(p, kineticEnergy); 153 } 157 } 154 158 155 //....oooOO0OOooo........oooOO0OOooo........oo 159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 156 160 157 G4double G4eeToHadronsModel::ComputeCrossSecti 161 G4double G4eeToHadronsModel::ComputeCrossSectionPerAtom( 158 const G4 162 const G4ParticleDefinition* p, 159 G4double kineticEnergy, 163 G4double kineticEnergy, 160 G4double Z, G4double, 164 G4double Z, G4double, 161 G4double, G4double) 165 G4double, G4double) 162 { 166 { 163 return Z*ComputeCrossSectionPerElectron(p, k 167 return Z*ComputeCrossSectionPerElectron(p, kineticEnergy); 164 } 168 } 165 169 166 //....oooOO0OOooo........oooOO0OOooo........oo 170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 167 171 168 G4double G4eeToHadronsModel::ComputeCrossSecti 172 G4double G4eeToHadronsModel::ComputeCrossSectionPerElectron( 169 cons 173 const G4ParticleDefinition*, 170 174 G4double energy, 171 175 G4double, G4double) 172 { 176 { 173 return crossPerElectron->Value(energy); << 177 return (crossPerElectron) ? crossPerElectron->Value(energy) : 0.0; 174 } 178 } 175 179 176 //....oooOO0OOooo........oooOO0OOooo........oo 180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 177 181 178 void G4eeToHadronsModel::SampleSecondaries(std 182 void G4eeToHadronsModel::SampleSecondaries(std::vector<G4DynamicParticle*>* newp, 179 const G4MaterialCutsCouple*, 183 const G4MaterialCutsCouple*, 180 const G4DynamicParticle* dParticl 184 const G4DynamicParticle* dParticle, 181 G4double, 185 G4double, 182 G4double) 186 G4double) 183 { 187 { 184 G4double t = dParticle->GetKineticEnergy() + << 188 if(crossPerElectron) { 185 G4LorentzVector inlv = dParticle->Get4Moment << 189 G4double t = dParticle->GetKineticEnergy() + 2*electron_mass_c2; 186 G4LorentzVector(0.0,0.0,0.0,electron_mass_ << 190 G4LorentzVector inlv = dParticle->Get4Momentum() + 187 G4double e = inlv.m(); << 191 G4LorentzVector(0.0,0.0,0.0,electron_mass_c2); 188 G4ThreeVector inBoost = inlv.boostVector(); << 192 G4double e = inlv.m(); 189 //G4cout << "G4eeToHadronsModel::SampleSecon << 193 G4ThreeVector inBoost = inlv.boostVector(); 190 // << " " << inlv << " " << inBoost <<G4 << 194 //G4cout << "G4eeToHadronsModel::SampleSecondaries e= " << e 191 if(e > emin) { << 195 // << " " << inlv << " " << inBoost <<G4endl; 192 G4DynamicParticle* gamma = GenerateCMPhoto << 196 if(e > emin) { 193 G4LorentzVector gLv = gamma->Get4Momentum( << 197 G4DynamicParticle* gamma = GenerateCMPhoton(e); 194 G4LorentzVector lv(0.0,0.0,0.0,e); << 198 G4LorentzVector gLv = gamma->Get4Momentum(); 195 lv -= gLv; << 199 G4LorentzVector lv(0.0,0.0,0.0,e); 196 G4double mass = lv.m(); << 200 lv -= gLv; 197 //G4cout << "mass= " << mass << " " << lv << 201 G4double mass = lv.m(); 198 G4ThreeVector boost = lv.boostVector(); << 202 //G4cout << "mass= " << mass << " " << lv << G4endl; 199 //G4cout << "mass= " << mass << " " << boo << 203 G4ThreeVector boost = lv.boostVector(); 200 const G4ThreeVector dir = gamma->GetMoment << 204 //G4cout << "mass= " << mass << " " << boost << G4endl; 201 model->SampleSecondaries(newp, mass, dir); << 205 const G4ThreeVector dir = gamma->GetMomentumDirection(); 202 std::size_t np = newp->size(); << 206 model->SampleSecondaries(newp, mass, dir); 203 for(std::size_t j=0; j<np; ++j) { << 207 G4int np = newp->size(); 204 G4DynamicParticle* dp = (*newp)[j]; << 208 for(G4int j=0; j<np; ++j) { 205 G4LorentzVector v = dp->Get4Momentum(); << 209 G4DynamicParticle* dp = (*newp)[j]; 206 v.boost(boost); << 210 G4LorentzVector v = dp->Get4Momentum(); 207 //G4cout << j << ". " << v << G4endl; << 211 v.boost(boost); 208 v.boost(inBoost); << 212 //G4cout << j << ". " << v << G4endl; 209 //G4cout << " " << v << G4endl; << 213 v.boost(inBoost); 210 dp->Set4Momentum(v); << 214 //G4cout << " " << v << G4endl; 211 t -= v.e(); << 215 dp->Set4Momentum(v); 212 } << 216 t -= v.e(); 213 //G4cout << "Gamma " << gLv << G4endl; << 217 } 214 gLv.boost(inBoost); << 218 //G4cout << "Gamma " << gLv << G4endl; 215 //G4cout << " " << gLv << G4endl; << 219 gLv.boost(inBoost); 216 gamma->Set4Momentum(gLv); << 220 //G4cout << " " << gLv << G4endl; 217 t -= gLv.e(); << 221 gamma->Set4Momentum(gLv); 218 newp->push_back(gamma); << 222 t -= gLv.e(); 219 if(std::abs(t) > CLHEP::MeV) { << 223 newp->push_back(gamma); 220 G4cout << "G4eeToHadronsModel::SampleSec << 224 if(std::abs(t) > MeV) { 221 << t/MeV << " primary 4-momentum: " << << 225 G4cout << "G4eeToHadronsModel::SampleSecondaries: Ebalance(MeV)= " >> 226 << t/MeV << " primary 4-momentum: " << inlv << G4endl; >> 227 } 222 } 228 } 223 } 229 } 224 } 230 } 225 231 226 //....oooOO0OOooo........oooOO0OOooo........oo 232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 227 233 228 void G4eeToHadronsModel::ComputeCMCrossSection 234 void G4eeToHadronsModel::ComputeCMCrossSectionPerElectron() 229 { 235 { 230 for(G4int i=0; i<nbins; i++) { 236 for(G4int i=0; i<nbins; i++) { 231 G4double e = crossPerElectron->Energy(i); 237 G4double e = crossPerElectron->Energy(i); 232 G4double cs = 0.0; 238 G4double cs = 0.0; 233 if(i > 0) { 239 if(i > 0) { 234 G4double LL = 2.0*G4Log(e/electron_mas 240 G4double LL = 2.0*G4Log(e/electron_mass_c2); 235 G4double bt = 2.0*fine_structure_const* 241 G4double bt = 2.0*fine_structure_const*(LL - 1.0)/pi; 236 G4double btm1= bt - 1.0; 242 G4double btm1= bt - 1.0; 237 G4double del = 1. + fine_structure_const 243 G4double del = 1. + fine_structure_const*(1.5*LL + pi*pi/3. -2.)/pi; 238 G4double s1 = crossBornPerElectron->Val 244 G4double s1 = crossBornPerElectron->Value(e); 239 G4double e1 = crossPerElectron->Energy( 245 G4double e1 = crossPerElectron->Energy(i-1); 240 G4double x1 = 1. - e1/e; 246 G4double x1 = 1. - e1/e; 241 cs += s1*(del*G4Exp(G4Log(x1)*bt) - bt*( 247 cs += s1*(del*G4Exp(G4Log(x1)*bt) - bt*(x1 - 0.25*x1*x1)); 242 if(i > 1) { 248 if(i > 1) { 243 G4double e2 = e1; 249 G4double e2 = e1; 244 G4double x2 = x1; 250 G4double x2 = x1; 245 G4double s2 = crossBornPerElectron->Value(e 251 G4double s2 = crossBornPerElectron->Value(e2); 246 G4double w2 = bt*(del*G4Exp(G4Log(x2)*btm1) 252 G4double w2 = bt*(del*G4Exp(G4Log(x2)*btm1) - 1.0 + 0.5*x2); 247 G4double w1; 253 G4double w1; 248 254 249 for(G4int j=i-2; j>=0; --j) { 255 for(G4int j=i-2; j>=0; --j) { 250 e1 = crossPerElectron->Energy(j); 256 e1 = crossPerElectron->Energy(j); 251 x1 = 1. - e1/e; 257 x1 = 1. - e1/e; 252 s1 = crossBornPerElectron->Value(e1); 258 s1 = crossBornPerElectron->Value(e1); 253 w1 = bt*(del*G4Exp(G4Log(x1)*btm1) - 1.0 259 w1 = bt*(del*G4Exp(G4Log(x1)*btm1) - 1.0 + 0.5*x1); 254 cs += 0.5*(x1 - x2)*(w2*s2 + w1*s1); 260 cs += 0.5*(x1 - x2)*(w2*s2 + w1*s1); 255 e2 = e1; 261 e2 = e1; 256 x2 = x1; 262 x2 = x1; 257 s2 = s1; 263 s2 = s1; 258 w2 = w1; 264 w2 = w1; 259 } 265 } 260 } 266 } 261 } 267 } 262 crossPerElectron->PutValue(i, cs); 268 crossPerElectron->PutValue(i, cs); 263 } 269 } 264 } 270 } 265 271 266 //....oooOO0OOooo........oooOO0OOooo........oo 272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 267 273 268 G4DynamicParticle* G4eeToHadronsModel::Generat 274 G4DynamicParticle* G4eeToHadronsModel::GenerateCMPhoton(G4double e) 269 { 275 { 270 G4double x; 276 G4double x; 271 G4DynamicParticle* gamma = nullptr; 277 G4DynamicParticle* gamma = nullptr; 272 G4double LL = 2.0*G4Log(e/electron_mass_c2 278 G4double LL = 2.0*G4Log(e/electron_mass_c2); 273 G4double bt = 2.0*fine_structure_const*(LL 279 G4double bt = 2.0*fine_structure_const*(LL - 1.)/pi; 274 G4double btm1= bt - 1.0; 280 G4double btm1= bt - 1.0; 275 G4double del = 1. + fine_structure_const*(1. 281 G4double del = 1. + fine_structure_const*(1.5*LL + pi*pi/3. -2.)/pi; 276 282 277 G4double s0 = crossBornPerElectron->Value(e) 283 G4double s0 = crossBornPerElectron->Value(e); 278 G4double de = (emax - emin)/(G4double)nbins; 284 G4double de = (emax - emin)/(G4double)nbins; 279 G4double xmax = 0.5*(1.0 - (emin*emin)/(e*e) 285 G4double xmax = 0.5*(1.0 - (emin*emin)/(e*e)); 280 G4double xmin = std::min(de/e, xmax); 286 G4double xmin = std::min(de/e, xmax); 281 G4double ds = s0*(del*G4Exp(G4Log(xmin)*bt) 287 G4double ds = s0*(del*G4Exp(G4Log(xmin)*bt) - bt*(xmin - 0.25*xmin*xmin)); 282 G4double e1 = e*(1. - xmin); 288 G4double e1 = e*(1. - xmin); 283 289 284 //G4cout << "e1= " << e1 << G4endl; 290 //G4cout << "e1= " << e1 << G4endl; 285 if(e1 < emax && s0*G4UniformRand()<ds) { 291 if(e1 < emax && s0*G4UniformRand()<ds) { 286 x = xmin*G4Exp(G4Log(G4UniformRand())/bt); 292 x = xmin*G4Exp(G4Log(G4UniformRand())/bt); 287 } else { 293 } else { 288 294 289 x = xmin; 295 x = xmin; 290 G4double s1 = crossBornPerElectron->Value( 296 G4double s1 = crossBornPerElectron->Value(e1); 291 G4double w1 = bt*(del*G4Exp(G4Log(x)*btm1) 297 G4double w1 = bt*(del*G4Exp(G4Log(x)*btm1) - 1.0 + 0.5*x); 292 G4double grej = s1*w1; 298 G4double grej = s1*w1; 293 G4double f; 299 G4double f; 294 /* 300 /* 295 G4cout << "e(GeV)= " << e/GeV << " epeak( 301 G4cout << "e(GeV)= " << e/GeV << " epeak(GeV)= " << epeak/GeV 296 << " s1= " << s1 << " w1= " << w1 302 << " s1= " << s1 << " w1= " << w1 297 << " grej= " << grej << G4endl; 303 << " grej= " << grej << G4endl; 298 */ 304 */ 299 // Above emax cross section is const 305 // Above emax cross section is const 300 if(e1 > emax) { 306 if(e1 > emax) { 301 x = 0.5*(1. - (emax*emax)/(e*e)); 307 x = 0.5*(1. - (emax*emax)/(e*e)); 302 G4double s2 = crossBornPerElectron->Valu 308 G4double s2 = crossBornPerElectron->Value(emax); 303 G4double w2 = bt*(del*G4Exp(G4Log(x)*btm 309 G4double w2 = bt*(del*G4Exp(G4Log(x)*btm1) - 1.0 + 0.5*x); 304 grej = s2*w2; 310 grej = s2*w2; 305 //G4cout << "emax= " << emax << " s2= " 311 //G4cout << "emax= " << emax << " s2= " << s2 << " w2= " << w2 306 // << " grej= " << grej << G4endl; 312 // << " grej= " << grej << G4endl; 307 } 313 } 308 314 309 if(e1 > epeak) { 315 if(e1 > epeak) { 310 x = 0.5*(1.0 - (epeak*epeak)/(e*e)); 316 x = 0.5*(1.0 - (epeak*epeak)/(e*e)); 311 G4double s2 = crossBornPerElectron->Valu 317 G4double s2 = crossBornPerElectron->Value(epeak); 312 G4double w2 = bt*(del*G4Exp(G4Log(x)*btm 318 G4double w2 = bt*(del*G4Exp(G4Log(x)*btm1) - 1.0 + 0.5*x); 313 grej = std::max(grej,s2*w2); 319 grej = std::max(grej,s2*w2); 314 //G4cout << "epeak= " << epeak << " s2= 320 //G4cout << "epeak= " << epeak << " s2= " << s2 << " w2= " << w2 315 // << " grej= " << grej << G4endl; 321 // << " grej= " << grej << G4endl; 316 } 322 } 317 G4int ii = 0; 323 G4int ii = 0; 318 const G4int iimax = 1000; 324 const G4int iimax = 1000; 319 do { 325 do { 320 x = xmin + G4UniformRand()*(xmax - xmin) 326 x = xmin + G4UniformRand()*(xmax - xmin); 321 327 322 G4double s2 = crossBornPerElectron->Valu 328 G4double s2 = crossBornPerElectron->Value(sqrt(1.0 - 2*x)*e); 323 G4double w2 = bt*(del*G4Exp(G4Log(x)*btm 329 G4double w2 = bt*(del*G4Exp(G4Log(x)*btm1) - 1.0 + 0.5*x); 324 /* 330 /* 325 G4cout << "x= " << x << " xmin= " << xmi 331 G4cout << "x= " << x << " xmin= " << xmin << " xmax= " << xmax 326 << " s2= " << s2 << " w2= " << w2 < 332 << " s2= " << s2 << " w2= " << w2 << G4endl; 327 */ 333 */ 328 f = s2*w2; 334 f = s2*w2; 329 if(f > grej) { 335 if(f > grej) { 330 G4cout << "G4DynamicParticle* G4eeToHadronsM 336 G4cout << "G4DynamicParticle* G4eeToHadronsModel:WARNING " 331 << f << " > " << grej << " majorant i 337 << f << " > " << grej << " majorant is`small!" 332 << G4endl; 338 << G4endl; 333 } 339 } 334 if(++ii >= iimax) { break; } 340 if(++ii >= iimax) { break; } 335 // Loop checking, 07-Aug-2015, Vladimir 341 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko 336 } while (f < grej*G4UniformRand()); 342 } while (f < grej*G4UniformRand()); 337 } 343 } 338 344 339 G4ThreeVector dir(0.0,0.0,1.0); 345 G4ThreeVector dir(0.0,0.0,1.0); 340 if(G4UniformRand() > 0.5) { dir.set(0.0,0.0, 346 if(G4UniformRand() > 0.5) { dir.set(0.0,0.0,-1.0); } 341 //G4cout << "Egamma(MeV)= " << x*e << " " < 347 //G4cout << "Egamma(MeV)= " << x*e << " " << dir << G4endl; 342 gamma = new G4DynamicParticle(theGamma,dir,x 348 gamma = new G4DynamicParticle(theGamma,dir,x*e); 343 return gamma; 349 return gamma; 344 } 350 } 345 351 346 //....oooOO0OOooo........oooOO0OOooo........oo 352 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 353 347 354