Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -36,6 +36,13 @@
|
||||
// Creation date: 02.08.2004
|
||||
//
|
||||
// Modified by Michel Maire, Vladimir Ivanchenko and Daren Sawkey
|
||||
//
|
||||
// Introduced Quantum Entanglement April 2021 John Allison
|
||||
// This is activated by /process/em/QuantumEntanglement
|
||||
// For e+e- -> gamma gamma, the gammas are "tagged" here
|
||||
// and must be "analysed" in a Compton scattering process - see, for
|
||||
// example, G4LivermorePolarizedComptonModel. Otherwise entanglement
|
||||
// has no effect even if activated.
|
||||
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
@@ -47,25 +54,31 @@
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4MaterialCutsCouple.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4eeToTwoGammaModel.hh"
|
||||
#include "G4EmBiasingManager.hh"
|
||||
#include "G4EntanglementAuxInfo.hh"
|
||||
#include "G4eplusAnnihilationEntanglementClipBoard.hh"
|
||||
#include "G4EmParameters.hh"
|
||||
#include "G4PhysicsModelCatalog.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
using namespace std;
|
||||
|
||||
G4eplusAnnihilation::G4eplusAnnihilation(const G4String& name)
|
||||
: G4VEmProcess(name), isInitialised(false)
|
||||
: G4VEmProcess(name)
|
||||
{
|
||||
theGamma = G4Gamma::Gamma();
|
||||
SetIntegral(true);
|
||||
theElectron = G4Electron::Electron();
|
||||
SetCrossSectionType(fEmDecreasing);
|
||||
SetBuildTableFlag(false);
|
||||
SetStartFromNullFlag(false);
|
||||
SetSecondaryParticle(theGamma);
|
||||
SetProcessSubType(fAnnihilation);
|
||||
enableAtRestDoIt = true;
|
||||
mainSecondaries = 2;
|
||||
fEntanglementModelIndex =
|
||||
G4PhysicsModelCatalog::Register("G4GammaGammaEntanglement");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -95,7 +108,7 @@ void G4eplusAnnihilation::InitialiseProcess(const G4ParticleDefinition*)
|
||||
{
|
||||
if(!isInitialised) {
|
||||
isInitialised = true;
|
||||
if(!EmModel(0)) { SetEmModel(new G4eeToTwoGammaModel()); }
|
||||
if(nullptr == EmModel(0)) { SetEmModel(new G4eeToTwoGammaModel()); }
|
||||
EmModel(0)->SetLowEnergyLimit(MinKinEnergy());
|
||||
EmModel(0)->SetHighEnergyLimit(MaxKinEnergy());
|
||||
AddEmModel(1, EmModel(0));
|
||||
@@ -128,7 +141,7 @@ G4VParticleChange* G4eplusAnnihilation::AtRestDoIt(const G4Track& track,
|
||||
G4double gammaCut = GetGammaEnergyCut();
|
||||
model->SampleSecondaries(&secParticles, MaterialCutsCouple(),
|
||||
track.GetDynamicParticle(), gammaCut);
|
||||
|
||||
|
||||
G4int num0 = secParticles.size();
|
||||
|
||||
// splitting or Russian roulette
|
||||
@@ -144,8 +157,37 @@ G4VParticleChange* G4eplusAnnihilation::AtRestDoIt(const G4Track& track,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// save secondaries
|
||||
G4int num = secParticles.size();
|
||||
|
||||
// Check that entanglement is switched on... (the following flag is
|
||||
// set by /process/em/QuantumEntanglement).
|
||||
G4bool entangled = G4EmParameters::Instance()->QuantumEntanglement();
|
||||
// ...and that we have two gammas with both gammas' energies above
|
||||
// gammaCut (entanglement is only programmed for e+ e- -> gamma gamma).
|
||||
G4bool entangledgammagamma = false;
|
||||
if (entangled) {
|
||||
if (num == 2) {
|
||||
entangledgammagamma = true;
|
||||
for (const auto* p: secParticles) {
|
||||
if (p->GetDefinition() != theGamma ||
|
||||
p->GetKineticEnergy() < gammaCut) {
|
||||
entangledgammagamma = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare a shared pointer for psossible use below. If it is used, the
|
||||
// shared pointer is copied into the tracks through G4EntanglementAuxInfo.
|
||||
// This ensures the clip board lasts until both tracks are destroyed.
|
||||
std::shared_ptr<G4eplusAnnihilationEntanglementClipBoard> clipBoard;
|
||||
if (entangledgammagamma) {
|
||||
clipBoard = std::make_shared<G4eplusAnnihilationEntanglementClipBoard>();
|
||||
clipBoard->SetParentParticleDefinition(track.GetDefinition());
|
||||
}
|
||||
|
||||
if(num > 0) {
|
||||
|
||||
fParticleChange.SetNumberOfSecondaries(num);
|
||||
@@ -169,6 +211,17 @@ G4VParticleChange* G4eplusAnnihilation::AtRestDoIt(const G4Track& track,
|
||||
if (good) {
|
||||
G4Track* t = new G4Track(dp, time, track.GetPosition());
|
||||
t->SetTouchableHandle(track.GetTouchableHandle());
|
||||
if (entangledgammagamma) {
|
||||
// entangledgammagamma is only true when there are only two gammas
|
||||
// (See code above where entangledgammagamma is calculated.)
|
||||
if (i == 0) { // First gamma
|
||||
clipBoard->SetTrackA(t);
|
||||
} else if (i == 1) { // Second gamma
|
||||
clipBoard->SetTrackB(t);
|
||||
}
|
||||
t->SetAuxiliaryTrackInformation
|
||||
(fEntanglementModelIndex,new G4EntanglementAuxInfo(clipBoard));
|
||||
}
|
||||
if (biasManager) {
|
||||
t->SetWeight(weight * biasManager->GetWeight(i));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user