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
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #ifndef G4LossTableManager_h
00077 #define G4LossTableManager_h 1
00078
00079 #include <map>
00080 #include <vector>
00081 #include "globals.hh"
00082 #include "G4VEnergyLossProcess.hh"
00083 #include "G4EnergyLossTables.hh"
00084
00085 class G4PhysicsTable;
00086 class G4MaterialCutsCouple;
00087 class G4EnergyLossMessenger;
00088 class G4ParticleDefinition;
00089 class G4VMultipleScattering;
00090 class G4VEmProcess;
00091 class G4EmCorrections;
00092 class G4EmSaturation;
00093 class G4EmConfigurator;
00094 class G4ElectronIonPair;
00095 class G4LossTableBuilder;
00096 class G4VAtomDeexcitation;
00097 class G4Region;
00098
00099 class G4LossTableManager
00100 {
00101
00102 public:
00103
00104 static G4LossTableManager* Instance();
00105
00106 ~G4LossTableManager();
00107
00108
00109
00110
00111
00112 void Clear();
00113
00114
00115
00116
00117
00118 void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
00119 G4VEnergyLossProcess* p);
00120
00121 void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
00122 G4VEmProcess* p);
00123
00124 void PreparePhysicsTable(const G4ParticleDefinition* aParticle,
00125 G4VMultipleScattering* p);
00126
00127 void BuildPhysicsTable(const G4ParticleDefinition* aParticle);
00128
00129 void BuildPhysicsTable(const G4ParticleDefinition* aParticle,
00130 G4VEnergyLossProcess* p);
00131
00132
00133
00134
00135
00136
00137 G4double GetDEDX(
00138 const G4ParticleDefinition *aParticle,
00139 G4double kineticEnergy,
00140 const G4MaterialCutsCouple *couple);
00141
00142 G4double GetSubDEDX(
00143 const G4ParticleDefinition *aParticle,
00144 G4double kineticEnergy,
00145 const G4MaterialCutsCouple *couple);
00146
00147 G4double GetRange(
00148 const G4ParticleDefinition *aParticle,
00149 G4double kineticEnergy,
00150 const G4MaterialCutsCouple *couple);
00151
00152 G4double GetCSDARange(
00153 const G4ParticleDefinition *aParticle,
00154 G4double kineticEnergy,
00155 const G4MaterialCutsCouple *couple);
00156
00157 G4double GetRangeFromRestricteDEDX(
00158 const G4ParticleDefinition *aParticle,
00159 G4double kineticEnergy,
00160 const G4MaterialCutsCouple *couple);
00161
00162 G4double GetEnergy(
00163 const G4ParticleDefinition *aParticle,
00164 G4double range,
00165 const G4MaterialCutsCouple *couple);
00166
00167 G4double GetDEDXDispersion(
00168 const G4MaterialCutsCouple *couple,
00169 const G4DynamicParticle* dp,
00170 G4double& length);
00171
00172
00173
00174
00175
00176 void Register(G4VEnergyLossProcess* p);
00177
00178 void DeRegister(G4VEnergyLossProcess* p);
00179
00180 void Register(G4VMultipleScattering* p);
00181
00182 void DeRegister(G4VMultipleScattering* p);
00183
00184 void Register(G4VEmProcess* p);
00185
00186 void DeRegister(G4VEmProcess* p);
00187
00188 void Register(G4VEmModel* p);
00189
00190 void DeRegister(G4VEmModel* p);
00191
00192 void Register(G4VEmFluctuationModel* p);
00193
00194 void DeRegister(G4VEmFluctuationModel* p);
00195
00196 void RegisterIon(const G4ParticleDefinition* aParticle,
00197 G4VEnergyLossProcess* p);
00198
00199 void RegisterExtraParticle(const G4ParticleDefinition* aParticle,
00200 G4VEnergyLossProcess* p);
00201
00202 void SetLossFluctuations(G4bool val);
00203
00204 void SetSubCutoff(G4bool val, const G4Region* r=0);
00205
00206 void SetIntegral(G4bool val);
00207
00208 void SetRandomStep(G4bool val);
00209
00210 void SetMinSubRange(G4double val);
00211
00212 void SetMinEnergy(G4double val);
00213
00214 void SetMaxEnergy(G4double val);
00215
00216 void SetMaxEnergyForCSDARange(G4double val);
00217
00218 void SetMaxEnergyForMuons(G4double val);
00219
00220 void SetDEDXBinning(G4int val);
00221
00222 void SetDEDXBinningForCSDARange(G4int val);
00223
00224 void SetLambdaBinning(G4int val);
00225
00226 G4int GetNumberOfBinsPerDecade() const;
00227
00228 void SetStepFunction(G4double v1, G4double v2);
00229
00230 void SetBuildCSDARange(G4bool val);
00231
00232 void SetLPMFlag(G4bool val);
00233
00234 void SetSplineFlag(G4bool val);
00235
00236 void SetLinearLossLimit(G4double val);
00237
00238 void SetBremsstrahlungTh(G4double val);
00239
00240 void SetFactorForAngleLimit(G4double val);
00241
00242 void SetVerbose(G4int val);
00243
00244
00245
00246
00247
00248 G4EnergyLossMessenger* GetMessenger();
00249
00250 G4bool BuildCSDARange() const;
00251
00252 G4bool LPMFlag() const;
00253
00254 G4bool SplineFlag() const;
00255
00256 G4double BremsstrahlungTh() const;
00257
00258 G4double FactorForAngleLimit() const;
00259
00260 G4double MinKinEnergy() const;
00261
00262 G4double MaxKinEnergy() const;
00263
00264 const std::vector<G4VEnergyLossProcess*>& GetEnergyLossProcessVector();
00265
00266 const std::vector<G4VEmProcess*>& GetEmProcessVector();
00267
00268 const std::vector<G4VMultipleScattering*>& GetMultipleScatteringVector();
00269
00270 G4VEnergyLossProcess* GetEnergyLossProcess(const G4ParticleDefinition*);
00271
00272 G4EmCorrections* EmCorrections();
00273
00274 G4EmSaturation* EmSaturation();
00275
00276 G4EmConfigurator* EmConfigurator();
00277
00278 G4ElectronIonPair* ElectronIonPair();
00279
00280 G4VAtomDeexcitation* AtomDeexcitation();
00281
00282 G4LossTableBuilder* GetTableBuilder();
00283
00284 void SetAtomDeexcitation(G4VAtomDeexcitation*);
00285
00286 private:
00287
00288
00289
00290
00291
00292 G4LossTableManager();
00293
00294 G4VEnergyLossProcess* BuildTables(const G4ParticleDefinition* aParticle);
00295
00296 void CopyTables(const G4ParticleDefinition* aParticle,
00297 G4VEnergyLossProcess*);
00298
00299 void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle);
00300
00301 void SetParameters(const G4ParticleDefinition* aParticle,
00302 G4VEnergyLossProcess*);
00303
00304 void CopyDEDXTables();
00305
00306 G4LossTableManager(G4LossTableManager &);
00307 G4LossTableManager & operator=(const G4LossTableManager &right);
00308
00309 static G4LossTableManager* theInstance;
00310
00311 typedef const G4ParticleDefinition* PD;
00312
00313 std::map<PD,G4VEnergyLossProcess*,std::less<PD> > loss_map;
00314
00315 std::vector<G4VEnergyLossProcess*> loss_vector;
00316 std::vector<PD> part_vector;
00317 std::vector<PD> base_part_vector;
00318 std::vector<G4bool> tables_are_built;
00319 std::vector<G4bool> isActive;
00320 std::vector<G4PhysicsTable*> dedx_vector;
00321 std::vector<G4PhysicsTable*> range_vector;
00322 std::vector<G4PhysicsTable*> inv_range_vector;
00323 std::vector<G4VMultipleScattering*> msc_vector;
00324 std::vector<G4VEmProcess*> emp_vector;
00325 std::vector<G4VEmModel*> mod_vector;
00326 std::vector<G4VEmFluctuationModel*> fmod_vector;
00327
00328
00329 G4VEnergyLossProcess* currentLoss;
00330 PD currentParticle;
00331 PD theElectron;
00332 PD firstParticle;
00333
00334 G4int n_loss;
00335 G4int run;
00336
00337 G4bool all_tables_are_built;
00338 G4bool startInitialisation;
00339
00340 G4bool lossFluctuationFlag;
00341 G4bool subCutoffFlag;
00342 G4bool rndmStepFlag;
00343 G4bool integral;
00344 G4bool integralActive;
00345 G4bool buildCSDARange;
00346 G4bool minEnergyActive;
00347 G4bool maxEnergyActive;
00348 G4bool maxEnergyForMuonsActive;
00349 G4bool stepFunctionActive;
00350 G4bool flagLPM;
00351 G4bool splineFlag;
00352
00353 G4double minSubRange;
00354 G4double maxRangeVariation;
00355 G4double maxFinalStep;
00356 G4double minKinEnergy;
00357 G4double maxKinEnergy;
00358 G4double maxKinEnergyForMuons;
00359 G4double bremsTh;
00360 G4double factorForAngleLimit;
00361
00362 G4LossTableBuilder* tableBuilder;
00363 G4EnergyLossMessenger* theMessenger;
00364 G4EmCorrections* emCorrections;
00365 G4EmSaturation* emSaturation;
00366 G4EmConfigurator* emConfigurator;
00367 G4ElectronIonPair* emElectronIonPair;
00368 G4VAtomDeexcitation* atomDeexcitation;
00369
00370 G4int nbinsLambda;
00371 G4int nbinsPerDecade;
00372 G4int verbose;
00373
00374 };
00375
00376
00377
00378 #endif
00379