Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/utils/include/G4LossTableManager.hh

    r1228 r1315  
    2424// ********************************************************************
    2525//
    26 // $Id: G4LossTableManager.hh,v 1.55 2009/10/29 19:25:28 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-03 $
     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 $
    2828//
    2929//
     
    6161// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
    6262// 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
     63// 12-04-10 Added PreparePhsyicsTables and BuildPhysicsTables entries (V.Ivanchenko)
    6364//
    6465// Class Description:
     
    9394class G4EmConfigurator;
    9495class G4LossTableBuilder;
     96class G4Region;
    9597
    9698class G4LossTableManager
     
    103105  ~G4LossTableManager();
    104106
     107  //-------------------------------------------------
     108  // called from destructor
     109  //-------------------------------------------------
     110
    105111  void Clear();
    106112
    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
    108132  inline G4double GetDEDX(
    109133    const G4ParticleDefinition *aParticle,
     
    141165          G4double& length);
    142166
    143   // to be called only by energy loss processes
     167  //-------------------------------------------------
     168  // Methods to be called only at initialisation
     169  //-------------------------------------------------
     170
    144171  void Register(G4VEnergyLossProcess* p);
    145172
     
    162189  void DeRegister(G4VEmFluctuationModel* p);
    163190
    164   void EnergyLossProcessIsInitialised(const G4ParticleDefinition* aParticle,
    165                                       G4VEnergyLossProcess* p);
    166  
    167191  void RegisterIon(const G4ParticleDefinition* aParticle,
    168192                   G4VEnergyLossProcess* p);
     
    171195                             G4VEnergyLossProcess* p);
    172196
    173   void BuildPhysicsTable(const G4ParticleDefinition* aParticle,
    174                          G4VEnergyLossProcess* p);
    175 
    176197  void SetLossFluctuations(G4bool val);
    177198
    178   void SetSubCutoff(G4bool val);
     199  void SetSubCutoff(G4bool val, const G4Region* r=0);
    179200
    180201  void SetIntegral(G4bool val);
     
    198219  void SetLambdaBinning(G4int val);
    199220
     221  G4int GetNumberOfBinsPerDecade() const;
     222
    200223  void SetStepFunction(G4double v1, G4double v2);
    201224
     
    214237  void SetVerbose(G4int val);
    215238
     239  //-------------------------------------------------
     240  // Access methods
     241  //-------------------------------------------------
     242
    216243  G4EnergyLossMessenger* GetMessenger();
    217244
     
    241268
    242269private:
     270
     271  //-------------------------------------------------
     272  // Private methods and members
     273  //-------------------------------------------------
    243274
    244275  G4LossTableManager();
     
    251282  void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle);
    252283
    253   void SetParameters(G4VEnergyLossProcess*);
     284  void SetParameters(const G4ParticleDefinition* aParticle,
     285                     G4VEnergyLossProcess*);
    254286
    255287  void CopyDEDXTables();
    256288
    257 private:
    258 
    259289  static G4LossTableManager* theInstance;
    260290
    261291  typedef const G4ParticleDefinition* PD;
     292
    262293  std::map<PD,G4VEnergyLossProcess*,std::less<PD> > loss_map;
    263294
     
    279310  PD                    currentParticle;
    280311  PD                    theElectron;
     312  PD                    firstParticle;
    281313
    282314  G4int n_loss;
     
    284316
    285317  G4bool all_tables_are_built;
    286   //  G4bool first_entry;
     318  G4bool startInitialisation;
     319
    287320  G4bool lossFluctuationFlag;
    288321  G4bool subCutoffFlag;
     
    290323  G4bool integral;
    291324  G4bool integralActive;
    292   G4bool all_tables_are_stored;
    293325  G4bool buildCSDARange;
    294326  G4bool minEnergyActive;
     
    314346  G4EmConfigurator*           emConfigurator;
    315347
    316   const G4ParticleDefinition* firstParticle;
     348  G4int nbinsLambda;
     349  G4int nbinsPerDecade;
    317350  G4int verbose;
    318351
     
    322355//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
    323356
     357inline 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
    324375inline G4double G4LossTableManager::GetDEDX(
    325376          const G4ParticleDefinition *aParticle,
     
    327378          const G4MaterialCutsCouple *couple)
    328379{
    329   if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);
     380  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
    330381  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); }
    334385  return x;
    335386}
     
    342393          const G4MaterialCutsCouple *couple)
    343394{
    344   if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);
     395  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
    345396  G4double x = 0.0;
    346   if(currentLoss) x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple);
     397  if(currentLoss) { x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple); }
    347398  return x;
    348399}
     
    355406          const G4MaterialCutsCouple *couple)
    356407{
    357   if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);
     408  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
    358409  G4double x = DBL_MAX;
    359   if(currentLoss) x = currentLoss->GetCSDARange(kineticEnergy, couple);
     410  if(currentLoss) { x = currentLoss->GetCSDARange(kineticEnergy, couple); }
    360411  return x;
    361412}
     
    368419          const G4MaterialCutsCouple *couple)
    369420{
    370   if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);
     421  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
    371422  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); }
    375426  return x;
    376427}
     
    383434          const G4MaterialCutsCouple *couple)
    384435{
    385   if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);
     436  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
    386437  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); }
    390441  return x;
    391442}
     
    398449          const G4MaterialCutsCouple *couple)
    399450{
    400   if(aParticle != currentParticle) GetEnergyLossProcess(aParticle);
     451  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
    401452  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); }
    405456  return x;
    406457}
     
    428479//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
    429480
    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 
    448481#endif
    449482
Note: See TracChangeset for help on using the changeset viewer.