Import Geant4 10.6.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2019-06-28 11:59:04 +02:00
parent 28a70706e0
commit d0f911957d
1056 changed files with 95168 additions and 78160 deletions
+42 -8
View File
@@ -16,27 +16,61 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13 March 19: M.Asai (emutils-V10-04-27)
- G4EmParametersMessenger: Defining unit categories for UI commands
that take units.
31 May 19: V.Ivanchenko (emutils-V10-05-12)
- G4NIELCalculator - new helper class
- G4LossTableManager - added access and initialisation of
G4NIELCalculator
11 March 19: G.Cosmo (emutils-V10-04-26)
17 May 19: V.Ivanchenko (emutils-V10-05-11)
- G4EmParameters, G4EmParametersMessenger, G4EmExtraParameters,
G4EmExtraParametersMessenger - added extra parameters;
07 May 19: V.Ivanchenko (emutils-V10-05-10)
- G4EmParameters, G4EmParametersMessenger - split clases keeping the
user interface unchanged;
G4EmExtraParameters, G4EmExtraParametersMessenger - new classes for
complex EM parameters;
G4EmLowEParameters, G4EmLowEParametersMessenger - new classes for
low-energy and DNA parameters
19 April 19: V.Ivanchenko (emutils-V10-05-09)
- G4EmParameters - added polarisation flag, move implementation of splitting
parameters to source and added check on lock; added 9.99 MeV low limit
in the SetMaxEnergy() method, added thread lock to Dump method
01 April 19: V.Ivanchenko (emutils-V10-05-08)
- G4LossTableManager - added Register/DeRegister methods and vector
of pointers for G4VProcess classes for X-ray and optical processes
17 March 19: M.Novak (emutils-V10-05-07)
- G4EmElementSelector, G4VEmModel - added extra method to select the target atom
by making use of the already known log-energy value in the log-vector access
17 March 19: M.Novak (emutils-V10-05-06)
- G4VEmProcess, G4VEnergyLossProcess and G4VMscModel - added extra methods to
access log-vector tables by propagating the already known log-energy value
13 March 19: M.Asai (emutils-V10-05-05)
- G4EmParametersMessenger: Defining unit categories for UI commands
that take units. Co-working with intercoms-V10-05-02.
11 March 19: G.Cosmo (emutils-V10-05-04)
- Fixed typos in printouts in G4EmParametersMessenger.
04 March 19: D.Sawkey
04 March 19: D.Sawkey (emutils-V10-05-03)
- G4EmBiasingManager, G4VEmProcess, G4VEnergyLossProcess - fix
weights for biasing. Should be like version 10.4 now for range cut,
splitting, roulette
18 February 19: D.Sawkey
18 February 19: D.Sawkey (emutils-V10-05-02)
- G4VEmProcess, G4VEnergyLossProcess - make printout information
more compact
13 February 19: D.Sawkey
13 February 19: D.Sawkey (emutils-V10-05-01)
- G4EmBiasingManager: fix incorrect weights with brem splitting
introduced in 10.5 (problem #2125)
31 January 19: V.Ivanchenko
31 January 19: V.Ivant (emutils-V10-05-00)
- G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering,
G4EmModelManager - make info printout at intialisation more
compact (fix problem #2105)
@@ -75,6 +75,9 @@ public:
void Dump(const G4ParticleDefinition* p = nullptr);
inline const G4Element* SelectRandomAtom(G4double kineticEnergy) const;
inline const G4Element* SelectRandomAtom(const G4double kineticEnergy,
const G4double logEKin,
size_t &lastIndx);
inline const G4Material* GetMaterial() const;
@@ -118,6 +121,27 @@ inline const G4Element* G4EmElementSelector::SelectRandomAtom(G4double e) const
return element;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline const G4Element*
G4EmElementSelector::SelectRandomAtom(const G4double e, const G4double loge,
size_t &lastIndx)
{
const G4Element* element = (*theElementVector)[nElmMinusOne];
if (nElmMinusOne > 0) {
const G4double x = G4UniformRand();
for (G4int i=0; i<nElmMinusOne; ++i) {
if (x <= (xSections[i])->Value(e, loge, lastIndx)) {
element = (*theElementVector)[i];
break;
}
}
}
return element;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline const G4Material* G4EmElementSelector::GetMaterial() const
{
return material;
@@ -0,0 +1,173 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
// File name: G4EmExtraParameters
//
// Author: Vladimir Ivanchenko
//
// Creation date: 06.05.2019
//
// Class Description:
//
// An internal utility class, responsable for keeping parameters
// for EM processes and models.
//
// It is initialized by the master thread but can be updated
// at any moment via G4EmParameters interface. It is not assumed
// to be used for a direct initialisation
//
// -------------------------------------------------------------------
//
#ifndef G4EmExtraParameters_h
#define G4EmExtraParameters_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ThreeVector.hh"
#include <vector>
class G4EmExtraParametersMessenger;
class G4VEnergyLossProcess;
class G4VEmProcess;
class G4VAtomDeexcitation;
class G4EmExtraParameters
{
public:
explicit G4EmExtraParameters();
~G4EmExtraParameters();
void Initialise();
G4bool GetDirectionalSplitting();
void SetDirectionalSplitting(G4bool v);
G4bool QuantumEntanglement();
void SetQuantumEntanglement(G4bool v);
void SetDirectionalSplittingRadius(G4double r);
G4double GetDirectionalSplittingRadius();
void SetDirectionalSplittingTarget(const G4ThreeVector& v);
G4ThreeVector GetDirectionalSplittingTarget() const;
void SetStepFunction(G4double v1, G4double v2);
G4double GetStepFunctionP1() const;
G4double GetStepFunctionP2() const;
void SetStepFunctionMuHad(G4double v1, G4double v2);
G4double GetStepFunctionMuHadP1() const;
G4double GetStepFunctionMuHadP2() const;
// parameters per region or per process
void AddPAIModel(const G4String& particle,
const G4String& region,
const G4String& type);
const std::vector<G4String>& ParticlesPAI() const;
const std::vector<G4String>& RegionsPAI() const;
const std::vector<G4String>& TypesPAI() const;
void AddPhysics(const G4String& region, const G4String& type);
const std::vector<G4String>& RegionsPhysics() const;
const std::vector<G4String>& TypesPhysics() const;
void SetSubCutoff(G4bool val, const G4String& region = "");
void SetProcessBiasingFactor(const G4String& procname,
G4double val, G4bool wflag);
void ActivateForcedInteraction(const G4String& procname,
const G4String& region,
G4double length,
G4bool wflag);
void ActivateSecondaryBiasing(const G4String& name,
const G4String& region,
G4double factor,
G4double energyLimit);
// initialisation methods
void DefineRegParamForLoss(G4VEnergyLossProcess*,
G4bool isElectron) const;
void DefineRegParamForEM(G4VEmProcess*) const;
G4EmExtraParameters(G4EmExtraParameters &) = delete;
G4EmExtraParameters & operator=
(const G4EmExtraParameters &right) = delete;
private:
G4String CheckRegion(const G4String&) const;
void PrintWarning(G4ExceptionDescription& ed) const;
G4EmExtraParametersMessenger* theMessenger;
G4bool directionalSplitting;
G4bool quantumEntanglement;
G4double dRoverRange;
G4double finalRange;
G4double dRoverRangeMuHad;
G4double finalRangeMuHad;
G4double directionalSplittingRadius;
G4ThreeVector directionalSplittingTarget;
std::vector<G4String> m_particlesPAI;
std::vector<G4String> m_regnamesPAI;
std::vector<G4String> m_typesPAI;
std::vector<G4String> m_regnamesPhys;
std::vector<G4String> m_typesPhys;
std::vector<G4String> m_regnamesSubCut;
std::vector<G4bool> m_subCuts;
std::vector<G4String> m_procBiasedXS;
std::vector<G4double> m_factBiasedXS;
std::vector<G4bool> m_weightBiasedXS;
std::vector<G4String> m_procForced;
std::vector<G4String> m_regnamesForced;
std::vector<G4double> m_lengthForced;
std::vector<G4bool> m_weightForced;
std::vector<G4String> m_procBiasedSec;
std::vector<G4String> m_regnamesBiasedSec;
std::vector<G4double> m_factBiasedSec;
std::vector<G4double> m_elimBiasedSec;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,96 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EmExtraParametersMessenger
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07-05-2019
//
// -------------------------------------------------------------------
//
// Class Description:
// This is a messenger class to interface to exchange information
// between G4VEm and UI.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef G4EmExtraParametersMessenger_h
#define G4EmExtraParametersMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADouble;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4UIcmdWith3VectorAndUnit;
class G4EmExtraParameters;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4EmExtraParametersMessenger: public G4UImessenger
{
public: // with description
explicit G4EmExtraParametersMessenger(G4EmExtraParameters*);
virtual ~G4EmExtraParametersMessenger();
virtual void SetNewValue(G4UIcommand*, G4String) override;
private:
G4EmExtraParameters* theParameters;
G4UIcmdWithABool* dirSplitCmd;
G4UIcmdWithABool* qeCmd;
G4UIcmdWithADoubleAndUnit* dirSplitRadiusCmd;
G4UIcommand* paiCmd;
G4UIcommand* mscoCmd;
G4UIcommand* SubSecCmd;
G4UIcommand* bfCmd;
G4UIcommand* fiCmd;
G4UIcommand* bsCmd;
G4UIcommand* StepFuncCmd;
G4UIcommand* StepFuncCmd1;
G4UIcmdWith3VectorAndUnit* dirSplitTargetCmd;
};
#endif
@@ -0,0 +1,159 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
// File name: G4EmLowEParameters
//
// Author: Vladimir Ivanchenko
//
// Creation date: 06.05.2019
//
// Class Description:
//
// An internal utility class, responsable for keeping parameters
// for low-energy EM and DNA physics processes and models.
//
// It is initialized by the master thread but can be updated
// at any moment via G4EmParameters interface. It is not assumed
// to be used for a direct initialisation
//
// -------------------------------------------------------------------
//
#ifndef G4EmLowEParameters_h
#define G4EmLowEParameters_h 1
#include "globals.hh"
#include "G4DNAModelSubType.hh"
#include <vector>
class G4EmLowEParametersMessenger;
class G4VAtomDeexcitation;
class G4EmLowEParameters
{
public:
explicit G4EmLowEParameters();
~G4EmLowEParameters();
void Initialise();
// boolean flags
void SetFluo(G4bool val);
G4bool Fluo() const;
void SetBeardenFluoDir(G4bool val);
G4bool BeardenFluoDir() const;
void SetAuger(G4bool val);
G4bool Auger() const;
void SetPixe(G4bool val);
G4bool Pixe() const;
void SetDeexcitationIgnoreCut(G4bool val);
G4bool DeexcitationIgnoreCut() const;
void SetDNAFast(G4bool val);
G4bool DNAFast() const;
void SetDNAStationary(G4bool val);
G4bool DNAStationary() const;
void SetDNAElectronMsc(G4bool val);
G4bool DNAElectronMsc() const;
// integer parameters
void SetDNAeSolvationSubType(G4DNAModelSubType val);
G4DNAModelSubType DNAeSolvationSubType() const;
// string parameters
void SetPIXECrossSectionModel(const G4String&);
const G4String& PIXECrossSectionModel();
void SetPIXEElectronCrossSectionModel(const G4String&);
const G4String& PIXEElectronCrossSectionModel();
// parameters per region or per process
void AddMicroElec(const G4String& region);
const std::vector<G4String>& RegionsMicroElec() const;
void AddDNA(const G4String& region, const G4String& type);
const std::vector<G4String>& RegionsDNA() const;
const std::vector<G4String>& TypesDNA() const;
void SetDeexActiveRegion(const G4String& region, G4bool fdeex,
G4bool fauger, G4bool fpixe);
// initialisation methods
void DefineRegParamForDeex(G4VAtomDeexcitation*) const;
G4EmLowEParameters(G4EmLowEParameters &) = delete;
G4EmLowEParameters & operator=
(const G4EmLowEParameters &right) = delete;
private:
G4String CheckRegion(const G4String&) const;
void PrintWarning(G4ExceptionDescription& ed) const;
G4EmLowEParametersMessenger* theMessenger;
G4bool fluo;
G4bool beardenFluoDir;
G4bool auger;
G4bool pixe;
G4bool deexIgnoreCut;
G4bool dnaFast;
G4bool dnaStationary;
G4bool dnaMsc;
G4DNAModelSubType dnaElectronSolvation;
G4String namePIXE;
G4String nameElectronPIXE;
std::vector<G4String> m_regnamesME;
std::vector<G4String> m_regnamesDNA;
std::vector<G4String> m_typesDNA;
std::vector<G4String> m_regnamesDeex;
std::vector<G4bool> m_fluo;
std::vector<G4bool> m_auger;
std::vector<G4bool> m_pixe;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EmLowEParametersMessenger
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07-05-2019
//
// -------------------------------------------------------------------
//
// Class Description:
// This is a messenger class to interface to exchange information
// between G4VEm and UI.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef G4EmLowEParametersMessenger_h
#define G4EmLowEParametersMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADouble;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4UIcmdWith3VectorAndUnit;
class G4EmLowEParameters;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4EmLowEParametersMessenger: public G4UImessenger
{
public: // with description
explicit G4EmLowEParametersMessenger(G4EmLowEParameters*);
virtual ~G4EmLowEParametersMessenger();
virtual void SetNewValue(G4UIcommand*, G4String) override;
private:
G4EmLowEParameters* theParameters;
G4UIcmdWithABool* deCmd;
G4UIcmdWithABool* dirFluoCmd;
G4UIcmdWithABool* auCmd;
G4UIcmdWithABool* auCascadeCmd;
G4UIcmdWithABool* pixeCmd;
G4UIcmdWithABool* dcutCmd;
G4UIcmdWithABool* dnafCmd;
G4UIcmdWithABool* dnasCmd;
G4UIcmdWithABool* dnamscCmd;
G4UIcmdWithAString* pixeXsCmd;
G4UIcmdWithAString* pixeeXsCmd;
G4UIcmdWithAString* dnaSolCmd;
G4UIcmdWithAString* meCmd;
G4UIcommand* dnaCmd;
G4UIcommand* deexCmd;
};
#endif
@@ -23,12 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4EmParameters
//
// Author: Vladimir Ivanchenko for migration to MT
@@ -60,13 +58,16 @@
#include "G4NuclearFormfactorType.hh"
#include "G4DNAModelSubType.hh"
#include "G4EmSaturation.hh"
#include "G4ThreeVector.hh"
#include "G4Threading.hh"
#include <vector>
class G4EmParametersMessenger;
class G4EmExtraParameters;
class G4EmLowEParameters;
class G4VAtomDeexcitation;
class G4VEnergyLossProcess;
class G4VEmProcess;
class G4VAtomDeexcitation;
class G4StateManager;
class G4EmParameters
@@ -80,7 +81,7 @@ public:
void SetDefaults();
// printing
std::ostream& StreamInfo(std::ostream& os) const;
void StreamInfo(std::ostream& os) const;
void Dump() const;
friend std::ostream& operator<< (std::ostream& os, const G4EmParameters&);
@@ -164,12 +165,20 @@ public:
void SetEnableSamplingTable(G4bool val);
G4bool EnableSamplingTable() const;
void SetEmSaturation(G4EmSaturation*);
G4EmSaturation* GetEmSaturation();
void SetEnablePolarisation(G4bool val);
G4bool EnablePolarisation() const;
G4bool GetDirectionalSplitting();
void SetDirectionalSplitting(G4bool v);
G4bool QuantumEntanglement();
void SetQuantumEntanglement(G4bool v);
// 5d
void SetOnIsolated(G4bool val);
bool OnIsolated() const;
G4bool OnIsolated() const;
void ActivateDNA();
// double parameters with values
void SetMinSubRange(G4double val);
@@ -226,10 +235,19 @@ public:
void SetScreeningFactor(G4double val);
G4double ScreeningFactor() const;
void SetMaxNIELEnergy(G4double val);
G4double MaxNIELEnergy() const;
void SetStepFunction(G4double v1, G4double v2);
void SetStepFunctionMuHad(G4double v1, G4double v2);
void SetDirectionalSplittingRadius(G4double r);
G4double GetDirectionalSplittingRadius();
void SetDirectionalSplittingTarget(const G4ThreeVector& v);
G4ThreeVector GetDirectionalSplittingTarget() const;
// integer parameters
void SetNumberOfBins(G4int val);
G4int NumberOfBins() const;
@@ -281,11 +299,6 @@ 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;
void AddPhysics(const G4String& region, const G4String& type);
const std::vector<G4String>& RegionsPhysics() const;
const std::vector<G4String>& TypesPhysics() const;
@@ -308,17 +321,8 @@ 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; }
void SetEmSaturation(G4EmSaturation*);
G4EmSaturation* GetEmSaturation();
// initialisation methods
void DefineRegParamForLoss(G4VEnergyLossProcess*,
@@ -337,17 +341,15 @@ private:
G4bool IsLocked() const;
G4String CheckRegion(const G4String&) const;
void PrintWarning(G4ExceptionDescription& ed) const;
void PrintWarning(G4ExceptionDescription& ed) const;
static G4EmParameters* theInstance;
G4EmParametersMessenger* theMessenger;
G4StateManager* fStateManager;
G4EmSaturation* emSaturation;
G4EmExtraParameters* fBParameters;
G4EmLowEParameters* fCParameters;
G4StateManager* fStateManager;
G4EmSaturation* emSaturation;
G4bool lossFluctuation;
G4bool buildCSDARange;
@@ -355,12 +357,6 @@ private:
G4bool spline;
G4bool cutAsFinalRange;
G4bool applyCuts;
G4bool fluo;
G4bool beardenFluoDir;
G4bool auger;
G4bool augerCascade;
G4bool pixe;
G4bool deexIgnoreCut;
G4bool lateralDisplacement;
G4bool lateralDisplacementAlg96;
G4bool muhadLateralDisplacement;
@@ -370,13 +366,11 @@ private:
G4bool integral;
G4bool birks;
G4bool fICRU90;
G4bool dnaFast;
G4bool dnaStationary;
G4bool dnaMsc;
G4bool gener;
G4bool enableSamplingTable;
G4bool fSamplingTable;
G4bool fPolarisation;
G4bool onIsolated; // 5d model conversion on free ions
G4bool directionalSplitting;
G4bool fDNA;
G4double minSubRange;
G4double minKinEnergy;
@@ -391,16 +385,12 @@ private:
G4double factorForAngleLimit;
G4double thetaLimit;
G4double energyLimit;
G4double maxNIELEnergy;
G4double rangeFactor;
G4double rangeFactorMuHad;
G4double geomFactor;
G4double skin;
G4double dRoverRange;
G4double finalRange;
G4double dRoverRangeMuHad;
G4double finalRangeMuHad;
G4double factorScreen;
G4double directionalSplittingRadius;
G4int nbins;
G4int nbinsPerDecade;
@@ -408,49 +398,9 @@ private:
G4int workerVerbose;
G4int tripletConv; // 5d model triplet generation type
G4ThreeVector directionalSplittingTarget;
G4MscStepLimitType mscStepLimit;
G4MscStepLimitType mscStepLimitMuHad;
G4NuclearFormfactorType nucFormfactor;
G4DNAModelSubType dnaElectronSolvation;
G4String namePIXE;
G4String nameElectronPIXE;
std::vector<G4String> m_particlesPAI;
std::vector<G4String> m_regnamesPAI;
std::vector<G4String> m_typesPAI;
std::vector<G4String> m_regnamesME;
std::vector<G4String> m_regnamesDNA;
std::vector<G4String> m_typesDNA;
std::vector<G4String> m_regnamesPhys;
std::vector<G4String> m_typesPhys;
std::vector<G4String> m_regnamesSubCut;
std::vector<G4bool> m_subCuts;
std::vector<G4String> m_regnamesDeex;
std::vector<G4bool> m_fluo;
std::vector<G4bool> m_auger;
std::vector<G4bool> m_pixe;
std::vector<G4String> m_procBiasedXS;
std::vector<G4double> m_factBiasedXS;
std::vector<G4bool> m_weightBiasedXS;
std::vector<G4String> m_procForced;
std::vector<G4String> m_regnamesForced;
std::vector<G4double> m_lengthForced;
std::vector<G4bool> m_weightForced;
std::vector<G4String> m_procBiasedSec;
std::vector<G4String> m_regnamesBiasedSec;
std::vector<G4double> m_factBiasedSec;
std::vector<G4double> m_elimBiasedSec;
#ifdef G4MULTITHREADED
static G4Mutex emParametersMutex;
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -34,8 +33,6 @@
//
// Creation date: 22-05-2013
//
// Modifications:
//
// -------------------------------------------------------------------
//
@@ -90,12 +87,6 @@ private:
G4UIcmdWithABool* splCmd;
G4UIcmdWithABool* rsCmd;
G4UIcmdWithABool* aplCmd;
G4UIcmdWithABool* deCmd;
G4UIcmdWithABool* dirFluoCmd;
G4UIcmdWithABool* auCmd;
G4UIcmdWithABool* auCascadeCmd;
G4UIcmdWithABool* pixeCmd;
G4UIcmdWithABool* dcutCmd;
G4UIcmdWithABool* latCmd;
G4UIcmdWithABool* lat96Cmd;
G4UIcmdWithABool* mulatCmd;
@@ -104,14 +95,10 @@ private:
G4UIcmdWithABool* IntegCmd;
G4UIcmdWithABool* mottCmd;
G4UIcmdWithABool* birksCmd;
G4UIcmdWithABool* dnafCmd;
G4UIcmdWithABool* dnasCmd;
G4UIcmdWithABool* dnamscCmd;
G4UIcmdWithABool* sharkCmd;
G4UIcmdWithABool* onIsolatedCmd;
G4UIcmdWithABool* sampleTCmd;
G4UIcmdWithABool* icru90Cmd;
G4UIcmdWithABool* dirSplitCmd;
G4UIcmdWithADouble* minSubSecCmd;
G4UIcmdWithADoubleAndUnit* minEnCmd;
@@ -126,12 +113,12 @@ private:
G4UIcmdWithADouble* mscfCmd;
G4UIcmdWithADoubleAndUnit* angCmd;
G4UIcmdWithADoubleAndUnit* msceCmd;
G4UIcmdWithADoubleAndUnit* nielCmd;
G4UIcmdWithADouble* frCmd;
G4UIcmdWithADouble* fr1Cmd;
G4UIcmdWithADouble* fgCmd;
G4UIcmdWithADouble* skinCmd;
G4UIcmdWithADouble* screCmd;
G4UIcmdWithADoubleAndUnit* dirSplitRadiusCmd;
G4UIcmdWithAnInteger* dedxCmd;
G4UIcmdWithAnInteger* lamCmd;
@@ -143,27 +130,10 @@ private:
G4UIcmdWithAString* mscCmd;
G4UIcmdWithAString* msc1Cmd;
G4UIcmdWithAString* pixeXsCmd;
G4UIcmdWithAString* pixeeXsCmd;
G4UIcmdWithAString* dnaSolCmd;
G4UIcommand* paiCmd;
G4UIcmdWithAString* meCmd;
G4UIcommand* dnaCmd;
G4UIcommand* mscoCmd;
G4UIcommand* dumpCmd;
G4UIcommand* SubSecCmd;
G4UIcommand* StepFuncCmd;
G4UIcommand* StepFuncCmd1;
G4UIcommand* deexCmd;
G4UIcommand* bfCmd;
G4UIcommand* fiCmd;
G4UIcommand* bsCmd;
G4UIcmdWithAString* nffCmd;
G4UIcmdWith3VectorAndUnit* dirSplitTargetCmd;
G4UIcommand* dumpCmd;
};
#endif
@@ -23,8 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
@@ -37,29 +35,7 @@
//
// Creation date: 03.01.2002
//
// Modifications:
//
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
// 17-02-03 Fix problem of store/restore tables for ions (V.Ivanchenko)
// 10-03-03 Add Ion registration (V.Ivanchenko)
// 25-03-03 Add deregistration (V.Ivanchenko)
// 26-03-03 Add GetDEDXDispersion (V.Ivanchenko)
// 02-04-03 Change messenger (V.Ivanchenko)
// 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko)
// 05-10-03 Add G4VEmProcesses registration (V.Ivanchenko)
// 17-10-03 Add SetParameters method (V.Ivanchenko)
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
// 14-01-04 Activate precise range calculation (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 20-01-06 Introduce GetSubDEDX method (VI)
// 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
// 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
// 22-05-06 Add methods Set/Get bremsTh (VI)
// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
// 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
// 12-04-10 Added PreparePhsyicsTables and BuildPhysicsTables entries (V.Ivanchenko)
// 04-06-13 Adaptation for MT mode, new method LocalPhysicsTables (V.Ivanchenko)
// Modifications by V.Ivanchenko
//
// Class Description:
//
@@ -93,6 +69,7 @@ class G4Region;
class G4EmSaturation;
class G4EmConfigurator;
class G4ElectronIonPair;
class G4NIELCalculator;
class G4VMultipleScattering;
class G4VEmProcess;
@@ -107,12 +84,6 @@ public:
~G4LossTableManager();
//-------------------------------------------------
// called from destructor
//-------------------------------------------------
void Clear();
//-------------------------------------------------
// initialisation before a new run
//-------------------------------------------------
@@ -178,6 +149,7 @@ public:
//-------------------------------------------------
// Methods to be called only at initialisation
// and at the end of the job
//-------------------------------------------------
void Register(G4VEnergyLossProcess* p);
@@ -192,6 +164,10 @@ public:
void DeRegister(G4VEmProcess* p);
void Register(G4VProcess* p);
void DeRegister(G4VProcess* p);
void Register(G4VEmModel* p);
void DeRegister(G4VEmModel* p);
@@ -209,6 +185,8 @@ public:
void SetSubCutProducer(G4VSubCutProducer*);
void SetNIELCalculator(G4NIELCalculator*);
//-------------------------------------------------
// Access methods
//-------------------------------------------------
@@ -229,6 +207,8 @@ public:
G4ElectronIonPair* ElectronIonPair();
G4NIELCalculator* NIELCalculator();
inline G4EmCorrections* EmCorrections();
inline G4VAtomDeexcitation* AtomDeexcitation();
@@ -253,6 +233,8 @@ private:
G4LossTableManager();
void Clear();
void ResetParameters();
G4VEnergyLossProcess* BuildTables(const G4ParticleDefinition* aParticle);
@@ -287,6 +269,7 @@ private:
std::vector<G4VEmProcess*> emp_vector;
std::vector<G4VEmModel*> mod_vector;
std::vector<G4VEmFluctuationModel*> fmod_vector;
std::vector<G4VProcess*> p_vector;
// cache
G4VEnergyLossProcess* currentLoss;
@@ -305,6 +288,7 @@ private:
G4EmCorrections* emCorrections;
G4EmConfigurator* emConfigurator;
G4ElectronIonPair* emElectronIonPair;
G4NIELCalculator* nielCalculator;
G4VAtomDeexcitation* atomDeexcitation;
G4VSubCutProducer* subcutProducer;
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4NIELCalculator_h
#define G4NIELCalculator_h 1
// -------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4NIELCalculator
//
// Author: Vladimir Ivanchenko
//
// Creation date: 30.05.2019
//
// Modifications:
//
//
// Class Description:
// This is a helper class to compute NIEL in user stepping action
// or sensitive detector code. User should provide G4VEmModel
// objects, which has NIEL model
//
// -------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Step;
class G4VEmModel;
class G4NIELCalculator
{
public:
explicit G4NIELCalculator(G4VEmModel*, G4int verb);
~G4NIELCalculator();
// initialisation before start of run
void Initialise();
// compute nuclear stopping power
G4double ComputeNIEL(const G4Step*);
// kinetic energy of recoil nucleus or zero
G4double RecoilEnergy(const G4Step*);
// replace model of NIEL
void AddEmModel(G4VEmModel*);
private:
// hide assignment operator
G4NIELCalculator & operator=(const G4NIELCalculator &right) = delete;
G4NIELCalculator(const G4NIELCalculator&) = delete;
G4VEmModel* fModel;
G4int fVerbose;
};
#endif
@@ -284,6 +284,14 @@ public:
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// same as SelectRandomAtom above but more efficient since log-ekin is known
inline const G4Element* SelectTargetAtom(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double logKineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// to select atom cross section per volume is recomputed for each element
const G4Element* SelectRandomAtom(const G4Material*,
@@ -429,6 +437,7 @@ protected:
const std::vector<G4double>* theDensityFactor;
const std::vector<G4int>* theDensityIdx;
size_t idxTable;
size_t fIdxTableElmSelector;
G4bool lossFlucFlag;
G4double inveplus;
@@ -559,6 +568,26 @@ G4VEmModel::SelectRandomAtom(const G4MaterialCutsCouple* couple,
return fCurrentElement;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4Element*
G4VEmModel::SelectTargetAtom(const G4MaterialCutsCouple* couple,
const G4ParticleDefinition* part,
G4double kinEnergy,
G4double logKinEnergy,
G4double cutEnergy,
G4double maxEnergy)
{
fCurrentCouple = couple;
fCurrentElement = (nSelectors > 0)
? ((*elmSelectors)[couple->GetIndex()])->SelectRandomAtom(kinEnergy,
logKinEnergy, fIdxTableElmSelector)
: SelectRandomAtom(couple->GetMaterial(),part,kinEnergy,cutEnergy,maxEnergy);
fCurrentIsotope = nullptr;
return fCurrentElement;
}
// ======== Get/Set inline methods used at initialisation ================
inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
@@ -150,7 +150,7 @@ 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,
@@ -162,6 +162,9 @@ public:
// It returns cross section per volume
inline G4double GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
inline G4double GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy);
//------------------------------------------------------------------------
// Specific methods to build and access Physics Tables
@@ -312,15 +315,20 @@ private:
void PrintWarning(G4String tit, G4double val);
void ComputeIntegralLambda(G4double kinEnergy);
// void ComputeIntegralLambda(G4double kinEnergy);
void ComputeIntegralLambda(G4double kinEnergy, G4double logKinEnergy);
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
inline G4double GetLambdaFromTable(G4double kinEnergy);
inline G4double GetLambdaFromTable(G4double kinEnergy, G4double logKinEnergy);
inline G4double GetLambdaFromTablePrim(G4double kinEnergy);
inline G4double GetLambdaFromTablePrim(G4double kinEnergy,
G4double logKinEnergy);
inline G4double GetCurrentLambda(G4double kinEnergy);
inline G4double GetCurrentLambda(G4double kinEnergy, G4double logKinEnergy);
inline G4double ComputeCurrentLambda(G4double kinEnergy);
@@ -363,6 +371,7 @@ private:
G4double minKinEnergyPrim;
G4double maxKinEnergy;
G4double lambdaFactor;
G4double logLambdaFactor;
G4double biasFactor;
G4double massRatio;
@@ -402,6 +411,7 @@ protected:
G4double mfpKinEnergy;
G4double preStepKinEnergy;
G4double preStepLogKinEnergy;
G4double preStepLambda;
private:
@@ -503,6 +513,11 @@ inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
return ((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
}
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e, G4double loge)
{
return ((*theLambdaTable)[basedCoupleIndex])->Value(e, loge, idxLambda);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTablePrim(G4double e)
@@ -510,6 +525,12 @@ inline G4double G4VEmProcess::GetLambdaFromTablePrim(G4double e)
return ((*theLambdaTablePrim)[basedCoupleIndex])->Value(e, idxLambdaPrim)/e;
}
inline G4double G4VEmProcess::GetLambdaFromTablePrim(G4double e, G4double loge)
{
return
((*theLambdaTablePrim)[basedCoupleIndex])->Value(e, loge, idxLambdaPrim)/e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
@@ -529,6 +550,15 @@ inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
return fFactor*x;
}
inline G4double G4VEmProcess::GetCurrentLambda(G4double e, G4double loge)
{
G4double x(0.0);
if(e >= minKinEnergyPrim) { x = GetLambdaFromTablePrim(e, loge); }
else if(theLambdaTable) { x = GetLambdaFromTable(e, loge); }
else if(currentModel) { x = ComputeCurrentLambda(e); }
return fFactor*x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void
@@ -541,13 +571,20 @@ G4VEmProcess::CurrentSetup(const G4MaterialCutsCouple* couple, G4double energy)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEmProcess::GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
G4VEmProcess::GetLambda(G4double kinEnergy, const G4MaterialCutsCouple* couple)
{
CurrentSetup(couple, kinEnergy);
return GetCurrentLambda(kinEnergy);
}
inline G4double
G4VEmProcess::GetLambda(G4double kinEnergy, const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
CurrentSetup(couple, kinEnergy);
return GetCurrentLambda(kinEnergy, logKinEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
@@ -213,6 +213,9 @@ public:
// Access to cross section table
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple,
G4double logKineticEnergy);
// access to cross section
G4double MeanFreePath(const G4Track& track);
@@ -365,20 +368,26 @@ public:
inline G4double CrossSectionBiasingFactor() const;
// Return values for given G4MaterialCutsCouple
inline G4double GetDEDX(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetDEDX(G4double kineticEnergy, const G4MaterialCutsCouple*);
inline G4double GetDEDX(G4double kineticEnergy, const G4MaterialCutsCouple*,
G4double logKineticEnergy);
inline G4double GetDEDXForSubsec(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRange(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRange(G4double kineticEnergy, const G4MaterialCutsCouple*);
inline G4double GetRange(G4double kineticEnergy, const G4MaterialCutsCouple*,
G4double logKineticEnergy);
inline G4double GetCSDARange(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRangeForLoss(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetRangeForLoss(G4double kineticEnergy,
const G4MaterialCutsCouple*,
G4double logKineticEnergy);
inline G4double GetKineticEnergy(G4double range,
const G4MaterialCutsCouple*);
inline G4double GetLambda(G4double kineticEnergy,
const G4MaterialCutsCouple*);
inline G4double GetLambda(G4double kineticEnergy,const G4MaterialCutsCouple*);
inline G4double GetLambda(G4double kineticEnergy,const G4MaterialCutsCouple*,
G4double logKineticEnergy);
inline G4bool TablesAreBuilt() const;
@@ -417,16 +426,24 @@ private:
//------------------------------------------------------------------------
// Compute values using scaling relation, mass and charge of based particle
//------------------------------------------------------------------------
inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
inline G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetIonisationForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetSubIonisationForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
inline G4double ScaledKinEnergyForLoss(G4double range);
inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy);
inline G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
void ComputeLambdaForScaledEnergy(G4double scaledKinEnergy,
G4double logScaledKinEnergy);
// hide assignment operator
G4VEnergyLossProcess(G4VEnergyLossProcess &) = delete;
@@ -509,6 +526,7 @@ private:
G4double dRoverRange;
G4double finalRange;
G4double lambdaFactor;
G4double logLambdafactor;
G4double biasFactor;
G4bool lossFluctuationFlag;
@@ -541,7 +559,9 @@ protected:
G4double fRange;
G4double computedRange;
G4double preStepKinEnergy;
G4double preStepLogKinEnergy;
G4double preStepScaledEnergy;
G4double preStepLogScaledEnergy;
G4double preStepRangeEnergy;
G4double mfpKinEnergy;
@@ -559,6 +579,7 @@ private:
size_t lastIdx;
G4double massRatio;
G4double logMassRatio;
G4double fFactor;
G4double reduceFactor;
G4double chargeSqRatio;
@@ -616,6 +637,7 @@ inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
G4double charge2ratio)
{
massRatio = massratio;
logMassRatio = G4Log(massRatio);
fFactor = charge2ratio*biasFactor*(*theDensityFactor)[currentCoupleIndex];
chargeSqRatio = charge2ratio;
reduceFactor = 1.0/(fFactor*massRatio);
@@ -635,6 +657,19 @@ inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
return x;
}
inline
G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e, G4double loge)
{
/*
G4cout << "G4VEnergyLossProcess::GetDEDX: Idx= "
<< basedCoupleIndex << " E(MeV)= " << e
<< " Emin= " << minKinEnergy << " Factor= " << fFactor
<< " " << theDEDXTable << G4endl; */
G4double x = fFactor*(*theDEDXTable)[basedCoupleIndex]->Value(e,loge,idxDEDX);
if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
@@ -677,7 +712,27 @@ inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
lastIdx = basedCoupleIndex;
preStepRangeEnergy = e;
computedRange =
((*theRangeTableForLoss)[basedCoupleIndex])->Value(e, idxRange);
((*theRangeTableForLoss)[basedCoupleIndex])->Value(e, idxRange);
if(e < minKinEnergy) { computedRange *= std::sqrt(e/minKinEnergy); }
}
//G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= "
// << basedCoupleIndex << " E(MeV)= " << e
// << " R= " << fRange << " " << theRangeTableForLoss << G4endl;
return computedRange;
}
inline G4double
G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e, G4double loge)
{
//G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= "
// << basedCoupleIndex << " E(MeV)= " << e
// << " lastIdx= " << lastIdx << " " << theRangeTableForLoss << G4endl;
if(basedCoupleIndex != lastIdx || preStepRangeEnergy != e) {
lastIdx = basedCoupleIndex;
preStepRangeEnergy = e;
computedRange =
((*theRangeTableForLoss)[basedCoupleIndex])->Value(e, loge, idxRange);
if(e < minKinEnergy) { computedRange *= std::sqrt(e/minKinEnergy); }
}
//G4cout << "G4VEnergyLossProcess::GetScaledRange: Idx= "
@@ -688,7 +743,6 @@ inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(G4double e)
{
@@ -703,6 +757,21 @@ G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(G4double e)
return x;
}
inline G4double
G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(G4double e,
G4double loge)
{
G4double x;
if (e < maxKinEnergyCSDA) {
x = ((*theCSDARangeTable)[basedCoupleIndex])->Value(e, loge, idxCSDA);
if(e < minKinEnergy) { x *= std::sqrt(e/minKinEnergy); }
} else {
x = theRangeAtMaxEnergy[basedCoupleIndex] +
(e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[basedCoupleIndex];
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::ScaledKinEnergyForLoss(G4double r)
@@ -728,14 +797,29 @@ inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e)
return fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
}
inline G4double
G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e, G4double loge)
{
return fFactor*((*theLambdaTable)[basedCoupleIndex])->Value(e,loge,idxLambda);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetDEDX(G4double kineticEnergy,
G4VEnergyLossProcess::GetDEDX(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return GetDEDXForScaledEnergy(kineticEnergy*massRatio);
return GetDEDXForScaledEnergy(kinEnergy*massRatio);
}
inline G4double
G4VEnergyLossProcess::GetDEDX(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
DefineMaterial(couple);
return GetDEDXForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -751,16 +835,32 @@ G4VEnergyLossProcess::GetDEDXForSubsec(G4double kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetRange(G4double kineticEnergy,
G4VEnergyLossProcess::GetRange(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
G4double x = fRange;
DefineMaterial(couple);
if(theCSDARangeTable) {
x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)
* reduceFactor;
x = reduceFactor * GetLimitScaledRangeForScaledEnergy(kinEnergy*massRatio);
} else if(theRangeTableForLoss) {
x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
x = reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
}
return x;
}
inline G4double
G4VEnergyLossProcess::GetRange(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
G4double x = fRange;
DefineMaterial(couple);
if(theCSDARangeTable) {
x = reduceFactor * GetLimitScaledRangeForScaledEnergy(kinEnergy*massRatio,
logKinEnergy+logMassRatio);
} else if(theRangeTableForLoss) {
x = reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio,
logKinEnergy+logMassRatio);
}
return x;
}
@@ -780,12 +880,23 @@ G4VEnergyLossProcess::GetCSDARange(G4double kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetRangeForLoss(G4double kineticEnergy,
G4VEnergyLossProcess::GetRangeForLoss(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
// G4cout << "GetRangeForLoss: Range from " << GetProcessName() << G4endl;
DefineMaterial(couple);
return GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
return reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
}
inline G4double
G4VEnergyLossProcess::GetRangeForLoss(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
// G4cout << "GetRangeForLoss: Range from " << GetProcessName() << G4endl;
DefineMaterial(couple);
return reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio,
logKinEnergy+logMassRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -801,11 +912,22 @@ G4VEnergyLossProcess::GetKineticEnergy(G4double range,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetLambda(G4double kineticEnergy,
G4VEnergyLossProcess::GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return theLambdaTable ? GetLambdaForScaledEnergy(kineticEnergy*massRatio) : 0.0;
return theLambdaTable ? GetLambdaForScaledEnergy(kinEnergy*massRatio) : 0.0;
}
inline G4double
G4VEnergyLossProcess::GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
DefineMaterial(couple);
return theLambdaTable
? GetLambdaForScaledEnergy(kinEnergy*massRatio, logKinEnergy+logMassRatio)
: 0.0;
}
// ======== Get/Set inline methods used at initialisation ================
@@ -139,12 +139,20 @@ public:
G4double limit);
inline G4double GetDEDX(const G4ParticleDefinition* part,
G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
inline G4double GetDEDX(const G4ParticleDefinition* part,
G4double kineticEnergy,
const G4MaterialCutsCouple* couple,
G4double logKineticEnergy);
inline G4double GetRange(const G4ParticleDefinition* part,
G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
const G4MaterialCutsCouple* couple);
inline G4double GetRange(const G4ParticleDefinition* part,
G4double kineticEnergy,
const G4MaterialCutsCouple* couple,
G4double logKineticEnergy);
inline G4double GetEnergy(const G4ParticleDefinition* part,
G4double range,
@@ -153,7 +161,11 @@ public:
// G4MaterialCutsCouple should be defined before call to this method
inline
G4double GetTransportMeanFreePath(const G4ParticleDefinition* part,
G4double kinEnergy);
G4double kinEnergy);
inline
G4double GetTransportMeanFreePath(const G4ParticleDefinition* part,
G4double kinEnergy,
G4double logKinEnergy);
private:
@@ -264,13 +276,28 @@ inline G4double G4VMscModel::ComputeGeomLimit(const G4Track& track,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double
G4VMscModel::GetDEDX(const G4ParticleDefinition* part,
G4double kinEnergy, const G4MaterialCutsCouple* couple)
G4VMscModel::GetDEDX(const G4ParticleDefinition* part, G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
G4double x;
if(ionisation) { x = ionisation->GetDEDX(kinEnergy, couple); }
else {
G4double q = part->GetPDGCharge()*inveplus;
if (ionisation) {
x = ionisation->GetDEDX(kinEnergy, couple);
} else {
const G4double q = part->GetPDGCharge()*inveplus;
x = dedx*q*q;
}
return x;
}
inline G4double
G4VMscModel::GetDEDX(const G4ParticleDefinition* part, G4double kinEnergy,
const G4MaterialCutsCouple* couple, G4double logKinEnergy)
{
G4double x;
if (ionisation) {
x = ionisation->GetDEDX(kinEnergy, couple, logKinEnergy);
} else {
const G4double q = part->GetPDGCharge()*inveplus;
x = dedx*q*q;
}
return x;
@@ -279,23 +306,41 @@ G4VMscModel::GetDEDX(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double
G4VMscModel::GetRange(const G4ParticleDefinition* part,
G4double kinEnergy, const G4MaterialCutsCouple* couple)
G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy,
const G4MaterialCutsCouple* couple)
{
//G4cout << "G4VMscModel::GetRange E(MeV)= " << kinEnergy << " "
// << ionisation << " " << part->GetParticleName()
// << G4endl;
// << G4endl;
localtkin = kinEnergy;
if(ionisation) {
if (ionisation) {
localrange = ionisation->GetRangeForLoss(kinEnergy, couple);
} else {
G4double q = part->GetPDGCharge()*inveplus;
} else {
const G4double q = part->GetPDGCharge()*inveplus;
localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity());
}
//G4cout << "R(mm)= " << localrange << " " << ionisation << G4endl;
return localrange;
}
inline G4double
G4VMscModel::GetRange(const G4ParticleDefinition* part,G4double kinEnergy,
const G4MaterialCutsCouple* couple, G4double logKinEnergy)
{
//G4cout << "G4VMscModel::GetRange E(MeV)= " << kinEnergy << " "
// << ionisation << " " << part->GetParticleName()
// << G4endl;
localtkin = kinEnergy;
if (ionisation) {
localrange = ionisation->GetRangeForLoss(kinEnergy, couple, logKinEnergy);
} else {
const G4double q = part->GetPDGCharge()*inveplus;
localrange = kinEnergy/(dedx*q*q*couple->GetMaterial()->GetDensity());
}
//G4cout << "R(mm)= " << localrange << " " << ionisation << G4endl;
return localrange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double
@@ -337,16 +382,32 @@ inline void G4VMscModel::SetIonisation(G4VEnergyLossProcess* p,
inline G4double
G4VMscModel::GetTransportMeanFreePath(const G4ParticleDefinition* part,
G4double ekin)
G4double ekin)
{
G4double x;
if(xSectionTable) {
G4int idx = CurrentCouple()->GetIndex();
x = (*xSectionTable)[(*theDensityIdx)[idx]]->Value(ekin, idxTable)
*(*theDensityFactor)[idx]/(ekin*ekin);
if (xSectionTable) {
const G4int idx = CurrentCouple()->GetIndex();
x = (*xSectionTable)[(*theDensityIdx)[idx]]->Value(ekin, idxTable)
*(*theDensityFactor)[idx]/(ekin*ekin);
} else {
x = CrossSectionPerVolume(CurrentCouple()->GetMaterial(), part, ekin,
0.0, DBL_MAX);
0.0, DBL_MAX);
}
return (x > 0.0) ? 1.0/x : DBL_MAX;
}
inline G4double
G4VMscModel::GetTransportMeanFreePath(const G4ParticleDefinition* part,
G4double ekin, G4double logekin)
{
G4double x;
if (xSectionTable) {
const G4int idx = CurrentCouple()->GetIndex();
x = (*xSectionTable)[(*theDensityIdx)[idx]]->Value(ekin, logekin, idxTable)
*(*theDensityFactor)[idx]/(ekin*ekin);
} else {
x = CrossSectionPerVolume(CurrentCouple()->GetMaterial(), part, ekin,
0.0, DBL_MAX);
}
return (x > 0.0) ? 1.0/x : DBL_MAX;
}
@@ -54,6 +54,10 @@ GEANT4_DEFINE_MODULE(NAME G4emutils
G4EmCorrections.hh
G4EmDataHandler.hh
G4EmElementSelector.hh
G4EmExtraParameters.hh
G4EmExtraParametersMessenger.hh
G4EmLowEParameters.hh
G4EmLowEParametersMessenger.hh
G4EmModelManager.hh
G4EmMultiModel.hh
G4EmParameters.hh
@@ -66,6 +70,7 @@ GEANT4_DEFINE_MODULE(NAME G4emutils
G4LossTableBuilder.hh
G4LossTableManager.hh
G4MscStepLimitType.hh
G4NIELCalculator.hh
G4NuclearFormfactorType.hh
G4VAtomDeexcitation.hh
G4VEmAngularDistribution.hh
@@ -87,6 +92,10 @@ GEANT4_DEFINE_MODULE(NAME G4emutils
G4EmCorrections.cc
G4EmDataHandler.cc
G4EmElementSelector.cc
G4EmExtraParameters.cc
G4EmExtraParametersMessenger.cc
G4EmLowEParameters.cc
G4EmLowEParametersMessenger.cc
G4EmModelManager.cc
G4EmMultiModel.cc
G4EmParameters.cc
@@ -96,6 +105,7 @@ GEANT4_DEFINE_MODULE(NAME G4emutils
G4EnergyLossTables.cc
G4LossTableBuilder.cc
G4LossTableManager.cc
G4NIELCalculator.cc
G4VAtomDeexcitation.cc
G4VEmAngularDistribution.cc
G4VEmFluctuationModel.cc
@@ -0,0 +1,420 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4EmExtraParameters
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07.05.2019
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmExtraParameters.hh"
#include "G4PhysicalConstants.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4EmExtraParametersMessenger.hh"
#include "G4RegionStore.hh"
#include "G4Region.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmExtraParameters::G4EmExtraParameters()
{
theMessenger = new G4EmExtraParametersMessenger(this);
Initialise();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmExtraParameters::~G4EmExtraParameters()
{
delete theMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4EmExtraParameters::Initialise()
{
quantumEntanglement = false;
directionalSplitting = false;
directionalSplittingTarget.set(0.,0.,0.);
directionalSplittingRadius = 0.;
dRoverRange = 0.2;
finalRange = CLHEP::mm;
dRoverRangeMuHad = 0.2;
finalRangeMuHad = 0.1*CLHEP::mm;
m_regnamesForced.clear();
m_procForced.clear();
m_lengthForced.clear();
m_weightForced.clear();
m_regnamesSubCut.clear();
m_subCuts.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4EmExtraParameters::PrintWarning(G4ExceptionDescription& ed) const
{
G4Exception("G4EmExtraParameters", "em0044", JustWarning, ed);
}
G4String G4EmExtraParameters::CheckRegion(const G4String& reg) const
{
G4String r = reg;
if(r == "" || r == "world" || r == "World") {
r = "DefaultRegionForTheWorld";
}
return r;
}
void G4EmExtraParameters::SetStepFunction(G4double v1, G4double v2)
{
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRange = v1;
finalRange = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
}
G4double G4EmExtraParameters::GetStepFunctionP1() const
{
return dRoverRange;
}
G4double G4EmExtraParameters::GetStepFunctionP2() const
{
return finalRange;
}
void G4EmExtraParameters::SetStepFunctionMuHad(G4double v1, G4double v2)
{
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRangeMuHad = v1;
finalRangeMuHad = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
}
G4double G4EmExtraParameters::GetStepFunctionMuHadP1() const
{
return dRoverRangeMuHad;
}
G4double G4EmExtraParameters::GetStepFunctionMuHadP2() const
{
return finalRangeMuHad;
}
void G4EmExtraParameters::AddPAIModel(const G4String& particle,
const G4String& region,
const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPAI.size();
for(G4int i=0; i<nreg; ++i) {
if((m_particlesPAI[i] == particle ||
m_particlesPAI[i] == "all" ||
particle == "all") &&
(m_regnamesPAI[i] == r ||
m_regnamesPAI[i] == "DefaultRegionForTheWorld" ||
r == "DefaultRegionForTheWorld") ) {
m_typesPAI[i] = type;
if(particle == "all") { m_particlesPAI[i] = particle; }
if(r == "DefaultRegionForTheWorld") { m_regnamesPAI[i] = r; }
return;
}
}
m_particlesPAI.push_back(particle);
m_regnamesPAI.push_back(r);
m_typesPAI.push_back(type);
}
const std::vector<G4String>& G4EmExtraParameters::ParticlesPAI() const
{
return m_particlesPAI;
}
const std::vector<G4String>& G4EmExtraParameters::RegionsPAI() const
{
return m_regnamesPAI;
}
const std::vector<G4String>& G4EmExtraParameters::TypesPAI() const
{
return m_typesPAI;
}
void G4EmExtraParameters::AddPhysics(const G4String& region,
const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPhys.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesPhys[i]) { return; }
}
m_regnamesPhys.push_back(r);
m_typesPhys.push_back(type);
}
const std::vector<G4String>& G4EmExtraParameters::RegionsPhysics() const
{
return m_regnamesPhys;
}
const std::vector<G4String>& G4EmExtraParameters::TypesPhysics() const
{
return m_typesPhys;
}
void G4EmExtraParameters::SetSubCutoff(G4bool val, const G4String& region)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesSubCut[i]) {
m_subCuts[i] = val;
return;
}
}
m_regnamesSubCut.push_back(r);
m_subCuts.push_back(val);
}
void
G4EmExtraParameters::SetProcessBiasingFactor(const G4String& procname,
G4double val, G4bool wflag)
{
if(val > 0.0) {
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedXS[i]) {
m_factBiasedXS[i] = val;
m_weightBiasedXS[i]= wflag;
return;
}
}
m_procBiasedXS.push_back(procname);
m_factBiasedXS.push_back(val);
m_weightBiasedXS.push_back(wflag);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " XS biasing factor "
<< val << " is negative - ignored";
PrintWarning(ed);
}
}
void
G4EmExtraParameters::ActivateForcedInteraction(const G4String& procname,
const G4String& region,
G4double length,
G4bool wflag)
{
G4String r = CheckRegion(region);
if(length >= 0.0) {
G4int n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procForced[i] && r == m_regnamesForced[i] ) {
m_lengthForced[i] = length;
m_weightForced[i]= wflag;
return;
}
}
m_regnamesForced.push_back(r);
m_procForced.push_back(procname);
m_lengthForced.push_back(length);
m_weightForced.push_back(wflag);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : forced interacttion length= "
<< length << " is negative - ignored";
PrintWarning(ed);
}
}
void
G4EmExtraParameters::ActivateSecondaryBiasing(const G4String& procname,
const G4String& region,
G4double factor,
G4double energyLim)
{
G4String r = CheckRegion(region);
if(factor >= 0.0 && energyLim >= 0.0) {
G4int n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedSec[i] && r == m_regnamesBiasedSec[i] ) {
m_factBiasedSec[i] = factor;
m_elimBiasedSec[i] = energyLim;
return;
}
}
m_regnamesBiasedSec.push_back(r);
m_procBiasedSec.push_back(procname);
m_factBiasedSec.push_back(factor);
m_elimBiasedSec.push_back(energyLim);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : secondary bised factor= "
<< factor << ", Elim= " << energyLim << " - ignored";
PrintWarning(ed);
}
}
void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr,
G4bool isElectron) const
{
if(isElectron) { ptr->SetStepFunction(dRoverRange, finalRange, false); }
else { ptr->SetStepFunction(dRoverRangeMuHad, finalRangeMuHad, false); }
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4int n = m_regnamesSubCut.size();
for(G4int i=0; i<n; ++i) {
const G4Region* reg = regionStore->GetRegion(m_regnamesSubCut[i], false);
if(reg) { ptr->ActivateSubCutoff(m_subCuts[i], reg); }
}
n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
break;
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
m_weightForced[i]);
break;
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
m_elimBiasedSec[i]);
break;
}
}
}
void G4EmExtraParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
{
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
break;
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
m_weightForced[i]);
break;
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
m_elimBiasedSec[i]);
break;
}
}
}
G4bool G4EmExtraParameters::QuantumEntanglement()
{
return quantumEntanglement;
}
void G4EmExtraParameters::SetQuantumEntanglement(G4bool v)
{
quantumEntanglement = v;
}
G4bool G4EmExtraParameters::GetDirectionalSplitting() {
return directionalSplitting;
}
void G4EmExtraParameters::SetDirectionalSplitting(G4bool v)
{
directionalSplitting = v;
}
void
G4EmExtraParameters::SetDirectionalSplittingTarget(const G4ThreeVector& v)
{
directionalSplittingTarget = v;
}
G4ThreeVector G4EmExtraParameters::GetDirectionalSplittingTarget() const
{
return directionalSplittingTarget;
}
void G4EmExtraParameters::SetDirectionalSplittingRadius(G4double r)
{
directionalSplittingRadius = r;
}
G4double G4EmExtraParameters::GetDirectionalSplittingRadius()
{
return directionalSplittingRadius;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,327 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EmExtraParametersMessenger
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07-05-2019
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmExtraParametersMessenger.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UImanager.hh"
#include "G4EmExtraParameters.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters* ptr)
: theParameters(ptr)
{
paiCmd = new G4UIcommand("/process/em/AddPAIRegion",this);
paiCmd->SetGuidance("Activate PAI in the G4Region.");
paiCmd->SetGuidance(" partName : particle name (default - all)");
paiCmd->SetGuidance(" regName : G4Region name");
paiCmd->SetGuidance(" paiType : PAI, PAIphoton");
paiCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* part = new G4UIparameter("partName",'s',false);
paiCmd->SetParameter(part);
G4UIparameter* pregName = new G4UIparameter("regName",'s',false);
paiCmd->SetParameter(pregName);
G4UIparameter* ptype = new G4UIparameter("type",'s',false);
paiCmd->SetParameter(ptype);
ptype->SetParameterCandidates("pai PAI PAIphoton");
mscoCmd = new G4UIcommand("/process/em/AddEmRegion",this);
mscoCmd->SetGuidance("Add optional EM configuration for a G4Region.");
mscoCmd->SetGuidance(" regName : G4Region name");
mscoCmd->SetGuidance(" emType : G4EmStandard, G4EmStandard_opt1, ...");
mscoCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* mregName = new G4UIparameter("regName",'s',false);
mscoCmd->SetParameter(mregName);
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");
SubSecCmd = new G4UIcommand("/process/eLoss/subsec",this);
SubSecCmd->SetGuidance("Switch true/false the subcutoff generation per region.");
SubSecCmd->SetGuidance(" subSec : true/false");
SubSecCmd->SetGuidance(" Region : region name");
SubSecCmd->AvailableForStates(G4State_PreInit);
StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd->SetGuidance(" finalRange: range for final step");
StepFuncCmd->SetGuidance(" unit : unit of finalRange");
StepFuncCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
dRoverRPrm->SetParameterRange("dRoverR>0. && dRoverR<=1.");
StepFuncCmd->SetParameter(dRoverRPrm);
G4UIparameter* finalRangePrm = new G4UIparameter("finalRange",'d',false);
finalRangePrm->SetParameterRange("finalRange>0.");
StepFuncCmd->SetParameter(finalRangePrm);
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetDefaultUnit("mm");
StepFuncCmd->SetParameter(unitPrm);
StepFuncCmd1 = new G4UIcommand("/process/eLoss/StepFunctionMuHad",this);
StepFuncCmd1->SetGuidance("Set the energy loss step limitation parameters for muon/hadron.");
StepFuncCmd1->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd1->SetGuidance(" finalRange: range for final step");
StepFuncCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm1 = new G4UIparameter("dRoverRMuHad",'d',false);
dRoverRPrm1->SetParameterRange("dRoverRMuHad>0. && dRoverRMuHad<=1.");
StepFuncCmd1->SetParameter(dRoverRPrm1);
G4UIparameter* finalRangePrm1 = new G4UIparameter("finalRangeMuHad",'d',false);
finalRangePrm1->SetParameterRange("finalRangeMuHad>0.");
StepFuncCmd1->SetParameter(finalRangePrm1);
G4UIparameter* unitPrm1 = new G4UIparameter("unit",'s',true);
unitPrm1->SetDefaultValue("mm");
StepFuncCmd1->SetParameter(unitPrm1);
G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
SubSecCmd->SetParameter(subSec);
G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
SubSecCmd->SetParameter(subSecReg);
bfCmd = new G4UIcommand("/process/em/setBiasingFactor",this);
bfCmd->SetGuidance("Set factor for the process cross section.");
bfCmd->SetGuidance(" procName : process name");
bfCmd->SetGuidance(" procFact : factor");
bfCmd->SetGuidance(" flagFact : flag to change weight");
bfCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* procName = new G4UIparameter("procName",'s',false);
bfCmd->SetParameter(procName);
G4UIparameter* procFact = new G4UIparameter("procFact",'d',false);
bfCmd->SetParameter(procFact);
G4UIparameter* flagFact = new G4UIparameter("flagFact",'s',false);
bfCmd->SetParameter(flagFact);
fiCmd = new G4UIcommand("/process/em/setForcedInteraction",this);
fiCmd->SetGuidance("Set factor for the process cross section.");
fiCmd->SetGuidance(" procNam : process name");
fiCmd->SetGuidance(" regNam : region name");
fiCmd->SetGuidance(" tlength : fixed target length");
fiCmd->SetGuidance(" unitT : length unit");
fiCmd->SetGuidance(" tflag : flag to change weight");
fiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* procNam = new G4UIparameter("procNam",'s',false);
fiCmd->SetParameter(procNam);
G4UIparameter* regNam = new G4UIparameter("regNam",'s',false);
fiCmd->SetParameter(regNam);
G4UIparameter* tlength = new G4UIparameter("tlength",'d',false);
tlength->SetParameterRange("tlength>0");
fiCmd->SetParameter(tlength);
G4UIparameter* unitT = new G4UIparameter("unitT",'s',true);
unitT->SetDefaultUnit("mm");
fiCmd->SetParameter(unitT);
G4UIparameter* flagT = new G4UIparameter("tflag",'b',true);
flagT->SetDefaultValue(true);
fiCmd->SetParameter(flagT);
bsCmd = new G4UIcommand("/process/em/setSecBiasing",this);
bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roulette per region.");
bsCmd->SetGuidance(" bProcNam : process name");
bsCmd->SetGuidance(" bRegNam : region name");
bsCmd->SetGuidance(" bFactor : number of split gamma or probability of Russian roulette");
bsCmd->SetGuidance(" bEnergy : max energy of a secondary for this biasing method");
bsCmd->SetGuidance(" bUnit : energy unit");
bsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* bProcNam = new G4UIparameter("bProcNam",'s',false);
bsCmd->SetParameter(bProcNam);
G4UIparameter* bRegNam = new G4UIparameter("bRegNam",'s',false);
bsCmd->SetParameter(bRegNam);
G4UIparameter* bFactor = new G4UIparameter("bFactor",'d',false);
bsCmd->SetParameter(bFactor);
G4UIparameter* bEnergy = new G4UIparameter("bEnergy",'d',false);
bsCmd->SetParameter(bEnergy);
G4UIparameter* bUnit = new G4UIparameter("bUnit",'s',true);
bUnit->SetDefaultUnit("MeV");
bsCmd->SetParameter(bUnit);
dirSplitCmd = new G4UIcmdWithABool("/process/em/setDirectionalSplitting",this);
dirSplitCmd->SetGuidance("Enable directional brem splitting");
dirSplitCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
qeCmd = new G4UIcmdWithABool("/process/em/QuantumEntanglement",this);
qeCmd->SetGuidance("Enable quantum entanglement");
qeCmd->AvailableForStates(G4State_PreInit);
dirSplitTargetCmd = new G4UIcmdWith3VectorAndUnit("/process/em/setDirectionalSplittingTarget",this);
dirSplitTargetCmd->SetGuidance("Position of arget for directional splitting");
dirSplitTargetCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dirSplitRadiusCmd = new G4UIcmdWithADoubleAndUnit("/process/em/setDirectionalSplittingRadius",this);
dirSplitRadiusCmd->SetGuidance("Radius of target for directional splitting");
dirSplitRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmExtraParametersMessenger::~G4EmExtraParametersMessenger()
{
delete paiCmd;
delete mscoCmd;
delete SubSecCmd;
delete bfCmd;
delete fiCmd;
delete bsCmd;
delete qeCmd;
delete StepFuncCmd;
delete StepFuncCmd1;
delete dirSplitCmd;
delete dirSplitTargetCmd;
delete dirSplitRadiusCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmExtraParametersMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
G4bool physicsModified = false;
if (command == paiCmd) {
G4String s1(""),s2(""),s3("");
std::istringstream is(newValue);
is >> s1 >> s2 >> s3;
theParameters->AddPAIModel(s1, s2, s3);
} else if (command == mscoCmd) {
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddPhysics(s1, s2);
} else if (command == StepFuncCmd || command == StepFuncCmd1) {
G4double v1,v2;
G4String unt;
std::istringstream is(newValue);
is >> v1 >> v2 >> unt;
v2 *= G4UIcommand::ValueOf(unt);
if(command == StepFuncCmd) {
theParameters->SetStepFunction(v1,v2);
} else {
theParameters->SetStepFunctionMuHad(v1,v2);
}
physicsModified = true;
} else if (command == SubSecCmd) {
G4String s1, s2;
std::istringstream is(newValue);
is >> s1 >> s2;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetSubCutoff(yes,s2);
} else if (command == bfCmd) {
G4double v1(1.0);
G4String s0(""),s1("");
std::istringstream is(newValue);
is >> s0 >> v1 >> s1;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetProcessBiasingFactor(s0,v1,yes);
physicsModified = true;
} else if (command == fiCmd) {
G4double v1(0.0);
G4String s1(""),s2(""),s3(""),unt("mm");
std::istringstream is(newValue);
is >> s1 >> s2 >> v1 >> unt >> s3;
G4bool yes = false;
if(s3 == "true") { yes = true; }
v1 *= G4UIcommand::ValueOf(unt);
theParameters->ActivateForcedInteraction(s1,s2,v1,yes);
physicsModified = true;
} else if (command == bsCmd) {
G4double fb(1.0),en(1.e+30);
G4String s1(""),s2(""),unt("MeV");
std::istringstream is(newValue);
is >> s1 >> s2 >> fb >> en >> unt;
en *= G4UIcommand::ValueOf(unt);
theParameters->ActivateSecondaryBiasing(s1,s2,fb,en);
physicsModified = true;
} else if (command == qeCmd) {
theParameters->SetQuantumEntanglement(qeCmd->GetNewBoolValue(newValue));
} 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;
}
if(physicsModified) {
G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,286 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4EmLowEParameters
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07.05.2019
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmLowEParameters.hh"
#include "G4PhysicalConstants.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4EmLowEParametersMessenger.hh"
#include "G4RegionStore.hh"
#include "G4Region.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmLowEParameters::G4EmLowEParameters()
{
theMessenger = new G4EmLowEParametersMessenger(this);
Initialise();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmLowEParameters::~G4EmLowEParameters()
{
delete theMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4EmLowEParameters::Initialise()
{
fluo = false;
beardenFluoDir = false;
auger = false;
pixe = false;
deexIgnoreCut = false;
dnaFast = false;
dnaStationary = false;
dnaMsc = false;
dnaElectronSolvation = fMeesungnoen2002eSolvation;
namePIXE = "Empirical";
nameElectronPIXE = "Livermore";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4EmLowEParameters::SetFluo(G4bool val)
{
fluo = val;
}
G4bool G4EmLowEParameters::Fluo() const
{
return fluo;
}
void G4EmLowEParameters::SetBeardenFluoDir(G4bool val)
{
beardenFluoDir = val;
}
G4bool G4EmLowEParameters::BeardenFluoDir() const
{
return beardenFluoDir;
}
void G4EmLowEParameters::SetAuger(G4bool val)
{
auger = val;
if(val) { fluo = true; }
}
G4bool G4EmLowEParameters::Auger() const
{
return auger;
}
void G4EmLowEParameters::SetPixe(G4bool val)
{
pixe = val;
if(val) { fluo = true; }
}
G4bool G4EmLowEParameters::Pixe() const
{
return pixe;
}
void G4EmLowEParameters::SetDeexcitationIgnoreCut(G4bool val)
{
deexIgnoreCut = val;
}
G4bool G4EmLowEParameters::DeexcitationIgnoreCut() const
{
return deexIgnoreCut;
}
void G4EmLowEParameters::SetDNAFast(G4bool val)
{
dnaFast = val;
}
G4bool G4EmLowEParameters::DNAFast() const
{
return dnaFast;
}
void G4EmLowEParameters::SetDNAStationary(G4bool val)
{
dnaStationary = val;
}
G4bool G4EmLowEParameters::DNAStationary() const
{
return dnaStationary;
}
void G4EmLowEParameters::SetDNAElectronMsc(G4bool val)
{
dnaMsc = val;
}
G4bool G4EmLowEParameters::DNAElectronMsc() const
{
return dnaMsc;
}
void G4EmLowEParameters::SetDNAeSolvationSubType(G4DNAModelSubType val)
{
dnaElectronSolvation = val;
}
G4DNAModelSubType G4EmLowEParameters::DNAeSolvationSubType() const
{
return dnaElectronSolvation;
}
void G4EmLowEParameters::SetPIXECrossSectionModel(const G4String& sss)
{
namePIXE = sss;
}
const G4String& G4EmLowEParameters::PIXECrossSectionModel()
{
return namePIXE;
}
void G4EmLowEParameters::SetPIXEElectronCrossSectionModel(const G4String& sss)
{
nameElectronPIXE = sss;
}
const G4String& G4EmLowEParameters::PIXEElectronCrossSectionModel()
{
return nameElectronPIXE;
}
void G4EmLowEParameters::PrintWarning(G4ExceptionDescription& ed) const
{
G4Exception("G4EmLowEParameters", "em0044", JustWarning, ed);
}
G4String G4EmLowEParameters::CheckRegion(const G4String& reg) const
{
G4String r = reg;
if(r == "" || r == "world" || r == "World") {
r = "DefaultRegionForTheWorld";
}
return r;
}
void G4EmLowEParameters::AddMicroElec(const G4String& region)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesME.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesME[i]) { return; }
}
m_regnamesME.push_back(r);
}
const std::vector<G4String>& G4EmLowEParameters::RegionsMicroElec() const
{
return m_regnamesME;
}
void G4EmLowEParameters::AddDNA(const G4String& region, const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDNA.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesDNA[i]) { return; }
}
m_regnamesDNA.push_back(r);
m_typesDNA.push_back(type);
}
const std::vector<G4String>& G4EmLowEParameters::RegionsDNA() const
{
return m_regnamesDNA;
}
const std::vector<G4String>& G4EmLowEParameters::TypesDNA() const
{
return m_typesDNA;
}
void
G4EmLowEParameters::SetDeexActiveRegion(const G4String& region, G4bool fdeex,
G4bool fauger, G4bool fpixe)
{
if(fdeex) { fluo = true; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDeex.size();
if(0 == nreg && r != "DefaultRegionForTheWorld") {
m_regnamesDeex.push_back("DefaultRegionForTheWorld");
m_fluo.push_back(false);
m_auger.push_back(false);
m_pixe.push_back(false);
nreg = 1;
}
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesDeex[i]) {
m_fluo[i] = fdeex;
m_auger[i]= fauger;
m_pixe[i] = fpixe;
return;
}
}
m_regnamesDeex.push_back(r);
m_fluo.push_back(fdeex);
m_auger.push_back(fauger);
m_pixe.push_back(fpixe);
}
void G4EmLowEParameters::DefineRegParamForDeex(G4VAtomDeexcitation* ptr) const
{
G4int n = m_regnamesDeex.size();
for(G4int i=0; i<n; ++i) {
ptr->SetDeexcitationActiveRegion(m_regnamesDeex[i],
m_fluo[i], m_auger[i], m_pixe[i]);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -0,0 +1,264 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EmLowEParametersMessenger
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07-05-2019
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmLowEParametersMessenger.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UImanager.hh"
#include "G4EmLowEParameters.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr)
: theParameters(ptr)
{
deCmd = new G4UIcmdWithABool("/process/em/fluo",this);
deCmd->SetGuidance("Enable/disable atomic deexcitation");
deCmd->SetParameterName("fluoFlag",true);
deCmd->SetDefaultValue(false);
deCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dirFluoCmd = new G4UIcmdWithABool("/process/em/fluoBearden",this);
dirFluoCmd->SetGuidance("Enable/disable usage of Bearden fluorescence files");
dirFluoCmd->SetParameterName("fluoBeardenFlag",true);
dirFluoCmd->SetDefaultValue(false);
dirFluoCmd->AvailableForStates(G4State_PreInit,G4State_Init);
auCmd = new G4UIcmdWithABool("/process/em/auger",this);
auCmd->SetGuidance("Enable/disable Auger electrons production");
auCmd->SetParameterName("augerFlag",true);
auCmd->SetDefaultValue(false);
auCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
auCascadeCmd = new G4UIcmdWithABool("/process/em/augerCascade",this);
auCascadeCmd->SetGuidance("Enable/disable simulation of cascade of Auger electrons");
auCascadeCmd->SetParameterName("augerCascadeFlag",true);
auCascadeCmd->SetDefaultValue(false);
auCascadeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
pixeCmd = new G4UIcmdWithABool("/process/em/pixe",this);
pixeCmd->SetGuidance("Enable/disable PIXE simulation");
pixeCmd->SetParameterName("pixeFlag",true);
pixeCmd->SetDefaultValue(false);
pixeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dcutCmd = new G4UIcmdWithABool("/process/em/deexcitationIgnoreCut",this);
dcutCmd->SetGuidance("Enable/Disable usage of cuts in de-excitation module");
dcutCmd->SetParameterName("deexcut",true);
dcutCmd->SetDefaultValue(false);
dcutCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dnafCmd = new G4UIcmdWithABool("/process/dna/UseDNAFast",this);
dnafCmd->SetGuidance("Enable usage of fast sampling for DNA models");
dnafCmd->SetParameterName("dnaf",true);
dnafCmd->SetDefaultValue(false);
dnafCmd->AvailableForStates(G4State_PreInit);
dnasCmd = new G4UIcmdWithABool("/process/dna/UseDNAStationary",this);
dnasCmd->SetGuidance("Enable usage of Stationary option for DNA models");
dnasCmd->SetParameterName("dnas",true);
dnasCmd->SetDefaultValue(false);
dnasCmd->AvailableForStates(G4State_PreInit);
dnamscCmd = new G4UIcmdWithABool("/process/dna/UseDNAElectronMsc",this);
dnamscCmd->SetGuidance("Enable usage of e- msc for DNA");
dnamscCmd->SetParameterName("dnamsc",true);
dnamscCmd->SetDefaultValue(false);
dnamscCmd->AvailableForStates(G4State_PreInit);
pixeXsCmd = new G4UIcmdWithAString("/process/em/pixeXSmodel",this);
pixeXsCmd->SetGuidance("The name of PIXE cross section");
pixeXsCmd->SetParameterName("pixeXS",true);
pixeXsCmd->SetCandidates("ECPSSR_Analytical Empirical ECPSSR_FormFactor");
pixeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pixeeXsCmd = new G4UIcmdWithAString("/process/em/pixeElecXSmodel",this);
pixeeXsCmd->SetGuidance("The name of PIXE cross section for electron");
pixeeXsCmd->SetParameterName("pixeEXS",true);
pixeeXsCmd->SetCandidates("ECPSSR_Analytical Empirical Livermore Penelope");
pixeeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dnaSolCmd = new G4UIcmdWithAString("/process/dna/e-SolvationSubType",this);
dnaSolCmd->SetGuidance("The name of e- solvation DNA model");
dnaSolCmd->SetParameterName("dnaSol",true);
dnaSolCmd->SetCandidates("Ritchie1994 Terrisol1990 Meesungnoen2002");
dnaSolCmd->AvailableForStates(G4State_PreInit);
meCmd = new G4UIcmdWithAString("/process/em/AddMicroElecRegion",this);
meCmd->SetGuidance("Activate MicroElec model in the G4Region");
meCmd->SetParameterName("MicroElec",true);
meCmd->AvailableForStates(G4State_PreInit);
dnaCmd = new G4UIcommand("/process/em/AddDNARegion",this);
dnaCmd->SetGuidance("Activate DNA in a G4Region.");
dnaCmd->SetGuidance(" regName : G4Region name");
dnaCmd->SetGuidance(" dnaType : DNA_opt0, DNA_opt1, DNA_opt2");
dnaCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* regName = new G4UIparameter("regName",'s',false);
dnaCmd->SetParameter(regName);
G4UIparameter* type = new G4UIparameter("dnaType",'s',false);
dnaCmd->SetParameter(type);
type->SetParameterCandidates("DNA_Opt0");
deexCmd = new G4UIcommand("/process/em/deexcitation",this);
deexCmd->SetGuidance("Set deexcitation flags per G4Region.");
deexCmd->SetGuidance(" regName : G4Region name");
deexCmd->SetGuidance(" flagFluo : Fluorescence");
deexCmd->SetGuidance(" flagAuger : Auger");
deexCmd->SetGuidance(" flagPIXE : PIXE");
deexCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
G4UIparameter* regNameD = new G4UIparameter("regName",'s',false);
deexCmd->SetParameter(regNameD);
G4UIparameter* flagFluo = new G4UIparameter("flagFluo",'s',false);
deexCmd->SetParameter(flagFluo);
G4UIparameter* flagAuger = new G4UIparameter("flagAuger",'s',false);
deexCmd->SetParameter(flagAuger);
G4UIparameter* flagPIXE = new G4UIparameter("flagPIXE",'s',false);
deexCmd->SetParameter(flagPIXE);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmLowEParametersMessenger::~G4EmLowEParametersMessenger()
{
delete deCmd;
delete dirFluoCmd;
delete auCmd;
delete auCascadeCmd;
delete pixeCmd;
delete dcutCmd;
delete dnafCmd;
delete dnasCmd;
delete dnamscCmd;
delete pixeXsCmd;
delete pixeeXsCmd;
delete dnaSolCmd;
delete meCmd;
delete dnaCmd;
delete deexCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmLowEParametersMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
G4bool physicsModified = false;
if (command == deCmd) {
theParameters->SetFluo(deCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dirFluoCmd) {
theParameters->SetBeardenFluoDir(dirFluoCmd->GetNewBoolValue(newValue));
} else if (command == auCmd) {
theParameters->SetAuger(auCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == auCascadeCmd) {
theParameters->SetAuger(auCascadeCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == pixeCmd) {
theParameters->SetPixe(pixeCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dcutCmd) {
theParameters->SetDeexcitationIgnoreCut(dcutCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dnafCmd) {
theParameters->SetDNAFast(dnafCmd->GetNewBoolValue(newValue));
} else if (command == dnasCmd) {
theParameters->SetDNAStationary(dnasCmd->GetNewBoolValue(newValue));
} else if (command == dnamscCmd) {
theParameters->SetDNAElectronMsc(dnamscCmd->GetNewBoolValue(newValue));
} else if (command == dnaSolCmd) {
G4DNAModelSubType ttt = fDNAUnknownModel;
if(newValue == "Ritchie1994") {
ttt = fRitchie1994eSolvation;
} else if(newValue == "Terrisol1990") {
ttt = fTerrisol1990eSolvation;
} else if (newValue == "Meesungnoen2002") {
ttt = fMeesungnoen2002eSolvation;
}
theParameters->SetDNAeSolvationSubType(ttt);
} else if (command == pixeXsCmd) {
theParameters->SetPIXECrossSectionModel(newValue);
physicsModified = true;
} else if (command == pixeeXsCmd) {
theParameters->SetPIXEElectronCrossSectionModel(newValue);
physicsModified = true;
} else if (command == meCmd) {
theParameters->AddMicroElec(newValue);
} else if (command == dnaCmd) {
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddDNA(s1, s2);
} else if (command == deexCmd) {
G4String s1 (""), s2(""), s3(""), s4("");
G4bool b2(false), b3(false), b4(false);
std::istringstream is(newValue);
is >> s1 >> s2 >> s3 >> s4;
if(s2 == "true") { b2 = true; }
if(s3 == "true") { b3 = true; }
if(s4 == "true") { b4 = true; }
theParameters->SetDeexActiveRegion(s1,b2,b3,b4);
physicsModified = true;
}
if(physicsModified) {
G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,12 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4EmParameters
//
// Author: Vladimir Ivanchenko
@@ -37,8 +35,6 @@
//
// Modifications:
//
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -51,6 +47,8 @@
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4EmExtraParameters.hh"
#include "G4EmLowEParameters.hh"
#include "G4EmParametersMessenger.hh"
#include "G4NistManager.hh"
#include "G4RegionStore.hh"
@@ -88,6 +86,8 @@ G4EmParameters* G4EmParameters::Instance()
G4EmParameters::~G4EmParameters()
{
delete theMessenger;
delete fBParameters;
delete fCParameters;
delete emSaturation;
}
@@ -97,15 +97,22 @@ G4EmParameters::G4EmParameters()
{
G4NistManager::Instance();
theMessenger = new G4EmParametersMessenger(this);
Initialise();
fBParameters = new G4EmExtraParameters();
fCParameters = new G4EmLowEParameters();
fStateManager = G4StateManager::GetStateManager();
Initialise();
emSaturation = nullptr;
}
void G4EmParameters::SetDefaults()
{
if(!IsLocked()) { Initialise(); }
if(!IsLocked()) {
Initialise();
fBParameters->Initialise();
fCParameters->Initialise();
}
}
void G4EmParameters::Initialise()
@@ -116,12 +123,6 @@ void G4EmParameters::Initialise()
spline = true;
cutAsFinalRange = false;
applyCuts = false;
fluo = false;
beardenFluoDir = false;
auger = false;
augerCascade = false;
pixe = false;
deexIgnoreCut = false;
lateralDisplacement = true;
lateralDisplacementAlg96 = true;
muhadLateralDisplacement = false;
@@ -131,12 +132,11 @@ void G4EmParameters::Initialise()
integral = true;
birks = false;
fICRU90 = false;
dnaFast = false;
dnaStationary = false;
dnaMsc = false;
gener = false;
onIsolated = false;
enableSamplingTable = false;
fSamplingTable = false;
fPolarisation = false;
fDNA = false;
minSubRange = 1.0;
minKinEnergy = 0.1*CLHEP::keV;
@@ -145,6 +145,7 @@ void G4EmParameters::Initialise()
lowestElectronEnergy = 1.0*CLHEP::keV;
lowestMuHadEnergy = 1.0*CLHEP::keV;
lowestTripletEnergy = 1.0*CLHEP::MeV;
maxNIELEnergy = 0.0;
linLossLimit = 0.01;
bremsTh = maxKinEnergy;
lambdaFactor = 0.8;
@@ -155,10 +156,6 @@ void G4EmParameters::Initialise()
rangeFactorMuHad = 0.2;
geomFactor = 2.5;
skin = 1.0;
dRoverRange = 0.2;
finalRange = CLHEP::mm;
dRoverRangeMuHad = 0.2;
finalRangeMuHad = 0.1*CLHEP::mm;
factorScreen = 1.0;
nbins = 84;
@@ -170,14 +167,6 @@ void G4EmParameters::Initialise()
mscStepLimit = fUseSafety;
mscStepLimitMuHad = fMinimal;
nucFormfactor = fExponentialNF;
dnaElectronSolvation = fMeesungnoen2002eSolvation;
namePIXE = "Empirical";
nameElectronPIXE = "Livermore";
directionalSplitting = false;
directionalSplittingTarget = G4ThreeVector(0.,0.,0.);
directionalSplittingRadius = 0.;
}
void G4EmParameters::SetLossFluctuations(G4bool val)
@@ -249,69 +238,67 @@ G4bool G4EmParameters::ApplyCuts() const
void G4EmParameters::SetFluo(G4bool val)
{
if(IsLocked()) { return; }
fluo = val;
fCParameters->SetFluo(val);
}
G4bool G4EmParameters::Fluo() const
{
return fluo;
return fCParameters->Fluo();
}
void G4EmParameters::SetBeardenFluoDir(G4bool val)
{
if(IsLocked()) { return; }
beardenFluoDir = val;
fCParameters->SetBeardenFluoDir(val);
}
G4bool G4EmParameters::BeardenFluoDir() const
{
return beardenFluoDir;
return fCParameters->BeardenFluoDir();
}
void G4EmParameters::SetAuger(G4bool val)
{
SetAugerCascade(val);
if(IsLocked()) { return; }
fCParameters->SetAuger(val);
}
G4bool G4EmParameters::Auger() const
{
return auger;
return fCParameters->Auger();
}
void G4EmParameters::SetAugerCascade(G4bool val)
{
if(IsLocked()) { return; }
augerCascade = val;
auger = val;
if(val) { fluo = true; }
fCParameters->SetAuger(val);
}
G4bool G4EmParameters::AugerCascade() const
{
return augerCascade;
return fCParameters->Auger();
}
void G4EmParameters::SetPixe(G4bool val)
{
if(IsLocked()) { return; }
pixe = val;
if(val) { fluo = true; }
fCParameters->SetPixe(val);
}
G4bool G4EmParameters::Pixe() const
{
return pixe;
return fCParameters->Pixe();
}
void G4EmParameters::SetDeexcitationIgnoreCut(G4bool val)
{
if(IsLocked()) { return; }
deexIgnoreCut = val;
fCParameters->SetDeexcitationIgnoreCut(val);
}
G4bool G4EmParameters::DeexcitationIgnoreCut() const
{
return deexIgnoreCut;
return fCParameters->DeexcitationIgnoreCut();
}
void G4EmParameters::SetLateralDisplacement(G4bool val)
@@ -391,6 +378,17 @@ G4bool G4EmParameters::Integral() const
return integral;
}
void G4EmParameters::SetEnablePolarisation(G4bool val)
{
if(IsLocked()) { return; }
fPolarisation = val;
}
G4bool G4EmParameters::EnablePolarisation() const
{
return fPolarisation;
}
void G4EmParameters::SetBirksActive(G4bool val)
{
birks = val;
@@ -424,34 +422,37 @@ G4bool G4EmParameters::UseICRU90Data() const
void G4EmParameters::SetDNAFast(G4bool val)
{
if(IsLocked()) { return; }
dnaFast = val;
fCParameters->SetDNAFast(val);
if(val) { ActivateDNA(); }
}
G4bool G4EmParameters::DNAFast() const
{
return dnaFast;
return fCParameters->DNAFast();
}
void G4EmParameters::SetDNAStationary(G4bool val)
{
if(IsLocked()) { return; }
dnaStationary = val;
fCParameters->SetDNAStationary(val);
if(val) { ActivateDNA(); }
}
G4bool G4EmParameters::DNAStationary() const
{
return dnaStationary;
return fCParameters->DNAStationary();
}
void G4EmParameters::SetDNAElectronMsc(G4bool val)
{
if(IsLocked()) { return; }
dnaMsc = val;
fCParameters->SetDNAElectronMsc(val);
if(val) { ActivateDNA(); }
}
G4bool G4EmParameters::DNAElectronMsc() const
{
return dnaMsc;
return fCParameters->DNAElectronMsc();
}
void G4EmParameters::SetGeneralProcessActive(G4bool val)
@@ -460,14 +461,7 @@ void G4EmParameters::SetGeneralProcessActive(G4bool 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();
}
if(gener) { fBParameters->Initialise(); }
}
G4bool G4EmParameters::GeneralProcessActive() const
@@ -498,12 +492,18 @@ G4bool G4EmParameters::OnIsolated() const
void G4EmParameters::SetEnableSamplingTable(G4bool val)
{
if(IsLocked()) { return; }
enableSamplingTable = val;
fSamplingTable = val;
}
G4bool G4EmParameters::EnableSamplingTable() const
{
return enableSamplingTable;
return fSamplingTable;
}
void G4EmParameters::ActivateDNA()
{
if(IsLocked()) { return; }
fDNA = true;
}
G4EmSaturation* G4EmParameters::GetEmSaturation()
@@ -538,7 +538,7 @@ void G4EmParameters::SetMinEnergy(G4double val)
nbins = nbinsPerDecade*G4lrint(std::log10(maxKinEnergy/minKinEnergy));
} else {
G4ExceptionDescription ed;
ed << "Value of MinKinEnergy is out of range: " << val/MeV
ed << "Value of MinKinEnergy - is out of range: " << val/MeV
<< " MeV is ignored";
PrintWarning(ed);
}
@@ -552,13 +552,13 @@ G4double G4EmParameters::MinKinEnergy() const
void G4EmParameters::SetMaxEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val > minKinEnergy && val < 1.e+7*TeV) {
if(val > std::max(minKinEnergy,9.99*MeV) && val < 1.e+7*TeV) {
maxKinEnergy = val;
nbins = nbinsPerDecade*G4lrint(std::log10(maxKinEnergy/minKinEnergy));
} else {
G4ExceptionDescription ed;
ed << "Value of MaxKinEnergy is out of range: "
<< val/GeV << " GeV is ignored";
<< val/GeV << " GeV is ignored; allowed range 10 MeV - 1.e+7 TeV";
PrintWarning(ed);
}
}
@@ -576,7 +576,8 @@ void G4EmParameters::SetMaxEnergyForCSDARange(G4double val)
} else {
G4ExceptionDescription ed;
ed << "Value of MaxKinEnergyCSDA is out of range: "
<< val/GeV << " GeV is ignored";
<< val/GeV << " GeV is ignored; allowed range "
<< minKinEnergy << " MeV - 100 TeV";
PrintWarning(ed);
}
}
@@ -589,14 +590,7 @@ G4double G4EmParameters::MaxEnergyForCSDARange() const
void G4EmParameters::SetLowestElectronEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val >= 0.0) {
lowestElectronEnergy = val;
} else {
G4ExceptionDescription ed;
ed << "Value of lowestElectronEnergy is out of range: "
<< val/MeV << " MeV is ignored";
PrintWarning(ed);
}
if(val >= 0.0) { lowestElectronEnergy = val; }
}
G4double G4EmParameters::LowestElectronEnergy() const
@@ -607,14 +601,7 @@ G4double G4EmParameters::LowestElectronEnergy() const
void G4EmParameters::SetLowestMuHadEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val >= 0.0) {
lowestMuHadEnergy = val;
} else {
G4ExceptionDescription ed;
ed << "Value of lowestMuHadEnergy is out of range: "
<< val/MeV << " MeV is ignored";
PrintWarning(ed);
}
if(val >= 0.0) { lowestMuHadEnergy = val; }
}
G4double G4EmParameters::LowestMuHadEnergy() const
@@ -633,6 +620,17 @@ G4double G4EmParameters::LowestTripletEnergy() const
return lowestTripletEnergy;
}
void G4EmParameters::SetMaxNIELEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val >= 0.0) { maxNIELEnergy = val; }
}
G4double G4EmParameters::MaxNIELEnergy() const
{
return maxNIELEnergy;
}
void G4EmParameters::SetLinearLossLimit(G4double val)
{
if(IsLocked()) { return; }
@@ -834,29 +832,13 @@ G4double G4EmParameters::ScreeningFactor() const
void G4EmParameters::SetStepFunction(G4double v1, G4double v2)
{
if(IsLocked()) { return; }
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRange = v1;
finalRange = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
fBParameters->SetStepFunction(v1, v2);
}
void G4EmParameters::SetStepFunctionMuHad(G4double v1, G4double v2)
{
if(IsLocked()) { return; }
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRangeMuHad = v1;
finalRangeMuHad = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
fBParameters->SetStepFunctionMuHad(v1, v2);
}
void G4EmParameters::SetNumberOfBins(G4int val)
@@ -957,12 +939,13 @@ G4NuclearFormfactorType G4EmParameters::NuclearFormfactorType() const
void G4EmParameters::SetDNAeSolvationSubType(G4DNAModelSubType val)
{
if(IsLocked()) { return; }
dnaElectronSolvation = val;
fCParameters->SetDNAeSolvationSubType(val);
ActivateDNA();
}
G4DNAModelSubType G4EmParameters::DNAeSolvationSubType() const
{
return dnaElectronSolvation;
return fCParameters->DNAeSolvationSubType();
}
void G4EmParameters::SetConversionType(G4int val)
@@ -979,24 +962,23 @@ G4int G4EmParameters::GetConversionType() const
void G4EmParameters::SetPIXECrossSectionModel(const G4String& sss)
{
if(IsLocked()) { return; }
G4cout << "G4EmParameters::SetPIXECrossSectionModel " << sss << G4endl;
namePIXE = sss;
fCParameters->SetPIXECrossSectionModel(sss);
}
const G4String& G4EmParameters::PIXECrossSectionModel()
{
return namePIXE;
return fCParameters->PIXECrossSectionModel();
}
void G4EmParameters::SetPIXEElectronCrossSectionModel(const G4String& sss)
{
if(IsLocked()) { return; }
nameElectronPIXE = sss;
fCParameters->SetPIXEElectronCrossSectionModel(sss);
}
const G4String& G4EmParameters::PIXEElectronCrossSectionModel()
{
return nameElectronPIXE;
return fCParameters->PIXEElectronCrossSectionModel();
}
void G4EmParameters::PrintWarning(G4ExceptionDescription& ed) const
@@ -1004,173 +986,85 @@ void G4EmParameters::PrintWarning(G4ExceptionDescription& ed) const
G4Exception("G4EmParameters", "em0044", JustWarning, ed);
}
G4String G4EmParameters::CheckRegion(const G4String& reg) const
{
G4String r = reg;
if(r == "" || r == "world" || r == "World") {
r = "DefaultRegionForTheWorld";
}
return r;
}
void G4EmParameters::AddPAIModel(const G4String& particle,
const G4String& region,
const G4String& type)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPAI.size();
for(G4int i=0; i<nreg; ++i) {
if((m_particlesPAI[i] == particle ||
m_particlesPAI[i] == "all" ||
particle == "all") &&
(m_regnamesPAI[i] == r ||
m_regnamesPAI[i] == "DefaultRegionForTheWorld" ||
r == "DefaultRegionForTheWorld") ) {
m_typesPAI[i] = type;
if(particle == "all") { m_particlesPAI[i] = particle; }
if(r == "DefaultRegionForTheWorld") { m_regnamesPAI[i] = r; }
return;
}
}
m_particlesPAI.push_back(particle);
m_regnamesPAI.push_back(r);
m_typesPAI.push_back(type);
fBParameters->AddPAIModel(particle, region, type);
}
const std::vector<G4String>& G4EmParameters::ParticlesPAI() const
{
return m_particlesPAI;
return fBParameters->ParticlesPAI();
}
const std::vector<G4String>& G4EmParameters::RegionsPAI() const
{
return m_regnamesPAI;
return fBParameters->RegionsPAI();
}
const std::vector<G4String>& G4EmParameters::TypesPAI() const
{
return m_typesPAI;
return fBParameters->TypesPAI();
}
void G4EmParameters::AddMicroElec(const G4String& region)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesME.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesME[i]) { return; }
}
m_regnamesME.push_back(r);
fCParameters->AddMicroElec(region);
}
const std::vector<G4String>& G4EmParameters::RegionsMicroElec() const
{
return m_regnamesME;
return fCParameters->RegionsMicroElec();
}
void G4EmParameters::AddDNA(const G4String& region, const G4String& type)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDNA.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesDNA[i]) { return; }
}
m_regnamesDNA.push_back(r);
m_typesDNA.push_back(type);
fCParameters->AddDNA(region, type);
ActivateDNA();
}
const std::vector<G4String>& G4EmParameters::RegionsDNA() const
{
return m_regnamesDNA;
return fCParameters->RegionsDNA();
}
const std::vector<G4String>& G4EmParameters::TypesDNA() const
{
return m_typesDNA;
}
void G4EmParameters::AddMsc(const G4String& region, const G4String& type)
{
AddPhysics(region, type);
}
const std::vector<G4String>& G4EmParameters::RegionsMsc() const
{
return m_regnamesPhys;
}
const std::vector<G4String>& G4EmParameters::TypesMsc() const
{
return m_typesPhys;
return fCParameters->TypesDNA();
}
void G4EmParameters::AddPhysics(const G4String& region, const G4String& type)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPhys.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesPhys[i]) { return; }
}
m_regnamesPhys.push_back(r);
m_typesPhys.push_back(type);
fBParameters->AddPhysics(region, type);
}
const std::vector<G4String>& G4EmParameters::RegionsPhysics() const
{
return m_regnamesPhys;
return fBParameters->RegionsPhysics();
}
const std::vector<G4String>& G4EmParameters::TypesPhysics() const
{
return m_typesPhys;
return fBParameters->TypesPhysics();
}
void G4EmParameters::SetSubCutoff(G4bool val, const G4String& region)
{
if(IsLocked() && !gener) { return; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesSubCut[i]) {
m_subCuts[i] = val;
return;
}
}
m_regnamesSubCut.push_back(r);
m_subCuts.push_back(val);
fBParameters->SetSubCutoff(val, region);
}
void
G4EmParameters::SetDeexActiveRegion(const G4String& region, G4bool fdeex,
G4bool fauger, G4bool fpixe)
G4EmParameters::SetDeexActiveRegion(const G4String& region, G4bool adeex,
G4bool aauger, G4bool apixe)
{
if(IsLocked()) { return; }
if(fdeex) { fluo = true; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDeex.size();
if(0 == nreg && r != "DefaultRegionForTheWorld") {
m_regnamesDeex.push_back("DefaultRegionForTheWorld");
m_fluo.push_back(false);
m_auger.push_back(false);
m_pixe.push_back(false);
nreg = 1;
}
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesDeex[i]) {
m_fluo[i] = fdeex;
m_auger[i]= fauger;
m_pixe[i] = fpixe;
return;
}
}
m_regnamesDeex.push_back(r);
m_fluo.push_back(fdeex);
m_auger.push_back(fauger);
m_pixe.push_back(fpixe);
fCParameters->SetDeexActiveRegion(region, adeex, aauger, apixe);
}
void
@@ -1178,24 +1072,7 @@ G4EmParameters::SetProcessBiasingFactor(const G4String& procname,
G4double val, G4bool wflag)
{
if(IsLocked()) { return; }
if(val > 0.0) {
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedXS[i]) {
m_factBiasedXS[i] = val;
m_weightBiasedXS[i]= wflag;
return;
}
}
m_procBiasedXS.push_back(procname);
m_factBiasedXS.push_back(val);
m_weightBiasedXS.push_back(wflag);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " XS biasing factor "
<< val << " is negative - ignored";
PrintWarning(ed);
}
fBParameters->SetProcessBiasingFactor(procname, val, wflag);
}
void
@@ -1205,27 +1082,7 @@ G4EmParameters::ActivateForcedInteraction(const G4String& procname,
G4bool wflag)
{
if(IsLocked() && !gener) { return; }
G4String r = CheckRegion(region);
if(length >= 0.0) {
G4int n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procForced[i] && r == m_regnamesForced[i] ) {
m_lengthForced[i] = length;
m_weightForced[i]= wflag;
return;
}
}
m_regnamesForced.push_back(r);
m_procForced.push_back(procname);
m_lengthForced.push_back(length);
m_weightForced.push_back(wflag);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : forced interacttion length= "
<< length << " is negative - ignored";
PrintWarning(ed);
}
fBParameters->ActivateForcedInteraction(procname, region, length, wflag);
}
void
@@ -1235,109 +1092,69 @@ G4EmParameters::ActivateSecondaryBiasing(const G4String& procname,
G4double energyLim)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
if(factor >= 0.0 && energyLim >= 0.0) {
G4int n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedSec[i] && r == m_regnamesBiasedSec[i] ) {
m_factBiasedSec[i] = factor;
m_elimBiasedSec[i] = energyLim;
return;
}
}
m_regnamesBiasedSec.push_back(r);
m_procBiasedSec.push_back(procname);
m_factBiasedSec.push_back(factor);
m_elimBiasedSec.push_back(energyLim);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : secondary bised factor= "
<< factor << ", Elim= " << energyLim << " - ignored";
PrintWarning(ed);
}
fBParameters->ActivateSecondaryBiasing(procname, region, factor, energyLim);
}
void G4EmParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr,
G4bool isElectron) const
{
if(isElectron) { ptr->SetStepFunction(dRoverRange, finalRange, false); }
else { ptr->SetStepFunction(dRoverRangeMuHad, finalRangeMuHad, false); }
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4int n = m_regnamesSubCut.size();
for(G4int i=0; i<n; ++i) {
const G4Region* reg = regionStore->GetRegion(m_regnamesSubCut[i], false);
if(reg) { ptr->ActivateSubCutoff(m_subCuts[i], reg); }
}
n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
break;
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
m_weightForced[i]);
break;
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
m_elimBiasedSec[i]);
break;
}
}
fBParameters->DefineRegParamForLoss(ptr, isElectron);
}
void G4EmParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
{
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
break;
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
m_weightForced[i]);
break;
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
m_elimBiasedSec[i]);
break;
}
}
fBParameters->DefineRegParamForEM(ptr);
}
G4bool G4EmParameters::QuantumEntanglement()
{
return fBParameters->QuantumEntanglement();
}
void G4EmParameters::SetQuantumEntanglement(G4bool v)
{
if(IsLocked()) { return; }
fBParameters->SetQuantumEntanglement(v);
}
G4bool G4EmParameters::GetDirectionalSplitting() {
return fBParameters->GetDirectionalSplitting();
}
void G4EmParameters::SetDirectionalSplitting(G4bool v)
{
if(IsLocked()) { return; }
fBParameters->SetDirectionalSplitting(v);
}
void G4EmParameters::SetDirectionalSplittingTarget(const G4ThreeVector& v)
{
if(IsLocked()) { return; }
fBParameters->SetDirectionalSplittingTarget(v);
}
G4ThreeVector G4EmParameters::GetDirectionalSplittingTarget() const
{
return fBParameters->GetDirectionalSplittingTarget();
}
void G4EmParameters::SetDirectionalSplittingRadius(G4double r)
{
if(IsLocked()) { return; }
fBParameters->SetDirectionalSplittingRadius(r);
}
G4double G4EmParameters::GetDirectionalSplittingRadius()
{
return fBParameters->GetDirectionalSplittingRadius();
}
void G4EmParameters::DefineRegParamForDeex(G4VAtomDeexcitation* ptr) const
{
G4int n = m_regnamesDeex.size();
for(G4int i=0; i<n; ++i) {
ptr->SetDeexcitationActiveRegion(m_regnamesDeex[i],
m_fluo[i], m_auger[i], m_pixe[i]);
}
fCParameters->DefineRegParamForDeex(ptr);
}
std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
void G4EmParameters::StreamInfo(std::ostream& os) const
{
G4int prec = os.precision(5);
os << "=======================================================================" << "\n";
@@ -1345,10 +1162,13 @@ 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 << "Enable creation and use of sampling tables " <<fSamplingTable << "\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 << "Enable linear polarisation for gamma " <<fPolarisation << "\n";
os << "Enable sampling of quantum entanglement "
<<fBParameters->QuantumEntanglement() << "\n";
os << "X-section factor for integral approach " <<lambdaFactor << "\n";
os << "Min kinetic energy for tables "
<<G4BestUnit(minKinEnergy,"Energy") << "\n";
@@ -1363,16 +1183,19 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
<<G4BestUnit(bremsTh,"Energy") << "\n";
os << "Lowest triplet kinetic energy "
<<G4BestUnit(lowestTripletEnergy,"Energy") << "\n";
os << "Enable sampling of gamma linear polarisation " <<fPolarisation << "\n";
os << "5D gamma conversion model type " <<tripletConv << "\n";
os << "5D gamma conversion model on isolated ion " <<onIsolated << "\n";
os << "=======================================================================" << "\n";
os << "====== Ionisation Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Step function for e+- " <<"("<< dRoverRange
<< ", " << finalRange/CLHEP::mm << " mm)\n";
os << "Step function for muons/hadrons " <<"("<< dRoverRangeMuHad
<< ", " << finalRangeMuHad/CLHEP::mm << " mm)\n";
os << "Step function for e+- "
<<"("<<fBParameters->GetStepFunctionP1() << ", "
<< fBParameters->GetStepFunctionP2()/CLHEP::mm << " mm)\n";
os << "Step function for muons/hadrons "
<<"("<<fBParameters->GetStepFunctionMuHadP1() << ", "
<< fBParameters->GetStepFunctionMuHadP2()/CLHEP::mm << " mm)\n";
os << "Lowest e+e- kinetic energy "
<<G4BestUnit(lowestElectronEnergy,"Energy") << "\n";
os << "Lowest muon/hadron kinetic energy "
@@ -1387,6 +1210,8 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Factor of cut reduction for sub-cutoff method " << minSubRange << "\n";
os << "Max kinetic energy for CSDA tables "
<<G4BestUnit(maxKinEnergyCSDA,"Energy") << "\n";
os << "Max kinetic energy for NIEL computation "
<<G4BestUnit(maxNIELEnergy,"Energy") << "\n";
os << "Linear loss limit " <<linLossLimit << "\n";
os << "=======================================================================" << "\n";
@@ -1413,39 +1238,55 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Type of nuclear form-factor " <<nucFormfactor << "\n";
os << "Screening factor " <<factorScreen << "\n";
if(fCParameters->Fluo()) {
os << "=======================================================================" << "\n";
os << "====== Atomic Deexcitation Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Fluorescence enabled " <<fluo << "\n";
os << "Fluorescence Bearden data files enabled " <<beardenFluoDir << "\n";
os << "Auger electron production enabled " <<auger << "\n";
os << "Auger cascade enabled " <<augerCascade << "\n";
os << "PIXE atomic de-excitation enabled " <<pixe << "\n";
os << "De-excitation module ignores cuts " <<deexIgnoreCut << "\n";
os << "Type of PIXE cross section for hadrons " <<namePIXE << "\n";
os << "Type of PIXE cross section for e+- " <<nameElectronPIXE << "\n";
os << "Fluorescence enabled " <<fCParameters->Fluo() << "\n";
os << "Fluorescence Bearden data files enabled "
<<fCParameters->BeardenFluoDir() << "\n";
os << "Auger electron cascade enabled "
<<fCParameters->Auger() << "\n";
os << "PIXE atomic de-excitation enabled " <<fCParameters->Pixe() << "\n";
os << "De-excitation module ignores cuts "
<<fCParameters->DeexcitationIgnoreCut() << "\n";
os << "Type of PIXE cross section for hadrons "
<<fCParameters->PIXECrossSectionModel() << "\n";
os << "Type of PIXE cross section for e+- "
<<fCParameters->PIXEElectronCrossSectionModel() << "\n";
}
if(fDNA) {
os << "=======================================================================" << "\n";
os << "====== DNA Physics Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Use fast sampling in DNA models " << dnaFast << "\n";
os << "Use Stationary option in DNA models " << dnaStationary << "\n";
os << "Use DNA with multiple scattering of e- " << dnaMsc << "\n";
os << "Use fast sampling in DNA models "
<< fCParameters->DNAFast() << "\n";
os << "Use Stationary option in DNA models "
<< fCParameters->DNAStationary() << "\n";
os << "Use DNA with multiple scattering of e- "
<< fCParameters->DNAElectronMsc() << "\n";
os << "Use DNA e- solvation model type "
<< dnaElectronSolvation << "\n";
<< fCParameters->DNAeSolvationSubType() << "\n";
os << "=======================================================================" << "\n";
}
os.precision(prec);
return os;
}
void G4EmParameters::Dump() const
{
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&emParametersMutex);
#endif
StreamInfo(G4cout);
#ifdef G4MULTITHREADED
G4MUTEXUNLOCK(&emParametersMutex);
#endif
}
std::ostream& operator<< (std::ostream& os, const G4EmParameters& par)
{
return par.StreamInfo(os);
par.StreamInfo(os);
return os;
}
G4bool G4EmParameters::IsLocked() const
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -34,8 +33,6 @@
//
// Creation date: 22-05-2013
//
// Modifications:
//
// -------------------------------------------------------------------
//
@@ -111,42 +108,6 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
aplCmd->SetDefaultValue(false);
aplCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
deCmd = new G4UIcmdWithABool("/process/em/fluo",this);
deCmd->SetGuidance("Enable/disable atomic deexcitation");
deCmd->SetParameterName("fluoFlag",true);
deCmd->SetDefaultValue(false);
deCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dirFluoCmd = new G4UIcmdWithABool("/process/em/fluoBearden",this);
dirFluoCmd->SetGuidance("Enable/disable usage of Bearden fluorescence files");
dirFluoCmd->SetParameterName("fluoBeardenFlag",true);
dirFluoCmd->SetDefaultValue(false);
dirFluoCmd->AvailableForStates(G4State_PreInit,G4State_Init);
auCmd = new G4UIcmdWithABool("/process/em/auger",this);
auCmd->SetGuidance("Enable/disable Auger electrons production");
auCmd->SetParameterName("augerFlag",true);
auCmd->SetDefaultValue(false);
auCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
auCascadeCmd = new G4UIcmdWithABool("/process/em/augerCascade",this);
auCascadeCmd->SetGuidance("Enable/disable simulation of cascade of Auger electrons");
auCascadeCmd->SetParameterName("augerCascadeFlag",true);
auCascadeCmd->SetDefaultValue(false);
auCascadeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
pixeCmd = new G4UIcmdWithABool("/process/em/pixe",this);
pixeCmd->SetGuidance("Enable/disable PIXE simulation");
pixeCmd->SetParameterName("pixeFlag",true);
pixeCmd->SetDefaultValue(false);
pixeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dcutCmd = new G4UIcmdWithABool("/process/em/deexcitationIgnoreCut",this);
dcutCmd->SetGuidance("Enable/Disable usage of cuts in de-excitation module");
dcutCmd->SetParameterName("deexcut",true);
dcutCmd->SetDefaultValue(false);
dcutCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
latCmd = new G4UIcmdWithABool("/process/msc/LateralDisplacement",this);
latCmd->SetGuidance("Enable/disable sampling of lateral displacement");
latCmd->SetParameterName("lat",true);
@@ -195,24 +156,6 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
birksCmd->SetDefaultValue(false);
birksCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dnafCmd = new G4UIcmdWithABool("/process/dna/UseDNAFast",this);
dnafCmd->SetGuidance("Enable usage of fast sampling for DNA models");
dnafCmd->SetParameterName("dnaf",true);
dnafCmd->SetDefaultValue(false);
dnafCmd->AvailableForStates(G4State_PreInit);
dnasCmd = new G4UIcmdWithABool("/process/dna/UseDNAStationary",this);
dnasCmd->SetGuidance("Enable usage of Stationary option for DNA models");
dnasCmd->SetParameterName("dnas",true);
dnasCmd->SetDefaultValue(false);
dnasCmd->AvailableForStates(G4State_PreInit);
dnamscCmd = new G4UIcmdWithABool("/process/dna/UseDNAElectronMsc",this);
dnamscCmd->SetGuidance("Enable usage of e- msc for DNA");
dnamscCmd->SetParameterName("dnamsc",true);
dnamscCmd->SetDefaultValue(false);
dnamscCmd->AvailableForStates(G4State_PreInit);
sharkCmd = new G4UIcmdWithABool("/process/em/UseGeneralProcess",this);
sharkCmd->SetGuidance("Enable gamma, e+- general process");
sharkCmd->SetParameterName("gen",true);
@@ -307,6 +250,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
msceCmd->SetUnitCategory("Energy");
msceCmd->AvailableForStates(G4State_PreInit);
nielCmd = new G4UIcmdWithADoubleAndUnit("/process/em/MaxEnergyNIEL",this);
nielCmd->SetGuidance("Set the upper energy limit for NIEL");
nielCmd->SetParameterName("niel",true);
nielCmd->SetUnitCategory("Energy");
nielCmd->AvailableForStates(G4State_PreInit);
frCmd = new G4UIcmdWithADouble("/process/msc/RangeFactor",this);
frCmd->SetGuidance("Set RangeFactor for msc processes of e+-");
frCmd->SetParameterName("Fr",true);
@@ -386,224 +335,9 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
msc1Cmd->SetCandidates("Minimal UseSafety UseSafetyPlus UseDistanceToBoundary");
msc1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pixeXsCmd = new G4UIcmdWithAString("/process/em/pixeXSmodel",this);
pixeXsCmd->SetGuidance("The name of PIXE cross section");
pixeXsCmd->SetParameterName("pixeXS",true);
pixeXsCmd->SetCandidates("ECPSSR_Analytical Empirical ECPSSR_FormFactor");
pixeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pixeeXsCmd = new G4UIcmdWithAString("/process/em/pixeElecXSmodel",this);
pixeeXsCmd->SetGuidance("The name of PIXE cross section for electron");
pixeeXsCmd->SetParameterName("pixeEXS",true);
pixeeXsCmd->SetCandidates("ECPSSR_Analytical Empirical Livermore Penelope");
pixeeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dnaSolCmd = new G4UIcmdWithAString("/process/dna/e-SolvationSubType",this);
dnaSolCmd->SetGuidance("The name of e- solvation DNA model");
dnaSolCmd->SetParameterName("dnaSol",true);
dnaSolCmd->SetCandidates("Ritchie1994 Terrisol1990 Meesungnoen2002");
dnaSolCmd->AvailableForStates(G4State_PreInit);
paiCmd = new G4UIcommand("/process/em/AddPAIRegion",this);
paiCmd->SetGuidance("Activate PAI in the G4Region.");
paiCmd->SetGuidance(" partName : particle name (default - all)");
paiCmd->SetGuidance(" regName : G4Region name");
paiCmd->SetGuidance(" paiType : PAI, PAIphoton");
paiCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* part = new G4UIparameter("partName",'s',false);
paiCmd->SetParameter(part);
G4UIparameter* pregName = new G4UIparameter("regName",'s',false);
paiCmd->SetParameter(pregName);
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");
meCmd->SetParameterName("MicroElec",true);
meCmd->AvailableForStates(G4State_PreInit);
dnaCmd = new G4UIcommand("/process/em/AddDNARegion",this);
dnaCmd->SetGuidance("Activate DNA in a G4Region.");
dnaCmd->SetGuidance(" regName : G4Region name");
dnaCmd->SetGuidance(" dnaType : DNA_opt0, DNA_opt1, DNA_opt2");
dnaCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* regName = new G4UIparameter("regName",'s',false);
dnaCmd->SetParameter(regName);
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(" emType : G4EmStandard, G4EmStandard_opt1, ...");
mscoCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* mregName = new G4UIparameter("regName",'s',false);
mscoCmd->SetParameter(mregName);
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.");
SubSecCmd = new G4UIcommand("/process/eLoss/subsec",this);
SubSecCmd->SetGuidance("Switch true/false the subcutoff generation per region.");
SubSecCmd->SetGuidance(" subSec : true/false");
SubSecCmd->SetGuidance(" Region : region name");
SubSecCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
SubSecCmd->SetParameter(subSec);
G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
SubSecCmd->SetParameter(subSecReg);
StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd->SetGuidance(" finalRange: range for final step");
StepFuncCmd->SetGuidance(" unit : unit of finalRange");
StepFuncCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
dRoverRPrm->SetParameterRange("dRoverR>0. && dRoverR<=1.");
StepFuncCmd->SetParameter(dRoverRPrm);
G4UIparameter* finalRangePrm = new G4UIparameter("finalRange",'d',false);
finalRangePrm->SetParameterRange("finalRange>0.");
StepFuncCmd->SetParameter(finalRangePrm);
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetDefaultUnit("mm");
StepFuncCmd->SetParameter(unitPrm);
StepFuncCmd1 = new G4UIcommand("/process/eLoss/StepFunctionMuHad",this);
StepFuncCmd1->SetGuidance("Set the energy loss step limitation parameters for muon/hadron.");
StepFuncCmd1->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd1->SetGuidance(" finalRange: range for final step");
StepFuncCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm1 = new G4UIparameter("dRoverRMuHad",'d',false);
dRoverRPrm1->SetParameterRange("dRoverRMuHad>0. && dRoverRMuHad<=1.");
StepFuncCmd1->SetParameter(dRoverRPrm1);
G4UIparameter* finalRangePrm1 = new G4UIparameter("finalRangeMuHad",'d',false);
finalRangePrm1->SetParameterRange("finalRangeMuHad>0.");
StepFuncCmd1->SetParameter(finalRangePrm1);
G4UIparameter* unitPrm1 = new G4UIparameter("unit",'s',true);
unitPrm1->SetDefaultValue("mm");
StepFuncCmd1->SetParameter(unitPrm1);
deexCmd = new G4UIcommand("/process/em/deexcitation",this);
deexCmd->SetGuidance("Set deexcitation flags per G4Region.");
deexCmd->SetGuidance(" regName : G4Region name");
deexCmd->SetGuidance(" flagFluo : Fluorescence");
deexCmd->SetGuidance(" flagAuger : Auger");
deexCmd->SetGuidance(" flagPIXE : PIXE");
deexCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
G4UIparameter* regNameD = new G4UIparameter("regName",'s',false);
deexCmd->SetParameter(regNameD);
G4UIparameter* flagFluo = new G4UIparameter("flagFluo",'s',false);
deexCmd->SetParameter(flagFluo);
G4UIparameter* flagAuger = new G4UIparameter("flagAuger",'s',false);
deexCmd->SetParameter(flagAuger);
G4UIparameter* flagPIXE = new G4UIparameter("flagPIXE",'s',false);
deexCmd->SetParameter(flagPIXE);
bfCmd = new G4UIcommand("/process/em/setBiasingFactor",this);
bfCmd->SetGuidance("Set factor for the process cross section.");
bfCmd->SetGuidance(" procName : process name");
bfCmd->SetGuidance(" procFact : factor");
bfCmd->SetGuidance(" flagFact : flag to change weight");
bfCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* procName = new G4UIparameter("procName",'s',false);
bfCmd->SetParameter(procName);
G4UIparameter* procFact = new G4UIparameter("procFact",'d',false);
bfCmd->SetParameter(procFact);
G4UIparameter* flagFact = new G4UIparameter("flagFact",'s',false);
bfCmd->SetParameter(flagFact);
fiCmd = new G4UIcommand("/process/em/setForcedInteraction",this);
fiCmd->SetGuidance("Set factor for the process cross section.");
fiCmd->SetGuidance(" procNam : process name");
fiCmd->SetGuidance(" regNam : region name");
fiCmd->SetGuidance(" tlength : fixed target length");
fiCmd->SetGuidance(" unitT : length unit");
fiCmd->SetGuidance(" tflag : flag to change weight");
fiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* procNam = new G4UIparameter("procNam",'s',false);
fiCmd->SetParameter(procNam);
G4UIparameter* regNam = new G4UIparameter("regNam",'s',false);
fiCmd->SetParameter(regNam);
G4UIparameter* tlength = new G4UIparameter("tlength",'d',false);
tlength->SetParameterRange("tlength>0");
fiCmd->SetParameter(tlength);
G4UIparameter* unitT = new G4UIparameter("unitT",'s',true);
unitT->SetDefaultUnit("mm");
fiCmd->SetParameter(unitT);
G4UIparameter* flagT = new G4UIparameter("tflag",'b',true);
flagT->SetDefaultValue(true);
fiCmd->SetParameter(flagT);
bsCmd = new G4UIcommand("/process/em/setSecBiasing",this);
bsCmd->SetGuidance("Set bremsstrahlung or delta-e- splitting/Russian roulette per region.");
bsCmd->SetGuidance(" bProcNam : process name");
bsCmd->SetGuidance(" bRegNam : region name");
bsCmd->SetGuidance(" bFactor : number of split gamma or probability of Russian roulette");
bsCmd->SetGuidance(" bEnergy : max energy of a secondary for this biasing method");
bsCmd->SetGuidance(" bUnit : energy unit");
bsCmd->AvailableForStates(G4State_Idle,G4State_Idle);
G4UIparameter* bProcNam = new G4UIparameter("bProcNam",'s',false);
bsCmd->SetParameter(bProcNam);
G4UIparameter* bRegNam = new G4UIparameter("bRegNam",'s',false);
bsCmd->SetParameter(bRegNam);
G4UIparameter* bFactor = new G4UIparameter("bFactor",'d',false);
bsCmd->SetParameter(bFactor);
G4UIparameter* bEnergy = new G4UIparameter("bEnergy",'d',false);
bsCmd->SetParameter(bEnergy);
G4UIparameter* bUnit = new G4UIparameter("bUnit",'s',true);
bUnit->SetDefaultUnit("MeV");
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);
@@ -645,12 +379,6 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete splCmd;
delete rsCmd;
delete aplCmd;
delete deCmd;
delete dirFluoCmd;
delete auCmd;
delete auCascadeCmd;
delete pixeCmd;
delete dcutCmd;
delete latCmd;
delete lat96Cmd;
delete mulatCmd;
@@ -659,10 +387,8 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete IntegCmd;
delete mottCmd;
delete birksCmd;
delete dnafCmd;
delete dnasCmd;
delete dnamscCmd;
delete sharkCmd;
delete onIsolatedCmd;
delete sampleTCmd;
delete icru90Cmd;
@@ -679,6 +405,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete mscfCmd;
delete angCmd;
delete msceCmd;
delete nielCmd;
delete frCmd;
delete fr1Cmd;
delete fgCmd;
@@ -691,34 +418,13 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete verCmd;
delete ver1Cmd;
delete ver2Cmd;
delete tripletCmd;
delete mscCmd;
delete msc1Cmd;
delete pixeXsCmd;
delete pixeeXsCmd;
delete dnaSolCmd;
delete paiCmd;
delete meCmd;
delete dnaCmd;
delete mscoCmd;
delete dumpCmd;
delete SubSecCmd;
delete StepFuncCmd;
delete StepFuncCmd1;
delete deexCmd;
delete bfCmd;
delete fiCmd;
delete bsCmd;
delete dirSplitCmd;
delete dirSplitTargetCmd;
delete dirSplitRadiusCmd;
delete nffCmd;
delete onIsolatedCmd;
delete tripletCmd;
delete dumpCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -743,23 +449,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == aplCmd) {
theParameters->SetApplyCuts(aplCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == deCmd) {
theParameters->SetFluo(deCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dirFluoCmd) {
theParameters->SetBeardenFluoDir(dirFluoCmd->GetNewBoolValue(newValue));
} else if (command == auCmd) {
theParameters->SetAuger(auCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == auCascadeCmd) {
theParameters->SetAugerCascade(auCascadeCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == pixeCmd) {
theParameters->SetPixe(pixeCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == dcutCmd) {
theParameters->SetDeexcitationIgnoreCut(dcutCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == latCmd) {
theParameters->SetLateralDisplacement(latCmd->GetNewBoolValue(newValue));
physicsModified = true;
@@ -783,22 +472,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
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->SetDNAElectronMsc(dnamscCmd->GetNewBoolValue(newValue));
} else if (command == dnaSolCmd) {
G4DNAModelSubType ttt = fDNAUnknownModel;
if(newValue == "Ritchie1994") {
ttt = fRitchie1994eSolvation;
} else if(newValue == "Terrisol1990") {
ttt = fTerrisol1990eSolvation;
} else if (newValue == "Meesungnoen2002") {
ttt = fMeesungnoen2002eSolvation;
}
theParameters->SetDNAeSolvationSubType(ttt);
} else if (command == sharkCmd) {
theParameters->SetGeneralProcessActive(sharkCmd->GetNewBoolValue(newValue));
} else if (command == sampleTCmd) {
@@ -838,6 +511,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
physicsModified = true;
} else if (command == msceCmd) {
theParameters->SetMscEnergyLimit(msceCmd->GetNewDoubleValue(newValue));
} else if (command == nielCmd) {
theParameters->SetMaxNIELEnergy(nielCmd->GetNewDoubleValue(newValue));
} else if (command == frCmd) {
theParameters->SetMscRangeFactor(frCmd->GetNewDoubleValue(newValue));
physicsModified = true;
@@ -852,7 +527,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
physicsModified = true;
} else if (command == screCmd) {
theParameters->SetScreeningFactor(screCmd->GetNewDoubleValue(newValue));
} else if (command == dedxCmd) {
theParameters->SetNumberOfBins(dedxCmd->GetNewIntValue(newValue));
} else if (command == lamCmd) {
@@ -867,7 +541,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == ver2Cmd) {
theParameters->SetWorkerVerbose(ver2Cmd->GetNewIntValue(newValue));
physicsModified = true;
} else if (command == dumpCmd) {
theParameters->Dump();
} else if (command == mscCmd || command == msc1Cmd) {
G4MscStepLimitType msctype = fUseSafety;
if(newValue == "Minimal") {
@@ -890,99 +565,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetMscMuHadStepLimitType(msctype);
}
physicsModified = true;
} else if (command == pixeXsCmd) {
theParameters->SetPIXECrossSectionModel(newValue);
physicsModified = true;
} else if (command == pixeeXsCmd) {
theParameters->SetPIXEElectronCrossSectionModel(newValue);
physicsModified = true;
} else if (command == paiCmd) {
G4String s1(""),s2(""),s3("");
std::istringstream is(newValue);
is >> s1 >> s2 >> s3;
theParameters->AddPAIModel(s1, s2, s3);
} else if (command == meCmd) {
theParameters->AddMicroElec(newValue);
} else if (command == dnaCmd) {
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddDNA(s1, s2);
} else if (command == mscoCmd) {
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddPhysics(s1, s2);
} else if (command == dumpCmd) {
theParameters->Dump();
} else if (command == SubSecCmd) {
G4String s1, s2;
std::istringstream is(newValue);
is >> s1 >> s2;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetSubCutoff(yes,s2);
} else if (command == StepFuncCmd || command == StepFuncCmd1) {
G4double v1,v2;
G4String unt;
std::istringstream is(newValue);
is >> v1 >> v2 >> unt;
v2 *= G4UIcommand::ValueOf(unt);
if(command == StepFuncCmd) {
theParameters->SetStepFunction(v1,v2);
} else {
theParameters->SetStepFunctionMuHad(v1,v2);
}
physicsModified = true;
} else if (command == deexCmd) {
G4String s1 (""), s2(""), s3(""), s4("");
G4bool b2(false), b3(false), b4(false);
std::istringstream is(newValue);
is >> s1 >> s2 >> s3 >> s4;
if(s2 == "true") { b2 = true; }
if(s3 == "true") { b3 = true; }
if(s4 == "true") { b4 = true; }
theParameters->SetDeexActiveRegion(s1,b2,b3,b4);
physicsModified = true;
} else if (command == bfCmd) {
G4double v1(1.0);
G4String s0(""),s1("");
std::istringstream is(newValue);
is >> s0 >> v1 >> s1;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetProcessBiasingFactor(s0,v1,yes);
physicsModified = true;
} else if (command == fiCmd) {
G4double v1(0.0);
G4String s1(""),s2(""),s3(""),unt("mm");
std::istringstream is(newValue);
is >> s1 >> s2 >> v1 >> unt >> s3;
G4bool yes = false;
if(s3 == "true") { yes = true; }
v1 *= G4UIcommand::ValueOf(unt);
theParameters->ActivateForcedInteraction(s1,s2,v1,yes);
physicsModified = true;
} else if (command == bsCmd) {
G4double fb(1.0),en(1.e+30);
G4String s1(""),s2(""),unt("MeV");
std::istringstream is(newValue);
is >> s1 >> s2 >> fb >> en >> unt;
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. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -35,43 +34,8 @@
//
// Creation date: 03.01.2002
//
// Modifications:
// Modifications: by V.Ivanchenko
//
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
// 15-02-03 Lambda table can be scaled (V.Ivanchenko)
// 17-02-03 Fix problem of store/restore tables (V.Ivanchenko)
// 10-03-03 Add Ion registration (V.Ivanchenko)
// 25-03-03 Add deregistration (V.Ivanchenko)
// 02-04-03 Change messenger (V.Ivanchenko)
// 26-04-03 Fix retrieve tables (V.Ivanchenko)
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
// 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko)
// 05-10-03 Add G4VEmProcesses registration and Verbose command (V.Ivanchenko)
// 17-10-03 Add SetParameters method (V.Ivanchenko)
// 23-10-03 Add control on inactive processes (V.Ivanchenko)
// 04-11-03 Add checks in RetrievePhysicsTable (V.Ivanchenko)
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
// 14-01-04 Activate precise range calculation (V.Ivanchenko)
// 10-03-04 Fix a problem of Precise Range table (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 13-01-04 Fix problem which takes place for inactivate eIoni (V.Ivanchenko)
// 25-01-04 Fix initialisation problem for ions (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 20-01-06 Introduce G4EmTableType to remove repeating code (VI)
// 23-03-06 Set flag isIonisation (VI)
// 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
// 22-05-06 Add methods Set/Get bremsTh (VI)
// 05-06-06 Do not clear loss_table map between runs (VI)
// 16-01-07 Create new energy loss table for e+,e-,mu+,mu- and
// left ionisation table for further usage (VI)
// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
// 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
// 21-02-08 Added G4EmSaturation (V.Ivanchenko)
// 12-04-10 Added PreparePhysicsTables and BuildPhysicsTables entries (V.Ivanchenko)
// 04-06-13 (V.Ivanchenko) Adaptation for MT mode; new method LocalPhysicsTables;
// ions expect G4GenericIon are not included in the map of energy loss
// processes for performnc reasons
//
// Class Description:
//
@@ -90,6 +54,7 @@
#include "G4EmSaturation.hh"
#include "G4EmConfigurator.hh"
#include "G4ElectronIonPair.hh"
#include "G4NIELCalculator.hh"
#include "G4PhysicsTable.hh"
#include "G4ParticleDefinition.hh"
@@ -128,20 +93,20 @@ G4LossTableManager* G4LossTableManager::Instance()
G4LossTableManager::~G4LossTableManager()
{
//G4cout << "### G4LossTableManager::~G4LossTableManager() "<< this << G4endl;
for (G4int i=0; i<n_loss; ++i) {
//G4cout << "### eloss #" << i << G4endl;
if( loss_vector[i] ) {
delete loss_vector[i];
}
delete loss_vector[i];
}
size_t msc = msc_vector.size();
for (size_t j=0; j<msc; ++j) {
if( msc_vector[j] ) { delete msc_vector[j]; }
delete msc_vector[j];
}
size_t emp = emp_vector.size();
for (size_t k=0; k<emp; ++k) {
if( emp_vector[k] ) { delete emp_vector[k]; }
delete emp_vector[k];
}
emp = p_vector.size();
for (size_t k=0; k<emp; ++k) {
delete p_vector[k];
}
size_t mod = mod_vector.size();
size_t fmod = fmod_vector.size();
@@ -159,13 +124,14 @@ G4LossTableManager::~G4LossTableManager()
}
}
for (size_t b=0; b<fmod; ++b) {
if( fmod_vector[b] ) { delete fmod_vector[b]; }
delete fmod_vector[b];
}
Clear();
delete tableBuilder;
delete emCorrections;
delete emConfigurator;
delete emElectronIonPair;
delete nielCalculator;
delete atomDeexcitation;
delete subcutProducer;
}
@@ -174,7 +140,6 @@ G4LossTableManager::~G4LossTableManager()
G4LossTableManager::G4LossTableManager()
{
//G4cout << "### G4LossTableManager::G4LossTableManager() " << this << G4endl;
theParameters = G4EmParameters::Instance();
n_loss = 0;
run = -1;
@@ -197,6 +162,7 @@ G4LossTableManager::G4LossTableManager()
emElectronIonPair = nullptr;
atomDeexcitation = nullptr;
subcutProducer = nullptr;
nielCalculator = nullptr;
gGeneral = nullptr;
eGeneral = nullptr;
}
@@ -208,19 +174,18 @@ void G4LossTableManager::Clear()
all_tables_are_built = false;
currentLoss = nullptr;
currentParticle = nullptr;
if(n_loss)
{
dedx_vector.clear();
range_vector.clear();
inv_range_vector.clear();
loss_map.clear();
loss_vector.clear();
part_vector.clear();
base_part_vector.clear();
tables_are_built.clear();
isActive.clear();
n_loss = 0;
}
if(n_loss) {
dedx_vector.clear();
range_vector.clear();
inv_range_vector.clear();
loss_map.clear();
loss_vector.clear();
part_vector.clear();
base_part_vector.clear();
tables_are_built.clear();
isActive.clear();
n_loss = 0;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -272,7 +237,10 @@ void G4LossTableManager::DeRegister(G4VEnergyLossProcess* p)
{
if(!p) { return; }
for (G4int i=0; i<n_loss; ++i) {
if(loss_vector[i] == p) { loss_vector[i] = nullptr; }
if(loss_vector[i] == p) {
loss_vector[i] = nullptr;
break;
}
}
}
@@ -299,7 +267,10 @@ void G4LossTableManager::DeRegister(G4VMultipleScattering* p)
if(!p) { return; }
size_t msc = msc_vector.size();
for (size_t i=0; i<msc; ++i) {
if(msc_vector[i] == p) { msc_vector[i] = nullptr; }
if(msc_vector[i] == p) {
msc_vector[i] = nullptr;
break;
}
}
}
@@ -326,7 +297,40 @@ void G4LossTableManager::DeRegister(G4VEmProcess* p)
if(!p) { return; }
size_t emp = emp_vector.size();
for (size_t i=0; i<emp; ++i) {
if(emp_vector[i] == p) { emp_vector[i] = nullptr; }
if(emp_vector[i] == p) {
emp_vector[i] = nullptr;
break;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::Register(G4VProcess* p)
{
if(!p) { return; }
G4int n = p_vector.size();
for (G4int i=0; i<n; ++i) {
if(p_vector[i] == p) { return; }
}
if(verbose > 1) {
G4cout << "G4LossTableManager::Register G4VProcess : "
<< p->GetProcessName() << " idx= " << p_vector.size() << G4endl;
}
p_vector.push_back(p);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::DeRegister(G4VProcess* p)
{
if(!p) { return; }
size_t emp = p_vector.size();
for (size_t i=0; i<emp; ++i) {
if(p_vector[i] == p) {
p_vector[i] = nullptr;
break;
}
}
}
@@ -542,7 +546,7 @@ void G4LossTableManager::LocalPhysicsTables(
if(1 < verbose) {
G4cout << "### G4LossTableManager::LocalPhysicsTable() for "
<< aParticle->GetParticleName()
<< " and process " << p->GetProcessName()
<< " and process " << p->GetProcessName()
<< G4endl;
}
@@ -581,8 +585,8 @@ void G4LossTableManager::LocalPhysicsTables(
inv_range_vector[i] = p->InverseRangeTable();
if(0 == run && p->IsIonisationProcess()) {
loss_map[part_vector[i]] = p;
//G4cout << "G4LossTableManager::LocalPhysicsTable " << part_vector[i]->GetParticleName()
// << " added to map " << p << G4endl;
//G4cout << "G4LossTableManager::LocalPhysicsTable " << part_vector[i]->GetParticleName()
// << " added to map " << p << G4endl;
}
if(1 < verbose) {
@@ -648,6 +652,9 @@ void G4LossTableManager::BuildPhysicsTable(
<< firstParticle->GetParticleName()
<< G4endl;
}
if(nielCalculator) { nielCalculator->Initialise(); }
for (G4int i=0; i<n_loss; ++i) {
G4VEnergyLossProcess* el = loss_vector[i];
@@ -683,7 +690,7 @@ void G4LossTableManager::BuildPhysicsTable(
}
}
if (all_tables_are_built) { return; }
if (all_tables_are_built) { return; }
// Build tables for given particle
all_tables_are_built = true;
@@ -694,16 +701,18 @@ void G4LossTableManager::BuildPhysicsTable(
if(1 < verbose) {
G4cout << "### Build Table for " << p->GetProcessName()
<< " and " << curr_part->GetParticleName()
<< " " << tables_are_built[i] << " " << base_part_vector[i] << G4endl;
<< " " << tables_are_built[i] << " " << base_part_vector[i]
<< G4endl;
}
G4VEnergyLossProcess* curr_proc = BuildTables(curr_part);
if(curr_proc) {
CopyTables(curr_part, curr_proc);
if(p == curr_proc && 0 == run && p->IsIonisationProcess()) {
loss_map[aParticle] = p;
//G4cout << "G4LossTableManager::BuildPhysicsTable: " << aParticle->GetParticleName()
// << " added to map " << p << G4endl;
}
CopyTables(curr_part, curr_proc);
if(p == curr_proc && 0 == run && p->IsIonisationProcess()) {
loss_map[aParticle] = p;
//G4cout << "G4LossTableManager::BuildPhysicsTable: "
// << aParticle->GetParticleName()
// << " added to map " << p << G4endl;
}
}
}
if ( !tables_are_built[i] ) { all_tables_are_built = false; }
@@ -745,8 +754,9 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
range_vector[j] = base_proc->RangeTableForLoss();
inv_range_vector[j] = base_proc->InverseRangeTable();
loss_map[part_vector[j]] = proc;
//G4cout << "G4LossTableManager::CopyTable " << part_vector[j]->GetParticleName()
// << " added to map " << proc << G4endl;
//G4cout << "G4LossTableManager::CopyTable "
// << part_vector[j]->GetParticleName()
// << " added to map " << proc << G4endl;
}
if (1 < verbose) {
G4cout << "For " << proc->GetProcessName()
@@ -779,7 +789,7 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(
G4VEnergyLossProcess* em = nullptr;
G4VEnergyLossProcess* p = nullptr;
G4int iem = 0;
G4PhysicsTable* dedx = 0;
G4PhysicsTable* dedx = nullptr;
G4int i;
G4ProcessVector* pvec =
@@ -1001,7 +1011,9 @@ G4EmSaturation* G4LossTableManager::EmSaturation()
G4EmConfigurator* G4LossTableManager::EmConfigurator()
{
if(!emConfigurator) { emConfigurator = new G4EmConfigurator(verbose); }
if(!emConfigurator) {
emConfigurator = new G4EmConfigurator(verbose);
}
return emConfigurator;
}
@@ -1015,6 +1027,26 @@ G4ElectronIonPair* G4LossTableManager::ElectronIonPair()
return emElectronIonPair;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4LossTableManager::SetNIELCalculator(G4NIELCalculator* ptr)
{
if(ptr && ptr != nielCalculator) {
delete nielCalculator;
nielCalculator = ptr;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4NIELCalculator* G4LossTableManager::NIELCalculator()
{
if(!nielCalculator) {
nielCalculator = new G4NIELCalculator(nullptr, verbose);
}
return nielCalculator;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableManager::SetAtomDeexcitation(G4VAtomDeexcitation* p)
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4NIELCalculator
//
// Author: Vladimir Ivanchenko
//
// Creation date: 30.05.2019
//
// Modifications:
//
// -------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4NIELCalculator.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "G4LossTableManager.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4VProcess.hh"
#include "G4Track.hh"
#include "Randomize.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4NIELCalculator::G4NIELCalculator(G4VEmModel* mod, G4int verb)
: fModel(mod), fVerbose(verb)
{
G4LossTableManager::Instance()->SetNIELCalculator(this);
if(fVerbose > 0) {
G4cout << "G4NIELCalculator: is created with the model <"
<< fModel->GetName() << ">" << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4NIELCalculator::~G4NIELCalculator()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4NIELCalculator::AddEmModel(G4VEmModel* mod)
{
if(mod && mod != fModel) {
fModel = mod;
if(fVerbose > 0) {
G4cout << "G4NIELCalculator: new model <" << fModel->GetName()
<< "> is added" << G4endl;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4NIELCalculator::Initialise()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4NIELCalculator::ComputeNIEL(const G4Step* step)
{
G4double niel = 0.0;
G4double T2 = step->GetPostStepPoint()->GetKineticEnergy();
if(fModel && T2 > 0.) {
const G4Track* track = step->GetTrack();
const G4ParticleDefinition* part = track->GetParticleDefinition();
G4double length = step->GetStepLength();
if(length > 0.0 && part->GetPDGMass() > 100*CLHEP::MeV) {
// primary
G4double T1= step->GetPreStepPoint()->GetKineticEnergy();
G4double T = 0.5*(T1 + T2);
const G4MaterialCutsCouple* couple =
step->GetPreStepPoint()->GetMaterialCutsCouple();
niel = length*fModel->ComputeDEDXPerVolume(couple->GetMaterial(),part,T);
niel = std::min(niel, T1);
}
}
return niel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4NIELCalculator::RecoilEnergy(const G4Step* step)
{
G4double erec = 0.0;
const std::vector<const G4Track*>* sec = step->GetSecondaryInCurrentStep();
if(sec) {
for(auto track : *sec) {
const G4ParticleDefinition* part = track->GetParticleDefinition();
if(part->IsGeneralIon()) {
erec += track->GetKineticEnergy();
}
}
}
return erec;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -81,6 +81,7 @@ G4VEmModel::G4VEmModel(const G4String& nam):
useAngularGenerator = false;
isLocked = false;
idxTable = 0;
fIdxTableElmSelector = 0;
fEmManager = G4LossTableManager::Instance();
fEmManager->Register(this);
@@ -105,7 +105,8 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
actBinning = actSpline = actMinKinEnergy = actMaxKinEnergy = false;
// default lambda factor
lambdaFactor = 0.8;
lambdaFactor = 0.8;
logLambdaFactor = G4Log(lambdaFactor);
// default limit on polar angle
biasFactor = fFactor = 1.0;
@@ -124,11 +125,11 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
baseMaterial = currentMaterial = nullptr;
preStepLambda = preStepKinEnergy = 0.0;
preStepLogKinEnergy = LOG_EKIN_MIN;
mfpKinEnergy = DBL_MAX;
massRatio = 1.0;
idxLambda = idxLambdaPrim = currentCoupleIndex
= basedCoupleIndex = 0;
idxLambda = idxLambdaPrim = currentCoupleIndex = basedCoupleIndex = 0;
modelManager = new G4EmModelManager();
biasManager = nullptr;
@@ -306,8 +307,9 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
} else {
SetVerboseLevel(theParameters->WorkerVerbose());
}
applyCuts = theParameters->ApplyCuts();
lambdaFactor = theParameters->LambdaFactor();
applyCuts = theParameters->ApplyCuts();
lambdaFactor = theParameters->LambdaFactor();
logLambdaFactor = G4Log(lambdaFactor);
theParameters->DefineRegParamForEM(this);
// initialisation of models
@@ -637,7 +639,8 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
G4double x = DBL_MAX;
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
preStepKinEnergy = track.GetKineticEnergy();
preStepLogKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
G4double scaledEnergy = preStepKinEnergy*massRatio;
SelectModel(scaledEnergy, currentCoupleIndex);
@@ -659,8 +662,11 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
// compute mean free path
if(preStepKinEnergy < mfpKinEnergy) {
if (integral) { ComputeIntegralLambda(preStepKinEnergy); }
else { preStepLambda = GetCurrentLambda(preStepKinEnergy); }
if (integral) {
ComputeIntegralLambda(preStepKinEnergy, preStepLogKinEnergy);
} else {
preStepLambda = GetCurrentLambda(preStepKinEnergy, preStepLogKinEnergy);
}
// zero cross section
if(preStepLambda <= 0.0) {
@@ -695,30 +701,29 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::ComputeIntegralLambda(G4double e)
void G4VEmProcess::ComputeIntegralLambda(G4double e, G4double loge)
{
// condition to skip recomputation of cross section
G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
const G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
if(e <= epeak && e/lambdaFactor >= mfpKinEnergy) { return; }
// recomputation is needed
if (e <= epeak) {
preStepLambda = GetCurrentLambda(e);
mfpKinEnergy = e;
preStepLambda = GetCurrentLambda(e, loge);
mfpKinEnergy = e;
} else {
G4double e1 = e*lambdaFactor;
if(e1 > epeak) {
preStepLambda = GetCurrentLambda(e);
mfpKinEnergy = e;
G4double preStepLambda1 = GetCurrentLambda(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
const G4double e1 = e*lambdaFactor;
if (e1 > epeak) {
preStepLambda = GetCurrentLambda(e, loge);
mfpKinEnergy = e;
const G4double preStepLambda1 = GetCurrentLambda(e1,loge+logLambdaFactor);
if (preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
mfpKinEnergy = epeak;
mfpKinEnergy = epeak;
}
}
}
@@ -738,7 +743,8 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
// should be performed by the AtRestDoIt!
if (track.GetTrackStatus() == fStopButAlive) { return &fParticleChange; }
G4double finalT = track.GetKineticEnergy();
const G4double finalT = track.GetKineticEnergy();
const G4double logFinalT = track.GetDynamicParticle()->GetLogKineticEnergy();
// forced process - should happen only once per track
if(biasFlag) {
@@ -749,7 +755,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
// Integral approach
if (integral) {
G4double lx = GetLambda(finalT, currentCouple);
G4double lx = GetLambda(finalT, currentCouple, logFinalT);
if(preStepLambda<lx && 1 < verboseLevel) {
G4cout << "WARNING: for " << currentParticle->GetParticleName()
<< " and " << GetProcessName()
@@ -1048,9 +1054,10 @@ G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
G4double G4VEmProcess::MeanFreePath(const G4Track& track)
{
G4double kinEnergy = track.GetKineticEnergy();
const G4double kinEnergy = track.GetKineticEnergy();
CurrentSetup(track.GetMaterialCutsCouple(), kinEnergy);
G4double xs = GetCurrentLambda(kinEnergy);
const G4double xs = GetCurrentLambda(kinEnergy,
track.GetDynamicParticle()->GetLogKineticEnergy());
return (0.0 < xs) ? 1.0/xs : DBL_MAX;
}
@@ -121,10 +121,11 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
SetVerboseLevel(1);
// low energy limit
lowestKinEnergy = theParameters->LowestElectronEnergy();
preStepKinEnergy = 0.0;
preStepRangeEnergy = 0.0;
computedRange = DBL_MAX;
lowestKinEnergy = theParameters->LowestElectronEnergy();
preStepKinEnergy = 0.0;
preStepLogKinEnergy = LOG_EKIN_MIN;
preStepRangeEnergy = 0.0;
computedRange = DBL_MAX;
// Size of tables assuming spline
minKinEnergy = 0.1*keV;
@@ -136,12 +137,13 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
= actLossFluc = actIntegral = actStepFunc = false;
// default linear loss limit for spline
linLossLimit = 0.01;
dRoverRange = 0.2;
finalRange = CLHEP::mm;
linLossLimit = 0.01;
dRoverRange = 0.2;
finalRange = CLHEP::mm;
// default lambda factor
lambdaFactor = 0.8;
lambdaFactor = 0.8;
logLambdafactor = G4Log(lambdaFactor);
// cross section biasing
biasFactor = 1.0;
@@ -185,7 +187,8 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
currentMaterial = nullptr;
currentCoupleIndex = basedCoupleIndex = 0;
massRatio = fFactor = reduceFactor = chargeSqRatio = 1.0;
preStepLambda = preStepScaledEnergy = fRange = 0.0;
preStepLambda = preStepScaledEnergy = fRange = logMassRatio = 0.0;
preStepLogScaledEnergy = LOG_EKIN_MIN;
secID = biasID = subsecID = -1;
}
@@ -369,11 +372,13 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
preStepLambda = 0.0;
mfpKinEnergy = DBL_MAX;
fRange = DBL_MAX;
preStepKinEnergy = 0.0;
preStepRangeEnergy = 0.0;
preStepKinEnergy = 0.0;
preStepLogKinEnergy = LOG_EKIN_MIN;
preStepRangeEnergy = 0.0;
chargeSqRatio = 1.0;
massRatio = 1.0;
reduceFactor = 1.0;
massRatio = 1.0;
logMassRatio = 0.;
reduceFactor = 1.0;
fFactor = 1.0;
lastIdx = 0;
@@ -450,7 +455,8 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
nBinsCSDA = theParameters->NumberOfBinsPerDecade()
*G4lrint(std::log10(maxKinEnergyCSDA/minKinEnergy));
if(!actLinLossLimit) { linLossLimit = theParameters->LinearLossLimit(); }
lambdaFactor = theParameters->LambdaFactor();
lambdaFactor = theParameters->LambdaFactor();
logLambdafactor = G4Log(lambdaFactor);
if(isMaster) { SetVerboseLevel(theParameters->Verbose()); }
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
@@ -462,7 +468,8 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
G4double initialMass = particle->GetPDGMass();
if (baseParticle) {
massRatio = (baseParticle->GetPDGMass())/initialMass;
massRatio = (baseParticle->GetPDGMass())/initialMass;
logMassRatio = G4Log(massRatio);
G4double q = initialCharge/baseParticle->GetPDGCharge();
chargeSqRatio = q*q;
if(chargeSqRatio > 0.0) { reduceFactor = 1.0/(chargeSqRatio*massRatio); }
@@ -1001,11 +1008,14 @@ void G4VEnergyLossProcess::StartTracking(G4Track* track)
G4double newmass = track->GetDefinition()->GetPDGMass();
if(baseParticle) {
massRatio = baseParticle->GetPDGMass()/newmass;
massRatio = baseParticle->GetPDGMass()/newmass;
logMassRatio = G4Log(massRatio);
} else if(theGenericIon) {
massRatio = proton_mass_c2/newmass;
massRatio = proton_mass_c2/newmass;
logMassRatio = G4Log(massRatio);
} else {
massRatio = 1.0;
massRatio = 1.0;
logMassRatio = 0.0;
}
}
// forced biasing only for primary particles
@@ -1027,7 +1037,8 @@ G4double G4VEnergyLossProcess::AlongStepGetPhysicalInteractionLength(
G4double x = DBL_MAX;
*selection = aGPILSelection;
if(isIonisation && currentModel->IsActive(preStepScaledEnergy)) {
fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor;
fRange = reduceFactor*GetScaledRangeForScaledEnergy(preStepScaledEnergy,
preStepLogScaledEnergy);
G4double finR = (rndmStepFlag) ? std::min(finalRange,
currentCouple->GetProductionCuts()->GetProductionCut(1)) : finalRange;
x = (fRange > finR) ?
@@ -1062,8 +1073,10 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
// initialisation of material, mass, charge, model
// at the beginning of the step
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
preStepScaledEnergy = preStepKinEnergy*massRatio;
preStepKinEnergy = track.GetKineticEnergy();
preStepLogKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
preStepScaledEnergy = preStepKinEnergy*massRatio;
preStepLogScaledEnergy = preStepLogKinEnergy + logMassRatio;
SelectModel(preStepScaledEnergy);
if(!currentModel->IsActive(preStepScaledEnergy)) {
@@ -1094,8 +1107,12 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
// compute mean free path
if(preStepScaledEnergy < mfpKinEnergy) {
if (integral) { ComputeLambdaForScaledEnergy(preStepScaledEnergy); }
else { preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy); }
if (integral) {
ComputeLambdaForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
} else {
preStepLambda =
GetLambdaForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
}
// zero cross section
if(preStepLambda <= 0.0) {
@@ -1145,30 +1162,31 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
void
G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e, G4double loge)
{
// condition to skip recomputation of cross section
G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
const G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
if(e <= epeak && e/lambdaFactor >= mfpKinEnergy) { return; }
// recomputation is needed
if (e <= epeak) {
preStepLambda = GetLambdaForScaledEnergy(e);
mfpKinEnergy = e;
preStepLambda = GetLambdaForScaledEnergy(e, loge);
mfpKinEnergy = e;
} else {
G4double e1 = e*lambdaFactor;
if(e1 > epeak) {
preStepLambda = GetLambdaForScaledEnergy(e);
mfpKinEnergy = e;
G4double preStepLambda1 = GetLambdaForScaledEnergy(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
const G4double e1 = e*lambdaFactor;
if (e1 > epeak) {
preStepLambda = GetLambdaForScaledEnergy(e, loge);
mfpKinEnergy = e;
const G4double preStepLambda1 =
GetLambdaForScaledEnergy(e1, loge+logLambdafactor);
if (preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
mfpKinEnergy = epeak;
mfpKinEnergy = epeak;
}
}
}
@@ -1233,7 +1251,8 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
// << " " << GetProcessName() << " "<< currentMaterial->GetName()<<G4endl;
//if(particle->GetParticleName() == "e-")G4cout << (*theDEDXTable) <<G4endl;
// Short step
eloss = GetDEDXForScaledEnergy(preStepScaledEnergy)*length;
eloss = GetDEDXForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
eloss *= length;
//G4cout << "eloss= " << eloss << G4endl;
@@ -1577,9 +1596,14 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
}
}
const G4DynamicParticle* dp = track.GetDynamicParticle();
const G4double logFinalT = dp->GetLogKineticEnergy();
// postStepLogScaledEnergy = logFinalT + logMassRatio;
// Integral approach
if (integral) {
G4double lx = GetLambdaForScaledEnergy(postStepScaledEnergy);
const G4double lx = GetLambdaForScaledEnergy(postStepScaledEnergy,
logFinalT + logMassRatio);
/*
if(preStepLambda<lx && 1 < verboseLevel) {
G4cout << "WARNING: for " << particle->GetParticleName()
@@ -1604,15 +1628,13 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
fParticleChange.ProposeWeight(weight);
}
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
G4double tcut = (*theCuts)[currentCoupleIndex];
// sample secondaries
secParticles.clear();
//G4cout<< "@@@ Eprimary= "<<dynParticle->GetKineticEnergy()/MeV
// << " cut= " << tcut/MeV << G4endl;
currentModel->SampleSecondaries(&secParticles, currentCouple,
dynParticle, tcut);
currentModel->SampleSecondaries(&secParticles, currentCouple, dp, tcut);
G4int num0 = secParticles.size();
@@ -1892,14 +1914,17 @@ G4double G4VEnergyLossProcess::GetDEDXDispersion(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEnergyLossProcess::CrossSectionPerVolume(
G4double kineticEnergy, const G4MaterialCutsCouple* couple)
G4double
G4VEnergyLossProcess::CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple,
G4double logKineticEnergy)
{
// Cross section per volume is calculated
DefineMaterial(couple);
G4double cross = 0.0;
if(theLambdaTable) {
cross = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
if (theLambdaTable) {
cross = GetLambdaForScaledEnergy(kineticEnergy * massRatio,
logKineticEnergy + logMassRatio);
} else {
SelectModel(kineticEnergy*massRatio);
cross = biasFactor*(*theDensityFactor)[currentCoupleIndex]
@@ -1915,7 +1940,10 @@ G4double G4VEnergyLossProcess::CrossSectionPerVolume(
G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
{
DefineMaterial(track.GetMaterialCutsCouple());
G4double cs = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
const G4double kinEnergy = track.GetKineticEnergy();
const G4double logKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
const G4double cs = GetLambdaForScaledEnergy(kinEnergy * massRatio,
logKinEnergy + logMassRatio);
return (0.0 < cs) ? 1.0/cs : DBL_MAX;
}