Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
@@ -23,7 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Author: Alexei Sytov
// Co-author: Gianfranco Paterno (modifications & testing)
// On the base of the CRYSTALRAD realization of the Baier-Katkov integral:
// A. I. Sytov, V. V. Tikhomirov, and L. Bandiera PRAB 22, 064601 (2019)
#ifndef G4BaierKatkov_h
#define G4BaierKatkov_h 1
@@ -113,7 +117,7 @@ public:
///number of steps in a trajectory small piece before
///the next call of the radiation integral
void SetNSmallTrajectorySteps(G4double nSmallTrajectorySteps)
void SetNSmallTrajectorySteps(G4int nSmallTrajectorySteps)
{fNSmallTrajectorySteps = nSmallTrajectorySteps;}
///reinitialize intermediate integrals fFa, fSs, fSc, fSsx, fSsy, fScx, fScy;
@@ -259,7 +263,7 @@ private:
//in sampling, y-plane
G4double fParamPhotonAngleY=1.e-3*CLHEP::rad; //a parameter radiated photon
//sampling distribution, y-plane
G4double fRadiationAngleFactor = 1.; // number of radiation angles 1/gamma:
G4double fRadiationAngleFactor = 4.; // number of radiation angles 1/gamma:
// more fRadiationAngleFactor =>
// higher fParamPhotonAngleX and Y
@@ -23,7 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Author: Alexei Sytov
// Co-author: Gianfranco Paternò (modifications & testing)
#ifndef G4ChannelingFastSimCrystalData_h
#define G4ChannelingFastSimCrystalData_h 1
@@ -60,7 +61,9 @@ public:
///find and upload crystal lattice input files, calculate all the basic values
///(to do only once)
void SetMaterialProperties(const G4Material* crystal, const G4String &lattice);
void SetMaterialProperties(const G4Material* crystal,
const G4String &lattice,
const G4String &filePath);
///calculate the coordinates in the co-rotating reference system
///within a channel (periodic cell)
@@ -88,6 +91,10 @@ public:
///auxialiary function to transform the horizontal angle
G4double AngleXShift(G4double z){return fMiscutAngle + z*fCurv;}
///get channel width in x and y
G4double GetChannelWidthX(){return fDx;}
G4double GetChannelWidthY(){return fDy;}
private:
///variables
@@ -23,6 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Author: Alexei Sytov
#ifndef G4ChannelingFastSimInterpolation_h
#define G4ChannelingFastSimInterpolation_h
@@ -23,6 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Author: Alexei Sytov
// Co-author: Gianfranco Paternò (modifications & testing)
// On the base of the CRYSTALRAD realization of channeling model:
// A. I. Sytov, V. V. Tikhomirov, and L. Bandiera PRAB 22, 064601 (2019)
#ifndef G4ChannelingFastSimModel_h
#define G4ChannelingFastSimModel_h 1
@@ -63,7 +67,13 @@ public:
void DoIt(const G4FastTrack&, G4FastStep&) override;
///special functions
void Input(const G4Material* crystal, const G4String &lattice);
void Input(const G4Material* crystal,
const G4String &lattice)
{Input(crystal,lattice,"");}
void Input(const G4Material* crystal,
const G4String &lattice,
const G4String &filePath);
void RadiationModelActivate();
@@ -80,11 +90,16 @@ public:
void SetLindhardAngleNumberHighLimit(G4double angleNumber, const G4String& particleName)
{fLindhardAngleNumberHighLimit[particleTable->FindParticle(particleName)->
GetParticleDefinitionID()]=angleNumber;}
void SetHighAngleLimit(G4double anglemax, const G4String& particleName)
{fHighAngleLimit[particleTable->FindParticle(particleName)->
GetParticleDefinitionID()] = anglemax;}
void SetDefaultLowKineticEnergyLimit(G4double ekinetic)
{fDefaultLowEnergyLimit=ekinetic;}
void SetDefaultLindhardAngleNumberHighLimit(G4double angleNumber)
{fDefaultLindhardAngleNumberHighLimit=angleNumber;}
void SetDefaultHighAngleLimit(G4double anglemax)
{fDefaultHighAngleLimit=anglemax;}
/// get the maximal number of photons that can be produced per fastStep
@@ -93,15 +108,6 @@ public:
{fMaxPhotonsProducedPerStep=nPhotons;}
///get cuts
G4double GetLowKineticEnergyLimit(const G4String& particleName)
{return GetLowKineticEnergyLimit(particleTable->
FindParticle(particleName)->
GetParticleDefinitionID());}
G4double GetLindhardAngleNumberHighLimit(const G4String& particleName)
{return GetLindhardAngleNumberHighLimit(particleTable->
FindParticle(particleName)->
GetParticleDefinitionID());}
//the same functions but using particleDefinitionID (needed for faster model execution)
G4double GetLowKineticEnergyLimit(G4int particleDefinitionID)
{return (fLowEnergyLimit.count(particleDefinitionID) == 1)
? fLowEnergyLimit[particleDefinitionID]
@@ -110,6 +116,10 @@ public:
{return (fLindhardAngleNumberHighLimit.count(particleDefinitionID) == 1)
? fLindhardAngleNumberHighLimit[particleDefinitionID]
: fDefaultLindhardAngleNumberHighLimit;}
G4double GetHighAngleLimit(G4int particleDefinitionID)
{return (fHighAngleLimit.count(particleDefinitionID) == 1)
? fHighAngleLimit[particleDefinitionID]
: fDefaultHighAngleLimit;}
/// get the maximal number of photons that can be produced per fastStep
G4int GetMaxPhotonsProducedPerStep(){return fMaxPhotonsProducedPerStep;}
@@ -124,12 +134,15 @@ private:
///flag of radiation model
G4bool fRad = false;
/// maps of cuts
/// maps of cuts (angular cuts are chosen as std::max of
/// fHighAngleLimit and calculated Lindhard angle)
std::unordered_map<G4int, G4double> fLowEnergyLimit;
std::unordered_map<G4int, G4double> fLindhardAngleNumberHighLimit;
std::unordered_map<G4int, G4double> fHighAngleLimit;
G4double fDefaultLowEnergyLimit = 200*CLHEP::MeV;
G4double fDefaultLindhardAngleNumberHighLimit = 100.;
G4double fDefaultHighAngleLimit = 0.;
/// the maximal number of photons that can be produced per fastStep
G4int fMaxPhotonsProducedPerStep=1000.;
@@ -0,0 +1,192 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Author: Alexei Sytov
// Co-author: Gianfranco Paterno (testing)
// Using the key points of G4BaierKatkov and developments of V.V. Tikhomirov,
// partially described in L. Bandiera et al. Eur. Phys. J. C 82, 699 (2022)
#ifndef G4CoherentPairProduction_h
#define G4CoherentPairProduction_h 1
#include "G4VDiscreteProcess.hh"
#include <vector>
#include <CLHEP/Units/SystemOfUnits.h>
#include <CLHEP/Units/PhysicalConstants.h>
#include <CLHEP/Vector/TwoVector.h>
#include "G4ChannelingFastSimCrystalData.hh"
#include "G4LogicalVolume.hh"
#include "G4ParticleTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4CoherentPairProduction : public G4VDiscreteProcess
{
public:
G4CoherentPairProduction(const G4String& processName = "cpp",
G4ProcessType aType = fElectromagnetic);
~G4CoherentPairProduction() = default;
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override;
G4bool IsApplicable(const G4ParticleDefinition& aPD) override
{
return(aPD.GetParticleName() == "gamma");
}
// print documentation in html format
void ProcessDescription(std::ostream&) const override;
///special functions
void Input(const G4Material* crystal,
const G4String &lattice)
{Input(crystal,lattice,"");}
void Input(const G4Material* crystal,
const G4String &lattice,
const G4String &filePath);
// an option to use crystal data already created outside this class
void Input(const G4ChannelingFastSimCrystalData* crystalData);
///activate incoherent scattering
///(standard gamma conversion should be switched off in physics list)
void ActivateIncoherentScattering(){fIncoherentScattering = true;}
G4ChannelingFastSimCrystalData* GetCrystalData() {return fCrystalData;}
///get cuts
// minimal energy for non-zero cross section
G4double ModelMinPrimaryEnergy() { return fLowEnergyLimit;}
G4double GetHighAngleLimit() {return fHighAngleLimit;}
G4double GetPPKineticEnergyCut() {return fPPKineticEnergyCut;}
/// get the number of pairs in sampling of Baier-Katkov Integral
/// (MC integration by e+- energy and angles <=> e+- momentum)
G4int GetSamplingPairsNumber(){return fNMCPairs;}
/// get the number of particle angles 1/gamma in pair production
/// defining the width of the angular distribution of pair sampling
/// in the Baier-Katkov Integral
G4double GetChargeParticleAngleFactor(){return fChargeParticleAngleFactor;}
/// get number of trajectory steps of a single particle (e- or e+)
G4double GetNTrajectorySteps(){return fNTrajectorySteps;}
/// get effective radiation length
/// (due to coherent process of pair production)
/// simulated for the current photon
G4double GetEffectiveLrad(){return fEffectiveLrad;}
///get the name of G4Region in which the model is applicable
G4String GetG4RegionName() {return fG4RegionName;}
///set cuts
void SetLowEnergyLimit(G4double energy){fLowEnergyLimit=energy;}
void SetHighAngleLimit(G4double angle) {fHighAngleLimit=angle;}
void SetPPKineticEnergyCut(G4double kineticEnergyCut) {fPPKineticEnergyCut=kineticEnergyCut;}
/// set the number of pairs in sampling of Baier-Katkov Integral
/// (MC integration by e+- energy and angles <=> e+- momentum)
void SetSamplingPairsNumber(G4int nPairs){fNMCPairs = nPairs;}
/// set the number of particle angles 1/gamma in pair production
/// defining the width of the angular distribution of pair sampling
/// in the Baier-Katkov Integral
void SetChargeParticleAngleFactor(G4double chargeParticleAngleFactor)
{fChargeParticleAngleFactor = chargeParticleAngleFactor;}
/// set number of trajectory steps of a single particle (e- or e+)
void SetNTrajectorySteps(G4int nTrajectorySteps)
{fNTrajectorySteps = nTrajectorySteps;}
///set the name of G4Region in which the model is applicable
void SetG4RegionName(const G4String& nameG4Region){fG4RegionName=nameG4Region;}
G4double GetMeanFreePath(const G4Track& aTrack,
G4double,
G4ForceCondition* condition) override;
private:
G4int FindVectorIndex(std::vector<G4double> &myvector, G4double value);
G4ChannelingFastSimCrystalData* fCrystalData{nullptr};
//collection of etotal
std::vector <CLHEP::Hep2Vector> fullVectorEtotal;
//collection of x
std::vector <CLHEP::Hep2Vector> fullVectorX;
//collection of y
std::vector <CLHEP::Hep2Vector> fullVectorY;
//collection of tx
std::vector <CLHEP::Hep2Vector> fullVectorTX;
//collection of tx
std::vector <CLHEP::Hep2Vector> fullVectorTY;
//the vector of the discrete CDF of the production of sampling e+e- pairs
//(in reality per distance along the photon direction)
std::vector <G4double> fPairProductionCDFdz;
G4double fLowEnergyLimit = 1*CLHEP::GeV;
G4double fHighAngleLimit = 50*CLHEP::mrad;
///minimal kinetic energy of a charged particle produced
G4double fPPKineticEnergyCut = 1*CLHEP::MeV;
///Monte Carlo statistics of e+- pair sampling in Baier-Katkov for 1 photon
G4int fNMCPairs = 150;
G4double fChargeParticleAngleFactor = 4; // number of particle angles 1/gamma:
// more fChargeParticleAngleFactor => higher paramParticleAngle
///number of trajectory steps of a single particle (e- or e+)
G4int fNTrajectorySteps=250;
///effective radiation length (due to coherent process of pair production)
G4double fEffectiveLrad = 0.;
///the name of G4Region in which the model is applicable
G4String fG4RegionName = "Crystal";
///charged particle mass
const G4double fMass = CLHEP::electron_mass_c2;
///flag of simulation of incoherent scattering
G4bool fIncoherentScattering = false;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Author: Alexei Sytov
// Co-author: Gianfranco Paternò (modifications & testing)
// On the base of the CRYSTALRAD realization of scattering model:
// A. I. Sytov, V. V. Tikhomirov, and L. Bandiera PRAB 22, 064601 (2019)
#ifndef G4VChannelingFastSimCrystalData_h
#define G4VChannelingFastSimCrystalData_h 1
@@ -81,7 +84,7 @@ public:
//don't put it =0, otherwise division on 0 in CoulombAtomicScattering
///Calculate the value of the Lindhard angle (!!! the value for a straight crystal)
G4double GetLindhardAngle(G4double etotal, G4double mass);
G4double GetLindhardAngle(G4double etotal, G4double mass, G4double charge);
///Calculate the value of the Lindhard angle (!!! the value for a straight crystal)
G4double GetLindhardAngle();//return the Lindhard angle value calculated in
//SetParticleProperties
@@ -90,7 +93,7 @@ public:
///reduced value for overbarrier particles)
G4double GetSimulationStep(G4double tx,G4double ty);
///Calculate maximal simulation step (standard value for channeling particles)
G4double GetMaxSimulationStep(G4double etotal, G4double mass);
G4double GetMaxSimulationStep(G4double etotal, G4double mass, G4double charge);
///get particle velocity/c
G4double GetBeta(){return fBeta;}
@@ -119,7 +122,8 @@ public:
///find and upload crystal lattice input files, calculate all the basic values
///(to do only once)
virtual void SetMaterialProperties(const G4Material* crystal,
const G4String &lattice) = 0;
const G4String &lattice,
const G4String &filePath) = 0;
///set geometry parameters from current logical volume
void SetGeometryParameters(const G4LogicalVolume *crystallogic);
@@ -153,7 +157,7 @@ public:
void SetParticleProperties(G4double etotal,
G4double mp,
G4double charge,
G4bool ifhadron);
const G4String& particleName);
///calculate the coordinates in the co-rotating reference system
///within a channel (periodic cell)
@@ -280,6 +284,7 @@ protected:
G4double fK3=0;//a useful coefficient, fK3=2.*pi*alpha*hdc/electron_mass_c2/(fPV)**2
std::vector <G4double> fKD; //a useful coefficient for dE/dx
std::vector <G4double> fLogPlasmaEdI0; //item of delta-correction of ionization loss
///coefficients for multiple scattering suppression
std::vector <G4double> fPu11;//a useful coefficient for exponent containing u1
@@ -324,7 +329,7 @@ private:
G4double fTmax=0; // max ionization losses
///particle properties flags
G4bool fHadron=false;//=true (for hadrons); =false (for leptons)
G4String fParticleName = "";
G4double fZ2=0; //particle charge
};