Ignore:
Timestamp:
Apr 6, 2009, 12:21:12 PM (15 years ago)
Author:
garnier
Message:

update processes

File:
1 edited

Legend:

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

    r819 r961  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VEnergyLossProcess.hh,v 1.76 2007/11/07 18:38:49 vnivanch Exp $
     26// $Id: G4VEnergyLossProcess.hh,v 1.86 2009/02/19 09:57:36 vnivanch Exp $
    2727// GEANT4 tag $Name:
    2828//
     
    7979//          PostStepGetPhysicalInteractionLength (V.Ivanchenko)
    8080// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
     81// 15-07-08 Reorder class members for further multi-thread development (VI)
    8182//
    8283// Class Description:
     
    125126  virtual ~G4VEnergyLossProcess();
    126127
     128private:
     129  // clean vectors and arrays
     130  void Clean();
     131
    127132  //------------------------------------------------------------------------
    128133  // Virtual methods to be implemented in concrete processes
    129134  //------------------------------------------------------------------------
    130135
     136public:
    131137  virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
    132138 
     
    141147  // Methods with standard implementation; may be overwritten if needed
    142148  //------------------------------------------------------------------------
    143 protected:
    144149
    145150  virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
    146151                                    const G4Material*, G4double cut);
    147152
    148   virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
    149                                     const G4DynamicParticle*,
    150                                     G4double& eloss,
    151                                     G4double& length);
    152 
    153   //------------------------------------------------------------------------
    154   // Generic methods common to all ContinuousDiscrete processes
    155   //------------------------------------------------------------------------
     153  //------------------------------------------------------------------------
     154  // Virtual methods implementation common to all EM ContinuousDiscrete
     155  // processes. Further inheritance is not assumed
     156  //------------------------------------------------------------------------
     157
    156158public:
    157159
     160  // prepare all tables
     161  void PreparePhysicsTable(const G4ParticleDefinition&);
     162
     163  // build all tables
     164  void BuildPhysicsTable(const G4ParticleDefinition&);
     165
     166  // build a table
     167  G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
     168
     169  // build a table
     170  G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
     171
     172  // summary printout after initialisation
    158173  void PrintInfoDefinition();
    159174
    160   void PreparePhysicsTable(const G4ParticleDefinition&);
    161 
    162   void BuildPhysicsTable(const G4ParticleDefinition&);
    163 
     175  // Add subcutoff option for the region
     176  void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
     177
     178  // Activate deexcitation code for region
     179  void ActivateDeexcitation(G4bool, const G4Region* region = 0);
     180
     181  // Step limit from AlongStep
     182  G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
     183                                                 G4double  previousStepSize,
     184                                                 G4double  currentMinimumStep,
     185                                                 G4double& currentSafety,
     186                                                 G4GPILSelection* selection);
     187
     188  // Step limit from cross section
     189  G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
     190                                                G4double   previousStepSize,
     191                                                G4ForceCondition* condition);
     192
     193  // AlongStep computations
    164194  G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
    165195
     196  // Sampling of secondaries in vicinity of geometrical boundary
     197  void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&,
     198                               G4VEmModel* model, G4int matIdx,
     199                               G4double& extraEdep);
     200
     201  // PostStep sampling of secondaries
    166202  G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
    167203
    168   // Store PhysicsTable in a file.
    169   // Return false in case of failure at I/O
     204  // Store all PhysicsTable in files.
     205  // Return false in case of any fatal failure at I/O 
    170206  G4bool StorePhysicsTable(const G4ParticleDefinition*,
    171207                           const G4String& directory,
    172208                           G4bool ascii = false);
    173209
    174   // Retrieve Physics from a file.
    175   // (return true if the Physics Table can be build by using file)
    176   // (return false if the process has no functionality or in case of failure)
    177   // File name should is constructed as processName+particleName and the
    178   // should be placed under the directory specifed by the argument.
     210  // Retrieve all Physics from a files.
     211  // Return true if all the Physics Table are built.
     212  // Return false if any fatal failure.
    179213  G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
    180214                              const G4String& directory,
    181215                              G4bool ascii);
    182216
     217private:
     218  // store a table
     219  G4bool StoreTable(const G4ParticleDefinition* p,
     220                    G4PhysicsTable*, G4bool ascii,
     221                    const G4String& directory,
     222                    const G4String& tname);
     223
     224  // retrieve a table
     225  G4bool RetrieveTable(const G4ParticleDefinition* p,
     226                       G4PhysicsTable*, G4bool ascii,
     227                       const G4String& directory,
     228                       const G4String& tname,
     229                       G4bool mandatory);
     230
     231  //------------------------------------------------------------------------
     232  // Public interface to cross section, mfp and sampling of fluctuations
     233  // These methods are not used in run time
     234  //------------------------------------------------------------------------
     235
     236public:
     237  // access to dispersion of restricted energy loss
     238  G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
     239                             const G4DynamicParticle* dp,
     240                             G4double length);
     241
     242  // Access to cross section table
     243  G4double CrossSectionPerVolume(G4double kineticEnergy,
     244                                 const G4MaterialCutsCouple* couple);
     245
     246  // access to cross section
     247  G4double MeanFreePath(const G4Track& track);
     248
     249  // access to step limit
     250  G4double ContinuousStepLimit(const G4Track& track,
     251                               G4double previousStepSize,
     252                               G4double currentMinimumStep,
     253                               G4double& currentSafety);
     254
    183255protected:
    184256
     257  // implementation of the pure virtual method
    185258  G4double GetMeanFreePath(const G4Track& track,
    186259                           G4double previousStepSize,
    187260                           G4ForceCondition* condition);
    188261
     262  // implementation of the pure virtual method
    189263  G4double GetContinuousStepLimit(const G4Track& track,
    190264                                  G4double previousStepSize,
     
    193267
    194268  //------------------------------------------------------------------------
    195   // Specific methods for along/post step EM processes
    196   //------------------------------------------------------------------------
     269  // Run time method which may be also used by derived processes
     270  //------------------------------------------------------------------------
     271
     272  // creeation of an empty vector for cross section
     273  G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*,
     274                                       G4double cut);
     275
     276  inline G4ParticleChangeForLoss* GetParticleChange();
     277
     278  inline size_t CurrentMaterialCutsCoupleIndex() const;
     279
     280  inline G4double GetCurrentRange() const;
     281
     282  //------------------------------------------------------------------------
     283  // Specific methods to set, access, modify models
     284  //------------------------------------------------------------------------
     285
     286  // Select model in run time
     287  inline void SelectModel(G4double kinEnergy);
    197288
    198289public:
    199 
     290  // Select model by energy and region index
     291  inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
     292                                            size_t& idx) const;
     293
     294  // Add EM model coupled with fluctuation model for region, smaller value
     295  // of order defines which pair of models will be selected for a given
     296  // energy interval 
     297  inline void AddEmModel(G4int, G4VEmModel*,
     298                         G4VEmFluctuationModel* fluc = 0,
     299                         const G4Region* region = 0);
     300
     301  // Define new energy range for the model identified by the name
     302  inline void UpdateEmModel(const G4String&, G4double, G4double);
     303
     304  // Assign a model to a process
     305  inline void SetEmModel(G4VEmModel*, G4int index=1);
     306 
     307  // return the assigned model
     308  inline G4VEmModel* EmModel(G4int index=1);
     309 
     310  // Access to models
     311  inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
     312
     313  inline G4int NumberOfModels();
     314
     315  // Assign a fluctuation model to a process
     316  inline void SetFluctModel(G4VEmFluctuationModel*);
     317 
     318  // return the assigned fluctuation model
     319  inline G4VEmFluctuationModel* FluctModel();
     320   
     321  //------------------------------------------------------------------------
     322  // Define and access particle type
     323  //------------------------------------------------------------------------
     324
     325protected:
     326  inline void SetParticle(const G4ParticleDefinition* p);
     327  inline void SetSecondaryParticle(const G4ParticleDefinition* p);
     328
     329public:
     330  inline void SetBaseParticle(const G4ParticleDefinition* p);
     331  inline const G4ParticleDefinition* Particle() const;
     332  inline const G4ParticleDefinition* BaseParticle() const;
     333  inline const G4ParticleDefinition* SecondaryParticle() const;
     334
     335  //------------------------------------------------------------------------
     336  // Get/set parameters to configure the process at initialisation time
     337  //------------------------------------------------------------------------
     338
     339  // Add subcutoff process (bremsstrahlung) to sample secondary
     340  // particle production in vicinity of the geometry boundary
    200341  void AddCollaborativeProcess(G4VEnergyLossProcess*);
    201342
    202   void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&,
    203                                G4VEmModel* model, G4int matIdx,
    204                                G4double& extraEdep);
    205 
    206   G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
    207                              const G4DynamicParticle* dp,
    208                              G4double length);
    209 
    210 
    211   virtual G4double AlongStepGetPhysicalInteractionLength(
    212                              const G4Track&,
    213                              G4double  previousStepSize,
    214                              G4double  currentMinimumStep,
    215                              G4double& currentSafety,
    216                              G4GPILSelection* selection
    217                             );
    218 
    219   virtual G4double PostStepGetPhysicalInteractionLength(
    220                              const G4Track& track,
    221                              G4double   previousStepSize,
    222                              G4ForceCondition* condition
    223                             );
    224 
    225   //------------------------------------------------------------------------
    226   // Specific methods to build and access Physics Tables
    227   //------------------------------------------------------------------------
    228 
    229   G4double MicroscopicCrossSection(G4double kineticEnergy,
    230                                    const G4MaterialCutsCouple* couple);
    231 
    232   G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
    233 
    234   G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
     343  inline void SetLossFluctuations(G4bool val);
     344  inline void SetRandomStep(G4bool val);
     345
     346  inline void SetIntegral(G4bool val);
     347  inline G4bool IsIntegral() const;
     348
     349  // Set/Get flag "isIonisation"
     350  inline void SetIonisation(G4bool val);
     351  inline G4bool IsIonisationProcess() const;
     352
     353  // Redefine parameteters for stepping control
     354  //
     355  inline void SetLinearLossLimit(G4double val);
     356  inline void SetMinSubRange(G4double val);
     357  inline void SetLambdaFactor(G4double val);
     358  inline void SetStepFunction(G4double v1, G4double v2);
     359
     360  inline G4int NumberOfSubCutoffRegions() const;
     361  inline G4int NumberOfDERegions() const;
     362
     363  //------------------------------------------------------------------------
     364  // Specific methods to path Physics Tables to the process
     365  //------------------------------------------------------------------------
    235366
    236367  void SetDEDXTable(G4PhysicsTable* p, G4EmTableType tType);
    237368  void SetCSDARangeTable(G4PhysicsTable* pRange);
    238369  void SetRangeTableForLoss(G4PhysicsTable* p);
     370  void SetSecondaryRangeTable(G4PhysicsTable* p);
    239371  void SetInverseRangeTable(G4PhysicsTable* p);
    240   void SetSecondaryRangeTable(G4PhysicsTable* p);
    241372
    242373  void SetLambdaTable(G4PhysicsTable* p);
     
    260391  // Max kinetic energy for tables
    261392  inline void SetMaxKinEnergyForCSDARange(G4double e);
     393
     394  // Return values for given G4MaterialCutsCouple
     395  inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     396  inline G4double GetDEDXForSubsec(G4double& kineticEnergy,
     397                                   const G4MaterialCutsCouple*);
     398  inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     399  inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     400  inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     401  inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
     402  inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
     403
     404  inline G4bool TablesAreBuilt() const;
    262405
    263406  // Access to specific tables
     
    273416  inline G4PhysicsTable* SubLambdaTable();
    274417
    275   // Return values for given G4MaterialCutsCouple
    276   inline G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    277   inline G4double GetDEDXForSubsec(G4double& kineticEnergy,
    278                                    const G4MaterialCutsCouple*);
    279   inline G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    280   inline G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    281   inline G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    282   inline G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
    283   inline G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
    284 
    285   inline G4bool TablesAreBuilt() const;
    286 
    287   //------------------------------------------------------------------------
    288   // Define and access particle type
    289   //------------------------------------------------------------------------
    290 
    291   inline void SetBaseParticle(const G4ParticleDefinition* p);
    292   inline const G4ParticleDefinition* Particle() const;
    293   inline const G4ParticleDefinition* BaseParticle() const;
    294   inline const G4ParticleDefinition* SecondaryParticle() const;
    295 
    296   //------------------------------------------------------------------------
    297   // Specific methods to set, access, modify models
    298   //------------------------------------------------------------------------
    299 
    300   // Add EM model coupled with fluctuation model for the region
    301   inline void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fluc = 0,
    302                                 const G4Region* region = 0);
    303 
    304   // Assign a model to a process
    305   inline void SetEmModel(G4VEmModel*, G4int index=1);
    306  
    307   // return the assigned model
    308   inline G4VEmModel* EmModel(G4int index=1);
    309  
    310   // Assign a fluctuation model to a process
    311   inline void SetFluctModel(G4VEmFluctuationModel*);
    312  
    313   // return the assigned fluctuation model
    314   inline G4VEmFluctuationModel* FluctModel();
    315    
    316   // Define new energy range for the model identified by the name
    317   inline void UpdateEmModel(const G4String&, G4double, G4double);
    318 
    319   // Access to models
    320   inline G4VEmModel* GetModelByIndex(G4int idx = 0);
    321 
    322   inline G4int NumberOfModels();
    323 
    324   //------------------------------------------------------------------------
    325   // Get/set parameters used for simulation of energy loss
    326   //------------------------------------------------------------------------
    327 
    328   inline void SetLossFluctuations(G4bool val);
    329   inline void SetRandomStep(G4bool val);
    330   inline void SetIntegral(G4bool val);
    331   inline G4bool IsIntegral() const;
    332 
    333   // Set/Get flag "isIonisation"
    334   inline void SetIonisation(G4bool val);
    335   inline G4bool IsIonisationProcess() const;
    336 
    337   // Redefine parameteters for stepping control
    338   //
    339   inline void SetLinearLossLimit(G4double val);
    340   inline void SetMinSubRange(G4double val);
    341   inline void SetStepFunction(G4double v1, G4double v2);
    342   inline void SetLambdaFactor(G4double val);
    343 
    344 
    345   // Add subcutoff option for the region
    346   void ActivateSubCutoff(G4bool val, const G4Region* region = 0);
    347 
    348   inline G4int NumberOfSubCutoffRegions() const;
    349 
    350   // Activate deexcitation code
    351   virtual void ActivateDeexcitation(G4bool, const G4Region* region = 0);
    352 
    353418  //------------------------------------------------------------------------
    354419  // Run time method for simulation of ionisation
    355420  //------------------------------------------------------------------------
    356421
     422  // sample range at the end of a step
    357423  inline G4double SampleRange();
    358424
    359   inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const;
    360 
    361 
    362   // Set scaling parameters
     425  // Set scaling parameters for ions is needed to G4EmCalculator
    363426  inline void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
    364427
    365   // Helper functions
    366   inline G4double MeanFreePath(const G4Track& track);
    367 
    368   inline G4double ContinuousStepLimit(const G4Track& track,
    369                                       G4double previousStepSize,
    370                                       G4double currentMinimumStep,
    371                                       G4double& currentSafety);
    372 
    373 protected:
    374 
    375   G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*,
    376                                        G4double cut);
    377 
    378   inline virtual void InitialiseMassCharge(const G4Track&);
    379 
    380   inline void SetParticle(const G4ParticleDefinition* p);
    381 
    382   inline void SetSecondaryParticle(const G4ParticleDefinition* p);
    383 
    384   inline G4VEmModel* SelectModel(G4double kinEnergy);
    385 
    386   inline size_t CurrentMaterialCutsCoupleIndex() const;
    387 
    388   inline G4double GetCurrentRange() const;
    389 
    390428private:
    391429
    392   // Clear tables
    393   void Clear();
    394 
    395   inline void InitialiseStep(const G4Track&);
    396 
     430  // define material and indexes
    397431  inline void DefineMaterial(const G4MaterialCutsCouple* couple);
    398432
    399   // Returnd values for scaled energy and base particles mass
    400   //
     433  //------------------------------------------------------------------------
     434  // Compute values using scaling relation, mass and charge of based particle
     435  //------------------------------------------------------------------------
     436
    401437  inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
    402438  inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
     
    405441  inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
    406442  inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
     443  inline G4double ScaledKinEnergyForLoss(G4double range);
    407444  inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
    408   inline G4double ScaledKinEnergyForLoss(G4double range);
    409445  inline void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
    410446
    411447  // hide  assignment operator
    412 
    413448  G4VEnergyLossProcess(G4VEnergyLossProcess &);
    414449  G4VEnergyLossProcess & operator=(const G4VEnergyLossProcess &right);
    415450
    416 // =====================================================================
    417 
    418 protected:
    419 
    420   G4ParticleChangeForLoss               fParticleChange;
    421 
    422 private:
    423 
    424   G4EmModelManager*                     modelManager;
     451  // ======== Parameters of the class fixed at construction =========
     452
     453  G4EmModelManager*           modelManager;
     454  G4SafetyHelper*             safetyHelper;
     455
     456  const G4ParticleDefinition* secondaryParticle;
     457  const G4ParticleDefinition* theElectron;
     458  const G4ParticleDefinition* thePositron;
     459  const G4ParticleDefinition* theGenericIon;
     460
     461  G4PhysicsVector*            vstrag;
     462
     463  // ======== Parameters of the class fixed at initialisation =======
     464
    425465  std::vector<G4VEmModel*>              emModels;
    426466  G4VEmFluctuationModel*                fluctModel;
    427467  std::vector<const G4Region*>          scoffRegions;
     468  std::vector<const G4Region*>          deRegions;
    428469  G4int                                 nSCoffRegions;
    429   G4int*                                idxSCoffRegions;
    430   std::vector<G4DynamicParticle*>       secParticles;
    431   std::vector<G4Track*>                 scTracks;
     470  G4int                                 nDERegions;
     471  G4bool*                               idxSCoffRegions;
     472  G4bool*                               idxDERegions;
     473
    432474  std::vector<G4VEnergyLossProcess*>    scProcesses;
    433475  G4int                                 nProcesses;
     
    453495  const G4DataVector*         theSubCuts;
    454496
    455   G4SafetyHelper*             safetyHelper;
    456 
    457   const G4ParticleDefinition* particle;
    458497  const G4ParticleDefinition* baseParticle;
    459   const G4ParticleDefinition* secondaryParticle;
    460   const G4ParticleDefinition* theElectron;
    461   const G4ParticleDefinition* thePositron;
    462 
    463   G4PhysicsVector*            vstrag;
    464 
    465   // cash
    466   const G4Material*           currentMaterial;
    467   const G4MaterialCutsCouple* currentCouple;
    468   size_t                      currentMaterialIndex;
    469498
    470499  G4int    nBins;
    471500  G4int    nBinsCSDA;
    472   G4int    nWarnings;
    473501
    474502  G4double lowestKinEnergy;
     
    477505  G4double maxKinEnergyCSDA;
    478506
    479   G4double massRatio;
    480   G4double reduceFactor;
    481   G4double chargeSquare;
    482   G4double chargeSqRatio;
    483 
    484   G4double preStepLambda;
    485   G4double fRange;
    486   G4double preStepKinEnergy;
    487   G4double preStepScaledEnergy;
    488507  G4double linLossLimit;
    489508  G4double minSubRange;
     
    491510  G4double finalRange;
    492511  G4double lambdaFactor;
    493   G4double mfpKinEnergy;
    494 
    495   G4GPILSelection  aGPILSelection;
    496512
    497513  G4bool   lossFluctuationFlag;
     
    499515  G4bool   tablesAreBuilt;
    500516  G4bool   integral;
     517  G4bool   isIon;
    501518  G4bool   isIonisation;
    502519  G4bool   useSubCutoff;
     520  G4bool   useDeexcitation;
     521
     522protected:
     523
     524  G4ParticleChangeForLoss          fParticleChange;
     525
     526  // ======== Cashed values - may be state dependent ================
     527
     528private:
     529
     530  std::vector<G4DynamicParticle*>  secParticles;
     531  std::vector<G4Track*>            scTracks;
     532
     533  const G4ParticleDefinition* particle;
     534
     535  G4VEmModel*                 currentModel;
     536  const G4Material*           currentMaterial;
     537  const G4MaterialCutsCouple* currentCouple;
     538  size_t                      currentMaterialIndex;
     539
     540  G4int    nWarnings;
     541
     542  G4double massRatio;
     543  G4double reduceFactor;
     544  G4double chargeSqRatio;
     545
     546  G4double preStepLambda;
     547  G4double fRange;
     548  G4double preStepKinEnergy;
     549  G4double preStepScaledEnergy;
     550  G4double mfpKinEnergy;
     551
     552  G4GPILSelection  aGPILSelection;
     553
    503554};
    504555
     
    506557//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    507558
    508 inline void G4VEnergyLossProcess::DefineMaterial(
    509             const G4MaterialCutsCouple* couple)
    510 {
    511   if(couple != currentCouple) {
    512     currentCouple   = couple;
    513     currentMaterial = couple->GetMaterial();
    514     currentMaterialIndex = couple->GetIndex();
    515     mfpKinEnergy = DBL_MAX;
    516   }
    517 }
    518 
    519 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    520 
    521 inline void G4VEnergyLossProcess::InitialiseStep(const G4Track& track)
    522 {
    523   InitialiseMassCharge(track);
    524   preStepKinEnergy = track.GetKineticEnergy();
    525   preStepScaledEnergy = preStepKinEnergy*massRatio;
    526   DefineMaterial(track.GetMaterialCutsCouple());
    527   if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
    528 }
    529 
    530 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    531 
    532 inline void G4VEnergyLossProcess::InitialiseMassCharge(const G4Track&)
    533 {}
     559inline G4ParticleChangeForLoss* G4VEnergyLossProcess::GetParticleChange()
     560{
     561  return &fParticleChange;
     562}
     563
     564//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     565
     566inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const
     567{
     568  return currentMaterialIndex;
     569}
     570
     571//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     572 
     573inline G4double G4VEnergyLossProcess::GetCurrentRange() const
     574{
     575  return fRange;
     576}
     577
     578//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     579
     580inline void G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
     581{
     582  currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
     583  currentModel->SetCurrentCouple(currentCouple);
     584}
     585
     586//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     587
     588inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(
     589                   G4double kinEnergy, size_t& idx) const
     590{
     591  return modelManager->SelectModel(kinEnergy, idx);
     592}
     593
     594//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     595
     596inline
     597void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p,
     598                                      G4VEmFluctuationModel* fluc,
     599                                      const G4Region* region)
     600{
     601  modelManager->AddEmModel(order, p, fluc, region);
     602  if(p) p->SetParticleChange(pParticleChange, fluc);
     603}
     604
     605//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     606
     607inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam,
     608                                                G4double emin, G4double emax)
     609{
     610  modelManager->UpdateEmModel(nam, emin, emax);
     611}
     612
     613//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     614
     615inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
     616{
     617  G4int n = emModels.size();
     618  if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
     619  emModels[index] = p;
     620}
     621
     622//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     623
     624inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
     625{
     626  G4VEmModel* p = 0;
     627  if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
     628  return p;
     629}
     630
     631//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     632
     633inline
     634G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx, G4bool ver)
     635{
     636  return modelManager->GetModel(idx, ver);
     637}
     638
     639//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     640
     641inline G4int G4VEnergyLossProcess::NumberOfModels()
     642{
     643  return modelManager->NumberOfModels();
     644}
     645
     646//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     647
     648inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
     649{
     650  fluctModel = p;
     651}
     652
     653//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     654
     655inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
     656{
     657  return fluctModel;
     658}
     659
     660//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     661
     662inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)
     663{
     664  particle = p;
     665}
     666
     667//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     668
     669inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
     670{
     671  secondaryParticle = p;
     672}
     673
     674//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     675
     676inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)
     677{
     678  baseParticle = p;
     679}
     680
     681//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     682
     683inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const
     684{
     685  return particle;
     686}
     687
     688//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     689
     690inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
     691{
     692  return baseParticle;
     693}
     694
     695//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     696
     697inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
     698{
     699  return secondaryParticle;
     700}
     701
     702//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     703
     704inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
     705{
     706  lossFluctuationFlag = val;
     707}
     708
     709//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     710
     711inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)
     712{
     713  rndmStepFlag = val;
     714}
     715
     716//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     717
     718inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
     719{
     720  integral = val;
     721}
     722
     723//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     724 
     725inline G4bool G4VEnergyLossProcess::IsIntegral() const
     726{
     727  return integral;
     728}
     729
     730//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     731
     732inline void G4VEnergyLossProcess::SetIonisation(G4bool val)
     733{
     734  isIonisation = val;
     735  if(val) aGPILSelection = CandidateForSelection;
     736  else    aGPILSelection = NotCandidateForSelection;
     737}
     738
     739//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     740
     741inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const
     742{
     743  return isIonisation;
     744}
     745
     746//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     747
     748inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
     749{
     750  linLossLimit = val;
     751}
     752
     753//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     754
     755inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)
     756{
     757  minSubRange = val;
     758}
     759
     760//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     761
     762inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)
     763{
     764  if(val > 0.0 && val <= 1.0) lambdaFactor = val;
     765}
     766
     767//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     768
     769void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
     770{
     771  dRoverRange = v1;
     772  finalRange = v2;
     773  if (dRoverRange > 0.999) dRoverRange = 1.0;
     774  currentCouple = 0;
     775  mfpKinEnergy  = DBL_MAX;
     776}
     777
     778//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     779
     780inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const
     781{
     782  return nSCoffRegions;
     783}
     784
     785//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     786
     787inline G4int G4VEnergyLossProcess::NumberOfDERegions() const
     788{
     789  return nDERegions;
     790}
     791
     792//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     793
     794inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
     795{
     796  nBins = nbins;
     797}
     798
     799//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     800
     801inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
     802{
     803  nBins = nbins;
     804}
     805
     806//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     807
     808inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)
     809{
     810  nBinsCSDA = nbins;
     811}
     812
     813//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     814
     815inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)
     816{
     817  minKinEnergy = e;
     818}
     819
     820//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     821
     822inline G4double G4VEnergyLossProcess::MinKinEnergy() const
     823{
     824  return minKinEnergy;
     825}
     826
     827//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     828
     829inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)
     830{
     831  maxKinEnergy = e;
     832  if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e;
     833}
     834
     835//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     836
     837inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
     838{
     839  return maxKinEnergy;
     840}
     841
     842//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     843
     844inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)
     845{
     846  maxKinEnergyCSDA = e;
     847}
    534848
    535849//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     
    549863  DefineMaterial(couple);
    550864  return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio);
    551 }
    552 
    553 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    554 
    555 inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
    556 {
    557   G4bool b;
    558   G4double x =
    559     ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
    560   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    561   return x;
    562 }
    563 
    564 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    565 
    566 inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
    567 {
    568   G4bool b;
    569   G4double x =
    570     ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
    571   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    572   return x;
    573 }
    574 
    575 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    576 
    577 inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
    578 {
    579   G4bool b;
    580   G4double x = 0.0;
    581   //  if(theIonisationTable) {
    582   x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
    583     *chargeSqRatio;
    584   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    585   //}
    586   return x;
    587 }
    588 
    589 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    590 
    591 inline
    592 G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
    593 {
    594   G4bool b;
    595   G4double x = 0.0;
    596   //if(theIonisationSubTable) {
    597   x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
    598     *chargeSqRatio;
    599   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    600   //}
    601   return x;
    602865}
    603866
     
    634897//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    635898
     899inline G4double G4VEnergyLossProcess::GetRangeForLoss(
     900                G4double& kineticEnergy,
     901                const G4MaterialCutsCouple* couple)
     902{
     903  DefineMaterial(couple);
     904  G4double x = DBL_MAX;
     905  if(theRangeTableForLoss)
     906    x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
     907  //  G4cout << "Range from " << GetProcessName()
     908  //         << "  e= " << kineticEnergy << " r= " << x << G4endl;
     909  return x;
     910}
     911
     912//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     913
     914inline G4double G4VEnergyLossProcess::GetKineticEnergy(
     915                G4double& range,
     916                const G4MaterialCutsCouple* couple)
     917{
     918  DefineMaterial(couple);
     919  G4double r = range/reduceFactor;
     920  G4double e = ScaledKinEnergyForLoss(r)/massRatio;
     921  return e;
     922}
     923
     924//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     925
     926inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
     927                                          const G4MaterialCutsCouple* couple)
     928{
     929  DefineMaterial(couple);
     930  G4double x = 0.0;
     931  if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
     932  return x;
     933}
     934
     935//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     936
     937inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
     938{
     939  return  tablesAreBuilt;
     940}
     941
     942//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     943
     944inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
     945{
     946  return theDEDXTable;
     947}
     948
     949//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     950
     951inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
     952{
     953  return theDEDXSubTable;
     954}
     955
     956//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     957
     958inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
     959{
     960  return theDEDXunRestrictedTable;
     961}
     962
     963//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     964
     965inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const
     966{
     967  G4PhysicsTable* t = theDEDXTable;
     968  if(theIonisationTable) t = theIonisationTable;
     969  return t;
     970}
     971
     972//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     973
     974inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const
     975{
     976  G4PhysicsTable* t = theDEDXSubTable;
     977  if(theIonisationSubTable) t = theIonisationSubTable;
     978  return t;
     979}
     980
     981//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     982
     983inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
     984{
     985  return theCSDARangeTable;
     986}
     987
     988//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     989
     990inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
     991{
     992  return theRangeTableForLoss;
     993}
     994
     995//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     996
     997inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const
     998{
     999  return theInverseRangeTable;
     1000}
     1001
     1002//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1003
     1004inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()
     1005{
     1006  return theLambdaTable;
     1007}
     1008
     1009//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1010
     1011inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()
     1012{
     1013  return theSubLambdaTable;
     1014}
     1015
     1016//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1017
     1018inline G4double G4VEnergyLossProcess::SampleRange()
     1019{
     1020  G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
     1021  G4bool b;
     1022  G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));
     1023  G4double x = fRange + G4RandGauss::shoot(0.0,s);
     1024  if(x > 0.0) fRange = x;
     1025  return fRange;
     1026}
     1027
     1028//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1029
     1030inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
     1031                                                       G4double charge2ratio)
     1032{
     1033  massRatio     = massratio;
     1034  chargeSqRatio = charge2ratio;
     1035  reduceFactor  = 1.0/(chargeSqRatio*massRatio);
     1036}
     1037
     1038//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1039
     1040inline void G4VEnergyLossProcess::DefineMaterial(
     1041            const G4MaterialCutsCouple* couple)
     1042{
     1043  if(couple != currentCouple) {
     1044    currentCouple   = couple;
     1045    currentMaterial = couple->GetMaterial();
     1046    currentMaterialIndex = couple->GetIndex();
     1047    mfpKinEnergy = DBL_MAX;
     1048  }
     1049}
     1050
     1051//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1052
     1053inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
     1054{
     1055  G4bool b;
     1056  G4double x =
     1057    ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
     1058  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1059  return x;
     1060}
     1061
     1062//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1063
     1064inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
     1065{
     1066  G4bool b;
     1067  G4double x =
     1068    ((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
     1069  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1070  return x;
     1071}
     1072
     1073//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1074
     1075inline G4double G4VEnergyLossProcess::GetIonisationForScaledEnergy(G4double e)
     1076{
     1077  G4bool b;
     1078  G4double x = 0.0;
     1079  //  if(theIonisationTable) {
     1080  x = ((*theIonisationTable)[currentMaterialIndex]->GetValue(e, b))
     1081    *chargeSqRatio;
     1082  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1083  //}
     1084  return x;
     1085}
     1086
     1087//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1088
     1089inline
     1090G4double G4VEnergyLossProcess::GetSubIonisationForScaledEnergy(G4double e)
     1091{
     1092  G4bool b;
     1093  G4double x = 0.0;
     1094  //if(theIonisationSubTable) {
     1095  x = ((*theIonisationSubTable)[currentMaterialIndex]->GetValue(e, b))
     1096    *chargeSqRatio;
     1097  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1098  //}
     1099  return x;
     1100}
     1101
     1102//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1103
     1104inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
     1105{
     1106  G4bool b;
     1107  G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);
     1108  if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
     1109  return x;
     1110}
     1111
     1112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
     1113
    6361114inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
    6371115                G4double e)
     
    6481126  }
    6491127  return x;
    650 }
    651 
    652 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    653 
    654 inline G4double G4VEnergyLossProcess::GetRangeForLoss(
    655                 G4double& kineticEnergy,
    656                 const G4MaterialCutsCouple* couple)
    657 {
    658   DefineMaterial(couple);
    659   G4double x = DBL_MAX;
    660   if(theRangeTableForLoss)
    661     x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
    662   //  G4cout << "Range from " << GetProcessName()
    663   //         << "  e= " << kineticEnergy << " r= " << x << G4endl;
    664   return x;
    665 }
    666 
    667 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    668 
    669 inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
    670 {
    671   G4bool b;
    672   G4double x = ((*theRangeTableForLoss)[currentMaterialIndex])->GetValue(e, b);
    673   if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
    674   return x;
    675 }
    676 
    677 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    678 
    679 inline G4double G4VEnergyLossProcess::GetKineticEnergy(
    680                 G4double& range,
    681                 const G4MaterialCutsCouple* couple)
    682 {
    683   DefineMaterial(couple);
    684   G4double r = range/reduceFactor;
    685   G4double e = ScaledKinEnergyForLoss(r)/massRatio;
    686   return e;
    6871128}
    6881129
     
    7021143  }
    7031144  return e;
    704 }
    705 
    706 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    707 
    708 inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
    709                                           const G4MaterialCutsCouple* couple)
    710 {
    711   DefineMaterial(couple);
    712   G4double x = 0.0;
    713   if(theLambdaTable) x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
    714   return x;
    7151145}
    7161146
     
    7491179//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    7501180
    751 inline G4double G4VEnergyLossProcess::ContinuousStepLimit(
    752          const G4Track& track, G4double x, G4double y, G4double& z)
    753 {
    754   G4GPILSelection sel;
    755   return AlongStepGetPhysicalInteractionLength(track, x, y, z, &sel);
    756 }
    757 
    758 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    759 
    760 inline G4double G4VEnergyLossProcess::SampleRange()
    761 {
    762   G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
    763   G4bool b;
    764   G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));
    765   G4double x = fRange + G4RandGauss::shoot(0.0,s);
    766   if(x > 0.0) fRange = x;
    767   return fRange;
    768 }
    769 
    770 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    771 
    772 inline G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
    773 {
    774   DefineMaterial(track.GetMaterialCutsCouple());
    775   preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
    776   G4double x = DBL_MAX;
    777   if(DBL_MIN < preStepLambda) x = 1.0/preStepLambda;
    778   return x;
    779 }
    780 
    781 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    782 
    783 inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(
    784                 const G4ParticleDefinition*, const G4Material*, G4double cut)
    785 {
    786   return cut;
    787 }
    788 
    789 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    790 
    791 inline G4VEmModel* G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
    792 {
    793   return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
    794 }
    795 
    796 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    797 
    798 inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(
    799                    G4double kinEnergy, size_t& idx) const
    800 {
    801   return modelManager->SelectModel(kinEnergy, idx);
    802 }
    803 
    804 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    805 
    806 inline const G4ParticleDefinition* G4VEnergyLossProcess::Particle() const
    807 {
    808   return particle;
    809 }
    810 
    811 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    812 
    813 inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
    814 {
    815   return baseParticle;
    816 }
    817 
    818 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    819 
    820 inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
    821 {
    822   return secondaryParticle;
    823 }
    824 
    825 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    826 
    827 inline void G4VEnergyLossProcess::CorrectionsAlongStep(
    828                              const G4MaterialCutsCouple*,
    829                              const G4DynamicParticle*,
    830                              G4double&,
    831                              G4double&)
    832 {}
    833 
    834 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    835 
    836 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
    837 {
    838   return theDEDXTable;
    839 }
    840 
    841 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    842 
    843 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
    844 {
    845   return theDEDXSubTable;
    846 }
    847 
    848 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    849 
    850 inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
    851 {
    852   return theDEDXunRestrictedTable;
    853 }
    854 
    855 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    856 
    857 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTable() const
    858 {
    859   G4PhysicsTable* t = theDEDXTable;
    860   if(theIonisationTable) t = theIonisationTable;
    861   return t;
    862 }
    863 
    864 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    865 
    866 inline G4PhysicsTable* G4VEnergyLossProcess::IonisationTableForSubsec() const
    867 {
    868   G4PhysicsTable* t = theDEDXSubTable;
    869   if(theIonisationSubTable) t = theIonisationSubTable;
    870   return t;
    871 }
    872 
    873 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    874 
    875 inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
    876 {
    877   return theCSDARangeTable;
    878 }
    879 
    880 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    881 
    882 inline G4PhysicsTable* G4VEnergyLossProcess::RangeTableForLoss() const
    883 {
    884   return theRangeTableForLoss;
    885 }
    886 
    887 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    888 
    889 inline G4PhysicsTable* G4VEnergyLossProcess::InverseRangeTable() const
    890 {
    891   return theInverseRangeTable;
    892 }
    893 
    894 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    895 
    896 inline G4PhysicsTable* G4VEnergyLossProcess::LambdaTable()
    897 {
    898   return theLambdaTable;
    899 }
    900 
    901 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    902 
    903 inline G4PhysicsTable* G4VEnergyLossProcess::SubLambdaTable()
    904 {
    905   return theSubLambdaTable;
    906 }
    907 
    908 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    909  
    910 inline G4bool G4VEnergyLossProcess::IsIntegral() const
    911 {
    912   return integral;
    913 }
    914 
    915 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    916 
    917 inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const
    918 {
    919   return currentMaterialIndex;
    920 }
    921 
    922 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    923 
    924 inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
    925                                                        G4double charge2ratio)
    926 {
    927   massRatio     = massratio;
    928   chargeSqRatio = charge2ratio;
    929   chargeSquare  = charge2ratio*eplus*eplus;
    930   if(chargeSqRatio > 0.0) reduceFactor  = 1.0/(chargeSqRatio*massRatio);
    931 }
    932  
    933 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    934  
    935 inline G4double G4VEnergyLossProcess::GetCurrentRange() const
    936 {
    937   return fRange;
    938 }
    939 
    940 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    941 
    942 void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p,
    943                                       G4VEmFluctuationModel* fluc,
    944                                       const G4Region* region)
    945 {
    946   modelManager->AddEmModel(order, p, fluc, region);
    947   if(p) p->SetParticleChange(pParticleChange, fluc);
    948 }
    949 
    950 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    951 
    952 inline G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx)
    953 {
    954   return modelManager->GetModel(idx);
    955 }
    956 
    957 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    958 
    959 inline G4int G4VEnergyLossProcess::NumberOfModels()
    960 {
    961   return modelManager->NumberOfModels();
    962 }
    963 
    964 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    965 
    966 inline void G4VEnergyLossProcess::SetEmModel(G4VEmModel* p, G4int index)
    967 {
    968   G4int n = emModels.size();
    969   if(index >= n) for(G4int i=n; i<index+1; i++) {emModels.push_back(0);}
    970   emModels[index] = p;
    971 }
    972 
    973 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    974 
    975 inline G4VEmModel* G4VEnergyLossProcess::EmModel(G4int index)
    976 {
    977   G4VEmModel* p = 0;
    978   if(index >= 0 && index <  G4int(emModels.size())) p = emModels[index];
    979   return p;
    980 }
    981 
    982 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    983 
    984 inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
    985 {
    986   fluctModel = p;
    987 }
    988 
    989 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    990 
    991 inline G4VEmFluctuationModel* G4VEnergyLossProcess::FluctModel()
    992 {
    993   return fluctModel;
    994 }
    995 
    996 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    997 
    998 inline void G4VEnergyLossProcess::UpdateEmModel(const G4String& nam,
    999                                                 G4double emin, G4double emax)
    1000 {
    1001   modelManager->UpdateEmModel(nam, emin, emax);
    1002 }
    1003 
    1004 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1005 
    1006 inline void G4VEnergyLossProcess::SetIntegral(G4bool val)
    1007 {
    1008   integral = val;
    1009 }
    1010 
    1011 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1012 
    1013 inline void G4VEnergyLossProcess::SetParticle(const G4ParticleDefinition* p)
    1014 {
    1015   particle = p;
    1016 }
    1017 
    1018 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1019 
    1020 inline void G4VEnergyLossProcess::SetBaseParticle(const G4ParticleDefinition* p)
    1021 {
    1022   baseParticle = p;
    1023 }
    1024 
    1025 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1026 
    1027 inline void G4VEnergyLossProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
    1028 {
    1029   secondaryParticle = p;
    1030 }
    1031 
    1032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1033 
    1034 inline void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
    1035 {
    1036   linLossLimit = val;
    1037 }
    1038 
    1039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1040 
    1041 inline void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
    1042 {
    1043   lossFluctuationFlag = val;
    1044 }
    1045 
    1046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1047 
    1048 inline void G4VEnergyLossProcess::SetRandomStep(G4bool val)
    1049 {
    1050   rndmStepFlag = val;
    1051 }
    1052 
    1053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1054 
    1055 inline void G4VEnergyLossProcess::SetMinSubRange(G4double val)
    1056 {
    1057   minSubRange = val;
    1058 }
    1059 
    1060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1061 
    1062 inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
    1063 {
    1064   return  tablesAreBuilt;
    1065 }
    1066 
    1067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1068 
    1069 inline G4int G4VEnergyLossProcess::NumberOfSubCutoffRegions() const
    1070 {
    1071   return nSCoffRegions;
    1072 }
    1073 
    1074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1075 
    1076 inline void G4VEnergyLossProcess::SetDEDXBinning(G4int nbins)
    1077 {
    1078   nBins = nbins;
    1079 }
    1080 
    1081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1082 
    1083 inline void G4VEnergyLossProcess::SetLambdaBinning(G4int nbins)
    1084 {
    1085   nBins = nbins;
    1086 }
    1087 
    1088 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1089 
    1090 inline void G4VEnergyLossProcess::SetDEDXBinningForCSDARange(G4int nbins)
    1091 {
    1092   nBinsCSDA = nbins;
    1093 }
    1094 
    1095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1096 
    1097 inline G4double G4VEnergyLossProcess::MinKinEnergy() const
    1098 {
    1099   return minKinEnergy;
    1100 }
    1101 
    1102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1103 
    1104 inline void G4VEnergyLossProcess::SetMinKinEnergy(G4double e)
    1105 {
    1106   minKinEnergy = e;
    1107 }
    1108 
    1109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1110 
    1111 inline void G4VEnergyLossProcess::SetMaxKinEnergy(G4double e)
    1112 {
    1113   maxKinEnergy = e;
    1114   if(e < maxKinEnergyCSDA) maxKinEnergyCSDA = e;
    1115 }
    1116 
    1117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1118 
    1119 inline void G4VEnergyLossProcess::SetMaxKinEnergyForCSDARange(G4double e)
    1120 {
    1121   maxKinEnergyCSDA = e;
    1122 }
    1123 
    1124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1125 
    1126 inline G4double G4VEnergyLossProcess::MaxKinEnergy() const
    1127 {
    1128   return maxKinEnergy;
    1129 }
    1130 
    1131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1132 
    1133 inline void G4VEnergyLossProcess::SetLambdaFactor(G4double val)
    1134 {
    1135   if(val > 0.0 && val <= 1.0) lambdaFactor = val;
    1136 }
    1137 
    1138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1139 
    1140 inline void G4VEnergyLossProcess::SetIonisation(G4bool val)
    1141 {
    1142   isIonisation = val;
    1143   if(val) aGPILSelection = CandidateForSelection;
    1144   else    aGPILSelection = NotCandidateForSelection;
    1145 }
    1146 
    1147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1148 
    1149 inline G4bool G4VEnergyLossProcess::IsIonisationProcess() const
    1150 {
    1151   return isIonisation;
    1152 }
    1153 
    1154 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1155 
    1156 void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
    1157 {
    1158   dRoverRange = v1;
    1159   finalRange = v2;
    1160   if (dRoverRange > 0.999) dRoverRange = 1.0;
    1161   currentCouple = 0;
    1162   mfpKinEnergy  = DBL_MAX;
    1163 }
    1164 
    1165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
    1166 
    11671181#endif
Note: See TracChangeset for help on using the changeset viewer.