Import Geant4 11.0.1 source tree
This commit is contained in:
@@ -14,6 +14,31 @@ and keep track of all category-tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
04 March 2022: V.Ivanchenko (emstand-V10-07-29)
|
||||
- G4UniversalFluctuation - removed unnecessary "if"
|
||||
|
||||
18 February 2022: V.Ivanchenko
|
||||
- G4UniversalFluctuation, G4UrbanFluctuation - L.Urban use the same fw=4 and a0=42
|
||||
parameters of the model providing similar results for small steps or thin
|
||||
layers to Geant4 10.7 version of fluctuations (fixed #2466)
|
||||
|
||||
14 February 2022: V.Ivanchenko
|
||||
- G4UrbanMscModel - minor optimisation of arithmetic
|
||||
- G4UniversalFluctuation - introduced a new protected method SampleGlandz(..),
|
||||
which provides sampling of non-Gauss fluctuations; improved arithmetic;
|
||||
results are identical to the version of the release
|
||||
- G4UrbanFluctuation - reorganized version of fluctuation model from
|
||||
Geant4 10.7 in SampleGlandz(...) method
|
||||
- G4LossFluctuationDummy - new class with zero fluctuations
|
||||
|
||||
24 January 22: V.Ivanchenko
|
||||
- G4UrbanMscModel - removed multiple initialisation of the cache data structure and
|
||||
possible data race
|
||||
|
||||
08 January 22: V.Ivanchenko
|
||||
- G4CoulombScattering - for single scattering used in restriced interval of large
|
||||
angles use fEmIncreasing type of cross section shape
|
||||
|
||||
26 November 21: V.Ivanchenko (emstand-V10-07-28)
|
||||
- G4PairProductionRelModel - reduce upper limit of parameterisation x-section
|
||||
from 80 to 30 GeV
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4LossFluctuationDummy
|
||||
//
|
||||
// Author: V.Ivanchenko
|
||||
//
|
||||
// Creation date: 14.02.2022
|
||||
//
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
|
||||
#ifndef G4LossFluctuationDummy_h
|
||||
#define G4LossFluctuationDummy_h 1
|
||||
|
||||
#include "G4VEmFluctuationModel.hh"
|
||||
|
||||
class G4LossFluctuationDummy : public G4VEmFluctuationModel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
explicit G4LossFluctuationDummy(const G4String& nam = "DummyFluc");
|
||||
|
||||
~G4LossFluctuationDummy() override;
|
||||
|
||||
G4double SampleFluctuations(const G4MaterialCutsCouple*,
|
||||
const G4DynamicParticle*,
|
||||
const G4double, const G4double,
|
||||
const G4double, const G4double) final;
|
||||
|
||||
G4double Dispersion(const G4Material*,
|
||||
const G4DynamicParticle*,
|
||||
const G4double, const G4double,
|
||||
const G4double) final;
|
||||
|
||||
// Initialisation prestep
|
||||
void SetParticleAndCharge(const G4ParticleDefinition*, G4double) final;
|
||||
|
||||
// hide assignment operator
|
||||
G4LossFluctuationDummy & operator=
|
||||
(const G4LossFluctuationDummy &right) = delete;
|
||||
G4LossFluctuationDummy(const G4LossFluctuationDummy&) = delete;
|
||||
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class header file
|
||||
@@ -40,7 +39,7 @@
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// Implementation of energy loss fluctuations
|
||||
// Implementation of energy loss fluctuations made by L.Urban in 2021
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -72,59 +71,64 @@ public:
|
||||
const G4double, const G4double,
|
||||
const G4double) override;
|
||||
|
||||
void InitialiseMe(const G4ParticleDefinition*) final;
|
||||
// Initialisation for a new particle type
|
||||
void InitialiseMe(const G4ParticleDefinition*) override;
|
||||
|
||||
// Initialisation prestep
|
||||
void SetParticleAndCharge(const G4ParticleDefinition*,
|
||||
G4double q2) final;
|
||||
void SetParticleAndCharge(const G4ParticleDefinition*,
|
||||
G4double q2) override;
|
||||
|
||||
// hide assignment operator
|
||||
G4UniversalFluctuation & operator=(const G4UniversalFluctuation &right) = delete;
|
||||
G4UniversalFluctuation(const G4UniversalFluctuation&) = delete;
|
||||
G4UniversalFluctuation & operator=
|
||||
(const G4UniversalFluctuation &right) = delete;
|
||||
G4UniversalFluctuation(const G4UniversalFluctuation&) = delete;
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
virtual G4double SampleGlandz(CLHEP::HepRandomEngine* rndm,
|
||||
const G4Material*, const G4double tcut);
|
||||
|
||||
inline void AddExcitation(CLHEP::HepRandomEngine* rndm,
|
||||
G4double a, G4double e, G4double& eav,
|
||||
const G4double ax, const G4double ex,
|
||||
G4double& eav,
|
||||
G4double& eloss, G4double& esig2);
|
||||
|
||||
inline void SampleGauss(CLHEP::HepRandomEngine* rndm,
|
||||
G4double eav, G4double esig2,
|
||||
const G4double eav, const G4double esig2,
|
||||
G4double& eloss);
|
||||
|
||||
const G4ParticleDefinition* particle = nullptr;
|
||||
const G4Material* lastMaterial = nullptr;
|
||||
|
||||
// particle properties
|
||||
G4double particleMass = 0.0;
|
||||
|
||||
// Derived quantities
|
||||
G4double m_Inv_particleMass = DBL_MAX;
|
||||
G4double m_massrate = DBL_MAX;
|
||||
G4double chargeSquare = 1.0;
|
||||
|
||||
// data members to speed up the fluctuation calculation
|
||||
// material properties
|
||||
G4double ipotFluct = 0.0;
|
||||
G4double ipotLogFluct = 0.0;
|
||||
G4double e0 = 0.0;
|
||||
G4double e1 = 0.0;
|
||||
|
||||
// model parameters
|
||||
G4double minNumberInteractionsBohr = 10.0;
|
||||
G4double minLoss;
|
||||
G4double nmaxCont = 8.0;
|
||||
G4double rate = 0.56;
|
||||
G4double fw = 5.0;
|
||||
G4double a0 = 15.0;
|
||||
G4double fw = 4.0;
|
||||
G4double a0 = 42.0;
|
||||
G4double w2 = 0.0;
|
||||
G4double meanLoss = 0.0;
|
||||
|
||||
G4int sizearray = 30;
|
||||
const G4ParticleDefinition* particle = nullptr;
|
||||
G4double* rndmarray = nullptr;
|
||||
G4int sizearray = 30;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
inline void
|
||||
G4UniversalFluctuation::AddExcitation(CLHEP::HepRandomEngine* rndm,
|
||||
G4double ax, G4double ex, G4double& eav,
|
||||
const G4double ax, const G4double ex,
|
||||
G4double& eav,
|
||||
G4double& eloss, G4double& esig2)
|
||||
{
|
||||
if(ax > nmaxCont) {
|
||||
@@ -136,9 +140,11 @@ G4UniversalFluctuation::AddExcitation(CLHEP::HepRandomEngine* rndm,
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
inline void
|
||||
G4UniversalFluctuation::SampleGauss(CLHEP::HepRandomEngine* rndm,
|
||||
G4double eav, G4double esig2,
|
||||
const G4double eav, const G4double esig2,
|
||||
G4double& eloss)
|
||||
{
|
||||
G4double x = eav;
|
||||
@@ -154,5 +160,7 @@ G4UniversalFluctuation::SampleGauss(CLHEP::HepRandomEngine* rndm,
|
||||
eloss += x;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4UrbanFluctuation
|
||||
//
|
||||
// Author: V.Ivanchenko make a class with the Laszlo Urban model
|
||||
//
|
||||
// Creation date: 14.02.2022
|
||||
//
|
||||
// Modifications:
|
||||
//
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// Implementation of energy loss fluctuations made by L.Urban for
|
||||
// Geant4 10.X series for updated design of 11.X by V.Ivanchenko
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
|
||||
#ifndef G4UrbanFluctuation_h
|
||||
#define G4UrbanFluctuation_h 1
|
||||
|
||||
#include "G4UniversalFluctuation.hh"
|
||||
|
||||
class G4UrbanFluctuation : public G4UniversalFluctuation
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
explicit G4UrbanFluctuation(const G4String& nam = "UrbanFluc");
|
||||
|
||||
~G4UrbanFluctuation() override;
|
||||
|
||||
// hide assignment operator
|
||||
G4UrbanFluctuation & operator =
|
||||
(const G4UrbanFluctuation &right) = delete;
|
||||
G4UrbanFluctuation(const G4UrbanFluctuation&) = delete;
|
||||
|
||||
protected:
|
||||
|
||||
G4double SampleGlandz(CLHEP::HepRandomEngine* rndm,
|
||||
const G4Material*, const G4double tcut) override;
|
||||
|
||||
private:
|
||||
|
||||
// material properties
|
||||
const G4Material* lastMaterial = nullptr;
|
||||
G4double f1Fluct = 0.0;
|
||||
G4double f2Fluct = 0.0;
|
||||
G4double e1Fluct = 0.0;
|
||||
G4double e2Fluct = 0.0;
|
||||
G4double e1LogFluct = 0.0;
|
||||
G4double e2LogFluct = 0.0;
|
||||
G4double esmall = 0.0;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -186,14 +186,14 @@ private:
|
||||
static std::vector<mscData*> msc;
|
||||
|
||||
// index of G4MaterialCutsCouple
|
||||
G4int idx;
|
||||
G4int idx;
|
||||
|
||||
G4bool firstStep;
|
||||
G4bool insideskin;
|
||||
|
||||
G4bool latDisplasmentbackup;
|
||||
G4bool dispAlg96;
|
||||
G4bool firstStep;
|
||||
G4bool insideskin;
|
||||
|
||||
G4bool latDisplasmentbackup;
|
||||
G4bool dispAlg96;
|
||||
G4bool isFirstInstance = false;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -34,6 +34,7 @@ geant4_add_module(G4emstandard
|
||||
G4KleinNishinaModel.hh
|
||||
G4LindhardSorensenData.hh
|
||||
G4LindhardSorensenIonModel.hh
|
||||
G4LossFluctuationDummy.hh
|
||||
G4ModifiedTsai.hh
|
||||
G4MollerBhabhaModel.hh
|
||||
G4MottData.hh
|
||||
@@ -54,6 +55,7 @@ geant4_add_module(G4emstandard
|
||||
G4ScreeningMottCrossSection.hh
|
||||
G4SeltzerBergerModel.hh
|
||||
G4UniversalFluctuation.hh
|
||||
G4UrbanFluctuation.hh
|
||||
G4UrbanMscModel.hh
|
||||
G4WaterStopping.hh
|
||||
G4WentzelOKandVIxSection.hh
|
||||
@@ -111,6 +113,7 @@ geant4_add_module(G4emstandard
|
||||
G4KleinNishinaModel.cc
|
||||
G4LindhardSorensenData.cc
|
||||
G4LindhardSorensenIonModel.cc
|
||||
G4LossFluctuationDummy.cc
|
||||
G4ModifiedTsai.cc
|
||||
G4MollerBhabhaModel.cc
|
||||
G4NuclearStopping.cc
|
||||
@@ -129,6 +132,7 @@ geant4_add_module(G4emstandard
|
||||
G4ScreeningMottCrossSection.cc
|
||||
G4SeltzerBergerModel.cc
|
||||
G4UniversalFluctuation.cc
|
||||
G4UrbanFluctuation.cc
|
||||
G4UrbanMscModel.cc
|
||||
G4WaterStopping.cc
|
||||
G4WentzelOKandVIxSection.cc
|
||||
|
||||
@@ -97,7 +97,11 @@ void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition* p)
|
||||
|
||||
// restricted or non-restricted cross section table
|
||||
G4bool yes = false;
|
||||
if(theta == CLHEP::pi) { yes = true; }
|
||||
if(theta == CLHEP::pi) {
|
||||
yes = true;
|
||||
// for restriced single scattering change cross section shape
|
||||
SetCrossSectionType(fEmIncreasing);
|
||||
}
|
||||
SetStartFromNullFlag(yes);
|
||||
/*
|
||||
G4cout << "### G4CoulombScattering::InitialiseProcess: "
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4LossFluctuationDummy
|
||||
//
|
||||
// Author: V. Ivanchenko
|
||||
//
|
||||
// Creation date: 14.02.2022
|
||||
//
|
||||
// Modifications:
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4LossFluctuationDummy.hh"
|
||||
#include "G4MaterialCutsCouple.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4LossFluctuationDummy::G4LossFluctuationDummy(const G4String& nam)
|
||||
: G4VEmFluctuationModel(nam)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4LossFluctuationDummy::~G4LossFluctuationDummy()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double
|
||||
G4LossFluctuationDummy::SampleFluctuations(const G4MaterialCutsCouple*,
|
||||
const G4DynamicParticle*,
|
||||
const G4double,
|
||||
const G4double,
|
||||
const G4double,
|
||||
const G4double averageLoss)
|
||||
{
|
||||
return averageLoss;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
G4double G4LossFluctuationDummy::Dispersion(const G4Material*,
|
||||
const G4DynamicParticle*,
|
||||
const G4double, const G4double,
|
||||
const G4double)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void
|
||||
G4LossFluctuationDummy::SetParticleAndCharge(const G4ParticleDefinition*,
|
||||
G4double)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -47,13 +47,11 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Poisson.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4MaterialCutsCouple.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Log.hh"
|
||||
#include "G4Exp.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -104,7 +102,7 @@ G4UniversalFluctuation::SampleFluctuations(const G4MaterialCutsCouple* couple,
|
||||
// (out of validity of the model)
|
||||
//
|
||||
if (averageLoss < minLoss) { return averageLoss; }
|
||||
G4double meanLoss = averageLoss;
|
||||
meanLoss = averageLoss;
|
||||
const G4double tkin = dp->GetKineticEnergy();
|
||||
//G4cout<< "Emean= "<< meanLoss<< " tmax= "<< tmax<< " L= "<<length<<G4endl;
|
||||
|
||||
@@ -151,38 +149,39 @@ G4UniversalFluctuation::SampleFluctuations(const G4MaterialCutsCouple* couple,
|
||||
return loss;
|
||||
}
|
||||
|
||||
// Glandz regime : initialisation
|
||||
//
|
||||
if (material != lastMaterial) {
|
||||
ipotFluct = material->GetIonisation()->GetMeanExcitationEnergy();
|
||||
ipotLogFluct = material->GetIonisation()->GetLogMeanExcEnergy();
|
||||
e0 = material->GetIonisation()->GetEnergy0fluct();
|
||||
lastMaterial = material;
|
||||
}
|
||||
auto ioni = material->GetIonisation();
|
||||
e0 = ioni->GetEnergy0fluct();
|
||||
|
||||
// very small step or low-density material
|
||||
if(tcut <= e0) { return meanLoss; }
|
||||
|
||||
ipotFluct = ioni->GetMeanExcitationEnergy();
|
||||
ipotLogFluct = ioni->GetLogMeanExcEnergy();
|
||||
|
||||
// width correction for small cuts
|
||||
const G4double scaling = std::min(1.+0.5*CLHEP::keV/tcut,1.50);
|
||||
const G4double scaling = std::min(1.+0.5*CLHEP::keV/tcut, 1.50);
|
||||
meanLoss /= scaling;
|
||||
|
||||
w2 = (tcut > ipotFluct) ?
|
||||
G4Log(2.*CLHEP::electron_mass_c2*beta2*gam2)-beta2 : 0.0;
|
||||
return SampleGlandz(rndmEngineF, material, tcut)*scaling;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double
|
||||
G4UniversalFluctuation::SampleGlandz(CLHEP::HepRandomEngine* rndmEngineF,
|
||||
const G4Material*,
|
||||
const G4double tcut)
|
||||
{
|
||||
G4double a1(0.0), a3(0.0);
|
||||
|
||||
loss = 0.0;
|
||||
G4double loss = 0.0;
|
||||
G4double e1 = ipotFluct;
|
||||
|
||||
e1 = ipotFluct;
|
||||
|
||||
if(tcut > ipotFluct) {
|
||||
const G4double w2 = G4Log(2.*CLHEP::electron_mass_c2*beta2*gam2)-beta2;
|
||||
if(w2 > ipotLogFluct) {
|
||||
const G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
|
||||
a1 = C*(w2-ipotLogFluct)/ipotFluct;
|
||||
} else {
|
||||
a1 = meanLoss*(1.-rate)/e1;
|
||||
}
|
||||
if(tcut > e1) {
|
||||
a1 = meanLoss*(1.-rate)/e1;
|
||||
if(a1 < a0) {
|
||||
const G4double fwnow = fw*a1/a0;
|
||||
const G4double fwnow = 0.1+(fw-0.1)*std::sqrt(a1/a0);
|
||||
a1 /= fwnow;
|
||||
e1 *= fwnow;
|
||||
} else {
|
||||
@@ -192,12 +191,9 @@ G4UniversalFluctuation::SampleFluctuations(const G4MaterialCutsCouple* couple,
|
||||
}
|
||||
|
||||
const G4double w1 = tcut/e0;
|
||||
if(tcut > e0) {
|
||||
a3 = rate*meanLoss*(tcut-e0)/(e0*tcut*G4Log(w1));
|
||||
if(a1 <= 0.) {
|
||||
a3 /= rate;
|
||||
}
|
||||
}
|
||||
a3 = rate*meanLoss*(tcut - e0)/(e0*tcut*G4Log(w1));
|
||||
if(a1 <= 0.) { a3 /= rate; }
|
||||
|
||||
//'nearly' Gaussian fluctuation if a1>nmaxCont&&a2>nmaxCont&&a3>nmaxCont
|
||||
G4double emean = 0.;
|
||||
G4double sig2e = 0.;
|
||||
@@ -219,12 +215,12 @@ G4UniversalFluctuation::SampleFluctuations(const G4MaterialCutsCouple* couple,
|
||||
const G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
|
||||
emean += namean*e0*alfa1;
|
||||
sig2e += e0*e0*namean*(alfa-alfa1*alfa1);
|
||||
p3 = a3-namean;
|
||||
p3 = a3 - namean;
|
||||
}
|
||||
|
||||
const G4double w2 = alfa*e0;
|
||||
if(tcut > w2) {
|
||||
const G4double w = (tcut-w2)/tcut;
|
||||
const G4double w3 = alfa*e0;
|
||||
if(tcut > w3) {
|
||||
const G4double w = (tcut-w3)/tcut;
|
||||
const G4int nnb = G4Poisson(p3);
|
||||
if(nnb > 0) {
|
||||
if(nnb > sizearray) {
|
||||
@@ -233,13 +229,13 @@ G4UniversalFluctuation::SampleFluctuations(const G4MaterialCutsCouple* couple,
|
||||
rndmarray = new G4double[nnb];
|
||||
}
|
||||
rndmEngineF->flatArray(nnb, rndmarray);
|
||||
for (G4int k=0; k<nnb; ++k) { loss += w2/(1.-w*rndmarray[k]); }
|
||||
for (G4int k=0; k<nnb; ++k) { loss += w3/(1.-w*rndmarray[k]); }
|
||||
}
|
||||
}
|
||||
if(sig2e > 0.0) { SampleGauss(rndmEngineF, emean, sig2e, loss); }
|
||||
}
|
||||
//G4cout << "### loss=" << loss << " scaling=" << scaling << G4endl;
|
||||
return loss*scaling;
|
||||
//G4cout << "### loss=" << loss << G4endl;
|
||||
return loss;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4UrbanFluctuation
|
||||
//
|
||||
// Author: V. Ivanchenko for Laszlo Urban
|
||||
//
|
||||
// Creation date: 14.02.2022
|
||||
//
|
||||
// Modifications:
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4UrbanFluctuation.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Poisson.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Log.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4UrbanFluctuation::G4UrbanFluctuation(const G4String& nam)
|
||||
: G4UniversalFluctuation(nam)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4UrbanFluctuation::~G4UrbanFluctuation()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4UrbanFluctuation::SampleGlandz(CLHEP::HepRandomEngine* rndmEngineF,
|
||||
const G4Material* material,
|
||||
const G4double tcut)
|
||||
{
|
||||
if (material != lastMaterial) {
|
||||
auto ioni = material->GetIonisation();
|
||||
f1Fluct = ioni->GetF1fluct();
|
||||
f2Fluct = ioni->GetF2fluct();
|
||||
e1Fluct = ioni->GetEnergy1fluct();
|
||||
e2Fluct = ioni->GetEnergy2fluct();
|
||||
e1LogFluct = ioni->GetLogEnergy1fluct();
|
||||
e2LogFluct = ioni->GetLogEnergy2fluct();
|
||||
esmall = 0.5*std::sqrt(e0*ipotFluct);
|
||||
lastMaterial = material;
|
||||
}
|
||||
|
||||
G4double a1(0.0), a2(0.0), a3(0.0);
|
||||
G4double loss = 0.0;
|
||||
G4double e1 = e1Fluct;
|
||||
G4double e2 = e2Fluct;
|
||||
|
||||
if(tcut > ipotFluct) {
|
||||
if(w2 > ipotLogFluct) {
|
||||
if(w2 > e2LogFluct) {
|
||||
const G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
|
||||
a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
|
||||
a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
|
||||
} else {
|
||||
a1 = meanLoss*(1.-rate)/e1;
|
||||
}
|
||||
if(a1 < a0) {
|
||||
const G4double fwnow = 0.5+(fw-0.5)*std::sqrt(a1/a0);
|
||||
a1 /= fwnow;
|
||||
e1 *= fwnow;
|
||||
} else {
|
||||
a1 /= fw;
|
||||
e1 *= fw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const G4double w1 = tcut/e0;
|
||||
a3 = rate*meanLoss*(tcut-e0)/(e0*tcut*G4Log(w1));
|
||||
if(a1+a2 <= 0.) { a3 /= rate; }
|
||||
|
||||
//'nearly' Gaussian fluctuation if a1>nmaxCont&&a2>nmaxCont&&a3>nmaxCont
|
||||
G4double emean = 0.;
|
||||
G4double sig2e = 0.;
|
||||
|
||||
// excitation of type 1
|
||||
if(a1 > 0.0) { AddExcitation(rndmEngineF, a1, e1, emean, loss, sig2e); }
|
||||
|
||||
// excitation of type 2
|
||||
if(a2 > 0.0) { AddExcitation(rndmEngineF, a2, e2, emean, loss, sig2e); }
|
||||
|
||||
if(sig2e > 0.0) { SampleGauss(rndmEngineF, emean, sig2e, loss); }
|
||||
|
||||
// ionisation
|
||||
if(a3 > 0.) {
|
||||
emean = 0.;
|
||||
sig2e = 0.;
|
||||
G4double p3 = a3;
|
||||
G4double alfa = 1.;
|
||||
if(a3 > nmaxCont) {
|
||||
alfa = w1*(nmaxCont+a3)/(w1*nmaxCont+a3);
|
||||
const G4double alfa1 = alfa*G4Log(alfa)/(alfa-1.);
|
||||
const G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
|
||||
emean += namean*e0*alfa1;
|
||||
sig2e += e0*e0*namean*(alfa-alfa1*alfa1);
|
||||
p3 -= namean;
|
||||
}
|
||||
|
||||
const G4double w3 = alfa*e0;
|
||||
if(tcut > w3) {
|
||||
const G4double w = (tcut-w3)/tcut;
|
||||
const G4int nnb = G4Poisson(p3);
|
||||
if(nnb > 0) {
|
||||
if(nnb > sizearray) {
|
||||
sizearray = nnb;
|
||||
delete [] rndmarray;
|
||||
rndmarray = new G4double[nnb];
|
||||
}
|
||||
rndmEngineF->flatArray(nnb, rndmarray);
|
||||
for (G4int k=0; k<nnb; ++k) { loss += w3/(1.-w*rndmarray[k]); }
|
||||
}
|
||||
}
|
||||
if(sig2e > 0.0) { SampleGauss(rndmEngineF, emean, sig2e, loss); }
|
||||
}
|
||||
//G4cout << "### loss=" << loss << G4endl;
|
||||
return loss;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -70,11 +70,17 @@
|
||||
#include "globals.hh"
|
||||
#include "G4Log.hh"
|
||||
#include "G4Exp.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4UrbanMscModel::mscData*> G4UrbanMscModel::msc;
|
||||
|
||||
namespace
|
||||
{
|
||||
G4Mutex theUrbanMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4UrbanMscModel::G4UrbanMscModel(const G4String& nam)
|
||||
@@ -135,7 +141,7 @@ G4UrbanMscModel::G4UrbanMscModel(const G4String& nam)
|
||||
|
||||
G4UrbanMscModel::~G4UrbanMscModel()
|
||||
{
|
||||
if(IsMaster()) {
|
||||
if(isFirstInstance) {
|
||||
for(auto & ptr : msc) { delete ptr; }
|
||||
msc.clear();
|
||||
}
|
||||
@@ -153,7 +159,19 @@ void G4UrbanMscModel::Initialise(const G4ParticleDefinition* p,
|
||||
|
||||
latDisplasmentbackup = latDisplasment;
|
||||
dispAlg96 = (G4EmParameters::Instance()->LateralDisplacementAlg96());
|
||||
if(IsMaster() || msc.size() == 0) { InitialiseModelCache(); }
|
||||
|
||||
// initialise cache only once
|
||||
if(0 == msc.size()) {
|
||||
G4AutoLock l(&theUrbanMutex);
|
||||
if(0 == msc.size()) {
|
||||
isFirstInstance = true;
|
||||
msc.resize(1, nullptr);
|
||||
}
|
||||
l.unlock();
|
||||
}
|
||||
// initialise cache for each new run
|
||||
if(isFirstInstance) { InitialiseModelCache(); }
|
||||
|
||||
/*
|
||||
G4cout << "### G4UrbanMscModel::Initialise done for "
|
||||
<< p->GetParticleName() << " type= " << steppingAlgorithm << G4endl;
|
||||
@@ -788,8 +806,9 @@ G4double G4UrbanMscModel::ComputeTrueStepLength(G4double geomStepLength)
|
||||
if(par1 < 0.) {
|
||||
tlength = -lambda0*G4Log(1.-geomStepLength/lambda0) ;
|
||||
} else {
|
||||
if(par1*par3*geomStepLength < 1.) {
|
||||
tlength = (1.-G4Exp(G4Log(1.-par1*par3*geomStepLength)/par3))/par1 ;
|
||||
const G4double par4 = par1*par3;
|
||||
if(par4*geomStepLength < 1.) {
|
||||
tlength = (1.-G4Exp(G4Log(1.-par4*geomStepLength)/par3))/par1;
|
||||
} else {
|
||||
tlength = currentRange;
|
||||
}
|
||||
@@ -1214,14 +1233,14 @@ void G4UrbanMscModel::InitialiseModelCache()
|
||||
// of a new G4MaterialCutsCouple is possible
|
||||
auto theCoupleTable = G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
if(numOfCouples != msc.size()) { msc.resize(numOfCouples); }
|
||||
if(numOfCouples != msc.size()) { msc.resize(numOfCouples, nullptr); }
|
||||
|
||||
for(size_t j=0; j<numOfCouples; ++j) {
|
||||
auto aCouple = theCoupleTable->GetMaterialCutsCouple(j);
|
||||
|
||||
// cut may be changed before runs
|
||||
G4double cut = aCouple->GetProductionCuts()->GetProductionCut(1);
|
||||
if(msc[j]) {
|
||||
if(nullptr != msc[j]) {
|
||||
msc[j]->ecut = cut;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user