Import Geant4 11.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2025-06-26 09:17:29 +02:00
parent 20a218bbe1
commit a499fb82e9
1941 changed files with 203285 additions and 95593 deletions
@@ -1,111 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
// Created by ngoc hoang tran on 03/08/2023.
//
#ifndef G4ChemEquilibrium_hh
#define G4ChemEquilibrium_hh 1
#include "globals.hh"
#include "G4MoleculeTable.hh"
#include "G4UnitsTable.hh"
class G4DNAMolecularReactionData;
class G4ChemEquilibrium //for each Equilibrium process
{
public:
using MolType = const G4MolecularConfiguration*;
using Reaction = const G4DNAMolecularReactionData*;
explicit G4ChemEquilibrium(const G4int& type, const G4double& time);
~G4ChemEquilibrium() = default;
void Initialize();
inline G4bool IsStatusChanged()
{
if(fStatus == fAddEquilibrium){
return false;
}else
{
fStatus = fAddEquilibrium;
if(fVerbose > 0)
{
PrintInfo();
}
return true;
}
}
inline void Reset()
{
fStatus = false;
fAddEquilibrium = false;
fEquilibriumTime = 0;
fGlobalTime = 0;
}
inline void SetVerbose(const G4int& verbose)
{
fVerbose = verbose;
}
inline void SetGlobalTime(const G4double& time)
{
fGlobalTime = time;
if(fGlobalTime - fEquilibriumTime > fEquilibriumDuration && fAddEquilibrium)
{
fAddEquilibrium = false;
if(fVerbose) {
G4cout << "SetEquilibrium : off " << fRectionType
<< " fGlobalTime : " << G4BestUnit(fGlobalTime, "Time")
<< " fEquilibriumTime8 : " << G4BestUnit(fEquilibriumTime, "Time")
<< " fAddEquilibrium : " << fAddEquilibrium << G4endl;
}
}
}
void SetEquilibrium(Reaction pReaction);
inline G4bool GetEquilibriumStatus() const
{
return fAddEquilibrium;
}
void PrintInfo() const;
private:
G4bool fStatus = false;
G4bool fAddEquilibrium = false;
G4double fEquilibriumTime = 0;
const G4double fEquilibriumDuration = 0;
G4int fRectionType = 0;
MolType fReactant1 = nullptr;
MolType fReactant2 = nullptr;
MolType fReactantB1 = nullptr;
MolType fReactantB2 = nullptr;
G4double fGlobalTime = 0;
G4int fVerbose = 1;
};
#endif //
@@ -23,22 +23,125 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4DNABornIonisationModel.hh
*
* Created on: 13 mai 2015
* Author: matkara
*/
// Created 25.03.2025 V.Ivanchenko
// on base of the G4DNABornIonisationModel1 of S.Incerti & M.Karamitros
//
// Simulation of ionisation for electrons and protons
//
#ifndef SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNIONISATIONMODEL_HH_
#define SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNIONISATIONMODEL_HH_
#ifndef G4DNABornIonisationModel_h
#define G4DNABornIonisationModel_h 1
#include "G4DNABornIonisationModel1.hh"
#include "G4DNABornIonisationModel2.hh"
#include "G4VEmModel.hh"
#include "G4VSIntegration.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4DNAWaterIonisationStructure.hh"
class G4DNAChemistryManager;
class G4VAtomDeexcitation;
class G4DNACrossSectionDataSet;
class G4DNASamplingTable;
class G4DNABornIonisationModel : public G4VEmModel, public G4VSIntegration
{
public:
G4DNABornIonisationModel(const G4ParticleDefinition* p = nullptr,
const G4String& nam = "DNABornIonisationModel");
~G4DNABornIonisationModel() override;
void Initialise(const G4ParticleDefinition*, const G4DataVector&) override;
G4double ProbabilityDensityFunction(G4double ekin) override;
G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax) override;
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin, G4double maxEnergy) override;
void StartTracking(G4Track*) override;
void SelectFasterComputation(G4bool input) { fasterCode = input; };
void SelectStationary(G4bool input) { statCode = input; };
void SelectSPScaling(G4bool input) { spScaling = input; };
G4DNABornIonisationModel & operator=(const G4DNABornIonisationModel &right) = delete;
G4DNABornIonisationModel(const G4DNABornIonisationModel&) = delete;
private:
void LoadData();
G4int SelectShell();
G4double SampleCumulative();
G4double SampleDifferential();
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
// Water density table
static const std::vector<G4double>* fpWaterDensity;
// data
static G4DNACrossSectionDataSet* xsdata_e;
static G4DNACrossSectionDataSet* xsdata_p;
G4DNACrossSectionDataSet* xsdata{nullptr};
// sampling data
static G4DNASamplingTable* sampling_e;
static G4DNASamplingTable* sampling_p;
G4DNASamplingTable* sampling;
const G4ParticleDefinition* fParticle{nullptr};
const G4Track* fTrack{nullptr};
G4DNAChemistryManager* fChemistry{nullptr};
// Deexcitation manager to produce fluo photons and e-
G4VAtomDeexcitation* fAtomDeexcitation;
// limits of x-section table
G4double fLowEnergy{0.0};
G4double fHighEnergy{0.0};
G4double fpLimitEnergy{0.0};
G4double feLimitEnergy{0.0};
// tracking cut
G4double fAbsorptionEnergy{0.0};
G4double fMass{0.0};
G4double fPrimaryEnergy{0.0};
G4double fMaxEnergy{0.0};
G4double fTemp[5] = {0.0};
G4int fSelectedShell{0};
G4int verbose{0};
G4bool isFirst{false};
G4bool isInitialised{false};
G4bool isElectron{false};
G4bool fasterCode{false};
G4bool statCode{false};
G4bool spScaling{true};
// Final state
G4DNAWaterIonisationStructure waterStructure;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef G4DNABornIonisationModel
#define G4DNABornIonisationModel G4DNABornIonisationModel1
//#define G4DNABornIonisationModel G4DNABornIonisationModel2
#endif
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNIONISATIONMODEL_HH_ */
@@ -43,6 +43,7 @@
#include "G4VAtomDeexcitation.hh"
#include "G4NistManager.hh"
class G4DNAChemistryManager;
class G4DNABornIonisationModel1 : public G4VEmModel
{
@@ -75,11 +76,12 @@ public:
G4int /*level*/,
const G4ParticleDefinition*,
G4double /*kineticEnergy*/) override;
void StartTracking(G4Track*) override;
G4double DifferentialCrossSection(G4ParticleDefinition * aParticleDefinition, G4double k, G4double energyTransfer, G4int shell);
G4double TransferedEnergy(G4ParticleDefinition * aParticleDefinition,
G4double incomingParticleEnergy, G4int shell, G4double random) ;
G4double incomingParticleEnergy, G4int shell, G4double random);
inline void SelectFasterComputation(G4bool input);
@@ -93,28 +95,27 @@ protected:
private:
G4bool fasterCode;
G4bool statCode;
G4bool spScaling;
G4bool fasterCode{false};
G4bool statCode{false};
G4bool spScaling{true};
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
// Deexcitation manager to produce fluo photons and e-
G4VAtomDeexcitation* fAtomDeexcitation;
G4VAtomDeexcitation* fAtomDeexcitation;
const G4Track* fTrack{nullptr};
G4DNAChemistryManager* fChemistry{nullptr};
std::map<G4String,G4double,std::less<G4String> > lowEnergyLimit;
std::map<G4String,G4double,std::less<G4String> > highEnergyLimit;
// TODO :
// std::map<const G4ParticleDefinition*,std::pair<G4double,G4double> > fEnergyLimits;
G4bool isInitialised{false};
G4int verboseLevel;
// Cross section
using MapFile = std::map<G4String, G4String, std::less<G4String>>;
MapFile tableFile; // useful ?
@@ -163,29 +164,27 @@ private:
VecMap eProbaShellMap[6]; // for cumulated dcs
VecMap pProbaShellMap[6]; // for cumulated dcs
// Partial cross section
// Partial cross section
G4int RandomSelect(G4double energy,const G4String& particle );
};
inline void G4DNABornIonisationModel1::SelectFasterComputation (G4bool input)
{
fasterCode = input;
fasterCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornIonisationModel1::SelectStationary (G4bool input)
{
statCode = input;
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornIonisationModel1::SelectSPScaling (G4bool input)
{
spScaling = input;
spScaling = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -63,12 +63,13 @@ class G4DNAEventScheduler : public IEventScheduler
G4DNAEventScheduler& operator=(const G4DNAEventScheduler& right) = delete;
void Initialize(const G4DNABoundingBox& boundingBox, G4int pixel);
void InitializeInMesh();
void Voxelizing();
void Voxelizing(const G4DNABoundingBox& boundingBox);
void ReVoxelizing(G4int);
void SetEndTime(const G4double&);
G4double GetStartTime() const;
G4double GetEndTime() const;
G4double GetTimeStep() const;
G4double GetGlobalTime() const;
void SetStartTime(G4double time);
inline void SetVerbose(G4int verbose) { fVerbose = verbose; }
@@ -93,7 +94,8 @@ class G4DNAEventScheduler : public IEventScheduler
G4int GetPixels() const;
void SetUserMeshAction(std::unique_ptr<G4UserMeshAction>);
static G4bool CheckingReactionRadius(G4double resolution);
void ParticleBasedCounter();
void ResetCounter();
private:
G4int fVerbose = 0;
G4bool fInitialized = false;
@@ -38,6 +38,7 @@
#include "G4ITTrackHolder.hh"
#include "G4ITReaction.hh"
#include "G4ReferenceCast.hh"
#include <unordered_map>
class G4VDNAReactionModel;
class G4DNAMolecularReactionTable;
@@ -66,20 +67,19 @@ class G4DNAIndependentReactionTimeStepper : public G4VITTimeStepComputer
G4VDNAReactionModel* GetReactionModel();
std::unique_ptr<G4ITReactionChange> FindReaction(
G4ITReactionSet* pReactionSet, const G4double& currentStepTime = 0,
const G4double& previousStepTime = 0,
const G4bool& reachedUserStepTimeLimit = false);
G4ITReactionSet* pReactionSet,
G4double& currentStepTime,
const G4double globalTime);
void SetReactionProcess(G4VITReactionProcess* pReactionProcess);
void SetVerbose(G4int);
private:
void InitializeForNewTrack();
class Utils;
void CheckAndRecordResults(const Utils& utils);
void CheckAndRecordResults(G4double reactionTime, const Utils& utils);
G4double GetTimeToEncounter(const G4Track& trackA, const G4Track& trackB);
G4bool fHasAlreadyReachedNullTime = false;
const G4DNAMolecularReactionTable*& fMolecularReactionTable =
reference_cast<const G4DNAMolecularReactionTable*>(fpReactionTable);
G4VDNAReactionModel* fReactionModel = nullptr;
@@ -88,18 +88,24 @@ class G4DNAIndependentReactionTimeStepper : public G4VITTimeStepComputer
G4int fVerbose = 0;
G4double fRCutOff = G4IRTUtils::GetRCutOff();
G4VITReactionProcess* fpReactionProcess = nullptr;
std::map<G4int, G4ThreeVector> fSampledPositions;
std::vector<const G4Track *> fSecondaries;
std::unordered_map<G4int, G4ThreeVector> fSampledPositions;
std::set<G4int> fCheckedTracks;
void InitializeReactions(G4double currentGlobalTime);
G4bool fIsInitialized = false;
G4double GetNextReactionTime();
const G4ITReaction* GetNextReaction();
class Utils
{
public:
Utils(const G4Track& tA, const G4Track& tB);
~Utils() = default;
const G4Track& fTrackA;
const G4Track& fTrackB;
const G4Molecule* fpMoleculeA;
const G4Molecule* fpMoleculeB;
G4Track* fpTrackA{nullptr};
G4Track* fpTrackB{nullptr};
const G4Molecule* fpMoleculeA{nullptr};
const G4Molecule* fpMoleculeB{nullptr};
};
};
#endif
@@ -33,6 +33,7 @@ class G4DNAMolecularReactionTable;
class G4VDNAReactionModel;
class G4ITReactionSet;
class G4VITTimeStepComputer;
class G4DNAScavengerMaterial;
class G4DNAMakeReaction : public G4VITReactionProcess
{
@@ -59,5 +60,7 @@ protected:
G4VDNAReactionModel* fpReactionModel;
G4VITTimeStepComputer* fpTimeStepper;
G4double fTimeStep;
G4DNAScavengerMaterial* fpScavengerMaterial{nullptr};
};
#endif
@@ -0,0 +1,177 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Created 11.02.2025 V.Ivanchenko & M. Vologzhin
// on base of previous Rudd models
//
// Rudd model of ion ionisation using dynamic mass and charge of an ion
//
#ifndef G4DNARuddIonisationDynamicModel_h
#define G4DNARuddIonisationDynamicModel_h 1
#include "G4VEmModel.hh"
#include "G4VSIntegration.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4DNAWaterIonisationStructure.hh"
#include <vector>
class G4DNAChemistryManager;
class G4VAtomDeexcitation;
class G4DNACrossSectionDataSet;
class G4Pow;
class G4DNARuddIonisationDynamicModel : public G4VEmModel, public G4VSIntegration
{
public:
explicit G4DNARuddIonisationDynamicModel(const G4ParticleDefinition* p = nullptr,
const G4String& nam = "DNARuddIonisationDynamicModel");
~G4DNARuddIonisationDynamicModel() override;
void Initialise(const G4ParticleDefinition*, const G4DataVector&) override;
G4double ProbabilityDensityFunction(G4double ekin) override;
G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax) override;
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy) override;
void StartTracking(G4Track*) override;
G4DNARuddIonisationDynamicModel & operator=
(const G4DNARuddIonisationDynamicModel &right) = delete;
G4DNARuddIonisationDynamicModel(const G4DNARuddIonisationDynamicModel&) = delete;
private:
void LoadData();
void SetParticle(const G4ParticleDefinition*);
G4int SelectShell();
G4double MaxEnergy();
G4double SampleElectronEnergy();
G4double CorrectionFactor();
G4double S_1s(G4double t,
G4double energyTransferred,
G4double slaterEffectiveChg,
G4double shellNumber);
G4double S_2s(G4double t,
G4double energyTransferred,
G4double slaterEffectiveChg,
G4double shellNumber);
G4double S_2p(G4double t,
G4double energyTransferred,
G4double slaterEffectiveChg,
G4double shellNumber);
G4double Rh(G4double t,
G4double energyTransferred,
G4double slaterEffectiveChg,
G4double shellNumber);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma{nullptr};
private:
// Water density table
static const std::vector<G4double>* fpWaterDensity;
// data for protons
static G4DNACrossSectionDataSet* xsdata_hydrogen;
static G4DNACrossSectionDataSet* xsdata_helium;
static G4DNACrossSectionDataSet* xsdata_p;
// run time data
G4DNACrossSectionDataSet* xsdata{nullptr};
const G4ParticleDefinition* fParticle{nullptr};
const G4Track* fTrack{nullptr};
G4DNAChemistryManager* fChemistry{nullptr};
G4Pow* fGpow;
//deexcitation manager to produce fluo photons and e-
G4VAtomDeexcitation* fAtomDeexcitation{nullptr};
// low-energy limit of proton x-section table
G4double fLowestEnergy{0.0};
// tracking cut
G4double fAbsorptionEnergy{0.0};
G4double fMass{0.0};
G4double fMassRate{1.0};
G4double fScaledEnergy{0.0};
G4double slaterEffectiveCharge[3] = {0.0};
G4double sCoefficient[3] = {0.0};
G4double fTemp[5] = {0.0};
G4double F1{0.0};
G4double F2{0.0};
G4double alphaConst{0.0};
G4double bEnergy{0.0};
G4double u{0.0};
G4double v{0.0};
G4double wc{0.0};
G4int fSelectedShell{0};
G4int verbose{0};
G4bool isFirst{false};
G4bool isInitialised{false};
G4bool isIon{false};
G4bool isHelium{false};
G4bool statCode{false};
G4bool useDNAWaterStructure{true};
// energy levels of water molecule
G4DNAWaterIonisationStructure waterStructure;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -71,8 +71,6 @@ public:
G4double tmin,
G4double maxEnergy) override;
void SelectStationary(G4bool val) { statCode = val; };
// method for unit tests
G4double ComputeProbabilityFunction(const G4ParticleDefinition*, G4double kine,
G4double deltae, G4int shell);