Changeset 961 for trunk/source/processes/electromagnetic/muons
- Timestamp:
- Apr 6, 2009, 12:21:12 PM (15 years ago)
- Location:
- trunk/source/processes/electromagnetic/muons
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/muons/History
r819 r961 1 $Id: History,v 1.1 06 2007/11/12 10:34:23vnivanch Exp $1 $Id: History,v 1.126 2009/02/26 11:04:20 vnivanch Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 26 February 09: V.Ivant (emmuons-V09-02-01) 21 G4MuIonisation - fixed initialisation alowing to configure external model 22 of fluctuations 23 24 20 February 09: V.Ivant (emmuons-V09-02-00) 25 - Cleanup: improved comments, move virtual methods from .hh to .cc 26 27 12 November 08: V.Ivant (emmuons-V09-01-15) 28 G4EnergyLossForExtrapolator - added method TrueStepLength; fixed initialisation 29 before a step 30 31 27 October 08: V.Ivant (emmuons-V09-01-14) 32 G4EnergyLossForExtrapolator - make method ComputeTrueStep public and cleanup 33 34 16 October 08: V.Ivant (emmuons-V09-01-13) 35 G4MuMscModel - remove obsolete 36 G4EnergyLossForExtrapolator - added spline option 37 G4MuIonisation, G4MuBremsstrahlung, G4MuPairProduction, 38 G4MuMultipleScattering - change SubType and improved cout 39 40 4 August 08: V.Ivant (emmuons-V09-01-12) 41 G4MuMscModel - added protection for ions 42 43 31 July 08: V.Ivant (emmuons-V09-01-11) 44 G4MuMscModel - do not define min and max energy in constructor but use Set 45 methods 46 G4MuMultipleScattering - added cout of model names 47 48 21 April 08: V.Ivanchenko (emmuons-V09-01-10) 49 G4MuBremsstrahlungModel, G4MuPairProductionModel - use CrossSectionPerVolume 50 from the base class, do not use A in CrossSEctionPerAtom 51 G4MuMscModel - do not use A in SetupTarget 52 53 04 April 08: V.Ivanchenko (emmuons-V09-01-09) 54 G4MuMultipleScattering - use G4WentzelVIModel model 55 build table for particles with mass < GeV 56 57 04 April 08: V.Ivanchenko (emmuons-V09-01-08) 58 - G4MuBremsstrahlungModel - instead of static const use members of a class, 59 this allows to reuse the model for different 60 particle type 61 62 27 March 08: V.Ivanchenko (emmuons-V09-01-07) 63 - G4MuPairProductionModel - fixed nan value at initialisation 64 of the sampling table 65 66 26 March 08: V.Ivanchenko (emmuons-V09-01-06) 67 - G4MuMscModel - fixed outstanding bug in sampling of scattering 68 69 25 March 08: V.Ivanchenko (emmuons-V09-01-05) 70 - G4MuMscModel - added shift along particle direction for displacement 71 - G4MuBetheBlochModel - update computation of correction 72 73 17 March 08: V.Ivanchenko (emmuons-V09-01-04) 74 - G4MuMscModel - fixed sampling 75 76 14 March 08: V.Ivanchenko (emmuons-V09-01-03) 77 - G4MuMscModel - use G4VMscModel interface 78 79 06 March 08: V.Ivanchenko (emmuons-V09-01-02) 80 - G4MuBremsstrahlungModel - remove ignoreCut flag, remove obsolete methods 81 and members, set some members protected to 82 be used by G4hBremsstrahlungModel 83 - G4MuPairProductionModel - remove ignoreCut flag, set some members protected 84 to be used by G4hBremsstrahlungModel 85 - SubType for all processes is initialized 86 87 22 February 08: V.Ivanchenko (emmuons-V09-01-01) 88 G4MuMscModel - added sampling of tail distribution 89 90 14 January 08: V.Ivanchenko (emmuons-V09-01-00) 91 G4MuMscModel - added computation of the second moment of the distribution; 92 fixed sampling 93 G4MuMultipleScattering - modified default RangeFactor 19 94 20 95 12 November 07: V.Ivanchenko (emmuons-V09-00-04) -
trunk/source/processes/electromagnetic/muons/include/G4EnergyLossForExtrapolator.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EnergyLossForExtrapolator.hh,v 1. 9 2007/07/28 13:44:25vnivanch Exp $27 // GEANT4 tag $Name: $26 // $Id: G4EnergyLossForExtrapolator.hh,v 1.12 2008/11/13 14:14:07 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 //--------------------------------------------------------------------------- … … 81 81 82 82 G4double EnergyBeforeStep(G4double kinEnergy, G4double step, 83 const G4Material*, const G4ParticleDefinition*); 83 const G4Material*, const G4ParticleDefinition*); 84 85 G4double TrueStepLength(G4double kinEnergy, G4double step, 86 const G4Material*, const G4ParticleDefinition* part); 84 87 85 88 inline G4double EnergyAfterStep(G4double kinEnergy, G4double step, 86 89 const G4Material*, const G4String& particleName); 87 90 88 91 inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step, 89 92 const G4Material*, const G4String& particleName); 90 93 91 94 inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step, 92 const G4Material*, const G4ParticleDefinition* part); 95 const G4Material*, 96 const G4ParticleDefinition* part); 93 97 94 98 inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step, 95 const G4Material*, const G4String& particleName); 99 const G4Material*, 100 const G4String& particleName); 101 102 inline G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part, 103 G4double kinEnergy, G4double stepLength); 96 104 97 105 inline G4double EnergyDispersion(G4double kinEnergy, G4double step, 98 106 const G4Material*, const G4ParticleDefinition*); 99 107 100 108 inline G4double EnergyDispersion(G4double kinEnergy, G4double step, … … 113 121 void Initialisation(); 114 122 123 G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*, 124 G4double kinEnergy); 125 115 126 G4PhysicsTable* PrepareTable(); 116 127 … … 123 134 void ComputeProtonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table); 124 135 125 G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part, 126 G4double kinEnergy, G4double stepLength); 136 void ComputeTrasportXS(const G4ParticleDefinition* part, G4PhysicsTable* table); 127 137 128 138 inline G4double ComputeValue(G4double x, const G4PhysicsTable* table); 129 130 inline G4double ComputeScatteringAngle(G4double x);131 139 132 140 // hide assignment operator … … 158 166 G4PhysicsTable* invRangeMuon; 159 167 G4PhysicsTable* invRangeProton; 168 G4PhysicsTable* mscElectron; 160 169 161 170 const G4Material* currentMaterial; … … 214 223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 215 224 216 inline G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy, 217 G4double step, 218 const G4Material* mat, 219 const G4String& name) 225 inline G4double 226 G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy, 227 G4double step, 228 const G4Material* mat, 229 const G4String& name) 220 230 { 221 231 return EnergyDispersion(kinEnergy,step,mat,FindParticle(name)); … … 224 234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 225 235 226 inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,227 G4double stepLength,228 const G4Material* mat,229 const G4ParticleDefinition* part)230 { 231 if(!isInitialised) Initialisation(); 236 inline G4double 237 G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy, 238 G4double stepLength, 239 const G4Material* mat, 240 const G4ParticleDefinition* part) 241 { 232 242 G4double theta = 0.0; 233 if(mat && part && kinEnergy > 0.0) { 234 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength); 235 if(step > 0.001*radLength) theta = ComputeScatteringAngle(stepLength); 243 if(SetupKinematics(part, mat, kinEnergy)) { 244 G4double t = stepLength/radLength; 245 G4double y = std::max(0.001, t); 246 theta = 19.23*MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(y))/(beta2*gam*mass); 236 247 } 237 248 return theta; … … 240 251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 241 252 242 inline G4double G4EnergyLossForExtrapolator::ComputeScatteringAngle(G4double x) 243 { 244 G4double t = x/radLength; 245 return 19.23*MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(t))/(beta2*gam*mass); 246 } 253 inline G4double 254 G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat, 255 const G4ParticleDefinition* part, 256 G4double kinEnergy, 257 G4double stepLength) 258 { 259 G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part); 260 return stepLength*std::sqrt(1.0 + 0.625*theta*theta); 261 } 247 262 248 263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 249 264 250 inline G4double G4EnergyLossForExtrapolator::EnergyDispersion(251 265 inline 266 G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy, 252 267 G4double stepLength, 253 268 const G4Material* mat, 254 269 const G4ParticleDefinition* part) 255 270 { 256 if(!isInitialised) Initialisation();257 271 G4double sig2 = 0.0; 258 if( mat && part) {272 if(SetupKinematics(part, mat, kinEnergy)) { 259 273 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength); 260 sig2 = (1.0/beta2 - 0.5)* twopi_mc2_rcl2 * tmax*step * electronDensity *charge2;274 sig2 = (1.0/beta2 - 0.5)*twopi_mc2_rcl2*tmax*step*electronDensity*charge2; 261 275 } 262 276 return sig2; … … 269 283 { 270 284 G4double res = 0.0; 271 bool b;272 res = ((*table)[index])->GetValue(x, b);285 G4bool b; 286 if(table) res = ((*table)[index])->GetValue(x, b); 273 287 return res; 274 288 } -
trunk/source/processes/electromagnetic/muons/include/G4MuBetheBlochModel.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuBetheBlochModel.hh,v 1.1 7 2007/05/22 17:35:58vnivanch Exp $27 // GEANT4 tag $Name: $26 // $Id: G4MuBetheBlochModel.hh,v 1.18 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 76 76 virtual ~G4MuBetheBlochModel(); 77 77 78 v oid Initialise(const G4ParticleDefinition*, const G4DataVector&);78 virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&); 79 79 80 G4double MinEnergyCut(const G4ParticleDefinition*,81 80 virtual G4double MinEnergyCut(const G4ParticleDefinition*, 81 const G4MaterialCutsCouple*); 82 82 83 83 virtual G4double ComputeCrossSectionPerElectron( … … 113 113 protected: 114 114 115 G4double MaxSecondaryEnergy(const G4ParticleDefinition*,116 115 virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 116 G4double kinEnergy); 117 117 118 118 private: 119 119 120 void SetParticle(const G4ParticleDefinition* p);120 inline void SetParticle(const G4ParticleDefinition* p); 121 121 122 122 // hide assignment operator … … 141 141 }; 142 142 143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 144 144 145 inline G4double G4MuBetheBlochModel::MaxSecondaryEnergy( 146 const G4ParticleDefinition*, 147 G4double kinEnergy) 145 inline void G4MuBetheBlochModel::SetParticle(const G4ParticleDefinition* p) 148 146 { 149 G4double tau = kinEnergy/mass; 150 G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) / 151 (1. + 2.0*(tau + 1.)*ratio + ratio*ratio); 152 return tmax; 147 if(!particle) { 148 particle = p; 149 mass = particle->GetPDGMass(); 150 massSquare = mass*mass; 151 ratio = electron_mass_c2/mass; 152 } 153 153 } 154 154 -
trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlung.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuBremsstrahlung.hh,v 1. 29 2007/05/23 08:49:32vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuBremsstrahlung.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 86 86 virtual ~G4MuBremsstrahlung(); 87 87 88 G4bool IsApplicable(const G4ParticleDefinition& p);88 virtual G4bool IsApplicable(const G4ParticleDefinition& p); 89 89 90 G4double MinPrimaryEnergy(const G4ParticleDefinition* p,91 const G4Material*,92 G4double cut);90 virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p, 91 const G4Material*, 92 G4double cut); 93 93 94 94 // Print out of the class parameters 95 v oid PrintInfo();95 virtual void PrintInfo(); 96 96 97 97 protected: 98 98 99 v oid InitialiseEnergyLossProcess(const G4ParticleDefinition*,100 const G4ParticleDefinition*);99 virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*, 100 const G4ParticleDefinition*); 101 101 102 102 private: … … 114 114 115 115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....117 118 inline G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)119 {120 return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);121 }122 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....124 125 inline G4double G4MuBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,126 const G4Material*,127 G4double)128 {129 return lowestKinEnergy;130 }131 132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......133 116 134 117 #endif -
trunk/source/processes/electromagnetic/muons/include/G4MuBremsstrahlungModel.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuBremsstrahlungModel.hh,v 1. 17 2007/10/11 09:25:31vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuBremsstrahlungModel.hh,v 1.22 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 45 45 // 10-02-04 Add lowestKinEnergy (V.Ivanchenko) 46 46 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko) 47 // 13-02-06 add ComputeCrossSectionPerAtom (mma)47 // 13-02-06 Add ComputeCrossSectionPerAtom (mma) 48 48 // 11-10-07 Add ignoreCut flag (V.Ivanchenko) 49 // 28-02-08 Reorganized protected methods and members (V.Ivanchenko) 50 // 06-03-08 Remove obsolete methods and members (V.Ivanchenko) 49 51 // 50 52 … … 52 54 // Class Description: 53 55 // 54 // Implementation of energy loss for gamma emissionby muons56 // Implementation of bremssrahlung by muons 55 57 56 58 // ------------------------------------------------------------------- … … 61 63 62 64 #include "G4VEmModel.hh" 65 #include "G4NistManager.hh" 63 66 64 67 class G4Element; … … 75 78 virtual ~G4MuBremsstrahlungModel(); 76 79 77 v oid SetParticle(const G4ParticleDefinition*);80 virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&); 78 81 79 void Initialise(const G4ParticleDefinition*, const G4DataVector&); 80 81 void SetLowestKineticEnergy(G4double e) {lowestKinEnergy = e;}; 82 83 G4double MinEnergyCut(const G4ParticleDefinition*, 84 const G4MaterialCutsCouple*); 82 virtual G4double MinEnergyCut(const G4ParticleDefinition*, 83 const G4MaterialCutsCouple*); 85 84 86 85 virtual G4double ComputeCrossSectionPerAtom( … … 90 89 G4double cutEnergy, 91 90 G4double maxEnergy); 92 93 virtual G4double CrossSectionPerVolume(const G4Material*, 94 const G4ParticleDefinition*, 95 G4double kineticEnergy, 96 G4double cutEnergy, 97 G4double maxEnergy); 98 91 99 92 virtual G4double ComputeDEDXPerVolume(const G4Material*, 100 93 const G4ParticleDefinition*, … … 102 95 G4double cutEnergy); 103 96 104 void SampleSecondaries(std::vector<G4DynamicParticle*>*, 105 const G4MaterialCutsCouple*, 106 const G4DynamicParticle*, 107 G4double tmin, 108 G4double maxEnergy); 97 virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*, 98 const G4MaterialCutsCouple*, 99 const G4DynamicParticle*, 100 G4double tmin, 101 G4double maxEnergy); 102 103 inline void SetLowestKineticEnergy(G4double e); 109 104 110 105 protected: 111 106 112 G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 113 G4double kineticEnergy); 107 G4double ComputMuBremLoss(G4double Z, G4double tkin, G4double cut); 108 109 G4double ComputeMicroscopicCrossSection(G4double tkin, 110 G4double Z, 111 G4double cut); 114 112 115 public: 113 virtual G4double ComputeDMicroscopicCrossSection(G4double tkin, 114 G4double Z, 115 G4double gammaEnergy); 116 116 117 G4double ComputMuBremLoss(G4double Z, G4double A, G4double tkin, G4double cut); 118 119 G4double ComputeMicroscopicCrossSection(G4double tkin, 120 G4double Z, 121 G4double A, 122 G4double cut); 123 124 G4double ComputeDMicroscopicCrossSection(G4double tkin, 125 G4double Z, 126 G4double A, 127 G4double gammaEnergy); 128 129 inline void SetIgnoreCutFlag(G4bool); 130 131 inline G4bool IgnoreCutFlag() const; 117 inline void SetParticle(const G4ParticleDefinition*); 132 118 133 119 private: 134 120 135 G4DataVector* ComputePartialSumSigma(const G4Material* material,136 G4double tkin, G4double cut);121 G4DataVector* ComputePartialSumSigma(const G4Material* material, 122 G4double tkin, G4double cut); 137 123 138 const G4Element* SelectRandomAtom(const G4MaterialCutsCouple* couple) const; 139 140 void MakeSamplingTables(); 141 124 const G4Element* SelectRandomAtom(const G4MaterialCutsCouple* couple) const; 142 125 143 126 // hide assignment operator … … 145 128 G4MuBremsstrahlungModel(const G4MuBremsstrahlungModel&); 146 129 130 protected: 131 132 const G4ParticleDefinition* particle; 133 G4NistManager* nist; 134 G4double mass; 135 G4double rmass; 136 G4double cc; 137 G4double coeff; 138 G4double sqrte; 139 G4double bh; 140 G4double bh1; 141 G4double btf; 142 G4double btf1; 143 144 private: 145 147 146 G4ParticleDefinition* theGamma; 148 const G4ParticleDefinition* particle;149 147 G4ParticleChangeForLoss* fParticleChange; 150 148 … … 153 151 G4double lowestKinEnergy; 154 152 G4double minThreshold; 155 G4double mass;156 157 // tables for sampling158 G4int nzdat,ntdat,NBIN;159 static G4double zdat[5],adat[5],tdat[8];160 G4double ya[1001], proba[5][8][1001];161 G4double cutFixed;162 163 G4bool ignoreCut;164 153 165 154 std::vector<G4DataVector*> partialSumSigma; 166 G4bool samplingTablesAreFilled;167 168 155 }; 169 156 170 157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 171 158 172 inline G4double G4MuBremsstrahlungModel::MaxSecondaryEnergy( 173 const G4ParticleDefinition*, 174 G4double kineticEnergy) 159 inline void G4MuBremsstrahlungModel::SetLowestKineticEnergy(G4double e) 175 160 { 176 return kineticEnergy;161 lowestKinEnergy = e; 177 162 } 178 163 179 164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 180 165 181 inline void G4MuBremsstrahlungModel::SetIgnoreCutFlag(G4bool val) 166 inline 167 void G4MuBremsstrahlungModel::SetParticle(const G4ParticleDefinition* p) 182 168 { 183 ignoreCut = val; 184 } 185 186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 187 188 inline G4bool G4MuBremsstrahlungModel::IgnoreCutFlag() const 189 { 190 return ignoreCut; 169 if(!particle) { 170 particle = p; 171 mass = particle->GetPDGMass(); 172 rmass=mass/electron_mass_c2 ; 173 cc=classic_electr_radius/rmass ; 174 coeff= 16.*fine_structure_const*cc*cc/3. ; 175 } 191 176 } 192 177 -
trunk/source/processes/electromagnetic/muons/include/G4MuIonisation.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuIonisation.hh,v 1.3 0 2007/05/23 08:49:32vnivanch Exp $27 // GEANT4 tag $Name: $26 // $Id: G4MuIonisation.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 95 95 virtual ~G4MuIonisation(); 96 96 97 G4bool IsApplicable(const G4ParticleDefinition& p);97 virtual G4bool IsApplicable(const G4ParticleDefinition& p); 98 98 99 G4double MinPrimaryEnergy(const G4ParticleDefinition* p,100 const G4Material*, G4double cut);99 virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p, 100 const G4Material*, G4double cut); 101 101 102 102 // Print out of the class parameters 103 v oid PrintInfo();103 virtual void PrintInfo(); 104 104 105 105 protected: … … 127 127 128 128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....130 131 inline G4bool G4MuIonisation::IsApplicable(const G4ParticleDefinition& p)132 {133 return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);134 }135 136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....137 138 inline G4double G4MuIonisation::MinPrimaryEnergy(const G4ParticleDefinition*,139 const G4Material*,140 G4double cut)141 {142 G4double x = 0.5*cut/electron_mass_c2;143 G4double g = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio));144 return mass*(g - 1.0);145 }146 147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....148 129 149 130 #endif -
trunk/source/processes/electromagnetic/muons/include/G4MuMultipleScattering.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuMultipleScattering.hh,v 1. 1 2007/10/26 09:52:37vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuMultipleScattering.hh,v 1.2 2008/04/13 17:19:13 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ----------------------------------------------------------------------------- … … 60 60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 61 61 62 class G4 MuMscModel;62 class G4VMscModel; 63 63 64 64 class G4MuMultipleScattering : public G4VMultipleScattering … … 94 94 private: // data members 95 95 96 G4 MuMscModel* mscModel;96 G4VMscModel* mscModel; 97 97 98 98 G4double thetaLimit; -
trunk/source/processes/electromagnetic/muons/include/G4MuPairProduction.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuPairProduction.hh,v 1. 29 2007/05/23 08:49:32vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuPairProduction.hh,v 1.31 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 84 84 virtual ~G4MuPairProduction(); 85 85 86 G4bool IsApplicable(const G4ParticleDefinition& p);86 virtual G4bool IsApplicable(const G4ParticleDefinition& p); 87 87 88 G4double MinPrimaryEnergy(const G4ParticleDefinition* p,89 const G4Material*, G4double cut);88 virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p, 89 const G4Material*, G4double cut); 90 90 91 91 // Print out of the class parameters 92 v oid PrintInfo();92 virtual void PrintInfo(); 93 93 94 94 protected: 95 95 96 v oid InitialiseEnergyLossProcess(const G4ParticleDefinition*,97 const G4ParticleDefinition*);96 virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*, 97 const G4ParticleDefinition*); 98 98 99 99 private: … … 113 113 114 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....116 117 inline G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p)118 {119 return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);120 }121 122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....123 124 inline G4double G4MuPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,125 const G4Material*,126 G4double)127 {128 return lowestKinEnergy;129 }130 131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......132 115 133 116 #endif -
trunk/source/processes/electromagnetic/muons/include/G4MuPairProductionModel.hh
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuPairProductionModel.hh,v 1.2 4 2007/10/11 13:52:03vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuPairProductionModel.hh,v 1.28 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 48 48 // 12-05-06 Add parameter to SelectRandomAtom (A.Bogdanov) 49 49 // 11-10-07 Add ignoreCut flag (V.Ivanchenko) 50 // 28-02-08 Reorganized protected methods and members (V.Ivanchenko) 50 51 51 52 // … … 62 63 63 64 #include "G4VEmModel.hh" 65 #include "G4NistManager.hh" 64 66 #include <vector> 65 67 … … 70 72 class G4MuPairProductionModel : public G4VEmModel 71 73 { 72 73 74 public: 74 75 … … 78 79 virtual ~G4MuPairProductionModel(); 79 80 80 void SetParticle(const G4ParticleDefinition*); 81 82 void Initialise(const G4ParticleDefinition*, const G4DataVector&); 83 84 void SetLowestKineticEnergy(G4double e) {lowestKinEnergy = e;}; 85 86 G4double MinEnergyCut(const G4ParticleDefinition*, 87 const G4MaterialCutsCouple*); 81 virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&); 82 88 83 89 84 virtual G4double ComputeCrossSectionPerAtom( … … 94 89 G4double maxEnergy); 95 90 96 virtual G4double CrossSectionPerVolume(const G4Material*,97 const G4ParticleDefinition*,98 G4double kineticEnergy,99 G4double cutEnergy,100 G4double maxEnergy);101 102 91 virtual G4double ComputeDEDXPerVolume(const G4Material*, 103 92 const G4ParticleDefinition*, … … 105 94 G4double cutEnergy); 106 95 107 void SampleSecondaries(std::vector<G4DynamicParticle*>*, 108 const G4MaterialCutsCouple*, 109 const G4DynamicParticle*, 110 G4double tmin, 111 G4double maxEnergy); 96 virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*, 97 const G4MaterialCutsCouple*, 98 const G4DynamicParticle*, 99 G4double tmin, 100 G4double maxEnergy); 101 102 virtual G4double MinEnergyCut(const G4ParticleDefinition*, 103 const G4MaterialCutsCouple*); 104 105 inline void SetLowestKineticEnergy(G4double e); 106 107 inline void SetParticle(const G4ParticleDefinition*); 112 108 113 109 protected: 114 115 inline G4double MaxSecondaryEnergy(const G4ParticleDefinition*,116 G4double kineticEnergy);117 118 119 public:120 110 121 111 G4double ComputMuPairLoss(G4double Z, G4double tkin, G4double cut, … … 126 116 G4double cut); 127 117 128 G4double ComputeDMicroscopicCrossSection(G4double tkin, 129 G4double Z, 130 G4double pairEnergy); 131 132 inline void SetIgnoreCutFlag(G4bool); 133 134 inline G4bool IgnoreCutFlag() const; 118 virtual G4double ComputeDMicroscopicCrossSection(G4double tkin, 119 G4double Z, 120 G4double pairEnergy); 121 122 virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 123 G4double kineticEnergy); 124 125 inline void SetCurrentElement(G4double Z); 135 126 136 127 private: … … 144 135 void MakeSamplingTables(); 145 136 146 void SetCurrentElement(G4double Z);147 148 137 inline G4double InterpolatedIntegralCrossSection( 149 138 G4double dt, G4double dz, G4int iz, … … 154 143 G4MuPairProductionModel(const G4MuPairProductionModel&); 155 144 156 G4ParticleDefinition* theElectron; 157 G4ParticleDefinition* thePositron; 158 G4ParticleChangeForLoss* fParticleChange; 159 G4ParticleChangeForGamma* gParticleChange; 160 161 G4double minPairEnergy; 162 G4double lowestKinEnergy; 145 protected: 146 147 const G4ParticleDefinition* particle; 148 G4NistManager* nist; 163 149 164 150 G4double factorForCross; … … 170 156 G4double lnZ; 171 157 172 const G4ParticleDefinition* particle; 158 static G4double xgi[8],wgi[8]; 159 160 private: 161 162 G4ParticleDefinition* theElectron; 163 G4ParticleDefinition* thePositron; 164 G4ParticleChangeForLoss* fParticleChange; 165 166 G4double minPairEnergy; 167 G4double lowestKinEnergy; 173 168 174 169 // tables for sampling … … 177 172 G4int nbiny; 178 173 size_t nmaxElements; 179 static G4double zdat[5],adat[5],tdat[8] ,xgi[8],wgi[8];174 static G4double zdat[5],adat[5],tdat[8]; 180 175 G4double ya[1001],proba[5][8][1001]; 181 176 … … 184 179 G4double dy; 185 180 186 G4bool ignoreCut;187 188 181 G4bool samplingTablesAreFilled; 189 182 std::vector<G4double> partialSum; … … 192 185 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 193 186 194 inline G4double G4MuPairProductionModel::MaxSecondaryEnergy( 195 const G4ParticleDefinition*, 196 G4double kineticEnergy) 197 { 198 G4double maxPairEnergy = kineticEnergy + particleMass*(1.0 - 0.75*sqrte*z13); 199 return maxPairEnergy; 187 inline void G4MuPairProductionModel::SetLowestKineticEnergy(G4double e) 188 { 189 lowestKinEnergy = e; 190 } 191 192 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 193 194 inline 195 void G4MuPairProductionModel::SetParticle(const G4ParticleDefinition* p) 196 { 197 if(!particle) { 198 particle = p; 199 particleMass = particle->GetPDGMass(); 200 } 200 201 } 201 202 … … 206 207 if(Z != currentZ) { 207 208 currentZ = Z; 208 z13 = std::pow(Z,0.333333333); 209 G4int iz = G4int(Z); 210 z13 = nist->GetZ13(iz); 209 211 z23 = z13*z13; 210 lnZ = std::log(Z);212 lnZ = nist->GetLOGZ(iz); 211 213 } 212 214 } … … 229 231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 230 232 231 inline void G4MuPairProductionModel::SetIgnoreCutFlag(G4bool val)232 {233 ignoreCut = val;234 }235 236 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......237 238 inline G4bool G4MuPairProductionModel::IgnoreCutFlag() const239 {240 return ignoreCut;241 }242 243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......244 245 233 #endif -
trunk/source/processes/electromagnetic/muons/src/G4EnergyLossForExtrapolator.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4EnergyLossForExtrapolator.cc,v 1.1 3 2007/07/28 13:44:25vnivanch Exp $27 // GEANT4 tag $Name: $26 // $Id: G4EnergyLossForExtrapolator.cc,v 1.18 2008/11/13 14:14:07 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 //--------------------------------------------------------------------------- … … 67 67 #include "G4MuBremsstrahlungModel.hh" 68 68 #include "G4ProductionCuts.hh" 69 #include "G4LossTableManager.hh" 70 #include "G4WentzelVIModel.hh" 69 71 70 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 88 90 delete invRangePositron; 89 91 delete invRangeProton; 92 delete mscElectron; 90 93 delete cuts; 91 94 } … … 100 103 if(!isInitialised) Initialisation(); 101 104 G4double kinEnergyFinal = kinEnergy; 102 if( mat && part) {103 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);105 if(SetupKinematics(part, mat, kinEnergy)) { 106 G4double step = TrueStepLength(kinEnergy,stepLength,mat,part); 104 107 G4double r = ComputeRange(kinEnergy,part); 105 108 if(r <= step) { … … 125 128 G4double kinEnergyFinal = kinEnergy; 126 129 127 if( mat && part) {128 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);130 if(SetupKinematics(part, mat, kinEnergy)) { 131 G4double step = TrueStepLength(kinEnergy,stepLength,mat,part); 129 132 G4double r = ComputeRange(kinEnergy,part); 130 133 … … 141 144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 142 145 143 G4double G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat, 144 const G4ParticleDefinition* part, 145 G4double kinEnergy, G4double stepLength) 146 { 146 G4double G4EnergyLossForExtrapolator::TrueStepLength(G4double kinEnergy, 147 G4double stepLength, 148 const G4Material* mat, 149 const G4ParticleDefinition* part) 150 { 151 G4double res = stepLength; 152 if(!isInitialised) Initialisation(); 153 if(SetupKinematics(part, mat, kinEnergy)) { 154 if(part == electron || part == positron) { 155 G4double x = stepLength*ComputeValue(kinEnergy, mscElectron); 156 if(x < 0.2) res *= (1.0 + 0.5*x + x*x/3.0); 157 else if(x < 0.9999) res = -std::log(1.0 - x)*stepLength/x; 158 else res = ComputeRange(kinEnergy,part); 159 160 } else { 161 res = ComputeTrueStep(mat,part,kinEnergy,stepLength); 162 } 163 } 164 return res; 165 } 166 167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 168 169 G4bool G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part, 170 const G4Material* mat, 171 G4double kinEnergy) 172 { 173 if(!part || !mat || kinEnergy < keV) return false; 147 174 if(!isInitialised) Initialisation(); 148 175 G4bool flag = false; … … 182 209 if(tmax > maxEnergyTransfer) tmax = maxEnergyTransfer; 183 210 } 184 G4double theta = ComputeScatteringAngle(stepLength); 185 return stepLength*std::sqrt(1.0 + 0.625*theta*theta); 211 return true; 186 212 } 187 213 … … 231 257 invRangeMuon = PrepareTable(); 232 258 invRangeProton = PrepareTable(); 259 mscElectron = PrepareTable(); 233 260 234 261 G4LossTableBuilder builder; … … 262 289 builder.BuildInverseRangeTable(rangeProton, invRangeProton); 263 290 291 ComputeTrasportXS(electron, mscElectron); 264 292 } 265 293 … … 273 301 274 302 G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins); 303 v->SetSpline(G4LossTableManager::Instance()->SplineFlag()); 275 304 table->push_back(v); 276 305 } … … 488 517 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 489 518 519 void G4EnergyLossForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part, 520 G4PhysicsTable* table) 521 { 522 G4DataVector v; 523 G4WentzelVIModel* msc = new G4WentzelVIModel(); 524 msc->SetPolarAngleLimit(CLHEP::pi); 525 msc->Initialise(part, v); 526 527 mass = part->GetPDGMass(); 528 charge2 = 1.0; 529 currentParticle = part; 530 531 const G4MaterialTable* mtable = G4Material::GetMaterialTable(); 532 533 if(0<verbose) { 534 G4cout << "G4EnergyLossForExtrapolator::ComputeProtonDEDX for " << part->GetParticleName() 535 << G4endl; 536 } 537 538 for(G4int i=0; i<nmat; i++) { 539 540 const G4Material* mat = (*mtable)[i]; 541 if(1<verbose) 542 G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl; 543 G4PhysicsVector* aVector = (*table)[i]; 544 for(G4int j=0; j<nbins; j++) { 545 546 G4double e = aVector->GetLowEdgeEnergy(j); 547 G4double xs = msc->CrossSectionPerVolume(mat,part,e); 548 aVector->PutValue(j,xs); 549 if(1<verbose) { 550 G4cout << "j= " << j << " e(MeV)= " << e/MeV 551 << " xs(1/mm)= " << xs*mm << G4endl; 552 } 553 } 554 } 555 delete msc; 556 } 557 558 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 559 -
trunk/source/processes/electromagnetic/muons/src/G4MuBetheBlochModel.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuBetheBlochModel.cc,v 1.2 3 2007/05/22 17:35:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuBetheBlochModel.cc,v 1.25 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 88 88 theElectron = G4Electron::Electron(); 89 89 corr = G4LossTableManager::Instance()->EmCorrections(); 90 fParticleChange = 0; 90 91 91 92 if(p) SetParticle(p); … … 99 100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 100 101 101 void G4MuBetheBlochModel::SetParticle(const G4ParticleDefinition* p)102 {103 if(!particle) {104 particle = p;105 mass = particle->GetPDGMass();106 massSquare = mass*mass;107 ratio = electron_mass_c2/mass;108 }109 }110 111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......112 113 102 G4double G4MuBetheBlochModel::MinEnergyCut(const G4ParticleDefinition*, 114 103 const G4MaterialCutsCouple* couple) … … 117 106 } 118 107 108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 109 110 G4double G4MuBetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition*, 111 G4double kinEnergy) 112 { 113 G4double tau = kinEnergy/mass; 114 G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) / 115 (1. + 2.0*(tau + 1.)*ratio + ratio*ratio); 116 return tmax; 117 } 118 119 119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 120 120 … … 124 124 if(p) SetParticle(p); 125 125 126 if(pParticleChange) 127 fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*> 128 (pParticleChange); 129 else 130 fParticleChange = new G4ParticleChangeForLoss(); 126 if(!fParticleChange) { 127 if(pParticleChange) { 128 fParticleChange = 129 reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); 130 } else { 131 fParticleChange = new G4ParticleChangeForLoss(); 132 } 133 } 131 134 } 132 135 … … 275 278 276 279 //High order corrections 277 dedx += corr->HighOrderCorrections(p,material,kineticEnergy );280 dedx += corr->HighOrderCorrections(p,material,kineticEnergy,cutEnergy); 278 281 279 282 return dedx; -
trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlung.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuBremsstrahlung.cc,v 1. 38 2007/05/22 17:35:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuBremsstrahlung.cc,v 1.42 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 82 82 lowestKinEnergy(1.*GeV), 83 83 isInitialised(false) 84 {} 84 { 85 SetProcessSubType(fBremsstrahlung); 86 } 85 87 86 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 91 93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 92 94 93 void G4MuBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition* part, 94 const G4ParticleDefinition*) 95 G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p) 96 { 97 return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV); 98 } 99 100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 101 102 G4double G4MuBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*, 103 const G4Material*, 104 G4double) 105 { 106 return lowestKinEnergy; 107 } 108 109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 110 111 void G4MuBremsstrahlung::InitialiseEnergyLossProcess( 112 const G4ParticleDefinition* part, 113 const G4ParticleDefinition*) 95 114 { 96 115 if(!isInitialised) { … … 105 124 em->SetLowestKineticEnergy(lowestKinEnergy); 106 125 107 G4VEmFluctuationModel* fm = new G4UniversalFluctuation();108 em->SetLowEnergyLimit( 0.1*keV);109 em->SetHighEnergyLimit( 100.0*TeV);126 G4VEmFluctuationModel* fm = 0; 127 em->SetLowEnergyLimit(MinKinEnergy()); 128 em->SetHighEnergyLimit(MaxKinEnergy()); 110 129 AddEmModel(1, em, fm); 111 130 } … … 115 134 116 135 void G4MuBremsstrahlung::PrintInfo() 117 { 118 G4cout << " Parametrised model " 119 << G4endl; 120 } 136 {} 121 137 122 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... -
trunk/source/processes/electromagnetic/muons/src/G4MuBremsstrahlungModel.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuBremsstrahlungModel.cc,v 1. 24 2007/11/08 11:48:28vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuBremsstrahlungModel.cc,v 1.33 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 46 46 // 13-02-03 Add name (V.Ivanchenko) 47 47 // 10-02-04 Add lowestKinEnergy (V.Ivanchenko) 48 // 08-04-05 Major optimisation of internal interfaces (V.Ivan tchenko)49 // 03-08-05 Angular correlations according to PRM (V.Ivan tchenko)48 // 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko) 49 // 03-08-05 Angular correlations according to PRM (V.Ivanchenko) 50 50 // 13-02-06 add ComputeCrossSectionPerAtom (mma) 51 51 // 21-03-06 Fix problem of initialisation in case when cuts are not defined (VI) 52 52 // 07-11-07 Improve sampling of final state (A.Bogdanov) 53 // 28-02-08 Use precomputed Z^1/3 and Log(A) (V.Ivanchenko) 53 54 // 54 55 … … 74 75 75 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 76 77 // static members78 //79 G4double G4MuBremsstrahlungModel::zdat[]={1., 4., 13., 29., 92.};80 G4double G4MuBremsstrahlungModel::adat[]={1.01, 9.01, 26.98, 63.55, 238.03};81 G4double G4MuBremsstrahlungModel::tdat[]={1.e3, 1.e4, 1.e5, 1.e6, 1.e7, 1.e8,82 1.e9, 1.e10};83 84 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 85 78 … … 90 83 : G4VEmModel(nam), 91 84 particle(0), 85 sqrte(sqrt(exp(1.))), 86 bh(202.4), 87 bh1(446.), 88 btf(183.), 89 btf1(1429.), 90 fParticleChange(0), 92 91 lowestKinEnergy(1.0*GeV), 93 minThreshold(1.0*keV), 94 nzdat(5), 95 ntdat(8), 96 NBIN(1000), 97 cutFixed(0.98*keV), 98 ignoreCut(false), 99 samplingTablesAreFilled(false) 92 minThreshold(1.0*keV) 100 93 { 101 94 theGamma = G4Gamma::Gamma(); 95 nist = G4NistManager::Instance(); 102 96 if(p) SetParticle(p); 103 97 } … … 125 119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 126 120 127 void G4MuBremsstrahlungModel::SetParticle(const G4ParticleDefinition* p)128 {129 if(!particle) {130 particle = p;131 mass = particle->GetPDGMass();132 }133 }134 135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......136 137 121 void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p, 138 122 const G4DataVector& cuts) … … 142 126 highKinEnergy = HighEnergyLimit(); 143 127 128 // partial cross section is computed for fixed energy 144 129 G4double fixedEnergy = 0.5*highKinEnergy; 145 130 … … 148 133 if(theCoupleTable) { 149 134 G4int numOfCouples = theCoupleTable->GetTableSize(); 150 135 136 // clear old data 151 137 G4int nn = partialSumSigma.size(); 152 138 G4int nc = cuts.size(); 153 139 if(nn > 0) { 154 140 for (G4int ii=0; ii<nn; ii++){ 155 G4DataVector* a =partialSumSigma[ii];141 G4DataVector* a = partialSumSigma[ii]; 156 142 if ( a ) delete a; 157 143 } 158 144 partialSumSigma.clear(); 159 145 } 146 // fill new data 160 147 if (numOfCouples>0) { 161 148 for (G4int i=0; i<numOfCouples; i++) { 162 149 G4double cute = DBL_MAX; 150 151 // protection for usage with extrapolator 163 152 if(i < nc) cute = cuts[i]; 164 if(cute < cutFixed || ignoreCut) cute = cutFixed; 153 165 154 const G4MaterialCutsCouple* couple = 166 155 theCoupleTable->GetMaterialCutsCouple(i); … … 171 160 } 172 161 } 173 if(!samplingTablesAreFilled) MakeSamplingTables(); 174 if(pParticleChange) 175 fParticleChange = 176 reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); 177 else 178 fParticleChange = new G4ParticleChangeForLoss(); 162 163 // define pointer to G4ParticleChange 164 if(!fParticleChange) { 165 if(pParticleChange) 166 fParticleChange = 167 reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); 168 else 169 fParticleChange = new G4ParticleChangeForLoss(); 170 } 179 171 } 180 172 … … 188 180 { 189 181 G4double dedx = 0.0; 190 if (kineticEnergy <= lowestKinEnergy || ignoreCut) return dedx;182 if (kineticEnergy <= lowestKinEnergy) return dedx; 191 183 192 184 G4double tmax = kineticEnergy; 193 G4double cut = min(cutEnergy,tmax);194 if(cut < cutFixed) cut = cutFixed;185 G4double cut = std::min(cutEnergy,tmax); 186 if(cut < minThreshold) cut = minThreshold; 195 187 196 188 const G4ElementVector* theElementVector = material->GetElementVector(); 197 189 const G4double* theAtomicNumDensityVector = 198 190 material->GetAtomicNumDensityVector(); 199 191 200 192 // loop for elements in the material 201 193 for (size_t i=0; i<material->GetNumberOfElements(); i++) { 202 194 203 G4double Z = (*theElementVector)[i]->GetZ(); 204 G4double A = (*theElementVector)[i]->GetA()/(g/mole) ; 205 206 G4double loss = ComputMuBremLoss(Z, A, kineticEnergy, cut); 195 G4double loss = 196 ComputMuBremLoss((*theElementVector)[i]->GetZ(), kineticEnergy, cut); 207 197 208 198 dedx += loss*theAtomicNumDensityVector[i]; 209 199 } 200 // G4cout << "BR e= " << kineticEnergy << " dedx= " << dedx << G4endl; 210 201 if(dedx < 0.) dedx = 0.; 211 202 return dedx; … … 214 205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 215 206 216 G4double G4MuBremsstrahlungModel::ComputMuBremLoss(G4double Z, G4double A,207 G4double G4MuBremsstrahlungModel::ComputMuBremLoss(G4double Z, 217 208 G4double tkin, G4double cut) 218 209 { … … 239 230 { 240 231 G4double ep = (aa + xgi[i]*hhh)*totalEnergy; 241 loss += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, A,ep);232 loss += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep); 242 233 } 243 234 aa += hhh; … … 254 245 G4double tkin, 255 246 G4double Z, 256 G4double A,257 247 G4double cut) 258 248 { … … 272 262 G4double bbb = log(vmax); 273 263 G4int kkk = (G4int)((bbb-aaa)/ak1)+k2 ; 274 G4double hhh = (bbb-aaa)/ float(kkk);264 G4double hhh = (bbb-aaa)/G4double(kkk); 275 265 276 266 G4double aa = aaa; … … 281 271 { 282 272 G4double ep = exp(aa + xgi[i]*hhh)*totalEnergy; 283 cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, A,ep);273 cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep); 284 274 } 285 275 aa += hhh; … … 287 277 288 278 cross *=hhh; 279 280 //G4cout << "BR e= " << tkin<< " cross= " << cross/barn << G4endl; 289 281 290 282 return cross; … … 296 288 G4double tkin, 297 289 G4double Z, 298 G4double A,299 290 G4double gammaEnergy) 300 291 // differential cross section 301 292 { 302 static const G4double sqrte=sqrt(exp(1.)) ;303 static const G4double bh=202.4,bh1=446.,btf=183.,btf1=1429. ;304 static const G4double rmass=mass/electron_mass_c2 ;305 static const G4double cc=classic_electr_radius/rmass ;306 static const G4double coeff= 16.*fine_structure_const*cc*cc/3. ;307 308 293 G4double dxsection = 0.; 309 294 … … 315 300 G4double rab0=delta*sqrte ; 316 301 317 G4double z13 = exp(-log(Z)/3.) ; 318 G4double dn = 1.54*exp(0.27*log(A)) ; 302 G4int iz = G4int(Z); 303 if(iz < 1) iz = 1; 304 305 G4double z13 = 1.0/nist->GetZ13(iz); 306 G4double dn = 1.54*nist->GetA27(iz); 319 307 320 308 G4double b,b1,dnstar ; 321 309 322 if( Z<1.5)310 if(1 == iz) 323 311 { 324 b =bh;325 b1 =bh1;326 dnstar =dn;312 b = bh; 313 b1 = bh1; 314 dnstar = dn; 327 315 } 328 316 else 329 317 { 330 b =btf;331 b1 =btf1;332 dnstar = exp((1.-1./Z)*log(dn));318 b = btf; 319 b1 = btf1; 320 dnstar = dn/std::pow(dn, 1./Z); 333 321 } 334 322 … … 359 347 const G4ParticleDefinition*, 360 348 G4double kineticEnergy, 361 G4double Z, G4double A,349 G4double Z, G4double, 362 350 G4double cutEnergy, 363 G4double) 364 { 365 G4double cut = min(cutEnergy, kineticEnergy); 366 if(cut < cutFixed || ignoreCut) cut = cutFixed; 367 G4double cross = 368 ComputeMicroscopicCrossSection (kineticEnergy, Z, A/(g/mole), cut); 369 return cross; 370 } 371 372 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 373 374 G4double G4MuBremsstrahlungModel::CrossSectionPerVolume( 375 const G4Material* material, 376 const G4ParticleDefinition*, 377 G4double kineticEnergy, 378 G4double cutEnergy, 379 G4double maxEnergy) 351 G4double maxEnergy) 380 352 { 381 353 G4double cross = 0.0; 382 if (cutEnergy >= maxEnergy || kineticEnergy <= lowestKinEnergy) return cross; 383 384 G4double tmax = min(maxEnergy, kineticEnergy); 385 G4double cut = min(cutEnergy, tmax); 386 if(cut < cutFixed || ignoreCut) cut = cutFixed; 387 388 const G4ElementVector* theElementVector = material->GetElementVector(); 389 const G4double* theAtomNumDensityVector = 390 material->GetAtomicNumDensityVector(); 391 392 for (size_t i=0; i<material->GetNumberOfElements(); i++) { 393 394 G4double Z = (*theElementVector)[i]->GetZ(); 395 G4double A = (*theElementVector)[i]->GetA()/(g/mole); 396 397 G4double cr = ComputeMicroscopicCrossSection(kineticEnergy, Z, A, cut); 398 399 if(tmax < kineticEnergy) { 400 cr -= ComputeMicroscopicCrossSection(kineticEnergy, Z, A, tmax); 401 } 402 cross += theAtomNumDensityVector[i] * cr; 403 } 404 354 if (kineticEnergy <= lowestKinEnergy) return cross; 355 G4double tmax = std::min(maxEnergy, kineticEnergy); 356 G4double cut = std::min(cutEnergy, kineticEnergy); 357 if(cut < minThreshold) cut = minThreshold; 358 if (cut >= tmax) return cross; 359 360 cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut); 361 if(tmax < kineticEnergy) { 362 cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax); 363 } 405 364 return cross; 406 365 } … … 410 369 G4DataVector* G4MuBremsstrahlungModel::ComputePartialSumSigma( 411 370 const G4Material* material, 412 G4double kineticEnergy, 413 G4double cut) 414 415 // Build the table of cross section per element. The table is built for MATERIAL 416 // This table is used by DoIt to select randomly an element in the material. 371 G4double kineticEnergy, 372 G4double cut) 373 374 // Build the table of cross section per element. 375 // The table is built for material 376 // This table is used to select randomly an element in the material. 417 377 { 418 378 G4int nElements = material->GetNumberOfElements(); 419 379 const G4ElementVector* theElementVector = material->GetElementVector(); 420 380 const G4double* theAtomNumDensityVector = 421 381 material->GetAtomicNumDensityVector(); 422 382 423 383 G4DataVector* dv = new G4DataVector(); … … 426 386 427 387 for (G4int i=0; i<nElements; i++ ) { 428 429 G4double Z = (*theElementVector)[i]->GetZ();430 G4double A = (*theElementVector)[i]->GetA()/(g/mole) ;431 388 cross += theAtomNumDensityVector[i] 432 * ComputeMicroscopicCrossSection(kineticEnergy, Z, A, cut); 389 * ComputeMicroscopicCrossSection(kineticEnergy, 390 (*theElementVector)[i]->GetZ(), cut); 433 391 dv->push_back(cross); 434 392 } … … 438 396 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 439 397 440 void G4MuBremsstrahlungModel::MakeSamplingTables() 441 { 442 443 G4double AtomicNumber,AtomicWeight,KineticEnergy, 444 TotalEnergy,Maxep; 445 446 for (G4int iz=0; iz<nzdat; iz++) 447 { 448 AtomicNumber = zdat[iz]; 449 AtomicWeight = adat[iz]*g/mole ; 450 451 for (G4int it=0; it<ntdat; it++) 452 { 453 KineticEnergy = tdat[it]; 454 TotalEnergy = KineticEnergy + mass; 455 Maxep = KineticEnergy ; 456 457 G4double CrossSection = 0.0 ; 458 459 // calculate the differential cross section 460 // numerical integration in 461 // log ............... 462 G4double c = log(Maxep/cutFixed) ; 463 G4double ymin = -5. ; 464 G4double ymax = 0. ; 465 G4double dy = (ymax-ymin)/NBIN ; 466 467 G4double y = ymin - 0.5*dy ; 468 G4double yy = ymin - dy ; 469 G4double x = exp(y); 470 G4double fac = exp(dy); 471 G4double dx = exp(yy)*(fac - 1.0); 472 473 for (G4int i=0 ; i<NBIN; i++) 474 { 475 y += dy ; 476 x *= fac; 477 dx*= fac; 478 G4double ep = cutFixed*exp(c*x) ; 479 480 CrossSection += ep*dx*ComputeDMicroscopicCrossSection( 481 KineticEnergy,AtomicNumber, 482 AtomicWeight,ep) ; 483 ya[i]=y ; 484 proba[iz][it][i] = CrossSection ; 485 486 } 487 488 proba[iz][it][NBIN] = CrossSection ; 489 ya[NBIN] = 0. ; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 490 491 if(CrossSection > 0.) 492 { 493 for(G4int ib=0; ib<=NBIN; ib++) 494 { 495 proba[iz][it][ib] /= CrossSection ; 496 } 497 } 498 } 499 } 500 samplingTablesAreFilled = true; 501 } 502 503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 504 505 void G4MuBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp, 506 const G4MaterialCutsCouple* couple, 507 const G4DynamicParticle* dp, 508 G4double minEnergy, 509 G4double maxEnergy) 398 void G4MuBremsstrahlungModel::SampleSecondaries( 399 std::vector<G4DynamicParticle*>* vdp, 400 const G4MaterialCutsCouple* couple, 401 const G4DynamicParticle* dp, 402 G4double minEnergy, 403 G4double maxEnergy) 510 404 { 511 405 G4double kineticEnergy = dp->GetKineticEnergy(); 512 406 // check against insufficient energy 513 G4double tmax = min(kineticEnergy, maxEnergy);514 G4double tmin = min(kineticEnergy, minEnergy);515 if(tmin < cutFixed || ignoreCut) tmin = cutFixed;407 G4double tmax = std::min(kineticEnergy, maxEnergy); 408 G4double tmin = std::min(kineticEnergy, minEnergy); 409 if(tmin < minThreshold) tmin = minThreshold; 516 410 if(tmin >= tmax) return; 517 411 518 // ===== the begining of a new code ======519 412 // ===== sampling of energy transfer ====== 520 413 … … 523 416 // select randomly one element constituing the material 524 417 const G4Element* anElement = SelectRandomAtom(couple); 418 G4double Z = anElement->GetZ(); 525 419 526 420 G4double totalEnergy = kineticEnergy + mass; 527 421 G4double totalMomentum = sqrt(kineticEnergy*(kineticEnergy + 2.0*mass)); 528 422 529 G4double AtomicNumber = anElement->GetZ(); 530 G4double AtomicWeight = anElement->GetA()/(g/mole); 531 532 G4double func1 = tmin*ComputeDMicroscopicCrossSection( 533 kineticEnergy,AtomicNumber, 534 AtomicWeight,tmin); 423 G4double func1 = tmin* 424 ComputeDMicroscopicCrossSection(kineticEnergy,Z,tmin); 535 425 536 426 G4double lnepksi, epksi; 537 427 G4double func2; 538 G4double ksi2;539 428 540 429 do { 541 430 lnepksi = log(tmin) + G4UniformRand()*log(kineticEnergy/tmin); 542 431 epksi = exp(lnepksi); 543 func2 = epksi*ComputeDMicroscopicCrossSection( 544 kineticEnergy,AtomicNumber, 545 AtomicWeight,epksi); 546 ksi2 = G4UniformRand(); 547 548 } while(func2/func1 < ksi2); 549 550 // ===== the end of a new code ===== 551 552 // create G4DynamicParticle object for the Gamma 432 func2 = epksi*ComputeDMicroscopicCrossSection(kineticEnergy,Z,epksi); 433 434 } while(func2 < func1*G4UniformRand()); 435 553 436 G4double gEnergy = epksi; 554 437 555 // sample angle 438 // ===== sample angle ===== 439 556 440 G4double gam = totalEnergy/mass; 557 G4double rmax = gam* min(1.0, totalEnergy/gEnergy - 1.0);558 rmax *=rmax;559 G4double x = G4UniformRand()*rmax /(1.0 + rmax);441 G4double rmax = gam*std::min(1.0, totalEnergy/gEnergy - 1.0); 442 G4double rmax2= rmax*rmax; 443 G4double x = G4UniformRand()*rmax2/(1.0 + rmax2); 560 444 561 445 G4double theta = sqrt(x/(1.0 - x))/gam; … … 577 461 578 462 // save secondary 579 G4DynamicParticle* aGamma = new G4DynamicParticle(theGamma,gDirection,gEnergy); 463 G4DynamicParticle* aGamma = 464 new G4DynamicParticle(theGamma,gDirection,gEnergy); 580 465 vdp->push_back(aGamma); 581 466 } -
trunk/source/processes/electromagnetic/muons/src/G4MuIonisation.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuIonisation.cc,v 1.5 4 2007/05/22 17:35:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuIonisation.cc,v 1.59 2009/02/26 11:04:20 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 86 86 #include "G4MuBetheBlochModel.hh" 87 87 #include "G4UniversalFluctuation.hh" 88 #include "G4IonFluctuations.hh" 88 89 #include "G4BohrFluctuations.hh" 89 90 #include "G4UnitsTable.hh" … … 99 100 isInitialised(false) 100 101 { 101 SetStepFunction(0.2, 1*mm); 102 SetIntegral(true); 103 SetVerboseLevel(1); 102 // SetStepFunction(0.2, 1*mm); 103 //SetIntegral(true); 104 //SetVerboseLevel(1); 105 SetProcessSubType(fIonisation); 104 106 } 105 107 … … 108 110 G4MuIonisation::~G4MuIonisation() 109 111 {} 112 113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 114 115 G4bool G4MuIonisation::IsApplicable(const G4ParticleDefinition& p) 116 { 117 return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV); 118 } 119 120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 121 122 G4double G4MuIonisation::MinPrimaryEnergy(const G4ParticleDefinition*, 123 const G4Material*, 124 G4double cut) 125 { 126 G4double x = 0.5*cut/electron_mass_c2; 127 G4double g = x*ratio + std::sqrt((1. + x)*(1. + x*ratio*ratio)); 128 return mass*(g - 1.0); 129 } 110 130 111 131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 122 142 SetSecondaryParticle(G4Electron::Electron()); 123 143 124 flucModel = new G4UniversalFluctuation(); 144 // Bragg peak model 145 if (!EmModel(1)) SetEmModel(new G4BraggModel(),1); 146 EmModel(1)->SetLowEnergyLimit(MinKinEnergy()); 147 EmModel(1)->SetHighEnergyLimit(0.2*MeV); 148 AddEmModel(1, EmModel(1), new G4IonFluctuations()); 125 149 126 G4VEmModel* em = new G4BraggModel(); 127 em->SetLowEnergyLimit(0.1*keV); 128 em->SetHighEnergyLimit(0.2*MeV); 129 AddEmModel(1, em, flucModel); 130 G4VEmModel* em1 = new G4BetheBlochModel(); 131 em1->SetLowEnergyLimit(0.2*MeV); 132 em1->SetHighEnergyLimit(1.0*GeV); 133 AddEmModel(2, em1, flucModel); 134 G4VEmModel* em2 = new G4MuBetheBlochModel(); 135 em2->SetLowEnergyLimit(1.0*GeV); 136 em2->SetHighEnergyLimit(100.0*TeV); 137 AddEmModel(3, em2, flucModel); 150 // high energy fluctuation model 151 if (!FluctModel()) SetFluctModel(new G4UniversalFluctuation()); 152 153 // moderate energy model 154 if (!EmModel(2)) SetEmModel(new G4BetheBlochModel(),2); 155 EmModel(2)->SetLowEnergyLimit(0.2*MeV); 156 EmModel(2)->SetHighEnergyLimit(1.0*GeV); 157 AddEmModel(2, EmModel(2), FluctModel()); 158 159 // high energy model 160 if (!EmModel(3)) SetEmModel(new G4MuBetheBlochModel(),3); 161 EmModel(3)->SetLowEnergyLimit(1.0*GeV); 162 EmModel(3)->SetHighEnergyLimit(MaxKinEnergy()); 163 AddEmModel(3, EmModel(3), FluctModel()); 138 164 139 165 ratio = electron_mass_c2/mass; … … 145 171 146 172 void G4MuIonisation::PrintInfo() 147 { 148 G4cout << " Bether-Bloch model for E > 0.2 MeV, " 149 << "parametrisation of Bragg peak below, " 150 << G4endl; 151 G4cout << " radiative corrections for E > 1 GeV" << G4endl; 152 } 173 {} 153 174 154 175 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... -
trunk/source/processes/electromagnetic/muons/src/G4MuMultipleScattering.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuMultipleScattering.cc,v 1. 3 2007/11/09 19:48:10vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuMultipleScattering.cc,v 1.12 2008/10/16 13:37:04 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ----------------------------------------------------------------------------- … … 47 47 48 48 #include "G4MuMultipleScattering.hh" 49 #include "G4 MuMscModel.hh"49 #include "G4WentzelVIModel.hh" 50 50 #include "G4MscStepLimitType.hh" 51 51 … … 61 61 samplez = false ; 62 62 isInitialized = false; 63 SetRangeFactor(0. 04);63 SetRangeFactor(0.2); 64 64 SetLateralDisplasmentFlag(true); 65 65 } … … 84 84 if(isInitialized) { 85 85 86 if (p->GetParticleType() != "nucleus" ) {86 if (p->GetParticleType() != "nucleus" && p->GetPDGMass() < GeV) { 87 87 mscModel->SetStepLimitType(StepLimitType()); 88 88 mscModel->SetLateralDisplasmentFlag(LateralDisplasmentFlag()); 89 //mscModel->SetThetaLimit(thetaLimit);90 89 mscModel->SetRangeFactor(RangeFactor()); 91 90 } 91 mscModel->SetPolarAngleLimit(PolarAngleLimit()); 92 92 return; 93 93 } 94 94 95 if (p->GetParticleType() == "nucleus" ) {95 if (p->GetParticleType() == "nucleus" || p->GetPDGMass() > GeV) { 96 96 SetLateralDisplasmentFlag(false); 97 97 SetBuildLambdaTable(false); 98 // SetRangeFactor(0.2);99 98 } 100 99 101 // initialisation of parameters 102 // G4String part_name = p->GetParticleName(); 103 mscModel = new G4MuMscModel(RangeFactor(),thetaLimit); 100 // initialisation of the model 101 102 mscModel = new G4WentzelVIModel(); 103 mscModel->SetStepLimitType(StepLimitType()); 104 104 mscModel->SetLateralDisplasmentFlag(LateralDisplasmentFlag()); 105 mscModel->SetRangeFactor(RangeFactor()); 106 mscModel->SetPolarAngleLimit(PolarAngleLimit()); 107 mscModel->SetLowEnergyLimit(MinKinEnergy()); 108 mscModel->SetHighEnergyLimit(MaxKinEnergy()); 105 109 106 110 AddEmModel(1,mscModel); … … 112 116 void G4MuMultipleScattering::PrintInfo() 113 117 { 114 G4cout << " Boundary/stepping algorithm is active with RangeFactor= "115 << RangeFactor()116 << " Step limit type " << StepLimitType()117 118 G4cout << " RangeFactor= " << RangeFactor() 119 << ", step limit type: " << StepLimitType() 120 << ", lateralDisplacement: " << LateralDisplasmentFlag() 121 << G4endl; 118 122 } 119 123 -
trunk/source/processes/electromagnetic/muons/src/G4MuPairProduction.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuPairProduction.cc,v 1. 48 2007/05/22 17:35:58vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuPairProduction.cc,v 1.52 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 89 89 lowestKinEnergy(1.*GeV), 90 90 isInitialised(false) 91 {} 91 { 92 SetProcessSubType(fPairProdByCharged); 93 } 92 94 93 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... … … 98 100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 99 101 100 void G4MuPairProduction::InitialiseEnergyLossProcess(const G4ParticleDefinition* part, 101 const G4ParticleDefinition*) 102 G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p) 103 { 104 return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV); 105 } 106 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 108 109 G4double G4MuPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*, 110 const G4Material*, 111 G4double) 112 { 113 return lowestKinEnergy; 114 } 115 116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 117 118 void G4MuPairProduction::InitialiseEnergyLossProcess( 119 const G4ParticleDefinition* part, 120 const G4ParticleDefinition*) 102 121 { 103 122 if (!isInitialised) { … … 110 129 G4MuPairProductionModel* em = new G4MuPairProductionModel(); 111 130 em->SetLowestKineticEnergy(lowestKinEnergy); 112 G4VEmFluctuationModel* fm = new G4UniversalFluctuation();113 em->SetLowEnergyLimit( 0.1*keV);114 em->SetHighEnergyLimit( 100.0*TeV);131 G4VEmFluctuationModel* fm = 0; 132 em->SetLowEnergyLimit(MinKinEnergy()); 133 em->SetHighEnergyLimit(MaxKinEnergy()); 115 134 AddEmModel(1, em, fm); 116 135 } … … 120 139 121 140 void G4MuPairProduction::PrintInfo() 122 { 123 G4cout << " Parametrised model " 124 << G4endl; 125 } 141 {} 126 142 127 143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... -
trunk/source/processes/electromagnetic/muons/src/G4MuPairProductionModel.cc
r819 r961 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4MuPairProductionModel.cc,v 1. 35 2007/10/11 13:52:04vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 1-patch-02 $26 // $Id: G4MuPairProductionModel.cc,v 1.40 2009/02/20 14:48:16 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-02-ref-02 $ 28 28 // 29 29 // ------------------------------------------------------------------- … … 104 104 const G4String& nam) 105 105 : G4VEmModel(nam), 106 minPairEnergy(4.*electron_mass_c2), 107 lowestKinEnergy(1.*GeV), 108 factorForCross(4.*fine_structure_const*fine_structure_const 106 particle(0), 107 factorForCross(4.*fine_structure_const*fine_structure_const 109 108 *classic_electr_radius*classic_electr_radius/(3.*pi)), 110 109 sqrte(sqrt(exp(1.))), 111 110 currentZ(0), 112 particle(0), 111 fParticleChange(0), 112 minPairEnergy(4.*electron_mass_c2), 113 lowestKinEnergy(1.*GeV), 113 114 nzdat(5), 114 115 ntdat(8), … … 118 119 ymax(0.), 119 120 dy((ymax-ymin)/nbiny), 120 ignoreCut(false),121 121 samplingTablesAreFilled(false) 122 122 { 123 123 SetLowEnergyLimit(minPairEnergy); 124 nist = G4NistManager::Instance(); 124 125 125 126 theElectron = G4Electron::Electron(); … … 144 145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 145 146 146 void G4MuPairProductionModel::SetParticle(const G4ParticleDefinition* p) 147 { 148 if(!particle) { 149 particle = p; 150 particleMass = particle->GetPDGMass(); 151 } 147 G4double G4MuPairProductionModel::MaxSecondaryEnergy(const G4ParticleDefinition*, 148 G4double kineticEnergy) 149 { 150 G4double maxPairEnergy = kineticEnergy + particleMass*(1.0 - 0.75*sqrte*z13); 151 return maxPairEnergy; 152 152 } 153 153 … … 161 161 MakeSamplingTables(); 162 162 } 163 if(pParticleChange) { 164 if(ignoreCut) { 165 gParticleChange = 166 reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange); 167 fParticleChange = 0; 168 } else { 163 if(!fParticleChange) { 164 if(pParticleChange) 169 165 fParticleChange = 170 166 reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange); 171 gParticleChange = 0; 172 } 173 } else { 174 fParticleChange = new G4ParticleChangeForLoss(); 175 gParticleChange = 0; 167 else 168 fParticleChange = new G4ParticleChangeForLoss(); 176 169 } 177 170 } … … 186 179 { 187 180 G4double dedx = 0.0; 188 if (cutEnergy <= minPairEnergy || kineticEnergy <= lowestKinEnergy 189 || ignoreCut) 181 if (cutEnergy <= minPairEnergy || kineticEnergy <= lowestKinEnergy) 190 182 return dedx; 191 183 … … 216 208 G4double loss = 0.0; 217 209 218 G4double cut =min(cutEnergy,tmax);210 G4double cut = std::min(cutEnergy,tmax); 219 211 if(cut <= minPairEnergy) return loss; 220 212 … … 251 243 G4double Z, 252 244 G4double cut) 253 254 { 255 G4double cross = 0. ; 256 245 { 246 G4double cross = 0.; 257 247 SetCurrentElement(Z); 258 248 G4double tmax = MaxSecondaryEnergy(particle, tkin); 259 260 249 if (tmax <= cut) return cross; 261 250 … … 400 389 G4double Z, G4double, 401 390 G4double cutEnergy, 402 G4double) 403 { 404 G4double cut = max(minPairEnergy,cutEnergy); 405 if(ignoreCut) cut = minPairEnergy; 406 G4double cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut); 407 return cross; 408 } 409 410 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 411 412 G4double G4MuPairProductionModel::CrossSectionPerVolume( 413 const G4Material* material, 414 const G4ParticleDefinition*, 415 G4double kineticEnergy, 416 G4double cutEnergy, 417 G4double maxEnergy) 391 G4double maxEnergy) 418 392 { 419 393 G4double cross = 0.0; 420 394 if (kineticEnergy <= lowestKinEnergy) return cross; 421 395 422 maxEnergy += particleMass; 423 424 const G4ElementVector* theElementVector = material->GetElementVector(); 425 const G4double* theAtomNumDensityVector = material-> 426 GetAtomicNumDensityVector(); 427 428 for (size_t i=0; i<material->GetNumberOfElements(); i++) { 429 G4double Z = (*theElementVector)[i]->GetZ(); 430 SetCurrentElement(Z); 431 G4double tmax = min(maxEnergy,MaxSecondaryEnergy(particle, kineticEnergy)); 432 G4double cut = max(minPairEnergy,cutEnergy); 433 if(ignoreCut) cut = minPairEnergy; 434 if(cut < tmax) { 435 G4double cr = ComputeMicroscopicCrossSection(kineticEnergy, Z, cut) 436 - ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax); 437 438 cross += theAtomNumDensityVector[i] * cr; 439 } 396 SetCurrentElement(Z); 397 G4double tmax = std::min(maxEnergy, kineticEnergy); 398 G4double cut = std::min(cutEnergy, kineticEnergy); 399 if(cut < minPairEnergy) cut = minPairEnergy; 400 if (cut >= tmax) return cross; 401 402 cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut); 403 if(tmax < kineticEnergy) { 404 cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax); 440 405 } 441 406 return cross; … … 451 416 SetCurrentElement(Z); 452 417 453 for (G4int it=0; it<ntdat; it++) 454 { 418 for (G4int it=0; it<ntdat; it++) { 419 455 420 G4double kineticEnergy = tdat[it]; 456 421 G4double maxPairEnergy = MaxSecondaryEnergy(particle,kineticEnergy); 457 422 // G4cout << "Z= " << currentZ << " z13= " << z13 423 //<< " mE= " << maxPairEnergy << G4endl; 458 424 G4double CrossSection = 0.0 ; 459 425 460 G4double y = ymin - 0.5*dy ; 461 G4double yy = ymin - dy ; 462 G4double x = exp(y); 463 G4double fac = exp(dy); 464 G4double dx = exp(yy)*(fac - 1.0); 465 466 G4double c = log(maxPairEnergy/minPairEnergy); 467 468 for (G4int i=0 ; i<nbiny; i++) 469 { 470 y += dy ; 471 if(c > 0.0) { 472 x *= fac; 473 dx*= fac; 474 G4double ep = minPairEnergy*exp(c*x) ; 475 CrossSection += ep*dx*ComputeDMicroscopicCrossSection( 476 kineticEnergy, Z, ep); 477 } 478 ya[i] = y; 479 proba[iz][it][i] = CrossSection; 426 if(maxPairEnergy > minPairEnergy) { 427 428 G4double y = ymin - 0.5*dy ; 429 G4double yy = ymin - dy ; 430 G4double x = exp(y); 431 G4double fac = exp(dy); 432 G4double dx = exp(yy)*(fac - 1.0); 433 434 G4double c = log(maxPairEnergy/minPairEnergy); 435 436 for (G4int i=0 ; i<nbiny; i++) { 437 y += dy ; 438 if(c > 0.0) { 439 x *= fac; 440 dx*= fac; 441 G4double ep = minPairEnergy*exp(c*x) ; 442 CrossSection += 443 ep*dx*ComputeDMicroscopicCrossSection(kineticEnergy, Z, ep); 444 } 445 ya[i] = y; 446 proba[iz][it][i] = CrossSection; 447 } 448 449 } else { 450 for (G4int i=0 ; i<nbiny; i++) { 451 proba[iz][it][i] = CrossSection; 452 } 480 453 } 481 454 482 455 ya[nbiny]=ymax; 483 484 456 proba[iz][it][nbiny] = CrossSection; 485 457 … … 515 487 G4double maxEnergy = std::min(tmax, maxPairEnergy); 516 488 G4double minEnergy = std::max(tmin, minPairEnergy); 517 if(ignoreCut)minEnergy = minPairEnergy; 489 518 490 if(minEnergy >= maxEnergy) return; 519 491 //G4cout << "emin= " << minEnergy << " emax= " << maxEnergy … … 618 590 // primary change 619 591 kineticEnergy -= (ElectronEnergy + PositronEnergy); 620 if(fParticleChange) 621 fParticleChange->SetProposedKineticEnergy(kineticEnergy); 622 else 623 gParticleChange->SetProposedKineticEnergy(kineticEnergy); 592 fParticleChange->SetProposedKineticEnergy(kineticEnergy); 624 593 625 594 vdp->push_back(aParticle1); … … 655 624 G4double maxPairEnergy = MaxSecondaryEnergy(particle,kinEnergy); 656 625 G4double minEnergy = std::max(tmin, minPairEnergy); 657 if(ignoreCut)minEnergy = minPairEnergy;658 626 659 627 G4int iz;
Note: See TracChangeset
for help on using the changeset viewer.