00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef G4EnergyLossForExtrapolator_h
00051 #define G4EnergyLossForExtrapolator_h 1
00052
00053 #include <vector>
00054 #include <CLHEP/Units/PhysicalConstants.h>
00055
00056 #include "globals.hh"
00057 #include "G4PhysicsTable.hh"
00058
00059 class G4ParticleDefinition;
00060 class G4Material;
00061 class G4MaterialCutsCouple;
00062 class G4ProductionCuts;
00063
00064
00065
00066 class G4EnergyLossForExtrapolator
00067 {
00068 public:
00069 G4EnergyLossForExtrapolator(G4int verb = 1);
00070
00071 ~G4EnergyLossForExtrapolator();
00072
00073 G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*);
00074
00075 G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition*);
00076
00077 G4double ComputeEnergy(G4double range, const G4ParticleDefinition*);
00078
00079 G4double EnergyAfterStep(G4double kinEnergy, G4double step,
00080 const G4Material*, const G4ParticleDefinition*);
00081
00082 G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
00083 const G4Material*, const G4ParticleDefinition*);
00084
00085 G4double TrueStepLength(G4double kinEnergy, G4double step,
00086 const G4Material*, const G4ParticleDefinition* part);
00087
00088 inline G4double EnergyAfterStep(G4double kinEnergy, G4double step,
00089 const G4Material*, const G4String& particleName);
00090
00091 inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
00092 const G4Material*, const G4String& particleName);
00093
00094 inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
00095 const G4Material*,
00096 const G4ParticleDefinition* part);
00097
00098 inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
00099 const G4Material*,
00100 const G4String& particleName);
00101
00102 inline G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part,
00103 G4double kinEnergy, G4double stepLength);
00104
00105 inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
00106 const G4Material*, const G4ParticleDefinition*);
00107
00108 inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
00109 const G4Material*, const G4String& particleName);
00110
00111 inline void SetVerbose(G4int val);
00112
00113 inline void SetMinKinEnergy(G4double);
00114
00115 inline void SetMaxKinEnergy(G4double);
00116
00117 inline void SetMaxEnergyTransfer(G4double);
00118
00119 private:
00120
00121 void Initialisation();
00122
00123 G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*,
00124 G4double kinEnergy);
00125
00126 G4PhysicsTable* PrepareTable();
00127
00128 const G4ParticleDefinition* FindParticle(const G4String& name);
00129
00130 void ComputeElectronDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table);
00131
00132 void ComputeMuonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table);
00133
00134 void ComputeProtonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table);
00135
00136 void ComputeTrasportXS(const G4ParticleDefinition* part, G4PhysicsTable* table);
00137
00138 inline G4double ComputeValue(G4double x, const G4PhysicsTable* table);
00139
00140
00141 G4EnergyLossForExtrapolator & operator=(const G4EnergyLossForExtrapolator &right);
00142 G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&);
00143
00144 const G4ParticleDefinition* currentParticle;
00145 const G4ParticleDefinition* electron;
00146 const G4ParticleDefinition* positron;
00147 const G4ParticleDefinition* muonPlus;
00148 const G4ParticleDefinition* muonMinus;
00149 const G4ParticleDefinition* proton;
00150
00151 G4ProductionCuts* cuts;
00152 std::vector<const G4MaterialCutsCouple*> couples;
00153
00154 G4String currentParticleName;
00155
00156 G4PhysicsTable* dedxElectron;
00157 G4PhysicsTable* dedxPositron;
00158 G4PhysicsTable* dedxMuon;
00159 G4PhysicsTable* dedxProton;
00160 G4PhysicsTable* rangeElectron;
00161 G4PhysicsTable* rangePositron;
00162 G4PhysicsTable* rangeMuon;
00163 G4PhysicsTable* rangeProton;
00164 G4PhysicsTable* invRangeElectron;
00165 G4PhysicsTable* invRangePositron;
00166 G4PhysicsTable* invRangeMuon;
00167 G4PhysicsTable* invRangeProton;
00168 G4PhysicsTable* mscElectron;
00169
00170 const G4Material* currentMaterial;
00171 G4int index;
00172 G4double electronDensity;
00173 G4double radLength;
00174 G4double mass;
00175 G4double charge2;
00176 G4double kineticEnergy;
00177 G4double gam;
00178 G4double bg2;
00179 G4double beta2;
00180 G4double tmax;
00181
00182 G4double linLossLimit;
00183 G4double emin;
00184 G4double emax;
00185 G4double maxEnergyTransfer;
00186
00187 G4int nbins;
00188 G4int nmat;
00189 G4int verbose;
00190 G4bool isInitialised;
00191 };
00192
00193
00194
00195 inline G4double G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy,
00196 G4double step,
00197 const G4Material* mat,
00198 const G4String& name)
00199 {
00200 return EnergyAfterStep(kinEnergy,step,mat,FindParticle(name));
00201 }
00202
00203
00204
00205 inline G4double G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
00206 G4double step,
00207 const G4Material* mat,
00208 const G4String& name)
00209 {
00210 return EnergyBeforeStep(kinEnergy,step,mat,FindParticle(name));
00211 }
00212
00213
00214
00215 inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,
00216 G4double step,
00217 const G4Material* mat,
00218 const G4String& name)
00219 {
00220 return AverageScatteringAngle(kinEnergy,step,mat,FindParticle(name));
00221 }
00222
00223
00224
00225 inline G4double
00226 G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
00227 G4double step,
00228 const G4Material* mat,
00229 const G4String& name)
00230 {
00231 return EnergyDispersion(kinEnergy,step,mat,FindParticle(name));
00232 }
00233
00234
00235
00236 inline G4double
00237 G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,
00238 G4double stepLength,
00239 const G4Material* mat,
00240 const G4ParticleDefinition* part)
00241 {
00242 G4double theta = 0.0;
00243 if(SetupKinematics(part, mat, kinEnergy)) {
00244 G4double t = stepLength/radLength;
00245 G4double y = std::max(0.001, t);
00246 theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(y))/(beta2*gam*mass);
00247 }
00248 return theta;
00249 }
00250
00251
00252
00253 inline G4double
00254 G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
00255 const G4ParticleDefinition* part,
00256 G4double kinEnergy,
00257 G4double stepLength)
00258 {
00259 G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part);
00260 return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
00261 }
00262
00263
00264
00265 inline
00266 G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
00267 G4double stepLength,
00268 const G4Material* mat,
00269 const G4ParticleDefinition* part)
00270 {
00271 G4double sig2 = 0.0;
00272 if(SetupKinematics(part, mat, kinEnergy)) {
00273 G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
00274 sig2 = (1.0/beta2 - 0.5)*CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
00275 }
00276 return sig2;
00277 }
00278
00279
00280
00281 inline G4double G4EnergyLossForExtrapolator::ComputeValue(G4double x,
00282 const G4PhysicsTable* table)
00283 {
00284 G4double res = 0.0;
00285 G4bool b;
00286 if(table) res = ((*table)[index])->GetValue(x, b);
00287 return res;
00288 }
00289
00290
00291
00292 inline void G4EnergyLossForExtrapolator::SetVerbose(G4int val)
00293 {
00294 verbose = val;
00295 }
00296
00297
00298
00299 inline void G4EnergyLossForExtrapolator::SetMinKinEnergy(G4double val)
00300 {
00301 emin = val;
00302 }
00303
00304
00305
00306 inline void G4EnergyLossForExtrapolator::SetMaxKinEnergy(G4double val)
00307 {
00308 emax = val;
00309 }
00310
00311
00312
00313 inline void G4EnergyLossForExtrapolator::SetMaxEnergyTransfer(G4double val)
00314 {
00315 maxEnergyTransfer = val;
00316 }
00317
00318
00319
00320 #endif
00321