Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // >> 23 // $Id: G4ionIonisation.hh,v 1.24 2004/05/10 18:46:48 vnivanch Exp $ >> 24 // GEANT4 tag $Name: geant4-06-02 $ 26 // 25 // 27 // ------------------------------------------- 26 // ------------------------------------------------------------------- 28 // 27 // 29 // GEANT4 Class header file 28 // GEANT4 Class header file 30 // 29 // 31 // 30 // 32 // File name: G4ionIonisation 31 // File name: G4ionIonisation 33 // 32 // 34 // Author: Vladimir Ivanchenko 33 // Author: Vladimir Ivanchenko 35 // 34 // 36 // Creation date: 07.05.2002 35 // Creation date: 07.05.2002 37 // 36 // 38 // Modifications: 37 // Modifications: 39 // 38 // 40 // 26-12-02 Secondary production moved to deri 39 // 26-12-02 Secondary production moved to derived classes (VI) 41 // 24-01-03 Make models region aware (V.Ivanch 40 // 24-01-03 Make models region aware (V.Ivanchenko) 42 // 05-02-03 Fix compilation warnings (V.Ivanch 41 // 05-02-03 Fix compilation warnings (V.Ivanchenko) 43 // 13-02-03 SubCutoff regime is assigned to a 42 // 13-02-03 SubCutoff regime is assigned to a region (V.Ivanchenko) 44 // 15-02-03 Add control on delta pointer (V.Iv 43 // 15-02-03 Add control on delta pointer (V.Ivanchenko) 45 // 23-05-03 Add fluctuation model as a member 44 // 23-05-03 Add fluctuation model as a member function (V.Ivanchenko) 46 // 03-08-03 Add effective charge and saturatio 45 // 03-08-03 Add effective charge and saturation of tmax (V.Ivanchenko) 47 // 12-11-03 Fix problem of negative effective 46 // 12-11-03 Fix problem of negative effective charge (V.Ivanchenko) 48 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossPro 47 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko) 49 // 21-01-04 Migrade to G4ParticleChangeForLoss 48 // 21-01-04 Migrade to G4ParticleChangeForLoss (V.Ivanchenko) 50 // 08-11-04 Migration to new interface of Stor << 51 // 08-04-05 Major optimisation of internal int << 52 // 11-04-05 Move MaxSecondary energy to model << 53 // 11-04-04 Move MaxSecondaryEnergy to models << 54 // 10-05-06 Add a possibility to download user << 55 // 22-07-06 Remove obsolete method (V.Ivantche << 56 // 07-11-07 Moved CorrectionsAlongStep to cc ( << 57 // 12-09-08 Removed InitialiseMassCharge and C << 58 // 49 // 59 // Class Description: 50 // Class Description: 60 // 51 // 61 // This class manages the ionisation process f << 52 // This class manages the ionisation process for ions. 62 // nuclear stopping power, energy loss correct << 53 // it inherites from G4VContinuousDiscreteProcess via G4VEnergyLoss. 63 // It inherites from G4VEnergyLossLoss. << 64 // 54 // 65 55 66 // ------------------------------------------- 56 // ------------------------------------------------------------------- 67 // 57 // 68 58 69 #ifndef G4ionIonisation_h 59 #ifndef G4ionIonisation_h 70 #define G4ionIonisation_h 1 60 #define G4ionIonisation_h 1 71 61 72 #include "G4VEnergyLossProcess.hh" 62 #include "G4VEnergyLossProcess.hh" 73 63 74 class G4Material; 64 class G4Material; >> 65 class G4VEmFluctuationModel; 75 66 76 class G4ionIonisation : public G4VEnergyLossPr 67 class G4ionIonisation : public G4VEnergyLossProcess 77 { 68 { >> 69 78 public: 70 public: 79 71 80 explicit G4ionIonisation(const G4String& nam << 72 G4ionIonisation(const G4String& name = "ionIoni"); 81 73 82 ~G4ionIonisation() override = default; << 74 ~G4ionIonisation(); 83 75 84 G4bool IsApplicable(const G4ParticleDefiniti << 76 G4bool IsApplicable(const G4ParticleDefinition& p); 85 77 86 void AddStoppingData(G4int Z, G4int A, const << 78 virtual G4double MinPrimaryEnergy(const G4ParticleDefinition* p, 87 G4PhysicsVector* dVector); << 79 const G4Material*, G4double cut); 88 80 89 void ActivateStoppingData(G4bool); << 81 virtual std::vector<G4Track*>* SecondariesAlongStep( >> 82 const G4Step&, >> 83 G4double&, >> 84 G4double&, >> 85 G4double&); 90 86 91 // print documentation in html format << 87 virtual void SecondariesPostStep( 92 void ProcessDescription(std::ostream&) const << 88 G4VEmModel*, >> 89 const G4MaterialCutsCouple*, >> 90 const G4DynamicParticle*, >> 91 G4double&, >> 92 G4double&); 93 93 94 // hide assignment operator << 94 void SetSubCutoff(G4bool val); 95 G4ionIonisation & operator=(const G4ionIonis << 95 96 G4ionIonisation(const G4ionIonisation&) = de << 96 void PrintInfoDefinition(); >> 97 // Print out of the class parameters >> 98 >> 99 G4double EffectiveChargeSquare(const G4Track& track); >> 100 >> 101 G4double EffectiveCharge(const G4ParticleDefinition* p, >> 102 const G4Material* material, >> 103 G4double kineticEnergy); 97 104 98 protected: 105 protected: 99 106 100 void InitialiseEnergyLossProcess(const G4Par << 107 const G4ParticleDefinition* DefineBaseParticle(const G4ParticleDefinition* p); 101 const G4ParticleDefinition*) overri << 102 108 103 G4double MinPrimaryEnergy(const G4ParticleDe << 109 virtual G4double GetMeanFreePath(const G4Track& track, 104 const G4Material*, G4double cut) fin << 110 G4double previousStepSize, >> 111 G4ForceCondition* condition); 105 112 106 inline G4double BetheBlochEnergyThreshold(); << 113 virtual G4double MaxSecondaryEnergy(const G4DynamicParticle* dynParticle); 107 114 108 private: 115 private: 109 116 >> 117 void InitialiseProcess(); 110 118 111 const G4ParticleDefinition* theParticle = nu << 119 // hide assignment operator 112 G4double eth; << 120 G4ionIonisation & operator=(const G4ionIonisation &right); >> 121 G4ionIonisation(const G4ionIonisation&); >> 122 >> 123 // cash >> 124 const G4Material* theMaterial; >> 125 const G4ParticleDefinition* currentParticle; >> 126 const G4ParticleDefinition* theParticle; >> 127 const G4ParticleDefinition* theBaseParticle; >> 128 G4VEmFluctuationModel* flucModel; >> 129 >> 130 G4double chargeCorrection; >> 131 G4double chargeLowLimit; >> 132 G4double energyLowLimit; 113 133 114 G4bool isInitialised = false; << 134 G4bool subCutoff; 115 }; 135 }; 116 136 117 //....oooOO0OOooo........oooOO0OOooo........oo 137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 118 139 119 inline G4double G4ionIonisation::BetheBlochEne << 140 inline G4bool G4ionIonisation::IsApplicable(const G4ParticleDefinition& p) 120 { 141 { 121 return eth; << 142 return (p.GetPDGCharge() != 0.0 && !p.IsShortLived() && >> 143 (p.GetParticleType() == "nucleus" || p.GetParticleType() == "static_nucleus")); >> 144 } >> 145 >> 146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 147 >> 148 inline G4double G4ionIonisation::MinPrimaryEnergy( >> 149 const G4ParticleDefinition*, const G4Material*, G4double cut) >> 150 { >> 151 G4double x = 0.5*cut/electron_mass_c2; >> 152 G4double g = sqrt(1. + x); >> 153 return proton_mass_c2*(g - 1.0); >> 154 } >> 155 >> 156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 157 >> 158 inline G4double G4ionIonisation::MaxSecondaryEnergy(const G4DynamicParticle* dynParticle) >> 159 { >> 160 G4double mass = dynParticle->GetMass(); >> 161 G4double gamma = dynParticle->GetKineticEnergy()/mass + 1.0; >> 162 G4double tmax = electron_mass_c2*std::min(2.0*(gamma*gamma - 1.), >> 163 51200.*pow(proton_mass_c2/mass,0.66667)); >> 164 return tmax; >> 165 } >> 166 >> 167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 168 >> 169 >> 170 inline G4double G4ionIonisation::GetMeanFreePath(const G4Track& track, >> 171 G4double, G4ForceCondition*) >> 172 { >> 173 G4double mRatio = proton_mass_c2/track.GetDynamicParticle()->GetMass(); >> 174 G4double q_2 = EffectiveChargeSquare(track); >> 175 SetMassRatio(mRatio); >> 176 SetReduceFactor(1.0/(q_2*mRatio)); >> 177 SetChargeSquare(q_2); >> 178 SetChargeSquareRatio(q_2); >> 179 >> 180 return G4VEnergyLossProcess::GetMeanFreePath(track, 0.0, 0); >> 181 } >> 182 >> 183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 184 >> 185 #include "G4VSubCutoffProcessor.hh" >> 186 >> 187 inline std::vector<G4Track*>* G4ionIonisation::SecondariesAlongStep( >> 188 const G4Step& step, >> 189 G4double& tmax, >> 190 G4double& eloss, >> 191 G4double& scaledEnergy) >> 192 { >> 193 std::vector<G4Track*>* newp = 0; >> 194 if(subCutoff) { >> 195 G4VSubCutoffProcessor* sp = SubCutoffProcessor(CurrentMaterialCutsCoupleIndex()); >> 196 if (sp) { >> 197 G4VEmModel* model = SelectModel(scaledEnergy); >> 198 newp = sp->SampleSecondaries(step,tmax,eloss,model); >> 199 } >> 200 } >> 201 G4double e = step.GetTrack()->GetKineticEnergy() - eloss; >> 202 fParticleChange.SetProposedCharge(EffectiveCharge(currentParticle,theMaterial,e)); >> 203 return newp; >> 204 } >> 205 >> 206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 207 >> 208 #include "G4VEmModel.hh" >> 209 >> 210 inline void G4ionIonisation::SecondariesPostStep( >> 211 G4VEmModel* model, >> 212 const G4MaterialCutsCouple* couple, >> 213 const G4DynamicParticle* dp, >> 214 G4double& tcut, >> 215 G4double& kinEnergy) >> 216 { >> 217 G4DynamicParticle* delta = model->SampleSecondary(couple, dp, tcut, kinEnergy); >> 218 if(delta) { >> 219 fParticleChange.SetNumberOfSecondaries(1); >> 220 fParticleChange.AddSecondary(delta); >> 221 G4ThreeVector finalP = dp->GetMomentum(); >> 222 kinEnergy -= delta->GetKineticEnergy(); >> 223 fParticleChange.SetProposedCharge(EffectiveCharge(currentParticle,theMaterial,kinEnergy)); >> 224 finalP -= delta->GetMomentum(); >> 225 finalP = finalP.unit(); >> 226 fParticleChange.SetProposedMomentumDirection(finalP); >> 227 } >> 228 } >> 229 >> 230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 231 >> 232 inline G4double G4ionIonisation::EffectiveChargeSquare(const G4Track& track) >> 233 { >> 234 currentParticle = track.GetDefinition(); >> 235 theMaterial = track.GetMaterial(); >> 236 G4double kinEnergy = track.GetKineticEnergy(); >> 237 G4double charge = EffectiveCharge(currentParticle,theMaterial,kinEnergy) >> 238 *chargeCorrection/eplus; >> 239 >> 240 return charge*charge; 122 } 241 } 123 242 124 //....oooOO0OOooo........oooOO0OOooo........oo 243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 125 244 126 #endif 245 #endif 127 246