Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AtomicShell.hh,v 1.1 2009/07/24 17:22:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
// Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
//
// History:
// -----------
//
// 16 Sept 2001 Modified according to a design iteration in the
// LowEnergy category
// 24 July 2009 Moved to utils subdirectory and make inline methods (VI)
//
// -------------------------------------------------------------------
// Class description:
// A container of atomic shell data
// -------------------------------------------------------------------
#ifndef G4AtomicShell_h
#define G4AtomicShell_h 1
#include "globals.hh"
class G4AtomicShell {
public:
// The data and the methods of this class are relative to
// a given shell
G4AtomicShell(G4int id, G4double bindingEnergy);
~G4AtomicShell();
// Returns the binding energy of the shell
inline G4double BindingEnergy() const;
// Returns the id of the shell
inline G4int ShellId() const;
private:
G4int identifier;
G4double bindingEnergy;
};
inline G4double G4AtomicShell::BindingEnergy() const {
return bindingEnergy;
}
inline G4int G4AtomicShell::ShellId() const{
return identifier;
}
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DummyModel.hh,v 1.3 2007/05/22 17:31:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4DummyModel.hh,v 1.4 2009/04/07 18:39:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -50,9 +50,9 @@
#define G4DummyModel_h 1
#include "globals.hh"
#include "G4VEmModel.hh"
#include "G4VMscModel.hh"
class G4DummyModel : public G4VEmModel
class G4DummyModel : public G4VMscModel
{
public:
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.hh,v 1.18 2007/03/15 12:34:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4EmCalculator.hh,v 1.19 2009/11/11 23:59:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// -------------------------------------------------------------------
@@ -59,6 +59,7 @@
#include <vector>
#include "globals.hh"
#include "G4DataVector.hh"
#include "G4DynamicParticle.hh"
class G4LossTableManager;
class G4Material;
@@ -81,8 +82,10 @@ public:
~G4EmCalculator();
//==================================================================================
// Methods to access precalculated dE/dx and cross sections
// Materials should exist in the list of the G4MaterialCutsCouple
//==================================================================================
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition*, const G4Material*,
const G4Region* r = 0);
@@ -135,8 +138,10 @@ public:
void PrintInverseRangeTable(const G4ParticleDefinition*);
//==================================================================================
// Methods to calculate dE/dx and cross sections "on fly"
// Existing tables and G4MaterialCutsCouples are not used
//==================================================================================
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*,
const G4String& processName, const G4Material*,
@@ -149,8 +154,10 @@ public:
G4double ComputeElectronicDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat, G4double cut = DBL_MAX);
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4ParticleDefinition*, const G4Material*);
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4String& part, const G4String& mat);
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*);
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat);
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*, G4double cut = DBL_MAX);
@@ -189,8 +196,14 @@ public:
G4double range, const G4String&,
const G4String&);
//==================================================================================
// Methods to access particles, materials, regions
//==================================================================================
const G4ParticleDefinition* FindParticle(const G4String&);
const G4ParticleDefinition* FindIon(G4int Z, G4int A);
const G4Material* FindMaterial(const G4String&);
const G4Region* FindRegion(const G4String&);
@@ -199,6 +212,10 @@ public:
void SetVerbose(G4int val);
//==================================================================================
// Private methods
//==================================================================================
private:
G4bool UpdateParticle(const G4ParticleDefinition*, G4double kinEnergy);
@@ -239,6 +256,7 @@ private:
const G4ParticleDefinition* theGenericIon;
G4ionEffectiveCharge* ionEffCharge;
G4DynamicParticle dynParticle;
G4String currentName;
G4double currentCut;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmElementSelector.hh,v 1.2 2008/07/22 15:55:15 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4EmElementSelector.hh,v 1.6 2009/09/29 11:31:37 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -88,6 +88,7 @@ private:
G4VEmModel* model;
const G4Material* material;
const G4Element* element;
const G4ElementVector* theElementVector;
G4int nElmMinusOne;
@@ -106,18 +107,17 @@ private:
inline const G4Element* G4EmElementSelector::SelectRandomAtom(G4double e)
{
const G4Element* elm = (*theElementVector)[nElmMinusOne];
if (nElmMinusOne > 0) {
G4bool b;
G4double x = G4UniformRand();
for(G4int i=0; i<nElmMinusOne; i++) {
if (x <= (xSections[i])->GetValue(e,b)) {
elm = (*theElementVector)[i];
element = (*theElementVector)[nElmMinusOne];
for(G4int i=0; i<nElmMinusOne; ++i) {
if (x <= (xSections[i])->Value(e)) {
element = (*theElementVector)[i];
break;
}
}
}
return elm;
return element;
}
inline const G4Material* G4EmElementSelector::GetMaterial() const
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.hh,v 1.25 2008/10/13 14:56:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4EmModelManager.hh,v 1.34 2009/08/11 10:29:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -52,6 +52,9 @@
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 13-05-06 Add GetModel by index method (VI)
// 15-03-07 Add maxCutInRange (V.Ivanchenko)
// 08-04-08 Simplify Select method for only one G4RegionModel (VI)
// 03-08-09 Removed unused members and simplify model search if only one
// model is used (VI)
//
// Class Description:
//
@@ -90,28 +93,28 @@ private:
~G4RegionModels();
G4int SelectIndex(G4double e) const {
inline G4int SelectIndex(G4double e) const {
G4int idx = 0;
if (nModelsForRegion>1) {
idx = nModelsForRegion;
do {idx--;} while (idx && e <= lowKineticEnergy[idx]);
do {--idx;} while (idx > 0 && e <= lowKineticEnergy[idx]);
}
return theListOfModelIndexes[idx];
};
G4int ModelIndex(G4int n) const {
inline G4int ModelIndex(G4int n) const {
return theListOfModelIndexes[n];
};
G4int NumberOfModels() const {
inline G4int NumberOfModels() const {
return nModelsForRegion;
};
G4double LowEdgeEnergy(G4int n) const {
inline G4double LowEdgeEnergy(G4int n) const {
return lowKineticEnergy[n];
};
const G4Region* Region() const {
inline const G4Region* Region() const {
return theRegion;
};
@@ -128,7 +131,6 @@ private:
class G4Region;
class G4ParticleDefinition;
class G4DataVector;
class G4PhysicsVector;
class G4MaterialCutsCouple;
@@ -149,30 +151,36 @@ public:
G4double,
G4int);
const G4DataVector* Cuts() const;
const G4DataVector* SubCutoff() const;
void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
G4EmTableType t = fRestricted);
void FillLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
G4bool startFromNull = true, G4EmTableType t = fRestricted);
G4VEmModel* SelectModel(G4double& energy, size_t& index);
G4VEmModel* GetModel(G4int, G4bool ver = false);
G4int NumberOfModels() const;
void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel*, const G4Region*);
void UpdateEmModel(const G4String&, G4double, G4double);
void DumpModelList(G4int verb);
inline G4VEmModel* SelectModel(G4double& energy, size_t& index);
inline const G4DataVector* Cuts() const;
inline const G4DataVector* SubCutoff() const;
inline G4int NumberOfModels() const;
private:
inline G4double ComputeDEDX(G4VEmModel* model,
const G4MaterialCutsCouple*,
G4double kinEnergy,
G4double cutEnergy,
G4double minEnergy);
// hide assignment operator
G4EmModelManager(G4EmModelManager &);
@@ -189,28 +197,24 @@ private:
std::vector<G4VEmFluctuationModel*> flucModels;
std::vector<const G4Region*> regions;
std::vector<G4int> orderOfModels;
std::vector<G4int> isUsed;
G4int nEmModels;
G4int nRegions;
G4int nCouples;
G4int* idxOfRegionModels;
G4RegionModels** setOfRegionModels;
std::vector<G4int> idxOfRegionModels;
std::vector<G4RegionModels*> setOfRegionModels;
G4double minSubRange;
G4double maxCutInRange;
G4double maxSubCutInRange;
const G4ParticleDefinition* particle;
const G4ParticleDefinition* secondaryParticle;
const G4ParticleDefinition* theGamma;
const G4ParticleDefinition* thePositron;
G4int verboseLevel;
G4bool severalModels;
// cash
G4int currentIdx;
// may be changed in run time
G4RegionModels* currRegionModel;
G4VEmModel* currModel;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -219,9 +223,13 @@ private:
inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy,
size_t& index)
{
currentIdx =
(setOfRegionModels[idxOfRegionModels[index]])->SelectIndex(kinEnergy);
return models[currentIdx];
if(severalModels) {
if(nRegions > 1) {
currRegionModel = setOfRegionModels[idxOfRegionModels[index]];
}
currModel = models[currRegionModel->SelectIndex(kinEnergy)];
}
return currModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -247,5 +255,22 @@ inline G4int G4EmModelManager::NumberOfModels() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4EmModelManager::ComputeDEDX(G4VEmModel* model,
const G4MaterialCutsCouple* couple,
G4double e,
G4double cut,
G4double emin)
{
G4double dedx = 0.0;
if(model && cut > emin) {
dedx = model->ComputeDEDX(couple,particle,e,cut);
if(emin > 0.0) {dedx -= model->ComputeDEDX(couple,particle,e,emin);}
}
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.hh,v 1.14 2008/04/17 10:33:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4EmProcessOptions.hh,v 1.16 2009/10/29 19:25:28 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// -------------------------------------------------------------------
@@ -106,7 +106,8 @@ public:
void SetLinearLossLimit(G4double val);
void ActivateDeexcitation(G4bool val, const G4Region* r = 0);
void ActivateDeexcitation(const G4String& proc, G4bool val,
const G4String& reg = "");
void SetMscStepLimitation(G4MscStepLimitType val);
@@ -126,6 +127,8 @@ public:
void SetPolarAngleLimit(G4double val);
void SetFactorForAngleLimit(G4double val);
private:
G4EmProcessOptions & operator=(const G4EmProcessOptions &right);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmSaturation.hh,v 1.6 2008/03/17 11:27:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4EmSaturation.hh,v 1.7 2009/09/25 09:16:40 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
#ifndef G4EmSaturation_h
@@ -103,9 +103,7 @@ private:
void Initialise();
const G4ParticleDefinition* gamma;
const G4ParticleDefinition* electron;
const G4ParticleDefinition* neutron;
const G4ParticleDefinition* proton;
G4LossTableManager* manager;
G4NistManager* nist;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4EnergyLossMessenger.hh,v 1.22 2008/10/20 13:27:45 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4EnergyLossMessenger.hh,v 1.24 2009/10/29 19:25:28 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -106,6 +106,7 @@ private:
G4UIcmdWithABool* SubSecCmd;
G4UIcmdWithADouble* MinSubSecCmd;
G4UIcommand* StepFuncCmd;
G4UIcommand* deexCmd;
G4UIcmdWithAString* mscCmd;
G4UIcmdWithADoubleAndUnit* MinEnCmd;
G4UIcmdWithADoubleAndUnit* MaxEnCmd;
@@ -124,6 +125,7 @@ private:
G4UIcmdWithADouble* skinCmd;
G4UIcmdWithADouble* frCmd;
G4UIcmdWithADouble* fgCmd;
G4UIcmdWithADouble* mscfCmd;
G4UIcmdWithADoubleAndUnit* angCmd;
};
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.hh,v 1.53 2008/07/15 16:56:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4LossTableManager.hh,v 1.55 2009/10/29 19:25:28 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// -------------------------------------------------------------------
@@ -90,6 +90,7 @@ class G4VMultipleScattering;
class G4VEmProcess;
class G4EmCorrections;
class G4EmSaturation;
class G4EmConfigurator;
class G4LossTableBuilder;
class G4LossTableManager
@@ -208,6 +209,8 @@ public:
void SetBremsstrahlungTh(G4double val);
void SetFactorForAngleLimit(G4double val);
void SetVerbose(G4int val);
G4EnergyLossMessenger* GetMessenger();
@@ -220,6 +223,8 @@ public:
G4double BremsstrahlungTh() const;
G4double FactorForAngleLimit() const;
const std::vector<G4VEnergyLossProcess*>& GetEnergyLossProcessVector();
const std::vector<G4VEmProcess*>& GetEmProcessVector();
@@ -232,6 +237,8 @@ public:
G4EmSaturation* EmSaturation();
G4EmConfigurator* EmConfigurator();
private:
G4LossTableManager();
@@ -298,11 +305,13 @@ private:
G4double maxKinEnergy;
G4double maxKinEnergyForMuons;
G4double bremsTh;
G4double factorForAngleLimit;
G4LossTableBuilder* tableBuilder;
G4EnergyLossMessenger* theMessenger;
G4EmCorrections* emCorrections;
G4EmSaturation* emSaturation;
G4EmConfigurator* emConfigurator;
const G4ParticleDefinition* firstParticle;
G4int verbose;
@@ -0,0 +1,152 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VAtomDeexcitation.hh,v 1.1 2009/07/09 11:42:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4VAtomDeexcitation
//
// Author: Alfonso Mantero & Vladimir Ivanchenko
//
// Creation date: 30.06.2009
//
// Modifications:
//
// Class Description:
//
// Abstract interface to energy loss models
// -------------------------------------------------------------------
//
#ifndef G4VAtomDeexcitation_h
#define G4VAtomDeexcitation_h 1
#include "globals.hh"
#include <vector>
class G4AtomicShell;
class G4ParticleDefinition;
class G4DynamicParticle;
class G4VAtomDeexcitation {
G4VAtomDeexcitation(const G4String& pname = "");
virtual ~G4VAtomDeexcitation();
//initialization
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// Get atomic shell by shell index, used by discrete processes
// (for example, photoelectric), when shell vacancy sampled by the model
virtual const G4AtomicChell* GetAtomicShell(G4int Z, G4int ShellIndex);
// selection of random shell for ionisation process
virtual const G4AtomicShell* SelectRandomShell(const G4DynamicParticle*,
G4int Z);
// generation of deexcitation for given atom and shell vacancy
virtual void GenerateParticles(std::vector<G4DynamicParticle*>*,
const G4AtomicChell*, G4int Z);
// access or compute PIXE cross section
virtual G4double GetPIXECrossSection (const G4ParticleDefinition*,
G4int Z, G4double kinE);
// calculate PIXE cross section from the models
virtual G4double CalculatePIXECrossSection(const G4ParticleDefinition*,
G4int Z, G4double kinE);
// Sampling of PIXE for ionisation processes
virtual void
AlongStepDeexcitation(std::vector<G4DynamicParticle*>* secVect,
const G4DynamicParticle* icidentParticle,
const G4MaterialCutsCouple*,
G4double trueStepLenght,
G4double eLoss);
// Check if deexcitation is active for a given geometry volume
G4bool CheckActiveRegion(G4int coupleIndex);
// Access flags defined in the CheckActiveVolume method
inline G4bool IsFluorescenceActive() const;
inline G4bool IsPIXECrossSectionActive() const;
// PIXE model name
inline void SetPIXECrossSectionModel(const G4String&);
inline const G4String& PIXECrossSectionModel() const;
// Activation of deexcitation per detector region
void SetFluorescenceActiveRegion(const G4Region* region = 0);
void SetAugerActiveRegion(const G4Region* region = 0);
void SetPIXECrossSectionActiveRegion(const G4Region* region = 0);
void SetFluorescenceActiveRegion(const G4String& rname = "");
void SetAugerActiveRegion(const G4String& rname = "");
void SetPIXECrossSectionActiveRegion(const G4String& rname = "");
private:
// copy constructor and hide assignment operator
G4VAtomDeexcitation(G4VAtomDeexcitation &);
G4VAtomDeexcitation & operator=(const G4VAtomDeexcitation &right);
G4String namePIXE;
G4bool isFluoActive;
G4bool isPIXEActive;
};
inline G4bool IsFluorescenceActive() const
{
return isFluoActive;
}
inline G4bool IsPIXECrossSectionActive() const
{
return isPIXEActive;
}
inline
void G4VAtomDeexcitation::SetPIXECrossSectionModel(const G4String& n)
{
namePIXE = n;
}
inline
const G4String& G4VAtomDeexcitation::PIXECrossSectionModel() const
{
return namePIXE;
}
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.hh,v 1.11 2008/09/12 14:47:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VEmFluctuationModel.hh,v 1.12 2009/02/19 11:25:50 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -100,7 +100,7 @@ public:
// Generic methods common to all models
//------------------------------------------------------------------------
G4String GetName() const;
inline G4String GetName() const;
private:
@@ -114,14 +114,6 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmFluctuationModel::InitialiseMe(const G4ParticleDefinition*)
{}
inline
void G4VEmFluctuationModel::SetParticleAndCharge(const G4ParticleDefinition*,
G4double)
{}
inline G4String G4VEmFluctuationModel::GetName() const
{
return name;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.hh,v 1.59 2008/11/13 19:29:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VEmModel.hh,v 1.72 2009/09/23 14:42:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -64,6 +64,8 @@
// 21-07-08 Added vector of G4ElementSelector and methods to use it (VI)
// 12-09-08 Added methods GetParticleCharge, GetChargeSquareRatio,
// CorrectionsAlongStep, ActivateNuclearStopping (VI)
// 16-02-09 Moved implementations of virtual methods to source (VI)
// 07-04-09 Moved msc methods from G4VEmModel to G4VMscModel (VI)
//
// Class Description:
//
@@ -91,6 +93,8 @@
class G4PhysicsTable;
class G4Region;
class G4VParticleChange;
class G4ParticleChangeForLoss;
class G4ParticleChangeForGamma;
class G4Track;
class G4VEmModel
@@ -119,25 +123,12 @@ public:
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
// dEdx per unit length
virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
// main method to compute dEdx
virtual G4double ComputeDEDXPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
// cross section per volume
virtual G4double CrossSection(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// main method to compute cross section per Volume
virtual G4double CrossSectionPerVolume(const G4Material*,
const G4ParticleDefinition*,
@@ -145,7 +136,7 @@ public:
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// main method to compute cross section depending on atom
// main method to compute cross section per atom
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z,
@@ -167,42 +158,40 @@ public:
const G4Material*,
G4double kineticEnergy);
// add correction to energy loss and ompute non-ionizing energy loss
// add correction to energy loss and compute non-ionizing energy loss
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& niel,
G4double length);
// sample PIXE deexcitation
virtual void SampleDeexcitationAlongStep(const G4Material*,
const G4Track&,
G4double& eloss);
// initilisation at run time for a given material
virtual void SetupForMaterial(const G4ParticleDefinition*,
const G4Material*,
G4double kineticEnergy);
// add a region for the model
virtual void DefineForRegion(const G4Region*);
protected:
// initialisation of the ParticleChange for the model
G4ParticleChangeForLoss* GetParticleChangeForLoss();
// initialisation of the ParticleChange for the model
G4ParticleChangeForGamma* GetParticleChangeForGamma();
// kinematically allowed max kinetic energy of a secondary
virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy);
//------------------------------------------------------------------------
// Methods for msc simulation which needs to be overwritten
//------------------------------------------------------------------------
public:
virtual void SampleScattering(const G4DynamicParticle*,
G4double safety);
virtual G4double ComputeTruePathLengthLimit(const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
virtual G4double ComputeGeomPathLength(G4double truePathLength);
virtual G4double ComputeTrueStepLength(G4double geomPathLength);
virtual void DefineForRegion(const G4Region*);
virtual void SetupForMaterial(const G4ParticleDefinition*,
const G4Material*,
G4double kineticEnergy);
//------------------------------------------------------------------------
// Generic methods common to all models
//------------------------------------------------------------------------
@@ -211,13 +200,26 @@ public:
void InitialiseElementSelectors(const G4ParticleDefinition*,
const G4DataVector&);
// compute mean free path via cross section per volume
G4double ComputeMeanFreePath(const G4ParticleDefinition*,
// dEdx per unit length
inline G4double ComputeDEDX(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
// cross section per volume
inline G4double CrossSection(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
const G4Material*,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// compute mean free path via cross section per volume
inline G4double ComputeMeanFreePath(const G4ParticleDefinition*,
G4double kineticEnergy,
const G4Material*,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// generic cross section per element
inline G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
const G4Element*,
@@ -232,8 +234,7 @@ public:
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// this method can be used only in the case if generic method to compute
// cross section per volume is used and not overwritten in derived class
// to select atom cross section per volume is recomputed for each element
inline const G4Element* SelectRandomAtom(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
@@ -259,16 +260,26 @@ public:
inline G4bool LPMFlag() const;
inline G4bool DeexcitationFlag() const;
inline void SetHighEnergyLimit(G4double);
inline void SetLowEnergyLimit(G4double);
inline void SetActivationHighEnergyLimit(G4double);
inline void SetActivationLowEnergyLimit(G4double);
inline G4bool IsActive(G4double kinEnergy);
inline void SetPolarAngleLimit(G4double);
inline void SetSecondaryThreshold(G4double);
inline void SetLPMFlag(G4bool val);
inline void SetDeexcitationFlag(G4bool val);
inline void ActivateNuclearStopping(G4bool);
inline G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle);
@@ -277,12 +288,16 @@ public:
inline void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*);
inline void SetCurrentCouple(const G4MaterialCutsCouple*);
protected:
inline const G4Element* GetCurrentElement() const;
inline const G4MaterialCutsCouple* CurrentCouple() const;
inline void SetCurrentElement(const G4Element*);
inline const G4Element* GetCurrentElement() const;
private:
// hide assignment operator
@@ -298,6 +313,8 @@ private:
G4double lowLimit;
G4double highLimit;
G4double eMinActive;
G4double eMaxActive;
G4double polarAngleLimit;
G4double secondaryThreshold;
G4bool theLPMflag;
@@ -314,8 +331,11 @@ protected:
private:
const G4Element* currentElement;
const G4MaterialCutsCouple* currentCouple;
const G4Element* currentElement;
G4int nsec;
G4bool flagDeexcitation;
std::vector<G4double> xsec;
};
@@ -323,79 +343,39 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::HighEnergyLimit() const
inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy)
{
return highLimit;
currentCouple = c;
return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::LowEnergyLimit() const
inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy,
G4double maxEnergy)
{
return lowLimit;
currentCouple = c;
return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::PolarAngleLimit() const
inline G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
G4double ekin,
const G4Material* material,
G4double emin,
G4double emax)
{
return polarAngleLimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::SecondaryThreshold() const
{
return secondaryThreshold;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEmModel::LPMFlag() const
{
return theLPMflag;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetHighEnergyLimit(G4double val)
{
highLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetLowEnergyLimit(G4double val)
{
lowLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetPolarAngleLimit(G4double val)
{
polarAngleLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetSecondaryThreshold(G4double val)
{
secondaryThreshold = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmModel::SetLPMFlag(G4bool val)
{
theLPMflag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmModel::ActivateNuclearStopping(G4bool val)
{
nuclearStopping = val;
G4double mfp = DBL_MAX;
G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
if (cross > DBL_MIN) mfp = 1./cross;
return mfp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -414,96 +394,6 @@ inline G4double G4VEmModel::ComputeCrossSectionPerAtom(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,
G4VEmFluctuationModel* f = 0)
{
if(p && pParticleChange != p) pParticleChange = p;
fluc = f;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
{
return fluc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*)
{
return 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
const G4Material*, G4double)
{
G4double q = p->GetPDGCharge()/CLHEP::eplus;
return q*q;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::GetParticleCharge(const G4ParticleDefinition* p,
const G4Material*, G4double)
{
return p->GetPDGCharge();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::CorrectionsAlongStep(const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double&,G4double&,G4double)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeDEDXPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double,G4double)
{
return 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy)
{
return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy,
G4double maxEnergy)
{
return CrossSectionPerVolume(c->GetMaterial(),p,
kinEnergy,cutEnergy,maxEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double, G4double, G4double,
G4double, G4double)
{
return 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
const G4Element* G4VEmModel::SelectRandomAtom(const G4MaterialCutsCouple* couple,
const G4ParticleDefinition* p,
@@ -511,6 +401,7 @@ const G4Element* G4VEmModel::SelectRandomAtom(const G4MaterialCutsCouple* couple
G4double cutEnergy,
G4double maxEnergy)
{
currentCouple = couple;
if(nSelectors > 0) {
currentElement =
elmSelectors[couple->GetIndex()]->SelectRandomAtom(kinEnergy);
@@ -550,12 +441,13 @@ const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* material,
inline G4int G4VEmModel::SelectIsotopeNumber(const G4Element* elm)
{
currentElement = elm;
G4int N = G4int(elm->GetN() + 0.5);
G4int ni = elm->GetNumberOfIsotopes();
if(ni > 0) {
G4int idx = 0;
if(ni > 1) {
G4double* ab = currentElement->GetRelativeAbundanceVector();
G4double* ab = elm->GetRelativeAbundanceVector();
G4double x = G4UniformRand();
for(; idx<ni; idx++) {
x -= ab[idx];
@@ -570,16 +462,121 @@ inline G4int G4VEmModel::SelectIsotopeNumber(const G4Element* elm)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4Element* G4VEmModel::GetCurrentElement() const
inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
{
return currentElement;
return fluc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetCurrentElement(const G4Element* elm)
inline G4double G4VEmModel::HighEnergyLimit() const
{
currentElement = elm;
return highLimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::LowEnergyLimit() const
{
return lowLimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::PolarAngleLimit() const
{
return polarAngleLimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::SecondaryThreshold() const
{
return secondaryThreshold;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEmModel::LPMFlag() const
{
return theLPMflag;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VEmModel::DeexcitationFlag() const
{
return flagDeexcitation;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetHighEnergyLimit(G4double val)
{
highLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetLowEnergyLimit(G4double val)
{
lowLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetActivationHighEnergyLimit(G4double val)
{
eMaxActive = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetActivationLowEnergyLimit(G4double val)
{
eMinActive = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4bool G4VEmModel::IsActive(G4double kinEnergy)
{
return (kinEnergy >= eMinActive && kinEnergy <= eMaxActive);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetPolarAngleLimit(G4double val)
{
polarAngleLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetSecondaryThreshold(G4double val)
{
secondaryThreshold = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmModel::SetLPMFlag(G4bool val)
{
theLPMflag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmModel::SetDeexcitationFlag(G4bool val)
{
flagDeexcitation = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmModel::ActivateNuclearStopping(G4bool val)
{
nuclearStopping = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -593,60 +590,47 @@ G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynPart)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy)
{
return kineticEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4String& G4VEmModel::GetName() const
{
return name;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Methods for msc simulation
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SampleScattering(const G4DynamicParticle*, G4double)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeTruePathLengthLimit(
const G4Track&,
G4PhysicsTable*,
G4double)
inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,
G4VEmFluctuationModel* f = 0)
{
return DBL_MAX;
if(p && pParticleChange != p) pParticleChange = p;
fluc = f;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeGeomPathLength(G4double truePathLength)
inline void G4VEmModel::SetCurrentCouple(const G4MaterialCutsCouple* p)
{
return truePathLength;
currentCouple = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeTrueStepLength(G4double geomPathLength)
inline const G4MaterialCutsCouple* G4VEmModel::CurrentCouple() const
{
return geomPathLength;
return currentCouple;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::DefineForRegion(const G4Region*)
{}
inline void G4VEmModel::SetCurrentElement(const G4Element* elm)
{
currentElement = elm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetupForMaterial(const G4ParticleDefinition*,
const G4Material*, G4double)
{}
inline const G4Element* G4VEmModel::GetCurrentElement() const
{
return currentElement;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.hh,v 1.47 2008/07/31 13:01:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VEmProcess.hh,v 1.55 2009/09/23 14:42:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -107,28 +107,29 @@ protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
inline G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
//------------------------------------------------------------------------
// Generic methods common to all Discrete processes
// Implementation of virtual methods common to all Discrete processes
//------------------------------------------------------------------------
public:
void PrintInfoDefinition();
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// Initialise for build of tables
void PreparePhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
void BuildPhysicsTable(const G4ParticleDefinition&);
void PrintInfoDefinition();
// implementation of virtual method, specific for G4VEmProcess
G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
// implementation of virtual method, specific for G4VEmProcess
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
G4bool StorePhysicsTable(const G4ParticleDefinition*,
@@ -144,6 +145,9 @@ public:
const G4String& directory,
G4bool ascii);
// deexcitation activated per G4Region
void ActivateDeexcitation(G4bool, const G4Region* r = 0);
//------------------------------------------------------------------------
// Specific methods for Discrete EM post step simulation
//------------------------------------------------------------------------
@@ -152,13 +156,6 @@ public:
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
// implementation of virtual method
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
// It returns the cross section of the process per atom
inline G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A=0.,
@@ -166,9 +163,6 @@ public:
inline G4double MeanFreePath(const G4Track& track);
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
// It returns cross section per volume
inline G4double GetLambda(G4double& kinEnergy,
const G4MaterialCutsCouple* couple);
@@ -202,29 +196,33 @@ public:
inline const G4ParticleDefinition* SecondaryParticle() const;
//------------------------------------------------------------------------
// Specific methods to set, access, modify models
// Specific methods to set, access, modify models and basic parameters
//------------------------------------------------------------------------
// Add EM model coupled for the region
inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
protected:
// Select model in run time
inline G4VEmModel* SelectModel(G4double& kinEnergy, size_t index);
public:
// Select model by energy and region index
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
// Add model for region, smaller value of order defines which
// model will be selected for a given energy interval
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
// Assign a model to a process
inline void SetModel(G4VEmModel*);
void SetModel(G4VEmModel*, G4int index = 1);
// return the assigned model
inline G4VEmModel* Model();
G4VEmModel* Model(G4int index = 1);
// Define new energy range for the model identified by the name
inline void UpdateEmModel(const G4String&, G4double, G4double);
void UpdateEmModel(const G4String&, G4double, G4double);
// Access to models
inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
//------------------------------------------------------------------------
// Get/set parameters used for simulation of energy loss
//------------------------------------------------------------------------
inline void ActivateDeexcitation(G4bool, const G4Region* r = 0);
G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
inline void SetLambdaFactor(G4double val);
@@ -232,6 +230,10 @@ public:
inline G4bool IsIntegral() const;
inline void SetApplyCuts(G4bool val);
//------------------------------------------------------------------------
// Other generic methods
//------------------------------------------------------------------------
protected:
@@ -241,14 +243,15 @@ protected:
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
inline G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
inline G4ParticleChangeForGamma* GetParticleChange();
inline void SetParticle(const G4ParticleDefinition* p);
inline void SetSecondaryParticle(const G4ParticleDefinition* p);
inline G4VEmModel* SelectModel(G4double& kinEnergy);
inline size_t CurrentMaterialCutsCoupleIndex() const;
inline G4double GetGammaEnergyCut();
@@ -279,8 +282,7 @@ private:
inline G4double ComputeCurrentLambda(G4double kinEnergy);
// hide assignment operator
// copy constructor and hide assignment operator
G4VEmProcess(G4VEmProcess &);
G4VEmProcess & operator=(const G4VEmProcess &right);
@@ -296,6 +298,8 @@ private:
// ======== Parameters of the class fixed at initialisation =======
std::vector<G4VEmModel*> emModels;
// tables and vectors
G4PhysicsTable* theLambdaTable;
G4double* theEnergyOfCrossSectionMax;
@@ -316,10 +320,11 @@ private:
G4bool integral;
G4bool applyCuts;
G4bool startFromNull;
G4bool useDeexcitation;
G4int nRegions;
std::vector<G4Region*> regions;
std::vector<G4bool> flagsDeexcitation;
G4int nDERegions;
std::vector<const G4Region*> deRegions;
G4bool* idxDERegions;
// ======== Cashed values - may be state dependent ================
@@ -331,14 +336,14 @@ private:
std::vector<G4DynamicParticle*> secParticles;
G4VEmModel* selectedModel;
G4VEmModel* currentModel;
const G4ParticleDefinition* particle;
// cash
const G4Material* currentMaterial;
const G4MaterialCutsCouple* currentCouple;
size_t currentMaterialIndex;
size_t currentCoupleIndex;
G4double mfpKinEnergy;
G4double preStepKinEnergy;
@@ -349,94 +354,16 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentMaterialIndex = couple->GetIndex();
mfpKinEnergy = DBL_MAX;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::InitialiseStep(const G4Track& track)
{
preStepKinEnergy = track.GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return GetCurrentLambda(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
G4double kineticEnergy, G4double Z, G4double A, G4double cut)
{
SelectModel(kineticEnergy, currentCoupleIndex);
G4double x = 0.0;
if(theLambdaTable) x = GetLambdaFromTable(e);
else x = ComputeCurrentLambda(e);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::RecalculateLambda(G4double e,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return ComputeCurrentLambda(e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
{
G4VEmModel* currentModel = SelectModel(e);
G4double x = 0.0;
if(currentModel)
x = currentModel->CrossSectionPerVolume(currentMaterial,particle,
e,(*theCuts)[currentMaterialIndex]);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
{
G4bool b;
return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
{
mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
} else {
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
G4double preStepLambda1 = GetLambdaFromTable(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = theCrossSectionMax[currentMaterialIndex];
}
if(currentModel) {
x = currentModel->ComputeCrossSectionPerAtom(particle,kineticEnergy,
Z,A,cut);
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -452,121 +379,11 @@ inline G4double G4VEmProcess::MeanFreePath(const G4Track& track)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy)
inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::SelectModelForMaterial(
G4double kinEnergy, size_t& idxRegion) const
{
return modelManager->SelectModel(kinEnergy, idxRegion);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::Particle() const
{
return particle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
{
return secondaryParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetGammaEnergyCut()
{
return (*theCutsGamma)[currentMaterialIndex];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetElectronEnergyCut()
{
return (*theCutsElectron)[currentMaterialIndex];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetLambdaFactor(G4double val)
{
if(val > 0.0 && val <= 1.0) lambdaFactor = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver)
{
return modelManager->GetModel(idx, ver);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange()
{
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p)
{
particle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
{
secondaryParticle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
const G4Region* region)
{
G4VEmFluctuationModel* fm = 0;
modelManager->AddEmModel(order, p, fm, region);
if(p) p->SetParticleChange(pParticleChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetModel(G4VEmModel* model)
{
selectedModel = model;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::Model()
{
return selectedModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
{
modelManager->UpdateEmModel(nam, emin, emax);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::ComputeCrossSectionPerAtom(
G4double kineticEnergy, G4double Z, G4double A, G4double cut)
{
G4VEmModel* model = SelectModel(kineticEnergy);
return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A,cut);
DefineMaterial(couple);
return GetCurrentLambda(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -629,11 +446,6 @@ inline G4double G4VEmProcess::PolarAngleLimit() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ActivateDeexcitation(G4bool, const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
{
return theLambdaTable;
@@ -641,6 +453,46 @@ inline const G4PhysicsTable* G4VEmProcess::LambdaTable() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::Particle() const
{
return particle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEmProcess::SecondaryParticle() const
{
return secondaryParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy, size_t index)
{
currentModel = modelManager->SelectModel(kinEnergy, index);
currentModel->SetCurrentCouple(currentCouple);
return currentModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4VEmModel* G4VEmProcess::SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const
{
return modelManager->SelectModel(kinEnergy, idxRegion);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetLambdaFactor(G4double val)
{
if(val > 0.0 && val <= 1.0) lambdaFactor = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetIntegral(G4bool val)
{
if(particle && particle != theGamma) integral = val;
@@ -656,6 +508,64 @@ inline G4bool G4VEmProcess::IsIntegral() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetApplyCuts(G4bool val)
{
applyCuts = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::RecalculateLambda(G4double e,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return ComputeCurrentLambda(e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4ParticleChangeForGamma* G4VEmProcess::GetParticleChange()
{
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetParticle(const G4ParticleDefinition* p)
{
particle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
{
secondaryParticle = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const
{
return currentCoupleIndex;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetGammaEnergyCut()
{
return (*theCutsGamma)[currentCoupleIndex];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetElectronEnergyCut()
{
return (*theCutsElectron)[currentCoupleIndex];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
{
buildLambdaTable = val;
@@ -671,16 +581,73 @@ inline void G4VEmProcess::SetStartFromNullFlag(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetApplyCuts(G4bool val)
inline void G4VEmProcess::InitialiseStep(const G4Track& track)
{
applyCuts = val;
preStepKinEnergy = track.GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
SelectModel(preStepKinEnergy, currentCoupleIndex);
if (theNumberOfInteractionLengthLeft < 0.0) mfpKinEnergy = DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline size_t G4VEmProcess::CurrentMaterialCutsCoupleIndex() const
inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
{
return currentMaterialIndex;
if(couple != currentCouple) {
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentCoupleIndex = couple->GetIndex();
mfpKinEnergy = DBL_MAX;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
{
mfpKinEnergy = theEnergyOfCrossSectionMax[currentCoupleIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
} else {
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetLambdaFromTable(e);
G4double preStepLambda1 = GetLambdaFromTable(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = theCrossSectionMax[currentCoupleIndex];
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
{
return (((*theLambdaTable)[currentCoupleIndex])->Value(e));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
{
G4double x = 0.0;
if(theLambdaTable) { x = GetLambdaFromTable(e); }
else { x = ComputeCurrentLambda(e); }
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
{
SelectModel(e, currentCoupleIndex);
return currentModel->CrossSectionPerVolume(currentMaterial,particle,
e,(*theCuts)[currentCoupleIndex]);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
File diff suppressed because it is too large Load Diff
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMscModel.hh,v 1.4 2008/03/10 10:39:28 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VMscModel.hh,v 1.9 2009/04/07 18:39:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -38,7 +38,7 @@
// Creation date: 07.03.2008
//
// Modifications:
//
// 07.04.2009 V.Ivanchenko moved msc methods from G4VEmModel to G4VMscModel
//
// Class Description:
//
@@ -53,6 +53,11 @@
#include "G4VEmModel.hh"
#include "G4MscStepLimitType.hh"
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4Track.hh"
#include "G4SafetyHelper.hh"
class G4ParticleChangeForMSC;
class G4VMscModel : public G4VEmModel
{
@@ -63,6 +68,28 @@ public:
virtual ~G4VMscModel();
virtual G4double ComputeTruePathLengthLimit(const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
virtual G4double ComputeGeomPathLength(G4double truePathLength);
virtual G4double ComputeTrueStepLength(G4double geomPathLength);
virtual void SampleScattering(const G4DynamicParticle*,
G4double safety);
// empty
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
//================================================================
// Set parameters of multiple scattering models
//================================================================
inline void SetStepLimitType(G4MscStepLimitType);
inline void SetLateralDisplasmentFlag(G4bool val);
@@ -73,12 +100,37 @@ public:
inline void SetSkin(G4double);
inline void SetSampleZ(G4bool);
protected:
// initialisation of the ParticleChange for the model
G4ParticleChangeForMSC* GetParticleChangeForMSC();
// initialisation of interface with geometry
void InitialiseSafetyHelper();
// shift point of the track PostStep
void ComputeDisplacement(G4ParticleChangeForMSC*,
const G4ThreeVector& displDir,
G4double displacement,
G4double postsafety);
// compute safety
inline G4double ComputeSafety(const G4ThreeVector& position, G4double limit);
// compute linear distance to a geometry boundary
inline G4double ComputeGeomLimit(const G4Track& position, G4double& presafety,
G4double limit);
private:
// hide assignment operator
G4VMscModel & operator=(const G4VMscModel &right);
G4VMscModel(const G4VMscModel&);
G4SafetyHelper* safetyHelper;
protected:
G4double facrange;
@@ -87,6 +139,7 @@ protected:
G4double skin;
G4double dtrl;
G4double lambdalimit;
G4double geommax;
G4MscStepLimitType steppingAlgorithm;
@@ -133,5 +186,36 @@ inline void G4VMscModel::SetStepLimitType(G4MscStepLimitType val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VMscModel::SetSampleZ(G4bool val)
{
samplez = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VMscModel::ComputeSafety(const G4ThreeVector& position,
G4double)
{
return safetyHelper->ComputeSafety(position);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VMscModel::ComputeGeomLimit(const G4Track& track,
G4double& presafety,
G4double limit)
{
G4double res = geommax;
if(track.GetVolume() != safetyHelper->GetWorldVolume()) {
res = safetyHelper->CheckNextStep(
track.GetStep()->GetPreStepPoint()->GetPosition(),
track.GetMomentumDirection(),
limit, presafety);
}
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.hh,v 1.54 2008/07/31 13:01:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VMultipleScattering.hh,v 1.62 2009/10/29 17:56:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// -------------------------------------------------------------------
//
@@ -63,6 +63,7 @@
// 12-02-07 Add get/set skin (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
// 15-07-08 Reorder class members for further multi-thread development (VI)
// 07-04-09 Moved msc methods from G4VEmModel to G4VMscModel (VI)
//
// -------------------------------------------------------------------
@@ -79,7 +80,7 @@
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4EmModelManager.hh"
#include "G4VEmModel.hh"
#include "G4VMscModel.hh"
#include "G4MscStepLimitType.hh"
class G4ParticleDefinition;
@@ -125,10 +126,6 @@ public:
// Print out of generic class parameters
void PrintInfoDefinition();
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
G4bool StorePhysicsTable(const G4ParticleDefinition*,
@@ -144,14 +141,10 @@ public:
const G4String& directory,
G4bool ascii);
//------------------------------------------------------------------------
// Specific methods for msc processes
//------------------------------------------------------------------------
// The function overloads the corresponding function of the base
// class.It limits the step near to boundaries only
// and invokes the method GetMscContinuousStepLimit at every step.
virtual G4double AlongStepGetPhysicalInteractionLength(
G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4double currentMinimalStep,
@@ -160,11 +153,17 @@ public:
// The function overloads the corresponding function of the base
// class.
G4double PostStepGetPhysicalInteractionLength(
inline G4double PostStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4ForceCondition* condition);
// Along step actions
inline G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
// Post step actions
inline G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// This method does not used for tracking, it is intended only for tests
inline G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
@@ -191,97 +190,86 @@ public:
inline G4PhysicsTable* LambdaTable() const;
//------------------------------------------------------------------------
// Define and access particle type
//------------------------------------------------------------------------
// access particle type
inline const G4ParticleDefinition* Particle() const;
inline void SetParticle(const G4ParticleDefinition*);
//------------------------------------------------------------------------
// Specific methods to set, access, modify models
//------------------------------------------------------------------------
inline void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
protected:
// Select model in run time
inline G4VEmModel* SelectModel(G4double kinEnergy);
public:
// Select model in run time
inline G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
// Access to models
inline G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false);
// Add model for region, smaller value of order defines which
// model will be selected for a given energy interval
void AddEmModel(G4int order, G4VEmModel*, const G4Region* region = 0);
// Assign a model to a process
void SetModel(G4VMscModel*, G4int index = 1);
// return the assigned model
G4VMscModel* Model(G4int index = 1);
// Access to models by index
G4VEmModel* GetModelByIndex(G4int idx = 0, G4bool ver = false) const;
//------------------------------------------------------------------------
// Set parameters for simulation of multiple scattering
// Get/Set parameters for simulation of multiple scattering
//------------------------------------------------------------------------
inline G4bool LateralDisplasmentFlag() const;
inline void SetLateralDisplasmentFlag(G4bool val);
inline G4double Skin() const;
inline void SetSkin(G4double val);
inline G4double RangeFactor() const;
inline void SetRangeFactor(G4double val);
inline G4double GeomFactor() const;
inline void SetGeomFactor(G4double val);
inline G4double PolarAngleLimit() const;
inline void SetPolarAngleLimit(G4double val);
inline G4MscStepLimitType StepLimitType() const;
inline void SetStepLimitType(G4MscStepLimitType val);
protected:
// This method is used for tracking, it returns mean free path value
G4double GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition);
//------------------------------------------------------------------------
// Run time methods
//------------------------------------------------------------------------
protected:
// This method is not used for tracking, it returns mean free path value
G4double GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition);
// This method is not used for tracking, it returns step limit
G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
// This method returns inversed transport cross section
inline G4double GetLambda(const G4ParticleDefinition* p,
G4double& kineticEnergy);
// This method is used for tracking, it returns step limit
inline G4double GetMscContinuousStepLimit(const G4Track& track,
G4double scaledKinEnergy,
G4double currentMinimalStep,
G4double& currentSafety);
inline G4VEmModel* SelectModel(G4double kinEnergy);
// Select concrete model
inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const;
// define current material
// defines current material in run time
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
//------------------------------------------------------------------------
// Access parameters of multiple scattering
//------------------------------------------------------------------------
inline G4ParticleChangeForMSC* GetParticleChange();
inline G4double Skin() const;
inline G4double RangeFactor() const;
inline G4double GeomFactor() const;
inline G4double PolarAngleLimit() const;
inline G4MscStepLimitType StepLimitType() const;
inline G4bool LateralDisplasmentFlag() const;
inline const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const;
private:
// hide assignment operator
G4VMultipleScattering(G4VMultipleScattering &);
G4VMultipleScattering & operator=(const G4VMultipleScattering &right);
@@ -292,6 +280,8 @@ private:
// ======== Parameters of the class fixed at initialisation =======
std::vector<G4VMscModel*> mscModels;
G4PhysicsTable* theLambdaTable;
const G4ParticleDefinition* firstParticle;
@@ -307,6 +297,7 @@ private:
G4int nBins;
G4bool latDisplasment;
G4bool isIon;
// ======== Cashed values - may be state dependent ================
@@ -317,7 +308,7 @@ protected:
private:
G4VEmModel* currentModel;
G4VMscModel* currentModel;
// cache
const G4ParticleDefinition* currentParticle;
@@ -329,81 +320,14 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = couple;
currentMaterialIndex = couple->GetIndex();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::GetMscContinuousStepLimit(
const G4Track& track,
G4double scaledKinEnergy,
G4double currentMinimalStep,
G4double&)
{
G4double x = currentMinimalStep;
DefineMaterial(track.GetMaterialCutsCouple());
currentModel = SelectModel(scaledKinEnergy);
if(x > 0.0 && scaledKinEnergy > 0.0) {
G4double tPathLength =
currentModel->ComputeTruePathLengthLimit(track, theLambdaTable, x);
if (tPathLength < x) valueGPILSelectionMSC = CandidateForSelection;
x = currentModel->ComputeGeomPathLength(tPathLength);
// G4cout << "tPathLength= " << tPathLength
// << " stepLimit= " << x
// << " currentMinimalStep= " << currentMinimalStep<< G4endl;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::ContinuousStepLimit(
const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety)
{
return GetMscContinuousStepLimit(track,previousStepSize,currentMinimalStep,
currentSafety);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p,
G4double& e)
{
G4double x;
if(theLambdaTable) {
G4bool b;
x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
} else {
x = currentModel->CrossSection(currentCouple,p,e);
}
if(x > DBL_MIN) x = 1./x;
else x = DBL_MAX;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
{
return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial(
G4double kinEnergy, size_t& idxRegion) const
{
return modelManager->SelectModel(kinEnergy, idxRegion);
return GetContinuousStepLimit(track,previousStepSize,currentMinimalStep,
currentSafety);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -450,6 +374,42 @@ inline G4double G4VMultipleScattering::MaxKinEnergy() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
{
buildLambdaTable = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
{
return theLambdaTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VMultipleScattering::Particle() const
{
return currentParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
{
return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VMultipleScattering::SelectModelForMaterial(
G4double kinEnergy, size_t& idxRegion) const
{
return modelManager->SelectModel(kinEnergy, idxRegion);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VMultipleScattering::LateralDisplasmentFlag() const
{
return latDisplasment;
@@ -464,13 +424,6 @@ inline void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4ParticleChangeForMSC* G4VMultipleScattering::GetParticleChange()
{
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::Skin() const
{
return skin;
@@ -545,49 +498,76 @@ inline void G4VMultipleScattering::SetStepLimitType(G4MscStepLimitType val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
inline
G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p,
G4double& e)
{
buildLambdaTable = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VMultipleScattering::Particle() const
{
return currentParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
{
return theLambdaTable;
G4double x;
if(theLambdaTable) {
x = ((*theLambdaTable)[currentMaterialIndex])->Value(e);
} else {
x = currentModel->CrossSection(currentCouple,p,e);
}
if(x > DBL_MIN) x = 1./x;
else x = DBL_MAX;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
const G4MaterialCutsCouple* G4VMultipleScattering::CurrentMaterialCutsCouple() const
void G4VMultipleScattering::DefineMaterial(const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = couple;
currentMaterialIndex = couple->GetIndex();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4MaterialCutsCouple*
G4VMultipleScattering::CurrentMaterialCutsCouple() const
{
return currentCouple;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
const G4Region* region)
// Follwoing methods are virtual, they are inlined because they applied at
// each simulation step and some compilers may inline these methods
inline G4double
G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
const G4Track&, G4double, G4ForceCondition* condition)
{
G4VEmFluctuationModel* fm = 0;
modelManager->AddEmModel(order, p, fm, region);
if(p) p->SetParticleChange(pParticleChange);
*condition = Forced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx, G4bool ver)
inline G4VParticleChange*
G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
{
return modelManager->GetModel(idx, ver);
if(currentModel->IsActive(track.GetKineticEnergy())) {
fParticleChange.ProposeTrueStepLength(currentModel->ComputeTrueStepLength(step.GetStepLength()));
}
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VParticleChange*
G4VMultipleScattering::PostStepDoIt(const G4Track& track, const G4Step& step)
{
fParticleChange.Initialize(track);
if(currentModel->IsActive(track.GetKineticEnergy())) {
currentModel->SampleScattering(track.GetDynamicParticle(),
step.GetPostStepPoint()->GetSafety());
}
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....