Import Geant4 10.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2018-12-07 15:15:39 +01:00
parent 6aa23be517
commit db49709b53
11370 changed files with 187480 additions and 160142 deletions
@@ -7,7 +7,6 @@
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt 66791 2013-01-12 15:24:24Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -1,4 +1,3 @@
# $Id: GNUmakefile 66791 2013-01-12 15:24:24Z gcosmo $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. John Allison, 25/6/98.
# --------------------------------------------------------------------
+59 -1
View File
@@ -1,4 +1,3 @@
$Id: History 110572 2018-05-30 13:08:12Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +16,65 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
29 October 18: D.Sawkey (emutils-V10-04-25)
- G4EmBiasingManager - fix Valgrind warning
26 October 18: V.Ivant (emutils-V10-04-24)
- G4EmParameters - fixed typo in printout
16 October 18: D.Sawkey (emutils-V10-04-23)
- G4EmBiasingManager, G4VEmProcess, G4VEnergyLossProcess - move logic
for directional splitting to G4EmBiasingManager
03 October 18: D.Sawkey (emutils-V10-04-22)
- G4EmBiasingManager, G4EmParameters, G4EmParametersMessenger,
G4VEnergyLossProcess, G4VEmProcess - enable directional splitting
26 September 18: V.Ivant (emutils-V10-04-21)
- G4EmParameters, G4EmProcessSubType, G4LossTableManager - renamed
general process classes
- G4EmParametersMessenger - fixed UI command name, which enables
usage of the ICRU90 data (Lucas Norberto Burigo)
17 September 18: D.Sawkey (emutils-V10-04-20)
- G4EmModelManager, G4VEmModel, G4VEmProcess, G4VEnergyLossProcess,
G4VMultipleScattering: Auto-generated documentation no in rST format
31 August 18: V.Ivant (emutils-V10-04-19)
- G4EmCalculator - fixed computation dEdx for ions
14 August 18: V.Ivant (emutils-V10-04-18)
14 August 18: V.Ivant (emutils-V10-04-16)
- G4EmParameters, G4EmParametersMessenger - added extra parameter
to enable usage of ICRU90 data; fixed DNA parameters;
added checks of EM physics type
- G4VEmProcess, G4VEnergyLossProcess - take out attempt of
optimisation introduced previously, return back to 10.4 logic
27 July 18: V.Ivant (emutils-V10-04-15)
- G4EmParameters - added extra protection to avoid simulteneous
definition of options, which should not be enabled together
- G4VEmProcess - clean-up StorePhysicsTable(..) methods; introduce
isTheMaster flag
- G4EmDataHandler - added public interfaces
25 July 18: V.Ivant (emutils-V10-04-14)
- G4VEmProcess, G4VEnergyLossProcess - attempt optimise number of
calls to cross sections
- G4EmParameters, G4EmParametersMessenger - added extra parameters
- G4EmElementSelector - optimisation
13 July 18: V.Ivant (emutils-V10-04-13)
- G4VEmProcess, G4VEnergyLossProcess - move few class members from
private to protected, introduced check on energy change between
steps with factorDeltaE, allowing skip recomputation of cross
section at a step
- G4EmDataHandler - added methods
12 July 18: V.Ivant (emutils-V10-04-12)
- G4EmParameters, G4EmParameterMessenger, G4LossTableManager - minor
update of interfaces
30 May 18: V.Ivant (emutils-V10-04-11)
30 May 18: V.Ivant (emutils-V10-04-10)
- G4LossTableManager - moved inline run time method to source
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AngleDirect.hh 73844 2013-09-13 14:16:30Z vnivanch $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AtomicShell.hh 96626 2016-04-27 08:36:27Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VAtomDeexcitation.hh,v 1.9 2011-01-03 19:34:03 vnivanch Exp $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAModelSubType.hh 66241 2012-12-13 18:34:42Z gunter $
//
//---------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DummyModel.hh 96139 2016-03-17 14:10:31Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ElectronIonPair.hh 95657 2016-02-17 13:03:36Z gcosmo $
//
//
#ifndef G4ElectronIonPair_h
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmBiasingManager.hh 95657 2016-02-17 13:03:36Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -96,9 +95,9 @@ public:
const G4Track& track,
G4VEmModel* currentModel,
G4ParticleChangeForGamma* pParticleChange,
G4double& eloss,
G4int coupleIdx,
G4double tcut,
G4double& eloss,
G4int coupleIdx,
G4double tcut,
G4double safety = 0.0);
// for G4VEnergyLossProcess
@@ -107,7 +106,7 @@ public:
G4VEmModel* currentModel,
G4ParticleChangeForLoss* pParticleChange,
G4double& eloss,
G4int coupleIdx,
G4int coupleIdx,
G4double tcut,
G4double safety = 0.0);
@@ -121,6 +120,17 @@ public:
inline void ResetForcedInteraction();
G4bool CheckDirection(G4ThreeVector pos, G4ThreeVector momdir) const;
G4bool GetDirectionalSplitting() { return fDirectionalSplitting; }
void SetDirectionalSplitting(G4bool v) { fDirectionalSplitting = v; }
void SetDirectionalSplittingTarget(G4ThreeVector v)
{ fDirectionalSplittingTarget = v; }
void SetDirectionalSplittingRadius(G4double r)
{ fDirectionalSplittingRadius = r; }
G4double GetWeight(G4int i);
private:
void ApplyRangeCut(std::vector<G4DynamicParticle*>& vd,
@@ -134,6 +144,19 @@ private:
G4int index,
G4double tcut);
void ApplyDirectionalSplitting(std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
G4VEmModel* currentModel,
G4int index,
G4double tcut,
G4ParticleChangeForGamma* partChange);
void ApplyDirectionalSplitting(std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
G4VEmModel* currentModel,
G4int index,
G4double tcut);
inline G4double ApplyRussianRoulette(std::vector<G4DynamicParticle*>& vd,
G4int index);
@@ -158,10 +181,18 @@ private:
G4VEnergyLossProcess* eIonisation;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* theGamma;
G4double fSafetyMin;
G4double currentStepLimit;
G4bool startTracking;
G4double fWeight;
G4bool fDirectionalSplitting;
G4ThreeVector fDirectionalSplittingTarget;
G4double fDirectionalSplittingRadius;
std::vector<G4double> fDirectionalSplittingWeights;
};
inline G4bool
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.hh 108306 2018-02-02 13:10:06Z gcosmo $
//
//
// -------------------------------------------------------------------
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmConfigurator.hh 95657 2016-02-17 13:03:36Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.hh 108386 2018-02-09 15:38:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmDataHandler.hh 73844 2013-09-13 14:16:30Z vnivanch $
//
// -------------------------------------------------------------------
//
@@ -51,11 +50,13 @@
#include "globals.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsVector.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4ParticleDefinition;
class G4VEmProcess;
class G4EmDataHandler
{
@@ -67,23 +68,36 @@ public:
size_t SetTable(G4PhysicsTable*);
G4PhysicsTable* MakeTable();
G4PhysicsTable* MakeTable(size_t idx);
void CleanTable(size_t idx);
G4bool StorePhysicsTable(size_t idx,
const G4ParticleDefinition* part,
const G4String& namet,
const G4String& procname,
const G4String& fname,
G4bool ascii);
G4bool RetrievePhysicsTable(size_t idx,
const G4ParticleDefinition* part,
const G4String& namet,
const G4String& procname,
const G4String& fname,
G4bool ascii);
inline G4PhysicsTable* GetTable(size_t idx) { return data[idx]; }
void SetMasterProcess(const G4VEmProcess*);
inline std::vector<G4PhysicsTable*>& GetTables() { return data; }
const G4VEmProcess* GetMasterProcess(size_t idx) const;
inline const G4PhysicsTable* GetTable(size_t idx) const {
return (idx < tLength) ? data[idx] : nullptr;
}
inline G4PhysicsTable* Table(size_t idx) const {
return (idx < tLength) ? data[idx] : nullptr;
}
inline const G4PhysicsVector* GetVector(size_t itable, size_t ivec) const
{ return (*(data[itable]))[ivec]; }
inline const std::vector<G4PhysicsTable*>& GetTables() const { return data; }
// hide assignment operator
G4EmDataHandler & operator=(const G4EmDataHandler &right) = delete;
@@ -93,6 +107,7 @@ private:
std::vector<G4PhysicsTable*> data;
size_t tLength;
std::vector<const G4VEmProcess*> masterProcess;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmElementSelector.hh 95657 2016-02-17 13:03:36Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -108,8 +107,9 @@ inline const G4Element* G4EmElementSelector::SelectRandomAtom(G4double e) const
const G4Element* element = (*theElementVector)[nElmMinusOne];
if (nElmMinusOne > 0) {
G4double x = G4UniformRand();
size_t idx(0);
for(G4int i=0; i<nElmMinusOne; ++i) {
if (x <= (xSections[i])->Value(e)) {
if (x <= (xSections[i])->Value(e, idx)) {
element = (*theElementVector)[i];
break;
}
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.hh 106714 2017-10-20 09:38:06Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -178,7 +177,6 @@ public:
// Automatic documentation
void DumpModelList(std::ostream& out, G4int verb);
void DumpModelList(std::ostream& out, G4int verb, G4String endOfLine);
// Select model for given material cuts couple index
inline G4VEmModel* SelectModel(G4double& energy, size_t& index);
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmMultiModel.hh 95681 2016-02-18 09:44:18Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmParameters.hh 66885 2013-01-16 17:37:13Z gunter $
//
// -------------------------------------------------------------------
//
@@ -113,6 +112,7 @@ public:
void SetAuger(G4bool val);
G4bool Auger() const;
// obsolete methods
void SetAugerCascade(G4bool val);
G4bool AugerCascade() const;
@@ -146,6 +146,9 @@ public:
void SetBirksActive(G4bool val);
G4bool BirksActive() const;
void SetUseICRU90Data(G4bool val);
G4bool UseICRU90Data() const;
void SetDNAFast(G4bool val);
G4bool DNAFast() const;
@@ -155,8 +158,11 @@ public:
void SetDNAElectronMsc(G4bool val);
G4bool DNAElectronMsc() const;
void SetGammaSharkActive(G4bool val);
G4bool GammaSharkActive() const;
void SetGeneralProcessActive(G4bool val);
G4bool GeneralProcessActive() const;
void SetEnableSamplingTable(G4bool val);
G4bool EnableSamplingTable() const;
void SetEmSaturation(G4EmSaturation*);
G4EmSaturation* GetEmSaturation();
@@ -275,6 +281,7 @@ public:
const std::vector<G4String>& RegionsDNA() const;
const std::vector<G4String>& TypesDNA() const;
// obsolete methods
void AddMsc(const G4String& region, const G4String& type);
const std::vector<G4String>& RegionsMsc() const;
const std::vector<G4String>& TypesMsc() const;
@@ -301,6 +308,18 @@ public:
G4double factor,
G4double energyLimit);
G4bool GetDirectionalSplitting() { return directionalSplitting; }
void SetDirectionalSplitting(G4int v) { directionalSplitting = v; }
void SetDirectionalSplittingTarget(G4ThreeVector v)
{ directionalSplittingTarget = v; }
G4ThreeVector GetDirectionalSplittingTarget()
{ return directionalSplittingTarget; }
void SetDirectionalSplittingRadius(G4double r)
{ directionalSplittingRadius = r; }
G4double GetDirectionalSplittingRadius()
{ return directionalSplittingRadius; }
// initialisation methods
void DefineRegParamForLoss(G4VEnergyLossProcess*,
G4bool isElectron) const;
@@ -350,12 +369,15 @@ private:
G4bool useMottCorrection;
G4bool integral;
G4bool birks;
G4bool fICRU90;
G4bool dnaFast;
G4bool dnaStationary;
G4bool dnaMsc;
G4bool gammaShark;
G4bool gener;
G4bool enableSamplingTable;
G4bool onIsolated; // 5d model conversion on free ions
G4bool directionalSplitting;
G4double minSubRange;
G4double minKinEnergy;
G4double maxKinEnergy;
@@ -378,6 +400,7 @@ private:
G4double dRoverRangeMuHad;
G4double finalRangeMuHad;
G4double factorScreen;
G4double directionalSplittingRadius;
G4int nbins;
G4int nbinsPerDecade;
@@ -385,6 +408,8 @@ private:
G4int workerVerbose;
G4int tripletConv; // 5d model triplet generation type
G4ThreeVector directionalSplittingTarget;
G4MscStepLimitType mscStepLimit;
G4MscStepLimitType mscStepLimitMuHad;
G4NuclearFormfactorType nucFormfactor;
@@ -402,8 +427,8 @@ private:
std::vector<G4String> m_regnamesDNA;
std::vector<G4String> m_typesDNA;
std::vector<G4String> m_regnamesMsc;
std::vector<G4String> m_typesMsc;
std::vector<G4String> m_regnamesPhys;
std::vector<G4String> m_typesPhys;
std::vector<G4String> m_regnamesSubCut;
std::vector<G4bool> m_subCuts;
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmParametersMessenger.hh 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -61,6 +60,7 @@ class G4UIcmdWithAnInteger;
class G4UIcmdWithADouble;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4UIcmdWith3VectorAndUnit;
class G4EmParameters;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -109,6 +109,9 @@ private:
G4UIcmdWithABool* dnamscCmd;
G4UIcmdWithABool* sharkCmd;
G4UIcmdWithABool* onIsolatedCmd;
G4UIcmdWithABool* sampleTCmd;
G4UIcmdWithABool* icru90Cmd;
G4UIcmdWithABool* dirSplitCmd;
G4UIcmdWithADouble* minSubSecCmd;
G4UIcmdWithADoubleAndUnit* minEnCmd;
@@ -128,6 +131,7 @@ private:
G4UIcmdWithADouble* fgCmd;
G4UIcmdWithADouble* skinCmd;
G4UIcmdWithADouble* screCmd;
G4UIcmdWithADoubleAndUnit* dirSplitRadiusCmd;
G4UIcmdWithAnInteger* dedxCmd;
G4UIcmdWithAnInteger* lamCmd;
@@ -159,6 +163,7 @@ private:
G4UIcommand* bsCmd;
G4UIcmdWithAString* nffCmd;
G4UIcmdWith3VectorAndUnit* dirSplitTargetCmd;
};
#endif
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.hh 96088 2016-03-14 16:03:38Z gcosmo $
//
//
// -------------------------------------------------------------------
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessSubType.hh 66241 2012-12-13 18:34:42Z gunter $
//
//---------------------------------------------------------------
//
@@ -51,6 +50,7 @@ enum G4EmProcessSubType
fAnnihilationToMuMu = 6,
fAnnihilationToHadrons = 7,
fNuclearStopping = 8,
fElectronGeneralProcess = 9,
fMultipleScattering = 10,
@@ -59,6 +59,7 @@ enum G4EmProcessSubType
fComptonScattering = 13,
fGammaConversion = 14,
fGammaConversionToMuMu = 15,
fGammaGeneralProcess = 16,
fCerenkov = 21,
fScintillation = 22,
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmSaturation.hh 100346 2016-10-18 15:30:36Z gcosmo $
//
//
#ifndef G4EmSaturation_h
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
// $Id: G4EmTableType.hh 66241 2012-12-13 18:34:42Z gunter $
//
//---------------------------------------------------------------
//
@@ -24,9 +24,7 @@
// ********************************************************************
//
//
// $Id: G4EnergyLossTables.hh 77290 2013-11-22 10:57:50Z gcosmo $
//
// $Id:
//
// -----------------------------------------------------------------------------
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableBuilder.hh 96088 2016-03-14 16:03:38Z gcosmo $
//
//
// -------------------------------------------------------------------
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.hh 110572 2018-05-30 13:08:12Z gcosmo $
//
//
// -------------------------------------------------------------------
@@ -96,7 +95,6 @@ class G4EmConfigurator;
class G4ElectronIonPair;
class G4VMultipleScattering;
class G4VEmProcess;
class G4GammaShark;
class G4LossTableManager
{
@@ -239,9 +237,13 @@ public:
inline G4LossTableBuilder* GetTableBuilder();
inline void SetGammaShark(G4GammaShark*);
inline void SetGammaGeneralProcess(G4VEmProcess*);
inline G4GammaShark* GetGammaShark();
inline G4VEmProcess* GetGammaGeneralProcess();
inline void SetElectronGeneralProcess(G4VEnergyLossProcess*);
inline G4VEnergyLossProcess* GetElectronGeneralProcess();
private:
@@ -306,11 +308,11 @@ private:
G4VAtomDeexcitation* atomDeexcitation;
G4VSubCutProducer* subcutProducer;
G4EmParameters* theParameters;
G4GammaShark* gammaShark;
G4EmParameters* theParameters;
G4VEmProcess* gGeneral;
G4VEnergyLossProcess* eGeneral;
G4int verbose;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -429,15 +431,36 @@ inline G4LossTableBuilder* G4LossTableManager::GetTableBuilder()
return tableBuilder;
}
inline void G4LossTableManager::SetGammaShark(G4GammaShark* ptr)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4LossTableManager::SetGammaGeneralProcess(G4VEmProcess* ptr)
{
gammaShark = ptr;
gGeneral = ptr;
}
inline G4GammaShark* G4LossTableManager::GetGammaShark()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmProcess* G4LossTableManager::GetGammaGeneralProcess()
{
return gammaShark;
return gGeneral;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
void G4LossTableManager::SetElectronGeneralProcess(G4VEnergyLossProcess* ptr)
{
eGeneral = ptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEnergyLossProcess* G4LossTableManager::GetElectronGeneralProcess()
{
return eGeneral;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
// $Id: G4MscStepLimitType.hh 84204 2014-10-10 14:40:56Z gcosmo $
//
//---------------------------------------------------------------
//
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
// $Id: G4NuclearFormfactorType.hh 84082 2014-10-06 14:33:09Z urban $
//
//---------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VAtomDeexcitation.hh 108386 2018-02-09 15:38:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmAngularDistribution.hh 110416 2018-05-23 06:45:42Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.hh 106208 2017-09-20 01:53:57Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.hh 108386 2018-02-09 15:38:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -223,9 +222,6 @@ public:
// for automatic documentation
virtual void ModelDescription(std::ostream& outFile) const;
virtual void ModelDescription(std::ostream& outFile,
G4String endOfLine) const;
protected:
@@ -529,7 +525,7 @@ G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* part,
G4double emax)
{
G4double cross = CrossSectionPerVolume(material,part,ekin,emin,emax);
return cross > 0.0 ? 1./cross : DBL_MAX;
return (cross > 0.0) ? 1./cross : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -827,4 +823,3 @@ inline void G4VEmModel::SetLocked(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#endif
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.hh 109178 2018-04-03 07:13:58Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -36,29 +35,11 @@
//
// Creation date: 01.10.2003
//
// Modifications:
// 30-06-04 make destructor virtual (V.Ivanchenko)
// 09-08-04 optimise integral option (V.Ivanchenko)
// 11-08-04 add protected methods to access cuts (V.Ivanchenko)
// 09-09-04 Bug fix for the integral mode with 2 peaks (V.Ivanchneko)
// 16-09-04 Add flag for LambdaTable and method RecalculateLambda (VI)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 18-04-05 Use G4ParticleChangeForGamma (V.Ivantchenko)
// 09-05-05 Fix problem in logic when path boundary between materials (VI)
// 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI)
// 01-02-06 put default value A=0. to keep compatibility with v5.2 (mma)
// 13-05-06 Add method to access model by index (V.Ivanchenko)
// 12-09-06 add SetModel() (mma)
// 25-09-07 More accurate handling zero xsect in
// PostStepGetPhysicalInteractionLength (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
// 15-07-08 Reorder class members for further multi-thread development (VI)
// 17-02-10 Added pointer currentParticle (VI)
// Modifications: Vladimir Ivanchenko
//
// Class Description:
//
// It is the unified Discrete process
// It is the base class - EM discrete and rest/discrete process
// -------------------------------------------------------------------
//
@@ -77,6 +58,7 @@
#include "G4UnitsTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4EmDataHandler.hh"
#include "G4EmParameters.hh"
class G4Step;
@@ -112,7 +94,7 @@ public:
protected:
virtual void StreamProcessInfo(std::ostream&, G4String) const {};
virtual void StreamProcessInfo(std::ostream&) const {};
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
@@ -169,17 +151,17 @@ public:
// It returns the cross section per volume for energy/ material
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
const G4MaterialCutsCouple* couple);
// It returns the cross section of the process per atom
G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A=0.,
G4double cut=0.0);
G4double Z, G4double A=0.,
G4double cut=0.0);
G4double MeanFreePath(const G4Track& track);
// It returns cross section per volume
inline G4double GetLambda(G4double& kinEnergy,
inline G4double GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
//------------------------------------------------------------------------
@@ -215,12 +197,12 @@ public:
protected:
// Select model in run time
inline G4VEmModel* SelectModel(G4double& kinEnergy, size_t index);
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;
size_t idxRegion) const;
// Add model for region, smaller value of order defines which
// model will be selected for a given energy interval
@@ -259,11 +241,15 @@ public:
void ActivateSecondaryBiasing(const G4String& region, G4double factor,
G4double energyLimit);
inline void SetEmMasterProcess(const G4VEmProcess*);
inline void SetIntegral(G4bool val);
inline void SetBuildTableFlag(G4bool val);
inline void CurrentSetup(const G4MaterialCutsCouple*, G4double energy);
//------------------------------------------------------------------------
// Other generic methods
//------------------------------------------------------------------------
@@ -321,15 +307,15 @@ private:
void BuildLambdaTable();
void StreamInfo(std::ostream& outFile, const G4ParticleDefinition&,
G4String endOfLine=G4String("\n")) const;
G4bool rst=false) const;
void FindLambdaMax();
void PrintWarning(G4String tit, G4double val);
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
void ComputeIntegralLambda(G4double kinEnergy);
inline void ComputeIntegralLambda(G4double kinEnergy);
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
inline G4double GetLambdaFromTable(G4double kinEnergy);
@@ -345,8 +331,6 @@ private:
// ======== Parameters of the class fixed at construction =========
G4LossTableManager* lManager;
G4EmParameters* theParameters;
G4EmModelManager* modelManager;
const G4ParticleDefinition* thePositron;
const G4ParticleDefinition* secondaryParticle;
@@ -397,12 +381,17 @@ private:
protected:
G4LossTableManager* lManager;
G4EmParameters* theParameters;
G4EmBiasingManager* biasManager;
const G4ParticleDefinition* theGamma;
const G4ParticleDefinition* theElectron;
G4ParticleChangeForGamma fParticleChange;
std::vector<G4DynamicParticle*> secParticles;
const G4MaterialCutsCouple* currentCouple;
const G4Material* currentMaterial;
size_t currentCoupleIndex;
G4int mainSecondaries;
G4int secID;
@@ -410,8 +399,16 @@ protected:
G4int augerID;
G4int biasID;
G4bool isTheMaster;
G4double mfpKinEnergy;
G4double preStepKinEnergy;
G4double preStepLambda;
private:
const G4VEmProcess* masterProc;
G4EmDataHandler* theData;
G4VEmModel* currentModel;
const G4ParticleDefinition* particle;
@@ -419,13 +416,8 @@ private:
// cache
const G4Material* baseMaterial;
const G4Material* currentMaterial;
size_t currentCoupleIndex;
size_t basedCoupleIndex;
G4double mfpKinEnergy;
G4double preStepKinEnergy;
G4double preStepLambda;
G4double fFactor;
G4bool biasFlag;
G4bool weightFlag;
@@ -473,12 +465,13 @@ inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
if(couple != currentCouple) {
currentCouple = couple;
currentMaterial = couple->GetMaterial();
baseMaterial = currentMaterial->GetBaseMaterial();
baseMaterial = (currentMaterial->GetBaseMaterial())
? currentMaterial->GetBaseMaterial() : currentMaterial;
currentCoupleIndex = couple->GetIndex();
basedCoupleIndex = (*theDensityIdx)[currentCoupleIndex];
fFactor = biasFactor*(*theDensityFactor)[currentCoupleIndex];
if(!baseMaterial) { baseMaterial = currentMaterial; }
mfpKinEnergy = DBL_MAX;
preStepKinEnergy = 0.0;
idxLambda = idxLambdaPrim = 0;
}
}
@@ -486,7 +479,7 @@ inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy, size_t index)
G4VEmModel* G4VEmProcess::SelectModel(G4double kinEnergy, size_t index)
{
if(1 < numberOfModels) {
currentModel = modelManager->SelectModel(kinEnergy, index);
@@ -499,7 +492,7 @@ G4VEmModel* G4VEmProcess::SelectModel(G4double& kinEnergy, size_t index)
inline
G4VEmModel* G4VEmProcess::SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const
size_t idxRegion) const
{
return modelManager->SelectModel(kinEnergy, idxRegion);
}
@@ -530,21 +523,29 @@ inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
{
G4double x;
G4double x(0.0);
if(e >= minKinEnergyPrim) { x = GetLambdaFromTablePrim(e); }
else if(theLambdaTable) { x = GetLambdaFromTable(e); }
else { x = ComputeCurrentLambda(e); }
else if(currentModel) { x = ComputeCurrentLambda(e); }
return fFactor*x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEmProcess::GetLambda(G4double& kinEnergy,
const G4MaterialCutsCouple* couple)
inline void
G4VEmProcess::CurrentSetup(const G4MaterialCutsCouple* couple, G4double energy)
{
DefineMaterial(couple);
SelectModel(kinEnergy, currentCoupleIndex);
SelectModel(energy, currentCoupleIndex);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEmProcess::GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
CurrentSetup(couple, kinEnergy);
return GetCurrentLambda(kinEnergy);
}
@@ -553,34 +554,10 @@ G4VEmProcess::GetLambda(G4double& kinEnergy,
inline G4double
G4VEmProcess::RecalculateLambda(G4double e, const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
SelectModel(e, currentCoupleIndex);
CurrentSetup(couple, e);
return fFactor*ComputeCurrentLambda(e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
{
mfpKinEnergy = theEnergyOfCrossSectionMax[currentCoupleIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetCurrentLambda(e);
} else {
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetCurrentLambda(e);
G4double preStepLambda1 = GetCurrentLambda(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
}
}
}
// ======== Get/Set inline methods used at initialisation ================
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -727,4 +704,11 @@ inline const G4VEmModel* G4VEmProcess::GetCurrentModel() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetEmMasterProcess(const G4VEmProcess* ptr)
{
masterProc = ptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.hh 106714 2017-10-20 09:38:06Z gcosmo $
// GEANT4 tag $Name:
//
// -------------------------------------------------------------------
//
@@ -37,48 +35,7 @@
//
// Creation date: 03.01.2002
//
// Modifications:
//
// 26-12-02 Secondary production moved to derived classes (V.Ivanchenko)
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
// 24-01-03 Make models region aware (V.Ivanchenko)
// 05-02-03 Fix compilation warnings (V.Ivanchenko)
// 13-02-03 SubCutoffProcessors defined for regions (V.Ivanchenko)
// 17-02-03 Fix problem of store/restore tables (V.Ivanchenko)
// 26-02-03 Region dependent step limit (V.Ivanchenko)
// 26-03-03 Add GetDEDXDispersion (V.Ivanchenko)
// 09-04-03 Fix problem of negative range limit for non integral (V.Ivanchenko)
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
// 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
// 14-01-04 Activate precise range calculation (V.Ivanchenko)
// 10-03-04 Fix problem of step limit calculation (V.Ivanchenko)
// 30-06-04 make destructor virtual (V.Ivanchenko)
// 05-07-04 fix problem of GenericIons seen at small cuts (V.Ivanchenko)
// 03-08-04 Add DEDX table to all processes for control on integral range(VI)
// 06-08-04 Clear up names of member functions (V.Ivanchenko)
// 27-08-04 Add NeedBuildTables method (V.Ivanchneko)
// 09-09-04 Bug fix for the integral mode with 2 peaks (V.Ivanchneko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
// 11-04-05 Use MaxSecondaryEnergy from a model (V.Ivanchenko)
// 10-01-05 Remove SetStepLimits (V.Ivanchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 13-01-06 Remove AddSubCutSecondaries and cleanup (V.Ivantchenko)
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 26-01-06 Add public method GetCSDARange (V.Ivanchenko)
// 22-03-06 Add SetDynamicMassCharge (V.Ivanchenko)
// 23-03-06 Use isIonisation flag (V.Ivanchenko)
// 13-05-06 Add method to access model by index (V.Ivanchenko)
// 14-01-07 add SetEmModel(index) and SetFluctModel() (mma)
// 15-01-07 Add separate ionisation tables and reorganise get/set methods for
// dedx tables (V.Ivanchenko)
// 13-03-07 use SafetyHelper instead of navigator (V.Ivanchenko)
// 27-07-07 use stl vector for emModels instead of C-array (V.Ivanchenko)
// 25-09-07 More accurate handling zero xsect in
// PostStepGetPhysicalInteractionLength (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
// 15-07-08 Reorder class members for further multi-thread development (VI)
// Modifications: Vladimir Ivanchenko
//
// Class Description:
//
@@ -148,7 +105,7 @@ public:
protected:
virtual void StreamProcessInfo(std::ostream&, G4String) const {};
virtual void StreamProcessInfo(std::ostream&) const {};
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*) = 0;
@@ -226,7 +183,7 @@ private:
// summary printout after initialisation
void StreamInfo(std::ostream& out, const G4ParticleDefinition& part,
G4String endOfLine=G4String("\n")) const;
G4bool rst=false) const;
// store a table
G4bool StoreTable(const G4ParticleDefinition* p,
@@ -408,19 +365,19 @@ public:
inline G4double CrossSectionBiasingFactor() const;
// Return values for given G4MaterialCutsCouple
inline G4double GetDEDX(G4double& kineticEnergy,
inline G4double GetDEDX(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetDEDXForSubsec(G4double& kineticEnergy,
inline G4double GetDEDXForSubsec(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRange(G4double& kineticEnergy,
inline G4double GetRange(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetCSDARange(G4double& kineticEnergy,
inline G4double GetCSDARange(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRangeForLoss(G4double& kineticEnergy,
inline G4double GetRangeForLoss(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetKineticEnergy(G4double& range,
inline G4double GetKineticEnergy(G4double range,
const G4MaterialCutsCouple*);
inline G4double GetLambda(G4double& kineticEnergy,
inline G4double GetLambda(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4bool TablesAreBuilt() const;
@@ -469,7 +426,7 @@ private:
inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
inline G4double ScaledKinEnergyForLoss(G4double range);
inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
inline void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
// hide assignment operator
G4VEnergyLossProcess(G4VEnergyLossProcess &) = delete;
@@ -575,7 +532,18 @@ private:
protected:
G4ParticleChangeForLoss fParticleChange;
G4ParticleChangeForLoss fParticleChange;
const G4Material* currentMaterial;
const G4MaterialCutsCouple* currentCouple;
size_t currentCoupleIndex;
G4double preStepLambda;
G4double fRange;
G4double computedRange;
G4double preStepKinEnergy;
G4double preStepScaledEnergy;
G4double preStepRangeEnergy;
G4double mfpKinEnergy;
// ======== Cached values - may be state dependent ================
@@ -587,9 +555,6 @@ private:
const G4ParticleDefinition* particle;
G4VEmModel* currentModel;
const G4Material* currentMaterial;
const G4MaterialCutsCouple* currentCouple;
size_t currentCoupleIndex;
size_t basedCoupleIndex;
size_t lastIdx;
@@ -598,14 +563,6 @@ private:
G4double reduceFactor;
G4double chargeSqRatio;
G4double preStepLambda;
G4double fRange;
G4double computedRange;
G4double preStepKinEnergy;
G4double preStepScaledEnergy;
G4double preStepRangeEnergy;
G4double mfpKinEnergy;
G4GPILSelection aGPILSelection;
G4int secID;
@@ -774,7 +731,7 @@ inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetDEDX(G4double& kineticEnergy,
G4VEnergyLossProcess::GetDEDX(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
@@ -784,7 +741,7 @@ G4VEnergyLossProcess::GetDEDX(G4double& kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetDEDXForSubsec(G4double& kineticEnergy,
G4VEnergyLossProcess::GetDEDXForSubsec(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
@@ -794,7 +751,7 @@ G4VEnergyLossProcess::GetDEDXForSubsec(G4double& kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetRange(G4double& kineticEnergy,
G4VEnergyLossProcess::GetRange(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
G4double x = fRange;
@@ -811,7 +768,7 @@ G4VEnergyLossProcess::GetRange(G4double& kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetCSDARange(G4double& kineticEnergy,
G4VEnergyLossProcess::GetCSDARange(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
@@ -823,7 +780,7 @@ G4VEnergyLossProcess::GetCSDARange(G4double& kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetRangeForLoss(G4double& kineticEnergy,
G4VEnergyLossProcess::GetRangeForLoss(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
// G4cout << "GetRangeForLoss: Range from " << GetProcessName() << G4endl;
@@ -834,7 +791,7 @@ G4VEnergyLossProcess::GetRangeForLoss(G4double& kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetKineticEnergy(G4double& range,
G4VEnergyLossProcess::GetKineticEnergy(G4double range,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
@@ -844,36 +801,13 @@ G4VEnergyLossProcess::GetKineticEnergy(G4double& range,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
G4VEnergyLossProcess::GetLambda(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return theLambdaTable ? GetLambdaForScaledEnergy(kineticEnergy*massRatio) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
{
mfpKinEnergy = theEnergyOfCrossSectionMax[currentCoupleIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambdaForScaledEnergy(e);
} else {
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetLambdaForScaledEnergy(e);
G4double preStepLambda1 = GetLambdaForScaledEnergy(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
}
}
}
// ======== Get/Set inline methods used at initialisation ================
inline void G4VEnergyLossProcess::SetFluctModel(G4VEmFluctuationModel* p)
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMscModel.hh 110572 2018-05-30 13:08:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.hh 106714 2017-10-20 09:38:06Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -113,7 +112,7 @@ protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
virtual void StreamProcessInfo(std::ostream&, G4String) const {};
virtual void StreamProcessInfo(std::ostream&) const {};
public:
@@ -253,7 +252,7 @@ private:
// Print out of generic class parameters
void StreamInfo(std::ostream& outFile, const G4ParticleDefinition&,
G4String endOfLine=G4String("\n")) const;
G4bool rst=false) const;
// ======== Parameters of the class fixed at construction =========
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VSubCutProducer.hh 73844 2013-09-13 14:16:30Z vnivanch $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.hh 108386 2018-02-09 15:38:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -11,7 +11,6 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 110416 2018-05-23 06:45:42Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AngleDirect.cc 73844 2013-09-13 14:16:30Z vnivanch $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DummyModel.cc 97432 2016-06-03 07:23:39Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ElectronIonPair.cc 92921 2015-09-21 15:06:51Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmBiasingManager.cc 98860 2016-08-15 09:59:59Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -48,6 +47,7 @@
#include "G4EmBiasingManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4ProductionCutsTable.hh"
#include "G4ProductionCuts.hh"
@@ -55,10 +55,12 @@
#include "G4RegionStore.hh"
#include "G4Track.hh"
#include "G4Electron.hh"
#include "G4Gamma.hh"
#include "G4VEmModel.hh"
#include "G4LossTableManager.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4EmParameters.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -68,6 +70,13 @@ G4EmBiasingManager::G4EmBiasingManager()
{
fSafetyMin = 1.e-6*mm;
theElectron = G4Electron::Electron();
theGamma = G4Gamma::Gamma();
fDirectionalSplitting = false;
fDirectionalSplittingRadius = 0.;
fDirectionalSplittingTarget = G4ThreeVector(0.,0.,0.);
fDirectionalSplittingWeights.clear();
fWeight = 1.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -116,6 +125,14 @@ void G4EmBiasingManager::Initialise(const G4ParticleDefinition& part,
}
}
}
G4EmParameters* param = G4EmParameters::Instance();
SetDirectionalSplitting(param->GetDirectionalSplitting());
if (fDirectionalSplitting) {
SetDirectionalSplittingTarget(param->GetDirectionalSplittingTarget());
SetDirectionalSplittingRadius(param->GetDirectionalSplittingRadius());
}
if (nForcedRegions > 0 && 0 < verbose) {
G4cout << " Forced Interaction is activated for "
<< part.GetParticleName() << " and "
@@ -138,6 +155,13 @@ void G4EmBiasingManager::Initialise(const G4ParticleDefinition& part,
<< " BiasingWeight= " << secBiasedWeight[i] << G4endl;
}
}
if (fDirectionalSplitting) {
G4cout << " Directional splitting activated, with target position: "
<< fDirectionalSplittingTarget/cm
<< " cm; radius: "
<< fDirectionalSplittingRadius/cm
<< "cm." << G4endl;
}
}
}
@@ -280,14 +304,15 @@ G4EmBiasingManager::ApplySecondaryBiasing(
G4double safety)
{
G4int index = idxSecBiasedCouple[coupleIdx];
G4double weight = 1.0;
fWeight = 1.0;
if(0 <= index) {
size_t n = vd.size();
// the check cannot be applied per secondary particle
// because weight correction is common, so the first
// secondary is checked
if(0 < n && vd[0]->GetKineticEnergy() < secBiasedEnegryLimit[index]) {
if((0 < n && vd[0]->GetKineticEnergy() < secBiasedEnegryLimit[index])
|| fDirectionalSplitting) {
G4int nsplit = nBremSplitting[index];
@@ -297,21 +322,26 @@ G4EmBiasingManager::ApplySecondaryBiasing(
// Russian Roulette
} else if(1 == nsplit) {
weight = ApplyRussianRoulette(vd, index);
fWeight = ApplyRussianRoulette(vd, index);
// Splitting
} else {
G4double tmpEnergy = pPartChange->GetProposedKineticEnergy();
G4ThreeVector tmpMomDir = pPartChange->GetProposedMomentumDirection();
if (fDirectionalSplitting) {
ApplyDirectionalSplitting(vd, track, currentModel, index, tcut);
fWeight = 1.;
} else {
G4double tmpEnergy = pPartChange->GetProposedKineticEnergy();
G4ThreeVector tmpMomDir = pPartChange->GetProposedMomentumDirection();
weight = ApplySplitting(vd, track, currentModel, index, tcut);
fWeight = ApplySplitting(vd, track, currentModel, index, tcut);
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
}
}
}
}
return weight;
return fWeight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -328,14 +358,15 @@ G4EmBiasingManager::ApplySecondaryBiasing(
G4double safety)
{
G4int index = idxSecBiasedCouple[coupleIdx];
G4double weight = 1.0;
fWeight = 1.0;
if(0 <= index) {
size_t n = vd.size();
// the check cannot be applied per secondary particle
// because weight correction is common, so the first
// secondary is checked
if(0 < n && vd[0]->GetKineticEnergy() < secBiasedEnegryLimit[index]) {
if((0 < n && vd[0]->GetKineticEnergy() < secBiasedEnegryLimit[index])
|| fDirectionalSplitting) {
G4int nsplit = nBremSplitting[index];
@@ -345,21 +376,27 @@ G4EmBiasingManager::ApplySecondaryBiasing(
// Russian Roulette
} else if(1 == nsplit) {
weight = ApplyRussianRoulette(vd, index);
fWeight = ApplyRussianRoulette(vd, index);
// Splitting
} else {
G4double tmpEnergy = pPartChange->GetProposedKineticEnergy();
G4ThreeVector tmpMomDir = pPartChange->GetProposedMomentumDirection();
if (fDirectionalSplitting) {
ApplyDirectionalSplitting(vd, track, currentModel,
index, tcut, pPartChange);
fWeight = 1.;
} else {
G4double tmpEnergy = pPartChange->GetProposedKineticEnergy();
G4ThreeVector tmpMomDir = pPartChange->GetProposedMomentumDirection();
weight = ApplySplitting(vd, track, currentModel, index, tcut);
fWeight = ApplySplitting(vd, track, currentModel, index, tcut);
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
pPartChange->SetProposedKineticEnergy(tmpEnergy);
pPartChange->ProposeMomentumDirection(tmpMomDir);
}
}
}
}
return weight;
return fWeight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -369,7 +406,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
G4int coupleIdx)
{
G4int index = idxSecBiasedCouple[coupleIdx];
G4double weight = 1.0;
fWeight = 1.0;
if(0 <= index) {
size_t n = track.size();
@@ -382,9 +419,9 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
// Russian Roulette only
if(1 == nsplit) {
weight = secBiasedWeight[index];
fWeight = secBiasedWeight[index];
for(size_t k=0; k<n; ++k) {
if(G4UniformRand()*weight > 1.0) {
if(G4UniformRand()*fWeight > 1.0) {
const G4Track* t = track[k];
delete t;
track[k] = 0;
@@ -393,7 +430,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
}
}
}
return weight;
return fWeight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -426,6 +463,20 @@ G4EmBiasingManager::ApplyRangeCut(std::vector<G4DynamicParticle*>& vd,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4EmBiasingManager::CheckDirection(G4ThreeVector pos,
G4ThreeVector momdir) const
{
G4ThreeVector delta = fDirectionalSplittingTarget - pos;
G4double angle = momdir.angle(delta);
G4double dist = delta.cross(momdir).mag();
if (dist <= fDirectionalSplittingRadius && angle < halfpi) {
return true;
}
return false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
@@ -434,28 +485,28 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
G4double tcut)
{
// method is applied only if 1 secondary created PostStep
// in the case of many secodndaries there is a contrudition
G4double weight = 1.0;
// in the case of many secondaries there is a contradiction
fWeight = 1.0;
size_t n = vd.size();
G4double w = secBiasedWeight[index];
if(1 != n || 1.0 <= w) { return weight; }
if(1 != n || 1.0 <= w) { return fWeight; }
G4double trackWeight = track.GetWeight();
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
G4int nsplit = nBremSplitting[index];
// double splitting is supressed
// double splitting is suppressed
if(1 < nsplit && trackWeight>w) {
weight = w;
// start from 1, because already one secondary created
fWeight = w;
if(nsplit > (G4int)tmpSecondaries.size()) {
tmpSecondaries.reserve(nsplit);
}
const G4MaterialCutsCouple* couple = track.GetMaterialCutsCouple();
for(G4int k=1; k<nsplit; ++k) {
// start from 1, because already one secondary created
for(G4int k=1; k<nsplit; ++k) {
tmpSecondaries.clear();
currentModel->SampleSecondaries(&tmpSecondaries, couple, dynParticle,
tcut);
@@ -464,7 +515,183 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
}
}
}
return weight;
return fWeight;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4EmBiasingManager::ApplyDirectionalSplitting(
std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
G4VEmModel* currentModel,
G4int index,
G4double tcut,
G4ParticleChangeForGamma* partChange)
{
// primary is gamma. do splitting/RR as appropriate
// method applied for any number of secondaries
G4double weight = 1.0;
G4double w = secBiasedWeight[index];
fDirectionalSplittingWeights.clear();
if(1.0 <= w) {
fDirectionalSplittingWeights.push_back(fWeight);
return;
}
G4double trackWeight = track.GetWeight();
G4int nsplit = nBremSplitting[index];
// double splitting is suppressed
if(1 < nsplit && trackWeight>w) {
weight = w;
const G4ThreeVector pos = track.GetPosition();
G4bool foundPrimaryParticle = false;
G4double primaryEnergy = 0.;
G4ThreeVector primaryMomdir(0.,0.,0.);
G4double primaryWeight = trackWeight;
tmpSecondaries = vd;
vd.clear();
vd.reserve(nsplit);
for (G4int k=0; k<nsplit; ++k) {
if (k>0) { // for k==0, SampleSecondaries has already been called
tmpSecondaries.clear();
// SampleSecondaries modifies primary info stored in partChange
currentModel->SampleSecondaries(&tmpSecondaries,
track.GetMaterialCutsCouple(),
track.GetDynamicParticle(), tcut);
}
for (auto sec : tmpSecondaries) {
if (sec->GetParticleDefinition() == theGamma) {
if (CheckDirection(pos, sec->GetMomentumDirection())) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(weight);
} else if (G4UniformRand() < w) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.0);
}
} else if (k==0) { // not gamma
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.);
}
}
// primary
G4double en = partChange->GetProposedKineticEnergy();
if (en>0.) { // don't add if kinetic energy = 0
G4ThreeVector momdir = partChange->GetProposedMomentumDirection();
if (CheckDirection(pos,momdir)) {
// keep only one primary; others are secondaries
if (!foundPrimaryParticle) {
primaryEnergy = en;
primaryMomdir = momdir;
foundPrimaryParticle = true;
primaryWeight = weight;
} else {
G4DynamicParticle* dp = new G4DynamicParticle(theGamma,
partChange->GetProposedMomentumDirection(),
partChange->GetProposedKineticEnergy());
vd.push_back(dp);
fDirectionalSplittingWeights.push_back(weight);
}
} else if (G4UniformRand()<w) { // not going to target. play RR.
if (!foundPrimaryParticle) {
foundPrimaryParticle = true;
primaryEnergy = en;
primaryMomdir = momdir;
primaryWeight = 1.;
} else {
G4DynamicParticle* dp = new G4DynamicParticle(theGamma,
partChange->GetProposedMomentumDirection(),
partChange->GetProposedKineticEnergy());
vd.push_back(dp);
fDirectionalSplittingWeights.push_back(1.0);
}
}
}
} // end of loop over nsplit
partChange->ProposeWeight(primaryWeight);
partChange->SetProposedKineticEnergy(primaryEnergy);
partChange->ProposeMomentumDirection(primaryMomdir);
} else {
for (size_t i = 0; i < vd.size(); ++i) {
fDirectionalSplittingWeights.push_back(trackWeight);
}
}
return;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmBiasingManager::GetWeight(G4int i)
{
if (fDirectionalSplittingWeights.size() >= (unsigned int)(i+1) ) {
return fDirectionalSplittingWeights[i];
}
else {
return fWeight;
}
}
void
G4EmBiasingManager::ApplyDirectionalSplitting(
std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
G4VEmModel* currentModel,
G4int index,
G4double tcut)
{
// Do nothing with primary
G4double weight = 1.0;
G4double w = secBiasedWeight[index];
fDirectionalSplittingWeights.clear();
if(1.0 <= w) {
fDirectionalSplittingWeights.push_back(weight);
return;
}
G4double trackWeight = track.GetWeight();
G4int nsplit = nBremSplitting[index];
// double splitting is suppressed
if(1 < nsplit && trackWeight>w) {
weight = w;
const G4ThreeVector pos = track.GetPosition();
tmpSecondaries = vd;
vd.clear();
vd.reserve(nsplit);
for (G4int k=0; k<nsplit; ++k) {
if (k>0) {
tmpSecondaries.clear();
currentModel->SampleSecondaries(&tmpSecondaries,
track.GetMaterialCutsCouple(),
track.GetDynamicParticle(), tcut);
}
for (auto sec : tmpSecondaries) {
if (CheckDirection(pos, sec->GetMomentumDirection())) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(weight);
} else if (G4UniformRand()<w) {
vd.push_back(sec);
fDirectionalSplittingWeights.push_back(1.0);
}
}
} // end of loop over nsplit
} else { // no splitting was done; still need weights
for (size_t i = 0; i < vd.size(); ++i) {
fDirectionalSplittingWeights.push_back(trackWeight);
}
}
return;
}
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.cc 108306 2018-02-02 13:10:06Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -36,28 +35,8 @@
//
// Creation date: 28.06.2004
//
// Modifications:
// 12.09.2004 Add verbosity (V.Ivanchenko)
// 17.11.2004 Change signature of methods, add new methods (V.Ivanchenko)
// 08.04.2005 Major optimisation of internal interfaces (V.Ivantchenko)
// 08.05.2005 Use updated interfaces (V.Ivantchenko)
// 23.10.2005 Fix computations for ions (V.Ivantchenko)
// 11.01.2006 Add GetCSDARange (V.Ivantchenko)
// 26.01.2006 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
// 14.03.2006 correction in GetCrossSectionPerVolume (mma)
// suppress GetCrossSectionPerAtom
// elm->GetA() in ComputeCrossSectionPerAtom
// 22.03.2006 Add ComputeElectronicDEDX and ComputeTotalDEDX (V.Ivanchenko)
// 13.05.2006 Add Corrections for ion stopping (V.Ivanchenko)
// 29.09.2006 Uncomment computation of smoothing factor (V.Ivanchenko)
// 27.10.2006 Change test energy to access lowEnergy model from
// 10 keV to 1 keV (V. Ivanchenko)
// 15.03.2007 Add ComputeEnergyCutFromRangeCut methods (V.Ivanchenko)
// 21.04.2008 Updated computations for ions (V.Ivanchenko)
// 02.02.2018 Fix the MCS (i.e. transport mean free path) case in
// GetCrossSectionPerVolume (M. Novak)
//
// Class Description:
// Class Description: V.Ivanchenko & M.Novak
//
// -------------------------------------------------------------------
//
@@ -289,7 +268,7 @@ G4double G4EmCalculator::GetCrossSectionPerVolume(G4double kinEnergy,
G4VEmProcess* emproc = FindDiscreteProcess(p, processName);
if(emproc) {
res = emproc->CrossSectionPerVolume(kinEnergy, couple);
res = emproc->CrossSectionPerVolume(kinEnergy, couple);
} else if(currentLambda) {
// special tables are built for Msc models (procType is set in FindLambdaTable
if(procType==2) {
@@ -408,7 +387,8 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
if(FindEmModel(p, processName, kinEnergy)) {
// Special case of ICRU'73 model
if(currentModel->GetName() == "ParamICRU73") {
const G4String& mname = currentModel->GetName();
if(mname == "ParamICRU73" || mname == "LinhardSorensen" || mname == "Atima") {
res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
if(verbose > 1) {
G4cout << " ICRU73 ion E(MeV)= " << kinEnergy << " ";
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmConfigurator.cc 106507 2017-10-12 08:24:49Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.cc 110572 2018-05-30 13:08:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmDataHandler.cc 73844 2013-09-13 14:16:30Z vnivanch $
//
// -------------------------------------------------------------------
//
@@ -45,25 +44,22 @@
#include "G4ParticleDefinition.hh"
#include "G4EmParameters.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4VEmProcess.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EmDataHandler::G4EmDataHandler(size_t n) : tLength(0)
G4EmDataHandler::G4EmDataHandler(size_t n) : tLength(n)
{
data.reserve(n);
data.resize(n, nullptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4EmDataHandler::~G4EmDataHandler()
{
for(auto & table : data) {
if(table) {
table->clearAndDestroy();
delete table;
}
}
data.clear();
//std::cout << "G4EmDataHandler::~G4EmDataHandler "
// << tLength << " " << this << std::endl;
for(size_t i=0; i<tLength; ++i) { CleanTable(i); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -77,37 +73,53 @@ size_t G4EmDataHandler::SetTable(G4PhysicsTable* ptr)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4PhysicsTable* G4EmDataHandler::MakeTable()
G4PhysicsTable* G4EmDataHandler::MakeTable(size_t i)
{
G4PhysicsTable* table = nullptr;
table = G4PhysicsTableHelper::PreparePhysicsTable(table);
data.push_back(table);
++tLength;
// create new table only if index corresponds to the
// position in the vector
if(i <= tLength) {
if(i < tLength) { table = data[i]; }
table = G4PhysicsTableHelper::PreparePhysicsTable(table);
if(i == tLength) {
data.push_back(table);
++tLength;
} else { data[i] = table; }
}
return table;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmDataHandler::CleanTable(size_t i)
{
//std::cout << i << " " << data[i] << std::endl;
if(i < tLength && data[i]) {
data[i]->clearAndDestroy();
delete data[i];
data[i] = nullptr;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4EmDataHandler::StorePhysicsTable(size_t idx,
const G4ParticleDefinition* part,
const G4String& namet,
const G4String& procname,
const G4String& fname,
G4bool ascii)
{
G4bool yes = true;
if(data[idx]) {
yes = data[idx]->StorePhysicsTable(namet, ascii);
yes = data[idx]->StorePhysicsTable(fname, ascii);
if ( yes ) {
G4cout << "Physics table is stored for "
<< part->GetParticleName()
<< " and process " << procname
<< " <" << namet << "> " << G4endl;
<< " <" << fname << "> " << G4endl;
} else {
G4cout << "Fail to store Physics Table for "
<< part->GetParticleName()
<< " and process " << procname
<< " <" << namet << "> " << G4endl;
<< " <" << fname << "> " << G4endl;
}
}
return yes;
@@ -117,20 +129,17 @@ G4bool G4EmDataHandler::StorePhysicsTable(size_t idx,
G4bool G4EmDataHandler::RetrievePhysicsTable(size_t idx,
const G4ParticleDefinition* part,
const G4String& namet,
const G4String& procname,
const G4String& fname,
G4bool ascii)
{
G4bool yes =
G4PhysicsTableHelper::RetrievePhysicsTable(data[idx],
namet, ascii);
G4PhysicsTableHelper::RetrievePhysicsTable(data[idx], fname, ascii);
G4EmParameters* param = G4EmParameters::Instance();
if ( yes ) {
if (0 < param->Verbose()) {
G4cout << "Physics table for "
G4cout << "Physics table " << idx << " for "
<< part->GetParticleName()
<< " and " << procname
<< " is retrieved from <" << namet << ">"
<< " is retrieved from <" << fname << ">"
<< G4endl;
}
if(param->Spline()) {
@@ -141,12 +150,27 @@ G4bool G4EmDataHandler::RetrievePhysicsTable(size_t idx,
}
}
} else if (1 < param->Verbose()) {
G4cout << "Fail to retrieve physics table for "
<< part->GetParticleName()
<< " and " << procname << " from <"
<< namet << ">" << G4endl;
G4cout << "Fail to retrieve physics table " << idx << " for "
<< part->GetParticleName() << " from <"
<< fname << ">" << G4endl;
}
return yes;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmDataHandler::SetMasterProcess(const G4VEmProcess* ptr)
{
masterProcess.push_back(ptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4VEmProcess* G4EmDataHandler::GetMasterProcess(size_t idx) const
{
const G4VEmProcess* ptr =
(idx < masterProcess.size()) ? masterProcess[idx] : nullptr;
return ptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmElementSelector.cc 92921 2015-09-21 15:06:51Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.cc 106714 2017-10-20 09:38:06Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -799,14 +798,6 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
{
DumpModelList(out, verb, G4String("\n"));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb,
G4String endOfLine)
{
if(verb == 0) { return; }
for(G4int i=0; i<nRegions; ++i) {
@@ -815,7 +806,7 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb,
G4int n = r->NumberOfModels();
if(n > 0) {
out << " ===== EM models for the G4Region " << reg->GetName()
<< " ======" << endOfLine;
<< " ======" << G4endl;
for(G4int j=0; j<n; ++j) {
G4VEmModel* model = models[r->ModelIndex(j)];
G4double emin =
@@ -848,15 +839,14 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb,
if(fluoFlag && model->DeexcitationFlag()) {
out << " FluoActive";
}
out << endOfLine;
out << G4endl;
}
}
}
if(1 == nEmModels) { break; }
}
if(theCutsNew) {
out << " ===== Limit on energy threshold has been applied "
<< endOfLine;
out << " ===== Limit on energy threshold has been applied " << G4endl;
}
}
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmMultiModel.cc 92921 2015-09-21 15:06:51Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmParameters.cc 69320 2013-04-30 15:59:36Z vnivanch $
//
// -------------------------------------------------------------------
//
@@ -131,11 +130,13 @@ void G4EmParameters::Initialise()
useMottCorrection = false;
integral = true;
birks = false;
fICRU90 = false;
dnaFast = false;
dnaStationary = false;
dnaMsc = false;
gammaShark = false;
gener = false;
onIsolated = false;
enableSamplingTable = false;
minSubRange = 1.0;
minKinEnergy = 0.1*CLHEP::keV;
@@ -173,6 +174,10 @@ void G4EmParameters::Initialise()
namePIXE = "Empirical";
nameElectronPIXE = "Livermore";
directionalSplitting = false;
directionalSplittingTarget = G4ThreeVector(0.,0.,0.);
directionalSplittingRadius = 0.;
}
void G4EmParameters::SetLossFluctuations(G4bool val)
@@ -406,6 +411,16 @@ G4bool G4EmParameters::BirksActive() const
return birks;
}
void G4EmParameters::SetUseICRU90Data(G4bool val)
{
fICRU90 = val;
}
G4bool G4EmParameters::UseICRU90Data() const
{
return fICRU90;
}
void G4EmParameters::SetDNAFast(G4bool val)
{
if(IsLocked()) { return; }
@@ -439,15 +454,25 @@ G4bool G4EmParameters::DNAElectronMsc() const
return dnaMsc;
}
void G4EmParameters::SetGammaSharkActive(G4bool val)
void G4EmParameters::SetGeneralProcessActive(G4bool val)
{
if(IsLocked()) { return; }
gammaShark = val;
gener = val;
// if general interaction is enabled then sub-cutoff and
// force interaction options should be disabled
if(gener) {
m_regnamesForced.clear();
m_procForced.clear();
m_lengthForced.clear();
m_weightForced.clear();
m_regnamesSubCut.clear();
m_subCuts.clear();
}
}
G4bool G4EmParameters::GammaSharkActive() const
G4bool G4EmParameters::GeneralProcessActive() const
{
return gammaShark;
return gener;
}
void G4EmParameters::SetEmSaturation(G4EmSaturation* ptr)
@@ -470,6 +495,17 @@ G4bool G4EmParameters::OnIsolated() const
return onIsolated;
}
void G4EmParameters::SetEnableSamplingTable(G4bool val)
{
if(IsLocked()) { return; }
enableSamplingTable = val;
}
G4bool G4EmParameters::EnableSamplingTable() const
{
return enableSamplingTable;
}
G4EmSaturation* G4EmParameters::GetEmSaturation()
{
if(!emSaturation) { SetBirksActive(true); }
@@ -1063,39 +1099,39 @@ void G4EmParameters::AddMsc(const G4String& region, const G4String& type)
const std::vector<G4String>& G4EmParameters::RegionsMsc() const
{
return m_regnamesMsc;
return m_regnamesPhys;
}
const std::vector<G4String>& G4EmParameters::TypesMsc() const
{
return m_typesMsc;
return m_typesPhys;
}
void G4EmParameters::AddPhysics(const G4String& region, const G4String& type)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesMsc.size();
G4int nreg = m_regnamesPhys.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesMsc[i]) { return; }
if(r == m_regnamesPhys[i]) { return; }
}
m_regnamesMsc.push_back(r);
m_typesMsc.push_back(type);
m_regnamesPhys.push_back(r);
m_typesPhys.push_back(type);
}
const std::vector<G4String>& G4EmParameters::RegionsPhysics() const
{
return m_regnamesMsc;
return m_regnamesPhys;
}
const std::vector<G4String>& G4EmParameters::TypesPhysics() const
{
return m_typesMsc;
return m_typesPhys;
}
void G4EmParameters::SetSubCutoff(G4bool val, const G4String& region)
{
if(IsLocked()) { return; }
if(IsLocked() && !gener) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i<nreg; ++i) {
@@ -1168,7 +1204,7 @@ G4EmParameters::ActivateForcedInteraction(const G4String& procname,
G4double length,
G4bool wflag)
{
if(IsLocked()) { return; }
if(IsLocked() && !gener) { return; }
G4String r = CheckRegion(region);
if(length >= 0.0) {
G4int n = m_procForced.size();
@@ -1309,8 +1345,10 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "=======================================================================" << "\n";
os << "LPM effect enabled " <<flagLPM << "\n";
os << "Spline of EM tables enabled " <<spline << "\n";
os << "Enable creation and use of sampling tables " <<enableSamplingTable << "\n";
os << "Apply cuts on all EM processes " <<applyCuts << "\n";
os << "Use integral approach for tracking " <<integral << "\n";
os << "Use general process " <<gener << "\n";
os << "X-section factor for integral approach " <<lambdaFactor << "\n";
os << "Min kinetic energy for tables "
<<G4BestUnit(minKinEnergy,"Energy") << "\n";
@@ -1340,9 +1378,10 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Lowest muon/hadron kinetic energy "
<<G4BestUnit(lowestMuHadEnergy,"Energy") << "\n";
os << "Fluctuations of dE/dx are enabled " <<lossFluctuation << "\n";
os << "Use ICRU90 data " << fICRU90 << "\n";
os << "Use built-in Birks satuaration " << birks << "\n";
os << "Build CSDA range enabled " <<buildCSDARange << "\n";
os << "Use cut as a final range enabled " <<finalRange << "\n";
os << "Use cut as a final range enabled " <<cutAsFinalRange << "\n";
os << "Enable angular generator interface "
<<useAngGeneratorForIonisation << "\n";
os << "Factor of cut reduction for sub-cutoff method " << minSubRange << "\n";
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmParametersMessenger.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -52,6 +51,7 @@
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UImanager.hh"
#include "G4MscStepLimitType.hh"
#include "G4NuclearFormfactorType.hh"
@@ -213,12 +213,24 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
dnamscCmd->SetDefaultValue(false);
dnamscCmd->AvailableForStates(G4State_PreInit);
sharkCmd = new G4UIcmdWithABool("/process/em/UseGammaShark",this);
sharkCmd->SetGuidance("Enable gamma super-process");
sharkCmd->SetParameterName("shark",true);
sharkCmd = new G4UIcmdWithABool("/process/em/UseGeneralProcess",this);
sharkCmd->SetGuidance("Enable gamma, e+- general process");
sharkCmd->SetParameterName("gen",true);
sharkCmd->SetDefaultValue(false);
sharkCmd->AvailableForStates(G4State_PreInit);
sampleTCmd = new G4UIcmdWithABool("/process/em/enableSamplingTable",this);
sampleTCmd->SetGuidance("Enable usage of sampling table for secondary generation");
sampleTCmd->SetParameterName("sampleT",true);
sampleTCmd->SetDefaultValue(false);
sampleTCmd->AvailableForStates(G4State_PreInit);
icru90Cmd = new G4UIcmdWithABool("/process/eLoss/UseICRU90",this);
icru90Cmd->SetGuidance("Enable usage of ICRU90 stopping powers");
icru90Cmd->SetParameterName("icru90",true);
icru90Cmd->SetDefaultValue(false);
icru90Cmd->AvailableForStates(G4State_PreInit);
minSubSecCmd = new G4UIcmdWithADouble("/process/eLoss/minsubsec",this);
minSubSecCmd->SetGuidance("Set the ratio subcut/cut ");
minSubSecCmd->SetParameterName("rcmin",true);
@@ -407,6 +419,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
G4UIparameter* ptype = new G4UIparameter("type",'s',false);
paiCmd->SetParameter(ptype);
ptype->SetParameterCandidates("pai PAI PAIphoton");
meCmd = new G4UIcmdWithAString("/process/em/AddMicroElecRegion",this);
meCmd->SetGuidance("Activate MicroElec model in the G4Region");
@@ -424,11 +437,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
G4UIparameter* type = new G4UIparameter("dnaType",'s',false);
dnaCmd->SetParameter(type);
type->SetParameterCandidates("DNA_Opt0");
mscoCmd = new G4UIcommand("/process/em/AddEmRegion",this);
mscoCmd->SetGuidance("Add optional EM configuration for a G4Region.");
mscoCmd->SetGuidance(" regName : G4Region name");
mscoCmd->SetGuidance(" mscType : G4EmStandard, G4EmStandard_opt1, ...");
mscoCmd->SetGuidance(" regName : G4Region name");
mscoCmd->SetGuidance(" emType : G4EmStandard, G4EmStandard_opt1, ...");
mscoCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* mregName = new G4UIparameter("regName",'s',false);
@@ -436,6 +450,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
G4UIparameter* mtype = new G4UIparameter("mscType",'s',false);
mscoCmd->SetParameter(mtype);
mtype->SetParameterCandidates("G4EmStandard G4EmStandard_opt1 G4EmStandard_opt2 G4EmStandard_opt3 G4EmStandard_opt4 G4EmStandardGS G4EmStandardSS G4EmLivermore G4EmPenelope G4RadioactiveDecay");
dumpCmd = new G4UIcommand("/process/em/printParameters",this);
dumpCmd->SetGuidance("Print all EM parameters.");
@@ -572,6 +587,18 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
G4UIparameter* bUnit = new G4UIparameter("bUnit",'s',true);
bsCmd->SetParameter(bUnit);
dirSplitCmd = new G4UIcmdWithABool("/process/em/setDirectionalSplitting",this);
dirSplitCmd->SetGuidance("Enable directional brem splitting");
dirSplitCmd->AvailableForStates(G4State_Idle,G4State_Idle);
dirSplitTargetCmd = new G4UIcmdWith3VectorAndUnit("/process/em/setDirectionalSplittingTarget",this);
dirSplitTargetCmd->SetGuidance("Position of arget for directional splitting");
dirSplitTargetCmd->AvailableForStates(G4State_Idle,G4State_Idle);
dirSplitRadiusCmd = new G4UIcmdWithADoubleAndUnit("/process/em/setDirectionalSplittingRadius",this);
dirSplitRadiusCmd->SetGuidance("Radius of target for directional splitting");
dirSplitRadiusCmd->AvailableForStates(G4State_Idle,G4State_Idle);
nffCmd = new G4UIcmdWithAString("/process/em/setNuclearFormFactor",this);
nffCmd->SetGuidance("Define typy of nuclear form-factor");
nffCmd->SetParameterName("NucFF",true);
@@ -631,6 +658,8 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete dnasCmd;
delete dnamscCmd;
delete sharkCmd;
delete sampleTCmd;
delete icru90Cmd;
delete minSubSecCmd;
delete minEnCmd;
@@ -678,6 +707,9 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete bfCmd;
delete fiCmd;
delete bsCmd;
delete dirSplitCmd;
delete dirSplitTargetCmd;
delete dirSplitRadiusCmd;
delete nffCmd;
delete onIsolatedCmd;
@@ -744,12 +776,14 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetUseMottCorrection(mottCmd->GetNewBoolValue(newValue));
} else if (command == birksCmd) {
theParameters->SetBirksActive(birksCmd->GetNewBoolValue(newValue));
} else if (command == icru90Cmd) {
theParameters->SetUseICRU90Data(icru90Cmd->GetNewBoolValue(newValue));
} else if (command == dnafCmd) {
theParameters->SetDNAFast(dnafCmd->GetNewBoolValue(newValue));
} else if (command == dnasCmd) {
theParameters->SetDNAStationary(dnasCmd->GetNewBoolValue(newValue));
} else if (command == dnamscCmd) {
theParameters->SetBirksActive(dnamscCmd->GetNewBoolValue(newValue));
theParameters->SetDNAElectronMsc(dnamscCmd->GetNewBoolValue(newValue));
} else if (command == dnaSolCmd) {
G4DNAModelSubType ttt = fDNAUnknownModel;
if(newValue == "Ritchie1994") {
@@ -761,7 +795,9 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
}
theParameters->SetDNAeSolvationSubType(ttt);
} else if (command == sharkCmd) {
theParameters->SetGammaSharkActive(sharkCmd->GetNewBoolValue(newValue));
theParameters->SetGeneralProcessActive(sharkCmd->GetNewBoolValue(newValue));
} else if (command == sampleTCmd) {
theParameters->SetEnableSamplingTable(sampleTCmd->GetNewBoolValue(newValue));
} else if (command == minSubSecCmd) {
theParameters->SetMinSubRange(minSubSecCmd->GetNewDoubleValue(newValue));
@@ -930,6 +966,18 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
en *= G4UIcommand::ValueOf(unt);
theParameters->ActivateSecondaryBiasing(s1,s2,fb,en);
physicsModified = true;
} else if (command == dirSplitCmd) {
theParameters->SetDirectionalSplitting(
dirSplitCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dirSplitTargetCmd) {
G4ThreeVector t = dirSplitTargetCmd->GetNew3VectorValue(newValue);
theParameters->SetDirectionalSplittingTarget(t);
physicsModified = true;
} else if (command == dirSplitRadiusCmd) {
G4double r = dirSplitRadiusCmd->GetNewDoubleValue(newValue);
theParameters->SetDirectionalSplittingRadius(r);
physicsModified = true;
} else if (command == nffCmd) {
G4NuclearFormfactorType x = fNoneNF;
if(newValue == "Exponential") { x = fExponentialNF; }
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.cc 96088 2016-03-14 16:03:38Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmSaturation.cc 104372 2017-05-29 09:55:44Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
// $Id: G4EnergyLossTables.cc 92921 2015-09-21 15:06:51Z gcosmo $
//
// -------------------------------------------------------------------
// first version created by P.Urban , 06/04/1998
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableBuilder.cc 96088 2016-03-14 16:03:38Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.cc 110572 2018-05-30 13:08:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -198,7 +197,8 @@ G4LossTableManager::G4LossTableManager()
emElectronIonPair = nullptr;
atomDeexcitation = nullptr;
subcutProducer = nullptr;
gammaShark = nullptr;
gGeneral = nullptr;
eGeneral = nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -1059,25 +1059,20 @@ void G4LossTableManager::DumpHtml()
// Automatic generation of html documentation page for physics lists
// List processes and models for the most important
// particles in descending order of importance
// NB. for model names with length > 18 characters the .rst file needs
// to be edited by hand. Or modify G4EmModelManager::DumpModelList
char* dirName = getenv("G4PhysListDocDir");
char* physListName = getenv("G4PhysListName");
if (dirName && physListName) {
G4String pathName = G4String(dirName) + "/" + G4String(physListName)
+ ".html";
char* physList = getenv("G4PhysListName");
if (dirName && physList) {
G4String physListName = G4String(physList);
G4String pathName = G4String(dirName) + "/" + physListName + ".rst";
std::ofstream outFile;
outFile.open(pathName);
outFile << "<html>\n";
outFile << "<head>\n";
outFile << "<title>Physics List Summary</title>\n";
outFile << "</head>\n";
outFile << "<body>\n";
outFile << "<h2> Summary of Electromagnetic Processes, Models and Cross "
<< "Sections for Physics List "
<< G4String(physListName) << "</h2>\n";
outFile << "<ul>\n";
outFile << physListName << G4endl;
outFile << std::string(physListName.length(), '=') << G4endl;
std::vector<G4ParticleDefinition*> particles {
G4Gamma::Gamma(),
@@ -1095,9 +1090,10 @@ void G4LossTableManager::DumpHtml()
GetMultipleScatteringVector();
for (auto theParticle : particles) {
outFile << "<li><h3>" << theParticle->GetParticleName() << "</h3><ul>\n";
outFile << G4endl << "**" << theParticle->GetParticleName()
<< "**" << G4endl << G4endl << " .. code-block:: none" << G4endl;
G4ProcessManager* pm = theParticle->GetProcessManager();
G4ProcessManager* pm = theParticle->GetProcessManager();
G4ProcessVector* pv = pm->GetProcessList();
G4int plen = pm->GetProcessListLength();
@@ -1105,9 +1101,8 @@ void G4LossTableManager::DumpHtml()
for (G4int i = 0; i < plen; ++i) {
G4VProcess* proc = (*pv)[i];
if (proc == emproc) {
outFile << "<li>\n";
outFile << G4endl;
proc->ProcessDescription(outFile);
outFile << "</li>\n";
break;
}
}
@@ -1117,9 +1112,8 @@ void G4LossTableManager::DumpHtml()
for (G4int i = 0; i < plen; ++i) {
G4VProcess* proc = (*pv)[i];
if (proc == mscproc) {
outFile << "<li>\n";
outFile << G4endl;
proc->ProcessDescription(outFile);
outFile << "</li>\n";
break;
}
}
@@ -1129,19 +1123,13 @@ void G4LossTableManager::DumpHtml()
for (G4int i = 0; i < plen; ++i) {
G4VProcess* proc = (*pv)[i];
if (proc == enlossproc) {
outFile << "<li>\n";
outFile << G4endl;
proc->ProcessDescription(outFile);
outFile << "</li>\n";
break;
}
}
}
outFile << "</ul>\n";
outFile << "</li>\n";
}
outFile << "</ul>\n";
outFile << "</body>\n";
outFile << "</html>\n";
outFile.close();
}
}
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VAtomDeexcitation.cc 108386 2018-02-09 15:38:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmAngularDistribution.cc 110416 2018-05-23 06:45:42Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.cc 106208 2017-09-20 01:53:57Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.cc 110572 2018-05-30 13:08:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -475,16 +474,7 @@ void G4VEmModel::SetCrossSectionTable(G4PhysicsTable* p, G4bool isLocal)
void G4VEmModel::ModelDescription(std::ostream& outFile) const
{
ModelDescription(outFile, G4String("\n"));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4VEmModel::ModelDescription(std::ostream& outFile,
G4String endOfLine) const
{
outFile << "The description for this model has not been written yet."
<< endOfLine;
outFile << "The description for this model has not been written yet.\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.cc 109178 2018-04-03 07:13:58Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -36,25 +35,9 @@
//
// Creation date: 01.10.2003
//
// Modifications:
// 30-06-04 make it to be pure discrete process (V.Ivanchenko)
// 30-09-08 optimise integral option (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1, add applyCuts and killPrimary flags (VI)
// 14-03-05 Update logic PostStepDoIt (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
// 18-04-05 Use G4ParticleChangeForGamma (V.Ivanchenko)
// 25-07-05 Add protection: integral mode only for charged particles (VI)
// 04-09-05 default lambdaFactor 0.8 (V.Ivanchenko)
// 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI)
// 12-09-06 add SetModel() (mma)
// 12-04-07 remove double call to Clear model manager (V.Ivanchenko)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
// 24-06-09 Removed hidden bin in G4PhysicsVector (V.Ivanchenko)
// 17-02-10 Added pointer currentParticle (VI)
// 30-05-12 allow Russian roulette, brem splitting (D. Sawkey)
// Modifications: by V.Ivanchenko
//
// Class Description:
// Class Description: based class for discrete and rest/discrete EM processes
//
// -------------------------------------------------------------------
@@ -73,6 +56,7 @@
#include "G4VEmModel.hh"
#include "G4DataVector.hh"
#include "G4PhysicsTable.hh"
#include "G4EmDataHandler.hh"
#include "G4PhysicsLogVector.hh"
#include "G4VParticleChange.hh"
#include "G4ProductionCutsTable.hh"
@@ -103,6 +87,9 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
splineFlag(true),
isIon(false),
currentCouple(nullptr),
isTheMaster(true),
masterProc(nullptr),
theData(nullptr),
currentModel(nullptr),
particle(nullptr),
currentParticle(nullptr)
@@ -174,20 +161,14 @@ G4VEmProcess::~G4VEmProcess()
<< " " << this << " " << theLambdaTable <<G4endl;
}
*/
if(lManager->IsMaster()) {
if(theLambdaTable) {
theLambdaTable->clearAndDestroy();
delete theLambdaTable;
}
if(theLambdaTablePrim) {
theLambdaTablePrim->clearAndDestroy();
delete theLambdaTablePrim;
}
if(isTheMaster) {
delete theData;
theData = nullptr;
}
delete modelManager;
delete biasManager;
lManager->DeRegister(this);
//G4cout << "G4VEmProcess removed " << G4endl;
//std::cout << "G4VEmProcess removed " << GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -196,7 +177,6 @@ void G4VEmProcess::Clear()
{
currentCouple = nullptr;
preStepLambda = 0.0;
mfpKinEnergy = DBL_MAX;
idxLambda = idxLambdaPrim = 0;
}
@@ -273,7 +253,7 @@ G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) const
void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
{
G4bool isMaster = lManager->IsMaster();
isTheMaster = lManager->IsMaster();
if(!particle) { SetParticle(&part); }
@@ -303,7 +283,7 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
G4LossTableBuilder* bld = lManager->GetTableBuilder();
lManager->PreparePhysicsTable(&part, this, isMaster);
lManager->PreparePhysicsTable(&part, this, isTheMaster);
Clear();
InitialiseProcess(particle);
@@ -320,8 +300,12 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
if(!actMaxKinEnergy) { maxKinEnergy = theParameters->MaxKinEnergy(); }
if(!actSpline) { splineFlag = theParameters->Spline(); }
if(isMaster) { SetVerboseLevel(theParameters->Verbose()); }
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
if(isTheMaster) {
SetVerboseLevel(theParameters->Verbose());
if(!theData) { theData = new G4EmDataHandler(2); }
} else {
SetVerboseLevel(theParameters->WorkerVerbose());
}
applyCuts = theParameters->ApplyCuts();
lambdaFactor = theParameters->LambdaFactor();
theParameters->DefineRegParamForEM(this);
@@ -332,7 +316,7 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
G4VEmModel* mod = modelManager->GetModel(i);
if(0 == i) { currentModel = mod; }
mod->SetPolarAngleLimit(theParameters->MscThetaLimit());
mod->SetMasterThread(isMaster);
mod->SetMasterThread(isTheMaster);
if(mod->HighEnergyLimit() > maxKinEnergy) {
mod->SetHighEnergyLimit(maxKinEnergy);
}
@@ -346,15 +330,13 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
theCutsPositron = theCoupleTable->GetEnergyCutsVector(idxG4PositronCut);
// prepare tables
if(buildLambdaTable && isMaster){
theLambdaTable =
G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable);
if(buildLambdaTable && isTheMaster){
theLambdaTable = theData->MakeTable(0);
bld->InitialiseBaseMaterials(theLambdaTable);
}
// high energy table
if(isMaster && minKinEnergyPrim < maxKinEnergy){
theLambdaTablePrim =
G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTablePrim);
if(isTheMaster && minKinEnergyPrim < maxKinEnergy){
theLambdaTablePrim = theData->MakeTable(1);
bld->InitialiseBaseMaterials(theLambdaTablePrim);
}
// forced biasing
@@ -379,9 +361,10 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
{
G4bool isMaster = lManager->IsMaster();
const G4VEmProcess* masterProc =
static_cast<const G4VEmProcess*>(GetMasterProcess());
if(!masterProc) {
if(isTheMaster) { masterProc = this; }
else { masterProc = static_cast<const G4VEmProcess*>(GetMasterProcess());}
}
G4String num = part.GetParticleName();
if(1 < verboseLevel) {
@@ -389,7 +372,8 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
<< GetProcessName()
<< " and particle " << num
<< " buildLambdaTable= " << buildLambdaTable
<< " isMaster= " << isMaster
<< " isTheMaster= " << isTheMaster
<< " " << masterProc
<< G4endl;
}
@@ -398,7 +382,7 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
G4LossTableBuilder* bld = lManager->GetTableBuilder();
// worker initialisation
if(!isMaster) {
if(!isTheMaster) {
theLambdaTable = masterProc->LambdaTable();
theLambdaTablePrim = masterProc->LambdaTablePrim();
@@ -417,6 +401,8 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
for(G4int i=0; i<numberOfModels; ++i) {
G4VEmModel* mod = GetModelByIndex(i, printing);
G4VEmModel* mod0= masterProc->GetModelByIndex(i, printing);
//G4cout << i << ". " << mod << " " << mod0 << " "
// << particle->GetParticleName() << G4endl;
mod->InitialiseLocal(particle, mod0);
}
// master thread
@@ -475,8 +461,8 @@ void G4VEmProcess::BuildLambdaTable()
G4PhysicsLogVector* bVectorPrim = nullptr;
G4double scale = theParameters->MaxKinEnergy()/theParameters->MinKinEnergy();
G4int nbin = theParameters->NumberOfBinsPerDecade()
*G4lrint(std::log10(scale));
G4int nbin =
theParameters->NumberOfBinsPerDecade()*G4lrint(std::log10(scale));
scale = G4Log(scale);
if(actBinning) { nbin = std::max(nbin, nLambdaBins); }
G4double emax1 = std::min(maxKinEnergy, minKinEnergyPrim);
@@ -550,11 +536,12 @@ void G4VEmProcess::BuildLambdaTable()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::StreamInfo(std::ostream& out,
const G4ParticleDefinition& part, G4String endOfLine) const
const G4ParticleDefinition& part, G4bool rst) const
{
G4String indent = (rst ? " " : "");
out << std::setprecision(6);
out << endOfLine << GetProcessName() << ": ";
if (endOfLine != G4String("<br>\n")) {
out << G4endl << indent << GetProcessName() << ": ";
if (!rst) {
out << " for " << part.GetParticleName();
if (integral) { out << ","; }
}
@@ -562,62 +549,59 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
if(applyCuts) { out << ", applyCuts: 1 "; }
out << " SubType= " << GetProcessSubType();;
if(biasFactor != 1.0) { out << " BiasingFactor= " << biasFactor; }
out << " BuildTable= " << buildLambdaTable;
out << endOfLine;
out << " BuildTable= " << buildLambdaTable << G4endl;
if(buildLambdaTable) {
if(particle == &part) {
size_t length = theLambdaTable->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTable)[i];
if(v) {
out << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
if(emin > minKinEnergy) { out << "threshold "; }
else { out << G4BestUnit(emin,"Energy"); }
out << " to "
<< G4BestUnit(emax,"Energy")
<< ", " << G4lrint(nbin/std::log10(emax/emin))
<< " bins per decade, spline: "
<< splineFlag
<< endOfLine;
break;
}
G4PhysicsVector* v = (*theLambdaTable)[i];
if(v) {
out << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
if(emin > minKinEnergy) { out << "threshold "; }
else { out << G4BestUnit(emin,"Energy"); }
out << " to "
<< G4BestUnit(emax,"Energy")
<< ", " << G4lrint(nbin/std::log10(emax/emin))
<< " bins per decade, spline: "
<< splineFlag << G4endl;
break;
}
}
} else {
out << " Used Lambda table of "
<< particle->GetParticleName() << endOfLine;
<< particle->GetParticleName() << G4endl;
}
}
if(minKinEnergyPrim < maxKinEnergy) {
if(particle == &part) {
size_t length = theLambdaTablePrim->length();
for(size_t i=0; i<length; ++i) {
G4PhysicsVector* v = (*theLambdaTablePrim)[i];
if(v) {
out << " LambdaPrime table from "
<< G4BestUnit(v->Energy(0),"Energy")
<< " to "
<< G4BestUnit(v->GetMaxEnergy(),"Energy")
<< " in " << v->GetVectorLength()-1
<< " bins "
<< endOfLine;
break;
}
G4PhysicsVector* v = (*theLambdaTablePrim)[i];
if(v) {
out << " LambdaPrime table from "
<< G4BestUnit(v->Energy(0),"Energy")
<< " to "
<< G4BestUnit(v->GetMaxEnergy(),"Energy")
<< " in " << v->GetVectorLength()-1
<< " bins " << G4endl;
break;
}
}
} else {
out << " Used LambdaPrime table of "
<< particle->GetParticleName() << endOfLine;
<< particle->GetParticleName() << G4endl;
}
}
StreamProcessInfo(out, endOfLine);
modelManager->DumpModelList(out, verboseLevel, endOfLine);
StreamProcessInfo(out);
modelManager->DumpModelList(out, verboseLevel);
if(verboseLevel > 2 && buildLambdaTable) {
out << " LambdaTable address= " << theLambdaTable << endOfLine;
out << " LambdaTable address= " << theLambdaTable << G4endl;
if(theLambdaTable && particle == &part) {
out << (*theLambdaTable) << endOfLine;
out << (*theLambdaTable) << G4endl;
}
}
}
@@ -630,7 +614,7 @@ void G4VEmProcess::StartTracking(G4Track* track)
currentParticle = track->GetParticleDefinition();
theNumberOfInteractionLengthLeft = -1.0;
mfpKinEnergy = DBL_MAX;
massRatio = (isIon) ? proton_mass_c2/currentParticle->GetPDGMass() : 1.0;
if(isIon) { massRatio = proton_mass_c2/currentParticle->GetPDGMass(); }
// forced biasing only for primary particles
if(biasManager) {
@@ -652,8 +636,8 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
*condition = NotForced;
G4double x = DBL_MAX;
preStepKinEnergy = track.GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
G4double scaledEnergy = preStepKinEnergy*massRatio;
SelectModel(scaledEnergy, currentCoupleIndex);
@@ -705,26 +689,42 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
// new mean free path and step limit for the next step
currentInteractionLength = 1.0/preStepLambda;
x = theNumberOfInteractionLengthLeft * currentInteractionLength;
/*
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VEmProcess::PostStepGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" << G4endl;
G4cout << " for " << currentParticle->GetParticleName()
<< " in Material " << currentMaterial->GetName()
<< " Ekin(MeV)= " << preStepKinEnergy/MeV
<<G4endl;
G4cout << " MeanFreePath = " << currentInteractionLength/cm << "[cm]"
<< " InteractionLength= " << x/cm <<"[cm] " <<G4endl;
}
#endif
*/
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::ComputeIntegralLambda(G4double e)
{
// condition to skip recomputation of cross section
G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
if(e <= epeak && e/lambdaFactor >= mfpKinEnergy) { return; }
// recomputation is needed
if (e <= epeak) {
preStepLambda = GetCurrentLambda(e);
mfpKinEnergy = e;
} else {
G4double e1 = e*lambdaFactor;
if(e1 > epeak) {
preStepLambda = GetCurrentLambda(e);
mfpKinEnergy = e;
G4double preStepLambda1 = GetCurrentLambda(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
mfpKinEnergy = epeak;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
const G4Step& step)
{
@@ -843,7 +843,11 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
if (good) {
G4Track* t = new G4Track(dp, time, track.GetPosition());
t->SetTouchableHandle(track.GetTouchableHandle());
t->SetWeight(weight);
if (biasManager) {
t->SetWeight(biasManager->GetWeight(i));
} else {
t->SetWeight(weight);
}
pParticleChange->AddSecondary(t);
// define type of secondary
@@ -885,18 +889,16 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
G4bool ascii)
const G4String& directory,
G4bool ascii)
{
G4bool yes = true;
const G4VEmProcess* masterProc =
static_cast<const G4VEmProcess*>(GetMasterProcess());
if(masterProc && masterProc != this) { return yes; }
if(!isTheMaster) { return yes; }
if ( theLambdaTable && part == particle) {
const G4String name =
const G4String& nam =
GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = theLambdaTable->StorePhysicsTable(name,ascii);
yes = theLambdaTable->StorePhysicsTable(nam,ascii);
if ( yes ) {
G4cout << "Physics table is stored for " << particle->GetParticleName()
@@ -912,7 +914,7 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
}
}
if ( theLambdaTablePrim && part == particle) {
const G4String name =
const G4String& name =
GetPhysicsTableFileName(part,directory,"LambdaPrim",ascii);
yes = theLambdaTablePrim->StorePhysicsTable(name,ascii);
@@ -936,7 +938,7 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
const G4String& directory,
G4bool ascii)
{
if(1 < verboseLevel) {
@@ -950,10 +952,10 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
|| particle != part) { return yes; }
const G4String particleName = part->GetParticleName();
G4String filename;
if(buildLambdaTable) {
filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
const G4String& filename =
GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,
filename,ascii);
if ( yes ) {
@@ -980,7 +982,8 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
}
}
if(minKinEnergyPrim < maxKinEnergy) {
filename = GetPhysicsTableFileName(part,directory,"LambdaPrim",ascii);
const G4String& filename =
GetPhysicsTableFileName(part,directory,"LambdaPrim",ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTablePrim,
filename,ascii);
if ( yes ) {
@@ -1006,7 +1009,6 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
}
}
}
return yes;
}
@@ -1019,17 +1021,17 @@ G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy,
// Cross section per atom is calculated
DefineMaterial(couple);
G4double cross = 0.0;
if(buildLambdaTable && theLambdaTable) {
if(buildLambdaTable) {
cross = GetCurrentLambda(kineticEnergy);
} else {
SelectModel(kineticEnergy, currentCoupleIndex);
cross = fFactor*currentModel->CrossSectionPerVolume(currentMaterial,
currentParticle,
kineticEnergy);
if(currentModel) {
cross = fFactor*currentModel->CrossSectionPerVolume(currentMaterial,
currentParticle,
kineticEnergy);
}
}
if(cross < 0.0) { cross = 0.0; }
return cross;
return std::max(cross, 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1046,26 +1048,22 @@ G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
G4double G4VEmProcess::MeanFreePath(const G4Track& track)
{
DefineMaterial(track.GetMaterialCutsCouple());
preStepLambda = GetCurrentLambda(track.GetKineticEnergy());
G4double x = DBL_MAX;
if(0.0 < preStepLambda) { x = 1.0/preStepLambda; }
return x;
G4double kinEnergy = track.GetKineticEnergy();
CurrentSetup(track.GetMaterialCutsCouple(), kinEnergy);
G4double xs = GetCurrentLambda(kinEnergy);
return (0.0 < xs) ? 1.0/xs : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4VEmProcess::ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4VEmProcess::ComputeCrossSectionPerAtom(G4double kinEnergy,
G4double Z, G4double A, G4double cut)
{
SelectModel(kineticEnergy, currentCoupleIndex);
G4double x = 0.0;
if(currentModel) {
x = currentModel->ComputeCrossSectionPerAtom(currentParticle,kineticEnergy,
Z,A,cut);
}
return x;
SelectModel(kinEnergy, currentCoupleIndex);
return (currentModel) ?
currentModel->ComputeCrossSectionPerAtom(currentParticle, kinEnergy,
Z, A, cut) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1135,8 +1133,8 @@ G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple*)
const G4Element* G4VEmProcess::GetCurrentElement() const
{
const G4Element* elm = nullptr;
if(currentModel) {elm = currentModel->GetCurrentElement(); }
const G4Element* elm =
(currentModel) ? currentModel->GetCurrentElement() : nullptr;
return elm;
}
@@ -1268,7 +1266,7 @@ void G4VEmProcess::PrintWarning(G4String tit, G4double val)
void G4VEmProcess::ProcessDescription(std::ostream& out) const
{
if(particle) {
StreamInfo(out, *particle, G4String("<br>\n"));
StreamInfo(out, *particle, true);
}
}
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.cc 107959 2017-12-14 13:05:59Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -36,87 +35,8 @@
//
// Creation date: 03.01.2002
//
// Modifications:
// Modifications: Vladimir Ivanchenko
//
// 13-11-02 Minor fix - use normalised direction (V.Ivanchenko)
// 04-12-02 Minor change in PostStepDoIt (V.Ivanchenko)
// 23-12-02 Change interface in order to move to cut per region (V.Ivanchenko)
// 26-12-02 Secondary production moved to derived classes (V.Ivanchenko)
// 04-01-03 Fix problem of very small steps for ions (V.Ivanchenko)
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
// 24-01-03 Temporarily close a control on usage of couples (V.Ivanchenko)
// 24-01-03 Make models region aware (V.Ivanchenko)
// 05-02-03 Fix compilation warnings (V.Ivanchenko)
// 06-02-03 Add control on tmax in PostStepDoIt (V.Ivanchenko)
// 13-02-03 SubCutoffProcessors defined for regions (V.Ivanchenko)
// 15-02-03 Lambda table can be scaled (V.Ivanchenko)
// 17-02-03 Fix problem of store/restore tables (V.Ivanchenko)
// 18-02-03 Add control on CutCouple usage (V.Ivanchenko)
// 26-02-03 Simplify control on GenericIons (V.Ivanchenko)
// 06-03-03 Control on GenericIons using SubType+ update verbose (V.Ivanchenko)
// 10-03-03 Add Ion registration (V.Ivanchenko)
// 22-03-03 Add Initialisation of cash (V.Ivanchenko)
// 26-03-03 Remove finalRange modification (V.Ivanchenko)
// 09-04-03 Fix problem of negative range limit for non integral (V.Ivanchenko)
// 26-04-03 Fix retrieve tables (V.Ivanchenko)
// 06-05-03 Set defalt finalRange = 1 mm (V.Ivanchenko)
// 12-05-03 Update range calculations + lowKinEnergy (V.Ivanchenko)
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
// 23-05-03 Remove tracking cuts (V.Ivanchenko)
// 03-06-03 Fix initialisation problem for STD ionisation (V.Ivanchenko)
// 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
// 03-11-03 Fix initialisation problem in RetrievePhysicsTable (V.Ivanchenko)
// 04-11-03 Add checks in RetrievePhysicsTable (V.Ivanchenko)
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
// 21-01-04 Migrade to G4ParticleChangeForLoss (V.Ivanchenko)
// 27-02-04 Fix problem of loss in low presure gases, cleanup precise range
// calculation, use functions ForLoss in AlongStepDoIt (V.Ivanchenko)
// 10-03-04 Fix a problem of Precise Range table (V.Ivanchenko)
// 19-03-04 Fix a problem energy below lowestKinEnergy (V.Ivanchenko)
// 31-03-04 Fix a problem of retrieve tables (V.Ivanchenko)
// 21-07-04 Check weather AtRest are active or not (V.Ivanchenko)
// 03-08-04 Add pointer of DEDX table to all processes (V.Ivanchenko)
// 06-08-04 Clear up names of member functions (V.Ivanchenko)
// 06-08-04 Clear up names of member functions (V.Ivanchenko)
// 27-08-04 Add NeedBuildTables method (V.Ivanchneko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 11-04-05 Use MaxSecondaryEnergy from a model (V.Ivanchenko)
// 25-07-05 Add extra protection PostStep for non-integral mode (V.Ivanchenko)
// 12-08-05 Integral=false; SetStepFunction(0.2, 0.1*mm) (mma)
// 18-08-05 Return back both AlongStep and PostStep from 7.0 (V.Ivanchenko)
// 02-09-05 Default StepFunction 0.2 1 mm + integral (V.Ivanchenko)
// 04-09-05 default lambdaFactor 0.8 (V.Ivanchenko)
// 05-10-05 protection against 0 energy loss added (L.Urban)
// 17-10-05 protection above has been removed (L.Urban)
// 06-01-06 reset currentCouple when StepFunction is changed (V.Ivanchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 18-01-06 Clean up subcutoff including recalculation of presafety (VI)
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 22-03-06 Add control on warning printout AlongStep (VI)
// 23-03-06 Use isIonisation flag (V.Ivanchenko)
// 07-06-06 Do not reflect AlongStep in subcutoff regime (V.Ivanchenko)
// 14-01-07 add SetEmModel(index) and SetFluctModel() (mma)
// 16-01-07 add IonisationTable and IonisationSubTable (V.Ivanchenko)
// 16-02-07 set linLossLimit=1.e-6 (V.Ivanchenko)
// 13-03-07 use SafetyHelper instead of navigator (V.Ivanchenko)
// 10-04-07 use unique SafetyHelper (V.Ivanchenko)
// 12-04-07 Add verbosity at destruction (V.Ivanchenko)
// 25-04-07 move initialisation of safety helper to BuildPhysicsTable (VI)
// 27-10-07 Virtual functions moved to source (V.Ivanchenko)
// 24-06-09 Removed hidden bin in G4PhysicsVector (V.Ivanchenko)
// 01-25-09 (Xin Dong) Phase II change for Geant4 multi-threading:
// New methods SlavePreparePhysicsTable, SlaveBuildPhysicsTable
// Worker threads share physics tables with the master thread for
// this kind of process. This member function is used by worker
// threads to achieve the partial effect of the master thread when
// it builds physcis tables.
// 15-10-10 Fixed 4-momentum balance if deexcitation is active (L.Pandola)
// 30-05-12 Call new ApplySecondaryBiasing so 2ries may be unique (D. Sawkey)
// 30-05-12 Fix bug in forced biasing: now called on first step (D. Sawkey)
// 04-06-13 Adoptation to MT mode, adding internal cache to GetRangeForLoss,
// more accurate initialisation for ions (V.Ivanchenko)
//
// Class Description:
//
@@ -193,9 +113,9 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
isIonisation(true),
useSubCutoff(false),
useDeexcitation(false),
particle(nullptr),
currentCouple(nullptr),
mfpKinEnergy(0.0)
mfpKinEnergy(0.0),
particle(nullptr)
{
theParameters = G4EmParameters::Instance();
SetVerboseLevel(1);
@@ -289,7 +209,7 @@ G4VEnergyLossProcess::~G4VEnergyLossProcess()
if(theDEDXTable) {
//G4cout << " theIonisationTable " << theIonisationTable << G4endl;
if(theIonisationTable == theDEDXTable) { theIonisationTable = 0; }
if(theIonisationTable == theDEDXTable) { theIonisationTable = nullptr; }
//G4cout << " delete theDEDXTable " << theDEDXTable << G4endl;
theDEDXTable->clearAndDestroy();
delete theDEDXTable;
@@ -547,11 +467,8 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
chargeSqRatio = q*q;
if(chargeSqRatio > 0.0) { reduceFactor = 1.0/(chargeSqRatio*massRatio); }
}
if(initialMass < MeV) {
lowestKinEnergy = theParameters->LowestElectronEnergy();
} else {
lowestKinEnergy = theParameters->LowestMuHadEnergy();
}
lowestKinEnergy = (initialMass < MeV) ? theParameters->LowestElectronEnergy()
: theParameters->LowestMuHadEnergy();
// Tables preparation
if (isMaster && !baseParticle) {
@@ -965,77 +882,72 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildLambdaTable(G4EmTableType tType)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
const G4ParticleDefinition& part, G4String endOfLine) const
const G4ParticleDefinition& part, G4bool rst) const
{
G4String indent = (rst ? " " : "");
out << std::setprecision(6);
out << endOfLine << GetProcessName() << ": ";
if (endOfLine != G4String("<br>\n")) {
out << " for " << part.GetParticleName();
}
out << " SubType= " << GetProcessSubType() << endOfLine
out << G4endl << indent << GetProcessName() << ": ";
if (!rst) out << " for " << part.GetParticleName();
out << " SubType= " << GetProcessSubType() << G4endl
<< " dE/dx and range tables from "
<< G4BestUnit(minKinEnergy,"Energy")
<< " to " << G4BestUnit(maxKinEnergy,"Energy")
<< " in " << nBins << " bins" << endOfLine
<< " in " << nBins << " bins" << G4endl
<< " Lambda tables from threshold to "
<< G4BestUnit(maxKinEnergy,"Energy")
<< ", " << theParameters->NumberOfBinsPerDecade()
<< " bins per decade, spline: "
<< theParameters->Spline()
<< endOfLine;
<< G4endl;
if(theRangeTableForLoss && isIonisation) {
out << " finalRange(mm)= " << finalRange/mm
<< ", dRoverRange= " << dRoverRange
<< ", integral: " << integral
<< ", fluct: " << lossFluctuationFlag
<< ", linLossLimit= " << linLossLimit
<< endOfLine;
<< G4endl;
}
StreamProcessInfo(out, endOfLine);
modelManager->DumpModelList(out, verboseLevel, endOfLine);
StreamProcessInfo(out);
modelManager->DumpModelList(out, verboseLevel);
if(theCSDARangeTable && isIonisation) {
out << " CSDA range table up"
<< " to " << G4BestUnit(maxKinEnergyCSDA,"Energy")
<< " in " << nBinsCSDA << " bins" << endOfLine;
<< " in " << nBinsCSDA << " bins" << G4endl;
}
if(nSCoffRegions>0 && isIonisation) {
out << " Subcutoff sampling in " << nSCoffRegions
<< " regions" << endOfLine;
<< " regions" << G4endl;
}
if(2 < verboseLevel) {
out << " DEDXTable address= " << theDEDXTable << endOfLine;
if(theDEDXTable && isIonisation) out << (*theDEDXTable) << endOfLine;
out << " DEDXTable address= " << theDEDXTable << G4endl;
if(theDEDXTable && isIonisation) out << (*theDEDXTable) << G4endl;
out << "non restricted DEDXTable address= "
<< theDEDXunRestrictedTable << endOfLine;
<< theDEDXunRestrictedTable << G4endl;
if(theDEDXunRestrictedTable && isIonisation) {
out << (*theDEDXunRestrictedTable) << endOfLine;
out << (*theDEDXunRestrictedTable) << G4endl;
}
if(theDEDXSubTable && isIonisation) {
out << (*theDEDXSubTable) << endOfLine;
out << (*theDEDXSubTable) << G4endl;
}
out << " CSDARangeTable address= " << theCSDARangeTable
<< endOfLine;
out << " CSDARangeTable address= " << theCSDARangeTable << G4endl;
if(theCSDARangeTable && isIonisation) {
out << (*theCSDARangeTable) << endOfLine;
out << (*theCSDARangeTable) << G4endl;
}
out << " RangeTableForLoss address= " << theRangeTableForLoss
<< endOfLine;
out << " RangeTableForLoss address= " << theRangeTableForLoss << G4endl;
if(theRangeTableForLoss && isIonisation) {
out << (*theRangeTableForLoss) << endOfLine;
out << (*theRangeTableForLoss) << G4endl;
}
out << " InverseRangeTable address= " << theInverseRangeTable
<< endOfLine;
out << " InverseRangeTable address= " << theInverseRangeTable << G4endl;
if(theInverseRangeTable && isIonisation) {
out << (*theInverseRangeTable) << endOfLine;
out << (*theInverseRangeTable) << G4endl;
}
out << " LambdaTable address= " << theLambdaTable << endOfLine;
out << " LambdaTable address= " << theLambdaTable << G4endl;
if(theLambdaTable && isIonisation) {
out << (*theLambdaTable) << endOfLine;
out << (*theLambdaTable) << G4endl;
}
out << " SubLambdaTable address= " << theSubLambdaTable
<< endOfLine;
out << " SubLambdaTable address= " << theSubLambdaTable << G4endl;
if(theSubLambdaTable && isIonisation) {
out << (*theSubLambdaTable) << endOfLine;
out << (*theSubLambdaTable) << G4endl;
}
}
}
@@ -1181,7 +1093,7 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
// compute mean free path
if(preStepScaledEnergy < mfpKinEnergy) {
if (integral) { ComputeLambdaForScaledEnergy(preStepScaledEnergy); }
else { preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy); }
else { preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy); }
// zero cross section
if(preStepLambda <= 0.0) {
@@ -1231,6 +1143,36 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
{
// condition to skip recomputation of cross section
G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
if(e <= epeak && e/lambdaFactor >= mfpKinEnergy) { return; }
// recomputation is needed
if (e <= epeak) {
preStepLambda = GetLambdaForScaledEnergy(e);
mfpKinEnergy = e;
} else {
G4double e1 = e*lambdaFactor;
if(e1 > epeak) {
preStepLambda = GetLambdaForScaledEnergy(e);
mfpKinEnergy = e;
G4double preStepLambda1 = GetLambdaForScaledEnergy(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
mfpKinEnergy = epeak;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
const G4Step& step)
{
@@ -1700,7 +1642,11 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
if(secParticles[i]) {
G4Track* t = new G4Track(secParticles[i], time, track.GetPosition());
t->SetTouchableHandle(track.GetTouchableHandle());
t->SetWeight(weight);
if (biasManager) {
t->SetWeight(biasManager->GetWeight(i));
} else {
t->SetWeight(weight);
}
if(i < num0) { t->SetCreatorModelIndex(secID); }
else { t->SetCreatorModelIndex(biasID); }
@@ -1959,8 +1905,7 @@ G4double G4VEnergyLossProcess::CrossSectionPerVolume(
particle, kineticEnergy,
(*theCuts)[currentCoupleIndex]));
}
if(cross < 0.0) { cross = 0.0; }
return cross;
return std::max(cross, 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1968,10 +1913,8 @@ G4double G4VEnergyLossProcess::CrossSectionPerVolume(
G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
{
DefineMaterial(track.GetMaterialCutsCouple());
preStepLambda = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
G4double x = DBL_MAX;
if(0.0 < preStepLambda) { x = 1.0/preStepLambda; }
return x;
G4double cs = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
return (0.0 < cs) ? 1.0/cs : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -2318,8 +2261,7 @@ G4VEnergyLossProcess::ActivateSecondaryBiasing(const G4String& region,
void G4VEnergyLossProcess::SetIonisation(G4bool val)
{
isIonisation = val;
if(val) { aGPILSelection = CandidateForSelection; }
else { aGPILSelection = NotCandidateForSelection; }
aGPILSelection = (val) ? CandidateForSelection : NotCandidateForSelection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -2409,7 +2351,7 @@ void G4VEnergyLossProcess::PrintWarning(G4String tit, G4double val)
void G4VEnergyLossProcess::ProcessDescription(std::ostream& out) const
{
if(particle) { StreamInfo(out, *particle, G4String("<br>\n")); }
if(particle) { StreamInfo(out, *particle, true); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMscModel.cc 105745 2017-08-16 13:14:37Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.cc 107364 2017-11-09 10:53:25Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -350,15 +349,14 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VMultipleScattering::StreamInfo(std::ostream& outFile,
const G4ParticleDefinition& part, G4String endOfLine) const
const G4ParticleDefinition& part, G4bool rst) const
{
outFile << endOfLine << GetProcessName() << ": ";
if (endOfLine != G4String("<br>\n")) {
outFile << " for " << part.GetParticleName();
}
outFile << " SubType= " << GetProcessSubType() << endOfLine;
StreamProcessInfo(outFile, endOfLine);
modelManager->DumpModelList(outFile, verboseLevel, endOfLine);
G4String indent = (rst ? " " : "");
outFile << G4endl << indent << GetProcessName() << ": ";
if (!rst) outFile << " for " << part.GetParticleName();
outFile << " SubType= " << GetProcessSubType() << G4endl;
StreamProcessInfo(outFile);
modelManager->DumpModelList(outFile, verboseLevel);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -733,7 +731,7 @@ void G4VMultipleScattering::SetIonisation(G4VEnergyLossProcess* p)
void G4VMultipleScattering::ProcessDescription(std::ostream& outFile) const
{
if(firstParticle) {
StreamInfo(outFile, *firstParticle, G4String("<br>\n"));
StreamInfo(outFile, *firstParticle, true);
}
}
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.cc 108386 2018-02-09 15:38:32Z gcosmo $
//
// -------------------------------------------------------------------
//