- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/utils/include/G4LossTableManager.hh
r1228 r1315 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4LossTableManager.hh,v 1.5 5 2009/10/29 19:25:28vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-0 3$26 // $Id: G4LossTableManager.hh,v 1.58 2010/04/27 16:59:52 vnivanch Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 28 28 // 29 29 // … … 61 61 // 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko) 62 62 // 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko) 63 // 12-04-10 Added PreparePhsyicsTables and BuildPhysicsTables entries (V.Ivanchenko) 63 64 // 64 65 // Class Description: … … 93 94 class G4EmConfigurator; 94 95 class G4LossTableBuilder; 96 class G4Region; 95 97 96 98 class G4LossTableManager … … 103 105 ~G4LossTableManager(); 104 106 107 //------------------------------------------------- 108 // called from destructor 109 //------------------------------------------------- 110 105 111 void Clear(); 106 112 107 // get the DEDX or the range for a given particle/energy/material 113 //------------------------------------------------- 114 // initialisation before a new run 115 //------------------------------------------------- 116 117 void PreparePhysicsTable(const G4ParticleDefinition* aParticle, 118 G4VEnergyLossProcess* p); 119 void PreparePhysicsTable(const G4ParticleDefinition* aParticle, 120 G4VEmProcess* p); 121 void PreparePhysicsTable(const G4ParticleDefinition* aParticle, 122 G4VMultipleScattering* p); 123 void BuildPhysicsTable(const G4ParticleDefinition* aParticle); 124 void BuildPhysicsTable(const G4ParticleDefinition* aParticle, 125 G4VEnergyLossProcess* p); 126 127 //------------------------------------------------- 128 // Run time access to DEDX, range, energy for a given particle, 129 // energy, and G4MaterialCutsCouple 130 //------------------------------------------------- 131 108 132 inline G4double GetDEDX( 109 133 const G4ParticleDefinition *aParticle, … … 141 165 G4double& length); 142 166 143 // to be called only by energy loss processes 167 //------------------------------------------------- 168 // Methods to be called only at initialisation 169 //------------------------------------------------- 170 144 171 void Register(G4VEnergyLossProcess* p); 145 172 … … 162 189 void DeRegister(G4VEmFluctuationModel* p); 163 190 164 void EnergyLossProcessIsInitialised(const G4ParticleDefinition* aParticle,165 G4VEnergyLossProcess* p);166 167 191 void RegisterIon(const G4ParticleDefinition* aParticle, 168 192 G4VEnergyLossProcess* p); … … 171 195 G4VEnergyLossProcess* p); 172 196 173 void BuildPhysicsTable(const G4ParticleDefinition* aParticle,174 G4VEnergyLossProcess* p);175 176 197 void SetLossFluctuations(G4bool val); 177 198 178 void SetSubCutoff(G4bool val );199 void SetSubCutoff(G4bool val, const G4Region* r=0); 179 200 180 201 void SetIntegral(G4bool val); … … 198 219 void SetLambdaBinning(G4int val); 199 220 221 G4int GetNumberOfBinsPerDecade() const; 222 200 223 void SetStepFunction(G4double v1, G4double v2); 201 224 … … 214 237 void SetVerbose(G4int val); 215 238 239 //------------------------------------------------- 240 // Access methods 241 //------------------------------------------------- 242 216 243 G4EnergyLossMessenger* GetMessenger(); 217 244 … … 241 268 242 269 private: 270 271 //------------------------------------------------- 272 // Private methods and members 273 //------------------------------------------------- 243 274 244 275 G4LossTableManager(); … … 251 282 void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle); 252 283 253 void SetParameters(G4VEnergyLossProcess*); 284 void SetParameters(const G4ParticleDefinition* aParticle, 285 G4VEnergyLossProcess*); 254 286 255 287 void CopyDEDXTables(); 256 288 257 private:258 259 289 static G4LossTableManager* theInstance; 260 290 261 291 typedef const G4ParticleDefinition* PD; 292 262 293 std::map<PD,G4VEnergyLossProcess*,std::less<PD> > loss_map; 263 294 … … 279 310 PD currentParticle; 280 311 PD theElectron; 312 PD firstParticle; 281 313 282 314 G4int n_loss; … … 284 316 285 317 G4bool all_tables_are_built; 286 // G4bool first_entry; 318 G4bool startInitialisation; 319 287 320 G4bool lossFluctuationFlag; 288 321 G4bool subCutoffFlag; … … 290 323 G4bool integral; 291 324 G4bool integralActive; 292 G4bool all_tables_are_stored;293 325 G4bool buildCSDARange; 294 326 G4bool minEnergyActive; … … 314 346 G4EmConfigurator* emConfigurator; 315 347 316 const G4ParticleDefinition* firstParticle; 348 G4int nbinsLambda; 349 G4int nbinsPerDecade; 317 350 G4int verbose; 318 351 … … 322 355 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 323 356 357 inline G4VEnergyLossProcess* G4LossTableManager::GetEnergyLossProcess( 358 const G4ParticleDefinition *aParticle) 359 { 360 if(aParticle != currentParticle) { 361 currentParticle = aParticle; 362 std::map<PD,G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos; 363 if ((pos = loss_map.find(aParticle)) != loss_map.end()) { 364 currentLoss = (*pos).second; 365 } else { 366 currentLoss = 0; 367 // ParticleHaveNoLoss(aParticle); 368 } 369 } 370 return currentLoss; 371 } 372 373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 374 324 375 inline G4double G4LossTableManager::GetDEDX( 325 376 const G4ParticleDefinition *aParticle, … … 327 378 const G4MaterialCutsCouple *couple) 328 379 { 329 if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);380 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 330 381 G4double x; 331 if(currentLoss) x = currentLoss->GetDEDX(kineticEnergy, couple);332 else x = G4EnergyLossTables::GetDEDX(333 currentParticle,kineticEnergy,couple,false); 382 if(currentLoss) { x = currentLoss->GetDEDX(kineticEnergy, couple); } 383 else { x = G4EnergyLossTables::GetDEDX(currentParticle, 384 kineticEnergy,couple,false); } 334 385 return x; 335 386 } … … 342 393 const G4MaterialCutsCouple *couple) 343 394 { 344 if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);395 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 345 396 G4double x = 0.0; 346 if(currentLoss) x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple);397 if(currentLoss) { x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple); } 347 398 return x; 348 399 } … … 355 406 const G4MaterialCutsCouple *couple) 356 407 { 357 if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);408 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 358 409 G4double x = DBL_MAX; 359 if(currentLoss) x = currentLoss->GetCSDARange(kineticEnergy, couple);410 if(currentLoss) { x = currentLoss->GetCSDARange(kineticEnergy, couple); } 360 411 return x; 361 412 } … … 368 419 const G4MaterialCutsCouple *couple) 369 420 { 370 if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);421 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 371 422 G4double x; 372 if(currentLoss) x = currentLoss->GetRangeForLoss(kineticEnergy, couple);373 else 374 x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy,couple,false); 423 if(currentLoss) { x = currentLoss->GetRangeForLoss(kineticEnergy, couple); } 424 else { x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy, 425 couple,false); } 375 426 return x; 376 427 } … … 383 434 const G4MaterialCutsCouple *couple) 384 435 { 385 if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);436 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 386 437 G4double x; 387 if(currentLoss) x = currentLoss->GetRange(kineticEnergy, couple);388 else 389 x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy,couple,false); 438 if(currentLoss) { x = currentLoss->GetRange(kineticEnergy, couple); } 439 else { x = G4EnergyLossTables::GetRange(currentParticle,kineticEnergy, 440 couple,false); } 390 441 return x; 391 442 } … … 398 449 const G4MaterialCutsCouple *couple) 399 450 { 400 if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);451 if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); } 401 452 G4double x; 402 if(currentLoss) x = currentLoss->GetKineticEnergy(range, couple);403 else x = G4EnergyLossTables::GetPreciseEnergyFromRange(404 currentParticle,range,couple,false); 453 if(currentLoss) { x = currentLoss->GetKineticEnergy(range, couple); } 454 else { x = G4EnergyLossTables::GetPreciseEnergyFromRange(currentParticle,range, 455 couple,false); } 405 456 return x; 406 457 } … … 428 479 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 429 480 430 inline G4VEnergyLossProcess* G4LossTableManager::GetEnergyLossProcess(431 const G4ParticleDefinition *aParticle)432 {433 if(aParticle != currentParticle) {434 currentParticle = aParticle;435 std::map<PD,G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos;436 if ((pos = loss_map.find(aParticle)) != loss_map.end()) {437 currentLoss = (*pos).second;438 } else {439 currentLoss = 0;440 // ParticleHaveNoLoss(aParticle);441 }442 }443 return currentLoss;444 }445 446 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......447 448 481 #endif 449 482
Note: See TracChangeset
for help on using the changeset viewer.