- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/lowenergy/src/G4Generator2BS.cc
r819 r1340 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4Generator2BS.cc,v 1.10 2010/10/14 14:01:02 vnivanch Exp $ 27 // GEANT4 tag $Name: emlowen-V09-03-54 $ 26 28 // 27 29 // ------------------------------------------------------------------- … … 39 41 // 40 42 // Modifications: 41 // 02 Jun 2003 First implementation acording with new design 42 // 05 Nov 2003 MGP Fixed std namespace 43 // 17 Nov 2003 MGP Fixed compilation problem on Windows 43 // 02 Jun 2003 First implementation acording with new design 44 // 05 Nov 2003 MGP Fixed std namespace 45 // 17 Nov 2003 MGP Fixed compilation problem on Windows 46 // 12 Oct 2010 V.Ivanchenko Moved RejectionFunction inline, use G4Pow to speadup 44 47 // 45 48 // Class Description: 46 49 // 47 // Concrete base class for Bremsstrahlung Angular Distribution Generation - 2BS Distribution 50 // Concrete base class for Bremsstrahlung Angular Distribution Generation 51 // 2BS Distribution 48 52 // 49 53 // Class Description: End … … 51 55 // ------------------------------------------------------------------- 52 56 // 53 //54 57 55 58 #include "G4Generator2BS.hh" 56 #include "Randomize.hh" 57 //59 #include "Randomize.hh" 60 #include "G4Pow.hh" 58 61 59 G4Generator2BS::G4Generator2BS(const G4String& name):G4VBremAngularDistribution(name) 60 {;} 62 // 63 64 G4Generator2BS::G4Generator2BS(const G4String&) 65 : G4VBremAngularDistribution("AngularGen2BS") 66 { 67 g4pow = G4Pow::GetInstance(); 68 } 61 69 62 70 // 63 71 64 72 G4Generator2BS::~G4Generator2BS() 65 { ;}73 {} 66 74 67 75 // … … 79 87 // Departement of Medical Physics, Memorial Sloan-Kettering Cancer Center, New York 80 88 81 82 89 G4double theta = 0; 83 90 … … 87 94 G4double gMaxEnergy = (pi*initialTotalEnergy)*(pi*initialTotalEnergy); 88 95 89 G4double Zeff = std::sqrt(static_cast<G4double>(Z) * (static_cast<G4double>(Z) + 1.0)); 90 z = (0.00008116224*(std::pow(Zeff,0.3333333))); 96 //G4double Zeff = std::sqrt(static_cast<G4double>(Z) * (static_cast<G4double>(Z) + 1.0)); 97 //z = (0.00008116224*(std::pow(Zeff,0.3333333))); 98 99 // VI speadup 100 z = 0.00008116224*(g4pow->Z13(Z) + g4pow->Z13(Z+1)); 91 101 92 102 // Rejection arguments … … 97 107 98 108 // Calculate rejection function at 0, 1 and Emax 99 G4double gfunction0 = RejectionFunction(0 );100 G4double gfunction1 = RejectionFunction(1 );109 G4double gfunction0 = RejectionFunction(0.0); 110 G4double gfunction1 = RejectionFunction(1.0); 101 111 G4double gfunctionEmax = RejectionFunction(gMaxEnergy); 102 103 112 104 113 // Calculate Maximum value … … 110 119 do{ 111 120 rand = G4UniformRand(); 112 rand = rand/(1-rand+1.0/gMaxEnergy);121 rand /= (1 - rand + 1.0/gMaxEnergy); 113 122 gfunctionTest = RejectionFunction(rand); 114 123 randTest = G4UniformRand(); 115 124 116 } while(randTest > (gfunctionTest/gMaximum));125 } while(randTest*gMaximum > gfunctionTest); 117 126 118 127 theta = std::sqrt(rand)/initialTotalEnergy; 119 128 120 121 129 return theta; 122 130 } 131 123 132 // 124 125 G4double G4Generator2BS::RejectionFunction(G4double value) const126 {127 128 G4double argument = (1+value)*(1+value);129 130 G4double gfunction = (4+std::log(rejection_argument3+(z/argument)))*131 ((4*EnergyRatio*value/argument)-rejection_argument1)+rejection_argument2;132 133 return gfunction;134 135 }136 133 137 134 void G4Generator2BS::PrintGeneratorInformation() const 138 135 { 139 136 G4cout << "\n" << G4endl; 140 G4cout << "Bremsstrahlung Angular Generator is 2BS Generator from 2BS Koch & Motz distribution (Rev Mod Phys 31(4), 920 (1959))" << G4endl; 137 G4cout << "Bremsstrahlung Angular Generator is 2BS Generator " 138 << "from 2BS Koch & Motz distribution (Rev Mod Phys 31(4), 920 (1959))" << G4endl; 141 139 G4cout << "Sampling algorithm adapted from PIRS-0203" << G4endl; 142 140 G4cout << "\n" << G4endl;
Note: See TracChangeset
for help on using the changeset viewer.