Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -27,14 +27,17 @@
// Larry Felawka (TRIUMF), April 1998
//---------------------------------------------------------------------
#include "G4AntiNeutronAnnihilationAtRest.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "G4HadronicProcessStore.hh"
#include "Randomize.hh"
#include <string.h>
#include <cmath>
#include <stdio.h>
#include "G4AntiNeutronAnnihilationAtRest.hh"
#include "G4SystemOfUnits.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "G4HadronicProcessStore.hh"
#include "G4HadronicDeprecate.hh"
#include "Randomize.hh"
#define MAX_SECONDARIES 100
@@ -60,6 +63,7 @@ G4AntiNeutronAnnihilationAtRest::G4AntiNeutronAnnihilationAtRest(const G4String&
pdefTriton(G4Triton::Triton()),
pdefAlpha(G4Alpha::Alpha())
{
G4HadronicDeprecate("G4AntiNeutronAnnihilationAtRest");
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
@@ -301,7 +305,7 @@ void G4AntiNeutronAnnihilationAtRest::Poisso(G4float xav, G4int *iran)
{
static G4int i;
static G4float r, p1, p2, p3;
static G4int mm;
static G4int fivex;
static G4float rr, ran, rrr, ran1;
// *** GENERATION OF POISSON DISTRIBUTION ***
@@ -319,14 +323,14 @@ void G4AntiNeutronAnnihilationAtRest::Poisso(G4float xav, G4int *iran)
}
}
else {
mm = G4int(xav * G4float(5.));
fivex = G4int(xav * G4float(5.));
*iran = 0;
if (mm > 0) {
if (fivex > 0) {
r = std::exp(-G4double(xav));
ran1 = G4UniformRand();
if (ran1 > r) {
rr = r;
for (i = 1; i <= mm; ++i) {
for (i = 1; i <= fivex; ++i) {
++(*iran);
if (i <= 5) {
rrr = std::pow(xav, G4float(i)) / NFac(i);
@@ -376,18 +380,18 @@ G4int G4AntiNeutronAnnihilationAtRest::NFac(G4int n)
{
G4int ret_val;
static G4int i, m;
static G4int i, j;
// *** NVE 16-MAR-1988 CERN GENEVA ***
// ORIGIN : H.FESEFELDT (27-OCT-1983)
ret_val = 1;
m = n;
if (m > 1) {
if (m > 10) {
m = 10;
j = n;
if (j > 1) {
if (j > 10) {
j = 10;
}
for (i = 2; i <= m; ++i) {
for (i = 2; i <= j; ++i) {
ret_val *= i;
}
}
@@ -27,14 +27,17 @@
// Larry Felawka (TRIUMF), April 1998
//---------------------------------------------------------------------
#include <string.h>
#include <cmath>
#include <stdio.h>
#include "G4AntiProtonAnnihilationAtRest.hh"
#include "G4SystemOfUnits.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "Randomize.hh"
#include "G4HadronicProcessStore.hh"
#include <string.h>
#include <cmath>
#include <stdio.h>
#include "G4HadronicDeprecate.hh"
#define MAX_SECONDARIES 100
@@ -60,6 +63,7 @@ G4AntiProtonAnnihilationAtRest::G4AntiProtonAnnihilationAtRest(const G4String& p
pdefTriton(G4Triton::Triton()),
pdefAlpha(G4Alpha::Alpha())
{
G4HadronicDeprecate("G4AntiProtonAnnihilationAtRest");
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
@@ -299,7 +303,7 @@ void G4AntiProtonAnnihilationAtRest::Poisso(G4float xav, G4int *iran)
{
static G4int i;
static G4float r, p1, p2, p3;
static G4int mm;
static G4int fivex;
static G4float rr, ran, rrr, ran1;
// *** GENERATION OF POISSON DISTRIBUTION ***
@@ -317,14 +321,14 @@ void G4AntiProtonAnnihilationAtRest::Poisso(G4float xav, G4int *iran)
}
}
else {
mm = G4int(xav * G4float(5.));
fivex = G4int(xav * G4float(5.));
*iran = 0;
if (mm > 0) {
if (fivex > 0) {
r = std::exp(-G4double(xav));
ran1 = G4UniformRand();
if (ran1 > r) {
rr = r;
for (i = 1; i <= mm; ++i) {
for (i = 1; i <= fivex; ++i) {
++(*iran);
if (i <= 5) {
rrr = std::pow(xav, G4float(i)) / NFac(i);
@@ -374,18 +378,18 @@ G4int G4AntiProtonAnnihilationAtRest::NFac(G4int n)
{
G4int ret_val;
static G4int i, m;
static G4int i, j;
// *** NVE 16-MAR-1988 CERN GENEVA ***
// ORIGIN : H.FESEFELDT (27-OCT-1983)
ret_val = 1;
m = n;
if (m > 1) {
if (m > 10) {
m = 10;
j = n;
if (j > 1) {
if (j > 10) {
j = 10;
}
for (i = 2; i <= m; ++i) {
for (i = 2; i <= j; ++i) {
ret_val *= i;
}
}
@@ -33,6 +33,7 @@
#include "globals.hh"
#include "G4DistributionGenerator.hh"
#include "G4HadronicDeprecate.hh"
#include "G4ios.hh"
#include <assert.h>
@@ -42,6 +43,7 @@ G4DistributionGenerator::G4DistributionGenerator(std::vector<G4double>& x,
std::vector<G4double>& values)
{
G4HadronicDeprecate("G4DistributionGenerator");
_x = x;
// Check boundaries: must be size(x) = size(values) + 1
@@ -0,0 +1,125 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id$
//
// File: G4ElementSelector
//
// Author: V.Ivanchenko (Vladimir.Ivanchenko@cern.ch)
//
// Creation date: 2 April 2000
//
// Modifications:
// 18/08/2000 V.Ivanchenko Update description
// 17/05/2006 V.Ivanchenko Cleanup
// 02/10/2007 V.Ivanchenko Fixed typo in computation of Lambda-factor
// proposed by Victor Pec
//
//---------------------------------------------------------------------
#include "G4ElementSelector.hh"
#include "Randomize.hh"
#include "G4Material.hh"
#include "G4Nucleus.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ElementSelector::G4ElementSelector()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ElementSelector::~G4ElementSelector()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4Element*
G4ElementSelector::SelectZandA(const G4Track& track, G4Nucleus* target)
{
// Fermi-Teller Z-low of mu- capture and exceptions
// for halogens and oxigen.
// N.C.Mukhopadhyay Phys. Rep. 30 (1977) 1.
size_t i = 0;
const G4Material* mat = track.GetMaterial();
size_t numberOfElements = mat->GetNumberOfElements();
const G4ElementVector* theElementVector = mat->GetElementVector();
if(1 < numberOfElements) {
if(numberOfElements > prob.size()) { prob.resize(numberOfElements, 0.0); }
const G4double* theAtomNumDensity = mat->GetAtomicNumDensityVector();
G4double sum = 0.0;
for (i=0; i < numberOfElements; ++i) {
G4int Z = G4lrint((*theElementVector)[i]->GetZ());
// Halogens
if( (9 == Z) || (17 == Z) || (35 == Z) || (53 == Z) || (85 == Z) ) {
sum += 0.66 * Z * theAtomNumDensity[i];
// Oxigen
} else if( 8 == Z ) {
sum += 0.56 * Z * theAtomNumDensity[i];
// Others
} else {
sum += Z * theAtomNumDensity[i];
}
prob[i] = sum;
}
sum *= G4UniformRand();
for (i=0; i < numberOfElements; ++i) {
if(sum <= prob[i]) { break; }
}
}
G4Element* elm = (*theElementVector)[i];
G4int Z = G4lrint(elm->GetZ());
// select isotope
const G4IsotopeVector* isv = elm->GetIsotopeVector();
size_t ni = isv->size();
i = 0;
if(1 < ni) {
const G4double* ab = elm->GetRelativeAbundanceVector();
G4double y = G4UniformRand();
for(i=0; i<ni; ++i) {
y -= ab[i];
if(y <= 0.0) { break; }
}
}
G4int A = elm->GetIsotope(i)->GetN();
target->SetParameters(A, Z);
return elm;
}
@@ -0,0 +1,179 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EmCaptureCascade
//
// Author: V.Ivanchenko (Vladimir.Ivantchenko@cern.ch)
//
// Creation date: 22 April 2012 on base of G4MuMinusCaptureCascade
//
//
//-----------------------------------------------------------------------------
//
// Modifications:
//
//-----------------------------------------------------------------------------
#include "G4EmCaptureCascade.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "G4MuonMinus.hh"
#include "G4Electron.hh"
#include "G4Gamma.hh"
#include "G4NucleiProperties.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmCaptureCascade::G4EmCaptureCascade()
: G4HadronicInteraction("emCaptureCascade")
{
theElectron = G4Electron::Electron();
theGamma = G4Gamma::Gamma();
fMuMass = G4MuonMinus::MuonMinus()->GetPDGMass();
fTime = 0.0;
// Calculate the Energy of K Mesoatom Level for this Element using
// the Energy of Hydrogen Atom taken into account finite size of the
// nucleus
const G4int nlevels = 28;
const G4int listK[nlevels] = {
1, 2, 4, 6, 8, 11, 14, 17, 18, 21, 24,
26, 29, 32, 38, 40, 41, 44, 49, 53, 55,
60, 65, 70, 75, 81, 85, 92};
const G4double listKEnergy[nlevels] = {
0.00275, 0.011, 0.043, 0.098, 0.173, 0.326,
0.524, 0.765, 0.853, 1.146, 1.472,
1.708, 2.081, 2.475, 3.323, 3.627,
3.779, 4.237, 5.016, 5.647, 5.966,
6.793, 7.602, 8.421, 9.249, 10.222,
10.923,11.984};
fKLevelEnergy[0] = 0.0;
fKLevelEnergy[1] = listKEnergy[0];
G4int idx = 1;
for(G4int i=1; i<nlevels; ++i) {
G4int z1 = listK[idx];
G4int z2 = listK[i];
if(z1+1 < z2) {
G4double dz = G4double(z2 - z1);
G4double y1 = listKEnergy[idx]/G4double(z1*z1);
G4double y2 = listKEnergy[i]/G4double(z2*z2);
for(G4int z=z1+1; z<z2; ++z) {
fKLevelEnergy[z] = (y1 + (y2 - y1)*(z - z1)/dz)*z*z;
}
}
fKLevelEnergy[z2] = listKEnergy[i];
idx = i;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmCaptureCascade::~G4EmCaptureCascade()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4HadFinalState*
G4EmCaptureCascade::ApplyYourself(const G4HadProjectile& projectile,
G4Nucleus& targetNucleus)
{
result.Clear();
result.SetStatusChange(isAlive);
fTime = projectile.GetGlobalTime();
G4int Z = targetNucleus.GetZ_asInt();
G4int A = targetNucleus.GetA_asInt();
G4double massA = G4NucleiProperties::GetNuclearMass(A, Z);
G4double mass = fMuMass * massA / (fMuMass + massA) ;
G4double e = 13.6 * eV * Z * Z * mass/ electron_mass_c2;
// precise corrections of energy only for K-shell
fLevelEnergy[0] = fKLevelEnergy[Z];
for( G4int i = 2; i < 15; ++i) {
fLevelEnergy[i-1] = e/G4double(i*i);
}
G4int nElec = G4int(Z);
G4int nAuger = 1;
G4int nLevel = 13;
G4double pGamma = Z*Z*Z*Z;
// Capture on 14-th level
G4double edep = fLevelEnergy[13];
AddNewParticle(theElectron,edep);
G4double deltaE;
// Emit new photon or electron
// Simplified model for probabilities
// N.C.Mukhopadhyay Phy. Rep. 30 (1977) 1.
do {
// case of Auger electrons
if((nAuger < nElec) && ((pGamma + 10000.0) * G4UniformRand() < 10000.0) ) {
++nAuger;
deltaE = fLevelEnergy[nLevel-1] - fLevelEnergy[nLevel];
--nLevel;
AddNewParticle(theElectron, deltaE);
} else {
// Case of photon cascade, probabilities from
// C.S.Wu and L.Wilets, Ann. Rev. Nuclear Sci. 19 (1969) 527.
G4double var = (10.0 + G4double(nLevel - 1) ) * G4UniformRand();
G4int iLevel = nLevel - 1 ;
if(var > 10.0) iLevel -= G4int(var-10.0) + 1;
if( iLevel < 0 ) iLevel = 0;
deltaE = fLevelEnergy[iLevel] - fLevelEnergy[nLevel];
nLevel = iLevel;
AddNewParticle(theGamma, deltaE);
}
edep += deltaE;
} while( nLevel > 0 );
result.SetLocalEnergyDeposit(edep);
return &result;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmCaptureCascade::ModelDescription(std::ostream& outFile) const
{
outFile << "Simulation of electromagnetic cascade from capture level"
<< " to K-shell of the mesonic atom\n."
<< "Probabilities of gamma and Auger transitions from\n"
<< " N.C.Mukhopadhyay Phys. Rep. 30 (1977) 1.\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,255 +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. *
// ********************************************************************
//---------------------------------------------------------------------------
//
// ClassName: G4FTFCaptureAtRest
//
// Author: Alberto Ribon
//
// Date: 18 October 2011
//
// Modified:
// 02 November 2011, A. Ribon : migration to the new exceptions.
//
//----------------------------------------------------------------------------
//
#include "G4FTFCaptureAtRest.hh"
#include "G4ParticleDefinition.hh"
#include "G4HadProjectile.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Nucleus.hh"
#include "G4HadFinalState.hh"
#include "G4NucleiProperties.hh"
#include "G4ProcessManager.hh"
#include "G4ExcitationHandler.hh"
#include "G4PreCompoundModel.hh"
#include "G4GeneratorPrecompoundInterface.hh"
#include "G4FTFModel.hh"
#include "G4LundStringFragmentation.hh"
#include "G4ExcitedStringDecay.hh"
#include "G4TheoFSGenerator.hh"
G4FTFCaptureAtRest::G4FTFCaptureAtRest( const G4String& processName )
: G4VRestProcess( processName, fHadronic ) {
// Create the FTFP final-state model.
// (We follow what it is done in the class G4FTFPAntiBarionBuilder
// except quasi-elastic which is not needed at rest.)
theMin = 0.0*GeV;
theMax = 100.0*TeV;
theModel = new G4TheoFSGenerator( "FTFP" );
theStringModel = new G4FTFModel;
theStringDecay = new G4ExcitedStringDecay( theLund = new G4LundStringFragmentation );
theStringModel->SetFragmentationModel( theStringDecay );
theCascade = new G4GeneratorPrecompoundInterface; // Not a cascade - goes straight to Preco
thePreEquilib = new G4PreCompoundModel( theHandler = new G4ExcitationHandler );
theCascade->SetDeExcitation( thePreEquilib );
theModel->SetHighEnergyGenerator( theStringModel );
theModel->SetTransport( theCascade );
theModel->SetMinEnergy( theMin );
theModel->SetMaxEnergy( 100*TeV );
}
G4FTFCaptureAtRest::~G4FTFCaptureAtRest() {
delete theCascade;
delete theStringDecay;
delete theStringModel;
delete theModel;
delete thePreEquilib;
delete theHandler;
delete theLund;
}
G4bool G4FTFCaptureAtRest::IsApplicable( const G4ParticleDefinition& particle ) {
// For the time being, we use Fritiof annihilation at rest only for
// anti-protons, but it could apply as well for anti-Sigma+ .
// For the other anti-baryons that Fritiof is able to annihilate on a
// nucleus, i.e. anti-neutron, anti-Lambda0, anti-Sigma-, anti-Sigma0,
// anti-Csi-, anti-Csi0, and anti-Omega-, they cannot have "at rest"
// capture in a nucleus because either they are neutrals and therefore
// never at rest, or they are positively charged and therefore cannot
// be captured in a nucleus.
if ( particle == *( G4AntiProton::AntiProton() ) ) return true;
return false;
}
G4VParticleChange* G4FTFCaptureAtRest::AtRestDoIt( const G4Track& track, const G4Step& step ) {
// Check applicability
if ( ! IsApplicable( *(track.GetDynamicParticle()->GetDefinition()) ) ) {
G4ExceptionDescription ed;
ed << "Error: particle is: " << track.GetDynamicParticle()->GetDefinition()->GetParticleName()
<< "\t ; it must be an anti-proton ! " << G4endl;
G4Exception( "G4FTFCaptureAtRest::AtRestDoIt()", "HAD_FTF_0000",
FatalException, ed );
return 0;
}
// Select the target nucleus
G4Material * material = track.GetMaterial();
G4Nucleus * targetNucleus = 0;
do {
targetNucleus = new G4Nucleus( material );
if ( targetNucleus->GetA_asInt() < 1 ) {
delete targetNucleus;
targetNucleus = 0;
}
} while ( targetNucleus == 0 );
G4int targetNucleusZ = targetNucleus->GetZ_asInt();
G4int targetNucleusA = targetNucleus->GetA_asInt();
//G4cout << " targetNucleus Z=" << targetNucleusZ << " A=" << targetNucleusA << G4endl;
// Prepare to call the interaction
G4HadProjectile projectile( track );
G4HadFinalState* result = 0;
G4int reentryCount = 0;
do {
try {
// Call the interaction
result = theModel->ApplyYourself( projectile, *targetNucleus );
++reentryCount;
}
catch( G4HadronicException aR ) {
DumpState( track, "G4FTFCaptureAtRest::AtRestDoIt()" );
G4ExceptionDescription ed;
ed << "Call for " << theModel->GetModelName() << G4endl
<< "Target nucleus Z=" << targetNucleusZ
<< " A=" << targetNucleusA;
G4Exception( "G4FTFCaptureAtRest::AtRestDoIt()", "HAD_FTF_0001",
FatalException, ed );
}
if ( reentryCount > 100 ) {
DumpState( track, "G4FTFCaptureAtRest::AtRestDoIt()" );
G4ExceptionDescription ed;
ed << "Reentering AtRestDoIt too often." << G4endl
<< "Call for " << theModel->GetModelName() << G4endl
<< "Target nucleus Z=" << targetNucleusZ
<< " A=" << targetNucleusA;
G4Exception( "G4FTFCaptureAtRest::AtRestDoIt()", "HAD_FTF_0002",
FatalException, ed );
}
} while ( !result );
// Transform from G4HadFinalState to G4ParticleChange .
// (We follow the (private) method G4HadronicProcess::FillResult
// used by the method G4HadronicProcess::PostStepDoIt .)
aParticleChange.Clear();
aParticleChange.Initialize( track );
aParticleChange.ProposeLocalEnergyDeposit( result->GetLocalEnergyDeposit() );
// Check status of primary: it should have been killed
if( result->GetStatusChange() == stopAndKill ) {
aParticleChange.ProposeTrackStatus( fStopAndKill );
aParticleChange.ProposeEnergy( 0.0 );
} else {
DumpState( track, "G4FTFCaptureAtRest::AtRestDoIt()" );
G4ExceptionDescription ed;
ed << "AtRestDoIt did not kill the absorbed particle." << G4endl
<< "Call for " << theModel->GetModelName() << G4endl
<< "Target nucleus Z=" << targetNucleusZ
<< " A=" << targetNucleusA;
G4Exception( "G4FTFCaptureAtRest::AtRestDoIt()", "HAD_FTF_0003",
FatalException, ed );
}
G4int nSec = result->GetNumberOfSecondaries();
//G4cout << "#### ParticleDebug : number of secondaries = " << nSec
// << " ; local energy deposit = " << result->GetLocalEnergyDeposit()
// << " MeV" << G4endl;
aParticleChange.SetNumberOfSecondaries( nSec );
G4LorentzVector final4mom;
if ( nSec > 0 ) {
G4double time0 = track.GetGlobalTime();
// Loop over the secondaries (which include the remnant nucleus)
for ( G4int i=0; i < nSec; i++ ) {
final4mom += result->GetSecondary(i)->GetParticle()->Get4Momentum();
G4double time = result->GetSecondary(i)->GetTime();
if ( time < time0) time = time0;
G4Track* secTrack = new G4Track( result->GetSecondary(i)->GetParticle(),
time, track.GetPosition() );
G4double newWeight = track.GetWeight() * result->GetSecondary(i)->GetWeight();
//G4cout << "#### ParticleDebug "
// << result->GetSecondary(i)->GetParticle()->GetDefinition()->GetParticleName()
// << " ; weight=" << result->GetSecondary(i)->GetWeight()
// << " ; 4-momentum=" << result->GetSecondary(i)->GetParticle()->Get4Momentum()
// << G4endl;
secTrack->SetWeight( newWeight );
secTrack->SetTouchableHandle( track.GetTouchableHandle() );
aParticleChange.AddSecondary( secTrack );
}
}
// Check energy-momentum conservation
G4LorentzVector projectile4mom = track.GetDynamicParticle()->Get4Momentum();
G4double targetMass = G4NucleiProperties::GetNuclearMass( targetNucleusA, targetNucleusZ );
G4LorentzVector target4mom( 0, 0, 0, targetMass ); // Neglect thermal motion
G4LorentzVector initial4mom = projectile4mom + target4mom;
G4LorentzVector diff = initial4mom - final4mom;
const G4double threshold = 1.0*MeV;
//G4cout << "===ANTI-PROTON CAPTURE AT REST=== : Ekin = "
// << ( projectile4mom.e() - projectile4mom.mag() ) / MeV << G4endl; // Debug
if ( std::abs( diff.e() ) > threshold ||
std::abs( diff.px() ) > threshold ||
std::abs( diff.py() ) > threshold ||
std::abs( diff.pz() ) > threshold ) {
//G4cout << "*** G4FTFCaptureAtRest::AtRestDoIt : 4-momentum non conservation "
// << diff << G4endl
// << " initial4mom = " << initial4mom << " ; final4mom = " << final4mom
// << G4endl;
}
result->Clear();
//return &aParticleChange; // This is not enough
return G4VRestProcess::AtRestDoIt( track, step );
}
void G4FTFCaptureAtRest::DumpState( const G4Track& aTrack , const G4String& method ) {
G4cout << "Unrecoverable error in method " << method << G4endl
<< "TrackID= " << aTrack.GetTrackID() << " ParentID= " << aTrack.GetParentID()
<< " " << aTrack.GetParticleDefinition()->GetParticleName() << G4endl
<< "Ekin(GeV)= " << aTrack.GetKineticEnergy()/CLHEP::GeV
<< "; direction= " << aTrack.GetMomentumDirection() << G4endl
<< "Position(mm)= " << aTrack.GetPosition()/CLHEP::mm << ";";
if ( aTrack.GetMaterial() ) G4cout << " material " << aTrack.GetMaterial()->GetName();
G4cout << G4endl;
if ( aTrack.GetVolume() )
G4cout << "PhysicalVolume <" << aTrack.GetVolume()->GetName() << ">" << G4endl;
}
@@ -0,0 +1,270 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id$
//
//---------------------------------------------------------------------
//
// GEANT4 Class
//
// File name: G4HadronStoppingProcess
//
// Author V.Ivanchenko 21 April 2012
//
//
// Class Description:
//
// Base process class for nuclear capture of negatively charged particles
//
// Modifications:
//
// 20120522 M. Kelsey -- Set enableAtRestDoIt flag for G4ProcessManager
// 20120914 M. Kelsey -- Pass subType in base ctor, remove enable flags
// 20121004 K. Genser -- use G4HadronicProcessType in the constructor
// 20121016 K. Genser -- Reverting to use one argument c'tor
//
//------------------------------------------------------------------------
#include "G4HadronStoppingProcess.hh"
#include "G4HadronicProcessStore.hh"
#include "G4HadronicProcessType.hh"
#include "G4EmCaptureCascade.hh"
#include "G4Nucleus.hh"
#include "G4HadFinalState.hh"
#include "G4HadProjectile.hh"
#include "G4HadSecondary.hh"
#include "G4Material.hh"
#include "G4Element.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4HadronStoppingProcess::G4HadronStoppingProcess(const G4String& name)
: G4HadronicProcess(name, fHadronAtRest)
{
// Modify G4VProcess flags to emulate G4VRest instead of G4VDiscrete
enableAtRestDoIt = true;
enablePostStepDoIt = false;
fElementSelector = new G4ElementSelector();
fEmCascade = new G4EmCaptureCascade(); // Owned by InteractionRegistry
fBoundDecay = 0;
G4HadronicProcessStore::Instance()->RegisterExtraProcess(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4HadronStoppingProcess::~G4HadronStoppingProcess()
{
G4HadronicProcessStore::Instance()->DeRegisterExtraProcess(this);
delete fElementSelector;
// NOTE: fEmCascade and fEmBoundDecay owned by registry, not locally
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4HadronStoppingProcess::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() < 0.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4HadronStoppingProcess::PreparePhysicsTable(const G4ParticleDefinition& p)
{
G4HadronicProcessStore::Instance()->RegisterParticleForExtraProcess(this, &p);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4HadronStoppingProcess::BuildPhysicsTable(const G4ParticleDefinition& p)
{
G4HadronicProcessStore::Instance()->PrintInfo(&p);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4HadronStoppingProcess::AtRestGetPhysicalInteractionLength(
const G4Track&, G4ForceCondition* condition)
{
*condition = NotForced;
return 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4HadronStoppingProcess::PostStepGetPhysicalInteractionLength(
const G4Track&, G4double, G4ForceCondition* condition)
{
*condition = NotForced;
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4HadronStoppingProcess::AtRestDoIt(const G4Track& track,
const G4Step&)
{
// if primary is not Alive then do nothing
theTotalResult->Initialize(track);
G4Nucleus* nucleus = GetTargetNucleusPointer();
G4Element* elm = fElementSelector->SelectZandA(track, nucleus);
G4HadFinalState* result = 0;
thePro.Initialise(track);
G4double time0 = track.GetGlobalTime();
G4bool nuclearCapture = true;
// Do the electromagnetic cascade in the nuclear field.
// EM cascade should keep G4HadFinalState object,
// because it will not be deleted at the end of this method
//
result = fEmCascade->ApplyYourself(thePro, *nucleus);
G4double ebound = result->GetLocalEnergyDeposit();
G4double edep = 0.0;
G4int nSecondaries = result->GetNumberOfSecondaries();
// Try decay from bound level
// For mu- the time of projectile should be changed.
// Decay should keep G4HadFinalState object,
// because it will not be deleted at the end of this method
//
thePro.SetBoundEnergy(ebound);
if(fBoundDecay) {
G4HadFinalState* resultDecay =
fBoundDecay->ApplyYourself(thePro, *nucleus);
G4int n = resultDecay->GetNumberOfSecondaries();
if(0 < n) {
nSecondaries += n;
result->AddSecondaries(resultDecay);
}
if(resultDecay->GetStatusChange() == stopAndKill) {
nuclearCapture = false;
}
resultDecay->Clear();
}
if(nuclearCapture) {
// select model
G4HadronicInteraction* model = 0;
try {
model = ChooseHadronicInteraction(0.0, track.GetMaterial(), elm);
}
catch(G4HadronicException & aE) {
G4ExceptionDescription ed;
ed << "Target element "<<elm->GetName()<<" Z= "
<< nucleus->GetZ_asInt() << " A= "
<< nucleus->GetA_asInt() << G4endl;
DumpState(track,"ChooseHadronicInteraction",ed);
ed << " No HadronicInteraction found out" << G4endl;
G4Exception("G4HadronStoppingProcess::AtRestDoIt", "had005",
FatalException, ed);
}
G4HadFinalState* resultNuc = 0;
G4int reentryCount = 0;
do {
// sample final state
// nuclear interaction should keep G4HadFinalState object
// model should define time of each secondary particle
try {
resultNuc = model->ApplyYourself(thePro, *nucleus);
++reentryCount;
}
catch(G4HadronicException aR) {
G4ExceptionDescription ed;
ed << "Call for " << model->GetModelName() << G4endl;
ed << "Target element "<<elm->GetName()<<" Z= "
<< nucleus->GetZ_asInt()
<< " A= " << nucleus->GetA_asInt() << G4endl;
DumpState(track,"ApplyYourself",ed);
ed << " ApplyYourself failed" << G4endl;
G4Exception("G4HadronStoppingProcess::AtRestDoIt", "had006",
FatalException, ed);
}
// Check the result for catastrophic energy non-conservation
resultNuc = CheckResult(thePro, *nucleus, resultNuc);
if(reentryCount>100) {
G4ExceptionDescription ed;
ed << "Call for " << model->GetModelName() << G4endl;
ed << "Target element "<<elm->GetName()<<" Z= "
<< nucleus->GetZ_asInt()
<< " A= " << nucleus->GetA_asInt() << G4endl;
DumpState(track,"ApplyYourself",ed);
ed << " ApplyYourself does not completed after 100 attempts" << G4endl;
G4Exception("G4HadronStoppingProcess::AtRestDoIt", "had006",
FatalException, ed);
}
}
while(!resultNuc);
edep = resultNuc->GetLocalEnergyDeposit();
nSecondaries += resultNuc->GetNumberOfSecondaries();
result->AddSecondaries(resultNuc);
resultNuc->Clear();
}
// Fill results
//
theTotalResult->ProposeTrackStatus(fStopAndKill);
theTotalResult->ProposeLocalEnergyDeposit(edep);
theTotalResult->SetNumberOfSecondaries(nSecondaries);
G4double w = track.GetWeight();
theTotalResult->ProposeWeight(w);
for(G4int i=0; i<nSecondaries; ++i) {
G4HadSecondary* sec = result->GetSecondary(i);
// add track global time to the reaction time
G4double time = sec->GetTime();
if(time < 0.0) { time = 0.0; }
time += time0;
// create secondary track
G4Track* t = new G4Track(sec->GetParticle(),
time,
track.GetPosition());
t->SetWeight(w*sec->GetWeight());
t->SetTouchableHandle(track.GetTouchableHandle());
theTotalResult->AddSecondary(t);
}
result->Clear();
if (epReportLevel != 0) {
CheckEnergyMomentumConservation(track, *nucleus);
}
return theTotalResult;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4HadronStoppingProcess::ProcessDescription(std::ostream& outFile) const
{
outFile << "Base process for negatively charged particle capture at rest.\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//---------------------------------------------------------------------
// Class Description:
//
// Intermediate class for hadronic absorption at rest using Bertini
// Physics lists should reference the concrete subclasses for pi-, K-, Sigma-
//
// 20120905 M. Kelsey -- Drop explicit list of "allowed" particles; Bertini
// can handle anything, or return no-interaction if not.
// 20121017 M. Kelsey -- Use Bertini's IsApplicable to check particle allowed
#include "G4HadronicAbsorptionBertini.hh"
#include "G4CascadeInterface.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include <iostream>
// Constructor
G4HadronicAbsorptionBertini::
G4HadronicAbsorptionBertini(G4ParticleDefinition* pdef)
: G4HadronStoppingProcess("hBertiniCaptureAtRest"), pdefApplicable(pdef) {
theCascade = new G4CascadeInterface;
theCascade->SetMinEnergy(0.); // Ensure it gets used at rest
theCascade->usePreCompoundDeexcitation();
RegisterMe(theCascade); // Transfers ownership
}
// Applies to constructor-specified particle, or to all known cases
G4bool G4HadronicAbsorptionBertini::IsApplicable(const G4ParticleDefinition& particle)
{
// Exclusive match (if registered for specific projectile
if (pdefApplicable) return (&particle == pdefApplicable);
// Any negative particles known to Bertini, excluding nuclei
return (G4HadronStoppingProcess::IsApplicable(particle) &&
particle.GetAtomicMass() <= 1 &&
theCascade->IsApplicable(&particle));
}
// Documentation of purpose
void
G4HadronicAbsorptionBertini::ProcessDescription(std::ostream& os) const {
os << "Stopping and absorption of charged hadrons (pi-, K-, Sigma-)\n"
<< "using Bertini-like intranuclear cascade.\n"
<< "Native PreCompound model is used for nuclear de-excitation"
<< std::endl;
}
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//---------------------------------------------------------------------------
//
// ClassName: G4HadronicAbsorptionFritiof
//
// Author: Alberto Ribon
//
// Date: 27 July 2012
//
// Modified:
//
// Class Description:
//
// Intermediate class for hadronic absorption at rest using FTF/Preco.
// Physics lists should reference the concrete subclasses for:
// anti_proton, anti_sigma+, and all anti-nuclei.
//
//---------------------------------------------------------------------------
#include <iostream>
#include "G4SystemOfUnits.hh"
#include "G4HadronicAbsorptionFritiof.hh"
#include "G4PreCompoundModel.hh"
#include "G4GeneratorPrecompoundInterface.hh"
#include "G4FTFModel.hh"
#include "G4LundStringFragmentation.hh"
#include "G4ExcitedStringDecay.hh"
#include "G4TheoFSGenerator.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4HadronicInteractionRegistry.hh"
// Constructor
G4HadronicAbsorptionFritiof::
G4HadronicAbsorptionFritiof( G4ParticleDefinition* pdef )
: G4HadronStoppingProcess( "hFritiofCaptureAtRest" ),
pdefApplicable( pdef ) {
G4TheoFSGenerator * theModel = new G4TheoFSGenerator( "FTFP" );
G4FTFModel * theStringModel = new G4FTFModel;
theLund = new G4LundStringFragmentation;
theStringDecay = new G4ExcitedStringDecay( theLund );
theStringModel->SetFragmentationModel( theStringDecay );
// Not a cascade - goes straight to Preco
G4HadronicInteraction* p =
G4HadronicInteractionRegistry::Instance()->FindModel("PRECO");
G4VPreCompoundModel * thePreEquilib = static_cast<G4VPreCompoundModel*>(p);
if(! thePreEquilib) { thePreEquilib = new G4PreCompoundModel; }
G4GeneratorPrecompoundInterface * theCascade =
new G4GeneratorPrecompoundInterface( thePreEquilib );
theModel->SetHighEnergyGenerator( theStringModel );
theModel->SetTransport( theCascade );
G4double theMin = 0.0*GeV;
G4double theMax = 100.0*TeV;
theModel->SetMinEnergy( theMin );
theModel->SetMaxEnergy( theMax );
RegisterMe( theModel );
}
G4HadronicAbsorptionFritiof::~G4HadronicAbsorptionFritiof() {
delete theLund;
delete theStringDecay;
}
// Applies to constructor-specified particle, or to all known cases
G4bool G4HadronicAbsorptionFritiof::
IsApplicable( const G4ParticleDefinition& particle ) {
return ( ( 0 == pdefApplicable &&
( &particle == G4AntiProton::Definition() ||
&particle == G4AntiSigmaPlus::Definition() ||
particle.GetBaryonNumber() < -1 ) ) // Anti-nuclei
|| ( &particle == pdefApplicable ) );
}
// Documentation of purpose
void G4HadronicAbsorptionFritiof::
ProcessDescription( std::ostream& os ) const {
os << "Stopping and absorption of anti_protons, anti_sigma+, and \n"
<< "all anti-nuclei using Fritiof (FTF) string model.\n"
<< "Geant4 PreCompound model is used for nuclear de-excitation."
<< std::endl;
}
@@ -27,15 +27,18 @@
// Larry Felawka (TRIUMF), April 1998
//---------------------------------------------------------------------
#include <string.h>
#include <cmath>
#include <stdio.h>
#include "G4KaonMinusAbsorption.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"
#include "G4HadronicProcessStore.hh"
#include <string.h>
#include <cmath>
#include <stdio.h>
#include "G4HadronicDeprecate.hh"
#define MAX_SECONDARIES 100
// constructor
@@ -58,6 +61,7 @@ G4KaonMinusAbsorption::G4KaonMinusAbsorption(const G4String& processName,
pdefTriton(G4Triton::Triton()),
pdefAlpha(G4Alpha::Alpha())
{
G4HadronicDeprecate("G4KaonMinusAbsorption");
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
@@ -297,7 +301,7 @@ void G4KaonMinusAbsorption::Poisso(G4float xav, G4int *iran)
{
static G4int i;
static G4float r, p1, p2, p3;
static G4int mm;
static G4int fivex;
static G4float rr, ran, rrr, ran1;
// *** GENERATION OF POISSON DISTRIBUTION ***
@@ -315,14 +319,14 @@ void G4KaonMinusAbsorption::Poisso(G4float xav, G4int *iran)
}
}
else {
mm = G4int(xav * G4float(5.));
fivex = G4int(xav * G4float(5.));
*iran = 0;
if (mm > 0) {
if (fivex > 0) {
r = std::exp(-G4double(xav));
ran1 = G4UniformRand();
if (ran1 > r) {
rr = r;
for (i = 1; i <= mm; ++i) {
for (i = 1; i <= fivex; ++i) {
++(*iran);
if (i <= 5) {
rrr = std::pow(xav, G4float(i)) / NFac(i);
@@ -372,18 +376,18 @@ G4int G4KaonMinusAbsorption::NFac(G4int n)
{
G4int ret_val;
static G4int i, m;
static G4int i, j;
// *** NVE 16-MAR-1988 CERN GENEVA ***
// ORIGIN : H.FESEFELDT (27-OCT-1983)
ret_val = 1;
m = n;
if (m > 1) {
if (m > 10) {
m = 10;
j = n;
if (j > 1) {
if (j > 10) {
j = 10;
}
for (i = 2; i <= m; ++i) {
for (i = 2; i <= j; ++i) {
ret_val *= i;
}
}
@@ -43,11 +43,13 @@
#include "G4StopDeexcitationAlgorithm.hh"
#include "G4ReactionKinematics.hh"
#include "G4HadronicProcessStore.hh"
#include "G4HadronicDeprecate.hh"
G4KaonMinusAbsorptionAtRest::G4KaonMinusAbsorptionAtRest(const G4String& processName,
G4ProcessType aType ) :
G4VRestProcess (processName, aType)
{
G4HadronicDeprecate("G4KaonMinusAbsorptionAtRest");
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
@@ -132,6 +134,13 @@ G4VParticleChange* G4KaonMinusAbsorptionAtRest::AtRestDoIt
// Do the interaction with the nucleon
G4DynamicParticleVector* absorptionProducts = KaonNucleonReaction();
//A.R. 26-Jul-2012 Coverity fix
if ( ! absorptionProducts ) {
G4Exception("G4KaonMinusAbsorptionAtRest::AtRestDoIt()", "HAD_STOP_0001",
FatalException, "NULL absorptionProducts");
return 0;
}
// Secondary interactions
@@ -224,7 +233,7 @@ G4VParticleChange* G4KaonMinusAbsorptionAtRest::AtRestDoIt
}
if (energyDeposit < 0.)
G4Exception("G4KaonMinusAbsorptionAtRest::AtRestDoIt()", "HAD_STOP_0001",
G4Exception("G4KaonMinusAbsorptionAtRest::AtRestDoIt()", "HAD_STOP_0002",
FatalException, "Excitation energy < 0");
delete nucleus;
@@ -396,6 +405,10 @@ G4DynamicParticleVector* G4KaonMinusAbsorptionAtRest::KaonNucleonReaction()
<< " is not a good nucleon - check G4Nucleus::ReturnTargetParticle()!"
<< G4endl;
}
//A.R. 26-Jul-2012 Coverity fix
if ( products ) delete products;
return 0;
}
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuMinusCaptureCascade.cc,v 1.16 2008-05-05 09:09:06 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// G4MuonMinusCaptureAtRest physics process
//
@@ -40,6 +39,8 @@
//----------------------------------------------------------------------
#include "G4MuMinusCaptureCascade.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4LorentzVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4MuonMinus.hh"
@@ -0,0 +1,263 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4MuMinusCapturePrecompound
//
// Author: V.Ivanchenko (Vladimir.Ivantchenko@cern.ch)
//
// Creation date: 22 April 2012 on base of G4MuMinusCaptureCascade
//
//
//-----------------------------------------------------------------------------
//
// Modifications:
//
//-----------------------------------------------------------------------------
#include "G4MuMinusCapturePrecompound.hh"
#include "Randomize.hh"
#include "G4RandomDirection.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4MuonMinus.hh"
#include "G4NeutrinoMu.hh"
#include "G4Neutron.hh"
#include "G4Proton.hh"
#include "G4Triton.hh"
#include "G4LorentzVector.hh"
#include "G4ParticleDefinition.hh"
#include "G4NucleiProperties.hh"
#include "G4VPreCompoundModel.hh"
#include "G4PreCompoundModel.hh"
#include "G4HadronicInteractionRegistry.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuMinusCapturePrecompound::G4MuMinusCapturePrecompound(
G4VPreCompoundModel* ptr)
: G4HadronicInteraction("muMinusNuclearCapture")
{
fMuMass = G4MuonMinus::MuonMinus()->GetPDGMass();
fProton = G4Proton::Proton();
fNeutron = G4Neutron::Neutron();
fThreshold = 10*MeV;
fPreCompound = ptr;
if(!ptr) {
G4HadronicInteraction* p =
G4HadronicInteractionRegistry::Instance()->FindModel("PRECO");
ptr = static_cast<G4VPreCompoundModel*>(p);
fPreCompound = ptr;
if(!ptr) { fPreCompound = new G4PreCompoundModel(); }
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuMinusCapturePrecompound::~G4MuMinusCapturePrecompound()
{
result.Clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4HadFinalState*
G4MuMinusCapturePrecompound::ApplyYourself(const G4HadProjectile& projectile,
G4Nucleus& targetNucleus)
{
result.Clear();
result.SetStatusChange(stopAndKill);
fTime = projectile.GetGlobalTime();
G4double time0 = fTime;
G4double muBindingEnergy = projectile.GetBoundEnergy();
G4int Z = targetNucleus.GetZ_asInt();
G4int A = targetNucleus.GetA_asInt();
G4double massA = G4NucleiProperties::GetNuclearMass(A, Z);
/*
G4cout << "G4MuMinusCapturePrecompound::ApplyYourself: Emu= "
<< muBindingEnergy << G4endl;
*/
// Energy on K-shell
G4double muEnergy = fMuMass + muBindingEnergy;
G4double muMom = std::sqrt(muBindingEnergy*(muBindingEnergy + 2.0*fMuMass));
G4double availableEnergy = massA + fMuMass - muBindingEnergy;
G4double residualMass = G4NucleiProperties::GetNuclearMass(A, Z - 1);
G4ThreeVector vmu = muMom*G4RandomDirection();
G4LorentzVector aMuMom(vmu, muEnergy);
// p or 3He as a target
// two body reaction mu- + A(Z,A) -> nuMu + A(Z-1,A)
if((1 == Z && 1 == A) || (2 == Z && 3 == A)) {
G4ParticleDefinition* pd = 0;
if(1 == Z) { pd = fNeutron; }
else { pd = G4Triton::Triton(); }
//
// Computation in assumption of CM reaction
//
G4double e = 0.5*(availableEnergy -
residualMass*residualMass/availableEnergy);
G4ThreeVector nudir = G4RandomDirection();
AddNewParticle(G4NeutrinoMu::NeutrinoMu(), nudir, e);
nudir *= -1.0;
AddNewParticle(pd, nudir, availableEnergy - e - residualMass);
} else {
// sample mu- + p -> nuMu + n reaction in CM of muonic atom
// muon
//
// NOTE by K.Genser and J.Yarba:
// The code below isn't working because emu always turns smaller than fMuMass
// For this reason the sqrt is producing a NaN
//
// G4double emu = (availableEnergy*availableEnergy - massA*massA
// + fMuMass*fMuMass)/(2*availableEnergy);
// G4ThreeVector mudir = G4RandomDirection();
// G4LorentzVector momMuon(std::sqrt(emu*emu - fMuMass*fMuMass)*mudir, emu);
// nucleus
G4LorentzVector momInitial(0.0,0.0,0.0,availableEnergy);
G4LorentzVector momResidual, momNu;
// pick random proton inside nucleus
G4double eEx;
fNucleus.Init(A, Z);
const std::vector<G4Nucleon>& nucleons= fNucleus.GetNucleons();
G4ParticleDefinition* pDef;
G4int nneutrons = 1;
G4int reentryCount = 0;
do {
++reentryCount;
G4int index = 0;
do {
index=G4int(A*G4UniformRand());
pDef = nucleons[index].GetDefinition();
} while(pDef != fProton);
G4LorentzVector momP = nucleons[index].Get4Momentum();
// Get CMS kinematics
G4LorentzVector theCMS = momP + aMuMom;
G4ThreeVector bst = theCMS.boostVector();
G4double Ecms = theCMS.mag();
G4double Enu = 0.5*(Ecms - neutron_mass_c2*neutron_mass_c2/Ecms);
eEx = 0.0;
if(Enu > 0.0) {
// make the nu, and transform to lab;
momNu.set(Enu*G4RandomDirection(), Enu);
// nu in lab.
momNu.boost(bst);
momResidual = momInitial - momNu;
eEx = momResidual.mag() - residualMass;
// release neutron
if(eEx > 0.0) {
G4double eth = residualMass - massA + fThreshold + 2*neutron_mass_c2;
if(Ecms - Enu > eth) {
theCMS -= momNu;
G4double ekin = theCMS.e() - eth;
G4ThreeVector dir = theCMS.vect().unit();
AddNewParticle(fNeutron, dir, ekin);
momResidual -=
result.GetSecondary(0)->GetParticle()->Get4Momentum();
--Z;
--A;
residualMass = G4NucleiProperties::GetNuclearMass(A, Z);
nneutrons = 0;
}
}
}
if(Enu <= 0.0 && eEx <= 0.0 && reentryCount > 100) {
G4ExceptionDescription ed;
ed << "Call for " << GetModelName() << G4endl;
ed << "Target Z= " << Z
<< " A= " << A << G4endl;
ed << " ApplyYourself does not completed after 100 attempts" << G4endl;
G4Exception("G4MuMinusCapturePrecompound::AtRestDoIt", "had006",
FatalException, ed);
}
} while(eEx <= 0.0);
G4ThreeVector dir = momNu.vect().unit();
AddNewParticle(G4NeutrinoMu::NeutrinoMu(), dir, momNu.e());
G4Fragment initialState(A, Z, momResidual);
initialState.SetNumberOfExcitedParticle(nneutrons,0);
initialState.SetNumberOfHoles(1,1);
// decay time for pre-compound/de-excitation starts from zero
G4ReactionProductVector* rpv = fPreCompound->DeExcite(initialState);
size_t n = rpv->size();
for(size_t i=0; i<n; ++i) {
G4ReactionProduct* rp = (*rpv)[i];
// reaction time
fTime = time0 + rp->GetTOF();
G4ThreeVector direction = rp->GetMomentum().unit();
AddNewParticle(rp->GetDefinition(), direction, rp->GetKineticEnergy());
delete rp;
}
delete rpv;
}
if(verboseLevel > 1)
G4cout << "G4MuMinusCapturePrecompound::ApplyYourself: Nsec= "
<< result.GetNumberOfSecondaries()
<<" E0(MeV)= " <<availableEnergy/MeV
<<" Mres(GeV)= " <<residualMass/GeV
<<G4endl;
return &result;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuMinusCapturePrecompound::ModelDescription(std::ostream& outFile) const
{
outFile << "Sampling of mu- capture by atomic nucleus from K-shell"
<< " mesoatom orbit.\n"
<< "Primary reaction mu- + p -> n + neutrino, neutron providing\n"
<< " initial excitation of the target nucleus and PreCompound"
<< " model samples final state\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,285 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// GEANT4 Class header file
//
// File name: G4MuonMinusBoundDecay
//
// Author: V.Ivanchenko (Vladimir.Ivantchenko@cern.ch)
//
// Creation date: 24 April 2012 on base of G4MuMinusCaptureAtRest
//
// Modified:
//
//----------------------------------------------------------------------
#include "G4MuonMinusBoundDecay.hh"
#include "Randomize.hh"
#include "G4RandomDirection.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4MuonMinus.hh"
#include "G4Electron.hh"
#include "G4NeutrinoMu.hh"
#include "G4AntiNeutrinoE.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuonMinusBoundDecay::G4MuonMinusBoundDecay()
: G4HadronicInteraction("muMinusBoundDeacy")
{
fMuMass = G4MuonMinus::MuonMinus()->GetPDGMass();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuonMinusBoundDecay::~G4MuonMinusBoundDecay()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4HadFinalState*
G4MuonMinusBoundDecay::ApplyYourself(const G4HadProjectile& projectile,
G4Nucleus& targetNucleus)
{
result.Clear();
G4int Z = targetNucleus.GetZ_asInt();
G4int A = targetNucleus.GetA_asInt();
// Decide on Decay or Capture, and doit.
G4double lambdac = GetMuonCaptureRate(Z, A);
G4double lambdad = GetMuonDecayRate(Z);
G4double lambda = lambdac + lambdad;
// === sample capture time and change time of projectile
G4double time = -std::log(G4UniformRand()) / lambda;
G4HadProjectile* p = const_cast<G4HadProjectile*>(&projectile);
p->SetGlobalTime(time);
//G4cout << "lambda= " << lambda << " lambdac= " << lambdac
//<< " t= " << time << G4endl;
// cascade
if( G4UniformRand()*lambda < lambdac) {
result.SetStatusChange(isAlive);
} else {
// Simulation on Decay of mu- on a K-shell of the muonic atom
result.SetStatusChange(stopAndKill);
G4double xmax = 1 + electron_mass_c2*electron_mass_c2/(fMuMass*fMuMass);
G4double xmin = 2.0*electron_mass_c2/fMuMass;
G4double KEnergy = projectile.GetBoundEnergy();
/*
G4cout << "G4MuonMinusBoundDecay::ApplyYourself"
<< " XMAX= " << xmax << " Ebound= " << KEnergy<< G4endl;
*/
G4double pmu = std::sqrt(KEnergy*(KEnergy + 2.0*fMuMass));
G4double emu = KEnergy + fMuMass;
G4ThreeVector dir = G4RandomDirection();
G4LorentzVector MU(pmu*dir, emu);
G4ThreeVector bst = MU.boostVector();
G4double Eelect, Pelect, x, ecm;
G4LorentzVector EL, NN;
// Calculate electron energy
do {
do {
x = xmin + (xmax-xmin)*G4UniformRand();
} while (G4UniformRand() > (3.0 - 2.0*x)*x*x );
Eelect = x*fMuMass*0.5;
Pelect = 0.0;
if(Eelect > electron_mass_c2) {
Pelect = std::sqrt(Eelect*Eelect - electron_mass_c2*electron_mass_c2);
} else {
Pelect = 0.0;
Eelect = electron_mass_c2;
}
dir = G4RandomDirection();
EL = G4LorentzVector(Pelect*dir,Eelect);
EL.boost(bst);
Eelect = EL.e() - electron_mass_c2 - 2.0*KEnergy;
//
// Calculate rest frame parameters of 2 neutrinos
//
NN = MU - EL;
ecm = NN.mag2();
} while (Eelect < 0.0 || ecm < 0.0);
//
// Create electron
//
G4DynamicParticle* dp = new G4DynamicParticle(G4Electron::Electron(),
EL.vect().unit(),
Eelect);
AddNewParticle(dp, time);
//
// Create Neutrinos
//
ecm = 0.5*std::sqrt(ecm);
bst = NN.boostVector();
G4ThreeVector p1 = ecm * G4RandomDirection();
G4LorentzVector N1 = G4LorentzVector(p1,ecm);
N1.boost(bst);
dp = new G4DynamicParticle(G4AntiNeutrinoE::AntiNeutrinoE(), N1);
AddNewParticle(dp, time);
NN -= N1;
dp = new G4DynamicParticle(G4NeutrinoMu::NeutrinoMu(), NN);
AddNewParticle(dp, time);
}
return &result;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuonMinusBoundDecay::GetMuonCaptureRate(G4int Z, G4int A)
{
// Initialized data
static G4double zeff[101] = { 0.,
1.,1.98,2.95,3.89,4.8,5.72,6.61,7.49,8.32,9.12,9.95,10.69,11.48,12.22,
12.91,13.64,14.24,14.89,15.53,16.15,16.75,17.38,18.04,18.49,
19.06,19.59,20.1,20.66,21.12,21.61,22.02,22.43,22.84,23.24,
23.65,24.06,24.47,24.85,25.23,25.61,25.99,26.37,26.69,27.,
27.32,27.63,27.95,28.2,28.42,28.64,28.79,29.03,29.27,29.51,
29.75,29.99,30.2,30.36,30.53,30.69,30.85,31.01,31.18,31.34,
31.48,31.62,31.76,31.9,32.05,32.19,32.33,32.47,32.61,32.76,
32.94,33.11,33.29,33.46,33.64,33.81,34.21,34.18,34.,34.1,
34.21,34.31,34.42,34.52,34.63,34.73,34.84,34.94,35.04,35.15,
35.25,35.36,35.46,35.57,35.67,35.78 };
// Mu- capture data from B.B.Balashov, G.Ya.Korenman, P.A.Eramgan
// Atomizdat, 1978. (Experimental capture velocities)
// Data for Hydrogen from Phys. Rev. Lett. 99(2007)032002
// Data for Helium from Phys. Rep. 354(2001)243
const size_t ListZE = 67;
static G4int ListZExp[ListZE] = { 1, 2,
3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 22, 23,
24, 25, 26, 27, 28, 31, 32, 33, 34, 37,
38, 39, 40, 41, 42, 45, 46, 47, 48, 49,
50, 51, 52, 53, 55, 56, 57, 58, 59, 60,
62, 64, 65, 67, 72, 73, 74, 80, 81, 82,
83, 90, 92, 93};
static G4double ListCaptureVel[ListZE] = { 0.000725, 0.000356,
0.0057, 0.010, 0.0258, 0.0371, 0.0644,
0.0974, 0.144, 0.250, 0.386, 0.479,
0.700, 0.849, 1.119, 1.338, 1.40,
1.30, 1.98, 2.45, 2.60, 3.19,
3.29, 3.91, 4.41, 4.96, 5.74,
5.68, 5.53, 6.06, 5.69, 6.89,
7.25, 7.89, 8.59, 10.40, 9.22,
10.01, 10.00, 10.88, 10.62, 11.37,
10.68, 10.49, 9.06, 11.20, 10.98,
10.18, 10.71, 11.44, 13.45, 12.32,
12.22, 12.09, 12.73, 12.95, 13.03,
12.86, 13.13, 13.39, 12.74, 13.78,
13.02, 13.26, 13.10, 14.00, 14.70};
// Local variables
G4double zeff2, xmu, a2ze, r1, r2;
G4double lambda;
// == Effective charges from Ford and Wills Nucl Phys 35(1962)295.
// == Untabulated charges are interpolated.
// == Mu capture lifetime (Goulard and Primakoff PRC10(1974)2034.
G4int i = Z;
if(i > 100) { i = 100; }
const G4double b0a = -.03;
const G4double b0b = -.25;
const G4double b0c = 3.24;
const G4double t1 = 875.e-10;
r1 = zeff[i];
zeff2 = r1 * r1;
// ^-4 -> ^-5 suggested by user
xmu = zeff2 * 2.663e-5;
a2ze = 0.5 * A / Z;
r2 = 1.0 - xmu;
lambda = t1 * zeff2 * zeff2 * (r2 * r2) * (1.0 - (1.0 - xmu) * .75704) *
(a2ze * b0a + 1.0 - (a2ze - 1.0) * b0b -
(2 * (A - Z) + std::fabs(a2ze - 1.) ) * b0c / G4double(A * 4) );
// == Mu capture data are taken if exist
for (size_t j = 0; j < ListZE; ++j) {
if( ListZExp[j] == i + 1) {
lambda = ListCaptureVel[j] / microsecond;
break;
}
}
return lambda;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4MuonMinusBoundDecay::GetMuonDecayRate(G4int Z)
{
// Decay time on K-shell
// N.C.Mukhopadhyay Phys. Rep. 30 (1977) 1.
G4double lambda = 1.0;
if(Z > 1) {
G4double x = Z*fine_structure_const;
lambda -= 2.5 * x * x;
if( 0.5 > lambda ) { lambda = 0.5; }
} else {
// Published value 0.455851 - Phys. Rev. Lett. 99(2007)032002
lambda = 1.00151;
}
return lambda * 0.445164 / microsecond;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuonMinusBoundDecay::ModelDescription(std::ostream& outFile) const
{
outFile << "Sample probabilities of mu- nuclear capture of decay"
<< " from K-shell orbit.\n"
<< " Time of projectile is changed taking into account life time"
<< " of muonic atom.\n"
<< " If decay is sampled primary state become stopAndKill,"
<< " else - isAlive.\n"
<< "Based of reviews:\n"
<< " N.C.Mukhopadhyay Phy. Rep. 30 (1977) 1.\n"
<< " B.B.Balashov, G.Ya.Korenman, P.A.Eramgan, Atomizdat, 1978.\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id$
//
//---------------------------------------------------------------------
//
// GEANT4 Class
//
// File name: G4MuonMinusCapture
//
// Author V.Ivanchenko 25 April 2012
//
//
// Class Description:
//
// Base process class for stopping of mu-
//
// Modifications:
//
// 20121003 K. Genser -- Changed the constructor argument type
// Used two argument base constructor
// 20121016 K. Genser -- Reverting to use one argument base c'tor
//
//------------------------------------------------------------------------
#include "G4MuonMinusCapture.hh"
#include "G4HadronicProcessType.hh"
#include "G4MuonMinusBoundDecay.hh"
#include "G4HadronicInteraction.hh"
#include "G4MuonMinus.hh"
#include "G4MuMinusCapturePrecompound.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuonMinusCapture::G4MuonMinusCapture(G4HadronicInteraction* hiptr)
: G4HadronStoppingProcess ("muMinusCaptureAtRest")
{
SetBoundDecay(new G4MuonMinusBoundDecay()); // Owned by InteractionRegistry
if (!hiptr) {
hiptr = new G4MuMinusCapturePrecompound(); // Owned by InteractionRegistry
}
RegisterMe(hiptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuonMinusCapture::~G4MuonMinusCapture()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4MuonMinusCapture::IsApplicable(const G4ParticleDefinition& p)
{
return (&p == G4MuonMinus::MuonMinus());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuonMinusCapture::ProcessDescription(std::ostream& outFile) const
{
outFile << "Stopping of mu- using default element selector, EM cascade"
<< " sampling and bound decay sampling.\n"
<< "Native PreCompound model is used for nuclear capture\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuonMinusCaptureAtRest.cc,v 1.56 2010-11-12 06:52:01 dennis Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// G4MuonMinusCaptureAtRest physics process
// Larry Felawka (TRIUMF) and Art Olin (TRIUMF)
@@ -44,6 +43,8 @@
#include "G4MuonMinusCaptureAtRest.hh"
#include "G4DynamicParticle.hh"
#include "Randomize.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4He3.hh"
#include "G4NeutrinoMu.hh"
#include "G4Fragment.hh"
@@ -27,15 +27,18 @@
// Larry Felawka (TRIUMF), April 1998
//---------------------------------------------------------------------
#include <string.h>
#include <cmath>
#include <stdio.h>
#include "G4NeutronCaptureAtRest.hh"
#include "G4SystemOfUnits.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "Randomize.hh"
#include "G4HadronicProcessStore.hh"
#include <string.h>
#include <cmath>
#include <stdio.h>
#include "G4HadronicDeprecate.hh"
#define MAX_SECONDARIES 100
// constructor
@@ -51,6 +54,7 @@ G4NeutronCaptureAtRest::G4NeutronCaptureAtRest(const G4String& processName,
pdefGamma(G4Gamma::Gamma()),
pdefNeutron(G4Neutron::Neutron())
{
G4HadronicDeprecate("G4NeutronCaptureAtRest");
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
@@ -39,6 +39,7 @@
#include "G4PiMinusAbsorptionAtRest.hh"
#include "G4SystemOfUnits.hh"
#include "G4PiMinusStopLi.hh"
#include "G4PiMinusStopC.hh"
#include "G4PiMinusStopN.hh"
@@ -56,6 +57,8 @@
#include "G4ThreeVector.hh"
#include "G4LorentzVector.hh"
#include "G4HadronicProcessStore.hh"
#include "G4HadronicDeprecate.hh"
// Constructor
@@ -63,6 +66,8 @@ G4PiMinusAbsorptionAtRest::G4PiMinusAbsorptionAtRest(const G4String& processName
G4ProcessType aType) :
G4VRestProcess (processName, aType)
{
G4HadronicDeprecate("G4PiMinusAbsorptionAtRest");
SetProcessSubType(fHadronAtRest);
_indexDeexcitation = 0;
@@ -1,173 +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. *
// ********************************************************************
//
//---------------------------------------------------------------------
#include "G4PiMinusAbsorptionBertini.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "Randomize.hh"
#include "G4HadronicProcessStore.hh"
#include <string.h>
#include <cmath>
#include <stdio.h>
// constructor
G4PiMinusAbsorptionBertini::G4PiMinusAbsorptionBertini(const G4String& processName,
G4ProcessType aType ) :
G4VRestProcess (processName, aType),
pdefPionMinus(G4PionMinus::PionMinus())
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
SetProcessSubType(fHadronAtRest);
cascade = new G4CascadeInterface;
cascade->usePreCompoundDeexcitation();
G4HadronicProcessStore::Instance()->RegisterExtraProcess(this);
}
// destructor
G4PiMinusAbsorptionBertini::~G4PiMinusAbsorptionBertini()
{
G4HadronicProcessStore::Instance()->DeRegisterExtraProcess(this);
}
void G4PiMinusAbsorptionBertini::PreparePhysicsTable(const G4ParticleDefinition& p)
{
G4HadronicProcessStore::Instance()->RegisterParticleForExtraProcess(this, &p);
}
void G4PiMinusAbsorptionBertini::BuildPhysicsTable(const G4ParticleDefinition& p)
{
G4HadronicProcessStore::Instance()->PrintInfo(&p);
}
// methods.............................................................................
G4bool G4PiMinusAbsorptionBertini::IsApplicable(const G4ParticleDefinition& particle)
{
return ( &particle == pdefPionMinus );
}
G4VParticleChange* G4PiMinusAbsorptionBertini::AtRestDoIt(const G4Track& track,
const G4Step&)
//
// Handles PionMinuss at rest
//
{
// We construct a fake track and we set the kinetic energy to 1keV in order to be able to use Bertini+PrecompoundDeexciation
G4Track faketrack(track);
faketrack.SetStep(track.GetStep());
faketrack.SetKineticEnergy(1*keV);
// Initialize ParticleChange
// all members of G4VParticleChange are set to equal to
// corresponding member in G4Track
aParticleChange.Initialize(track);
// Store some global quantities that depend on current material and particle
G4Material * aMaterial = track.GetMaterial();
const G4int numberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomicNumberDensity = aMaterial->GetAtomicNumDensityVector();
G4double normalization = 0;
for ( G4int i1=0; i1 < numberOfElements; i1++ )
{
normalization += theAtomicNumberDensity[i1] ; // change when nucleon specific
// probabilities are included.
}
G4double runningSum= 0.;
G4double random = G4UniformRand()*normalization;
for ( G4int i2=0; i2 < numberOfElements; i2++ )
{
runningSum += theAtomicNumberDensity[i2]; // change when nucleon specific
// probabilities are included.
if (random<=runningSum)
{
targetZ = G4double((*theElementVector)[i2]->GetZ());
currentN = (*theElementVector)[i2]->GetN();
}
}
if (random>runningSum)
{
targetZ = G4double((*theElementVector)[numberOfElements-1]->GetZ());
currentN = (*theElementVector)[numberOfElements-1]->GetN();
}
targetNucleus.SetParameters(currentN, targetZ);
if (verboseLevel>1) {
G4cout << "G4PiMinusAbsorptionBertini::AtRestDoIt is invoked " <<G4endl;
}
G4HadFinalState* result = cascade->ApplyYourself(faketrack, targetNucleus);
ClearNumberOfInteractionLengthLeft();
G4int ns = result->GetNumberOfSecondaries();
G4int nb = ns;
if(result->GetStatusChange() == isAlive) nb++;
aParticleChange.ProposeTrackStatus(fStopAndKill);
aParticleChange.SetNumberOfSecondaries(nb);
for(G4int i=0; i<ns; i++) {
G4Track* tr = new G4Track(result->GetSecondary(i)->GetParticle(),
track.GetGlobalTime(),
track.GetPosition());
aParticleChange.AddSecondary(tr);
}
if(result->GetStatusChange() == isAlive) {
G4DynamicParticle* dp = new G4DynamicParticle(*(track.GetDynamicParticle()));
G4Track* tr = new G4Track(dp,track.GetGlobalTime(),track.GetPosition());
tr->SetKineticEnergy(result->GetEnergyChange());
tr->SetMomentumDirection(result->GetMomentumChange());
aParticleChange.AddSecondary(tr);
}
result->Clear();
return &aParticleChange;
}
@@ -46,6 +46,7 @@
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4ThreeVector.hh"
#include "G4HadronicDeprecate.hh"
// Constructor
@@ -53,6 +54,7 @@ G4PiMinusStopAbsorption::G4PiMinusStopAbsorption(G4PiMinusStopMaterial* material
const G4double Z, const G4double A)
{
G4HadronicDeprecate("G4PiMinusStopAbsorption");
_materialAlgo = materialAlgo;
_nucleusZ = Z;
_nucleusA = A;
@@ -31,14 +31,14 @@
//
// -------------------------------------------------------------------
#include "G4ios.hh"
#include <vector>
#include "G4PiMinusStopMaterial.hh"
#include <vector>
#include "globals.hh"
#include "G4ios.hh"
#include "Randomize.hh"
#include "G4PhysicalConstants.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4PionMinus.hh"
@@ -69,8 +69,11 @@ G4PiMinusStopMaterial::~G4PiMinusStopMaterial()
if (_definitions != 0) delete _definitions;
_definitions = 0;
for (unsigned int i=0; i<_momenta->size(); i++) delete(*_momenta)[i];
if (_momenta != 0) delete _momenta;
//A.R. 26-Jul-2012 Coverity fix
if (_momenta != 0) {
for (unsigned int i=0; i<_momenta->size(); i++) delete(*_momenta)[i];
delete _momenta;
}
delete _distributionE;
delete _distributionAngle;
@@ -149,8 +152,11 @@ G4PiMinusStopMaterial::P4Vector(const G4double binding,
} while ((eKin1 + eKin2 + eRecoil) > availableE);
_momenta->push_back(new G4LorentzVector(p1));
_momenta->push_back(new G4LorentzVector(p2));
//A.R. 26-Jul-2012 Coverity fix
if (_momenta != 0) {
_momenta->push_back(new G4LorentzVector(p1));
_momenta->push_back(new G4LorentzVector(p2));
}
return _momenta;
@@ -176,11 +182,15 @@ G4LorentzVector G4PiMinusStopMaterial::MakeP4(G4double p, G4double theta, G4doub
G4double G4PiMinusStopMaterial::RecoilEnergy(const G4double mass)
{
G4ThreeVector p(0.,0.,0.);
for (unsigned int i = 0; i< _momenta->size(); i++)
{
p = p + (*_momenta)[i]->vect();
}
//A.R. 26-Jul-2012 Coverity fix
if (_momenta != 0) {
for (unsigned int i = 0; i< _momenta->size(); i++)
{
p = p + (*_momenta)[i]->vect();
}
}
G4double pNucleus = p.mag();
G4double eNucleus = std::sqrt(pNucleus*pNucleus + mass*mass);
@@ -88,7 +88,6 @@ G4double G4PiMinusStopTa::angle[8] = { 1.308997, 1.570796, 1.832596, 2.094395,
// Constructor
G4PiMinusStopTa::G4PiMinusStopTa()
{
// Cluster size: nucleon pair, alpha, triton etc.
// First implementation: interaction with nucleon pair only
@@ -27,15 +27,18 @@
// Larry Felawka (TRIUMF), April 1998
//---------------------------------------------------------------------
#include "G4PionMinusAbsorptionAtRest.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "Randomize.hh"
#include "G4HadronicProcessStore.hh"
#include <string.h>
#include <cmath>
#include <stdio.h>
#include "G4PionMinusAbsorptionAtRest.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "G4HadronicProcessStore.hh"
#include "G4HadronicDeprecate.hh"
#define MAX_SECONDARIES 100
// constructor
@@ -53,6 +56,8 @@ G4PionMinusAbsorptionAtRest::G4PionMinusAbsorptionAtRest(const G4String& process
pdefTriton(G4Triton::Triton()),
pdefAlpha(G4Alpha::Alpha())
{
G4HadronicDeprecate("G4PiMinusAbsorptionAtRest");
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
@@ -439,7 +444,7 @@ void G4PionMinusAbsorptionAtRest::Poisso(G4float xav, G4int *iran)
{
static G4int i;
static G4float r, p1, p2, p3;
static G4int mm;
static G4int fivex;
static G4float rr, ran, rrr, ran1;
// *** GENERATION OF POISSON DISTRIBUTION ***
@@ -457,14 +462,14 @@ void G4PionMinusAbsorptionAtRest::Poisso(G4float xav, G4int *iran)
}
}
else {
mm = G4int(xav * G4float(5.));
fivex = G4int(xav * G4float(5.));
*iran = 0;
if (mm > 0) {
if (fivex > 0) {
r = std::exp(-G4double(xav));
ran1 = G4UniformRand();
if (ran1 > r) {
rr = r;
for (i = 1; i <= mm; ++i) {
for (i = 1; i <= fivex; ++i) {
++(*iran);
if (i <= 5) {
rrr = std::pow(xav, G4float(i)) / NFac(i);
@@ -513,19 +518,18 @@ void G4PionMinusAbsorptionAtRest::Poisso(G4float xav, G4int *iran)
G4int G4PionMinusAbsorptionAtRest::NFac(G4int n)
{
G4int ret_val;
static G4int i, m;
static G4int i, j;
// *** NVE 16-MAR-1988 CERN GENEVA ***
// ORIGIN : H.FESEFELDT (27-OCT-1983)
ret_val = 1;
m = n;
if (m > 1) {
if (m > 10) {
m = 10;
j = n;
if (j > 1) {
if (j > 10) {
j = 10;
}
for (i = 2; i <= m; ++i) {
for (i = 2; i <= j; ++i) {
ret_val *= i;
}
}
@@ -40,13 +40,14 @@
#include "G4ParticleTypes.hh"
#include "G4ParticleDefinition.hh"
#include "G4ThreeVector.hh"
#include "G4HadronicDeprecate.hh"
// Constructor
G4StopDeexcitation::G4StopDeexcitation(G4StopDeexcitationAlgorithm* algorithm)
{
G4HadronicDeprecate("G4StopDeexcitation");
_algorithm = algorithm;
}
@@ -38,11 +38,13 @@
#include "globals.hh"
#include "G4DynamicParticleVector.hh"
#include "G4ThreeVector.hh"
#include "G4HadronicDeprecate.hh"
// Constructor
G4StopDummyDeexcitation::G4StopDummyDeexcitation()
{
G4HadronicDeprecate("G4StopDummyDeexcitation");
_products = 0;
}
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4StopElementSelector.cc,v 1.16 2007-10-02 18:27:43 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// File: G4StopElementSelector
//
@@ -41,6 +40,8 @@
//---------------------------------------------------------------------
#include "G4StopElementSelector.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "G4Material.hh"
@@ -139,9 +140,10 @@ G4double G4StopElementSelector::GetMuonCaptureRate(G4double Z, G4double A)
// Mu- capture data from B.B.Balashov, G.Ya.Korenman, P.A.Eramgan
// Atomizdat, 1978. (Experimental capture velocities)
// Data for Hydrogen from Phys. Rev. Lett. 99(2007)032002
const size_t ListZE = 65;
static G4int ListZExp[ListZE] = {
const size_t ListZE = 66;
static G4int ListZExp[ListZE] = {1,
3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 22, 23,
24, 25, 26, 27, 28, 31, 32, 33, 34, 37,
@@ -150,7 +152,7 @@ G4double G4StopElementSelector::GetMuonCaptureRate(G4double Z, G4double A)
62, 64, 65, 67, 72, 73, 74, 80, 81, 82,
83, 90, 92, 93};
static G4double ListCaptureVel[ListZE] = {
static G4double ListCaptureVel[ListZE] = {0.000725,
0.0057, 0.010, 0.0258, 0.0371, 0.0644,
0.0974, 0.144, 0.250, 0.386, 0.479,
0.700, 0.849, 1.119, 1.338, 1.40,
@@ -209,9 +211,13 @@ G4double G4StopElementSelector::GetMuonDecayRate(G4double Z, G4double /* A */)
// Decay time on K-shell
// N.C.Mukhopadhyay Phys. Rep. 30 (1977) 1.
G4double lambda = 1.0 - 2.5 * Z * Z / (137.0*137.0);
if( 0.5 > lambda ) lambda = 0.5;
return lambda * 0.445 / microsecond;
G4double lambda = 1.0;
if(Z > 1) {
G4double x = Z*fine_structure_const;
lambda -= 2.5 * x * x;
if( 0.5 > lambda ) { lambda = 0.5; }
}
return lambda * 0.445164 / microsecond;
}
@@ -39,28 +39,30 @@
#include "G4StopTheoDeexcitation.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4LorentzVector.hh"
#include "G4NucleiProperties.hh"
#include "G4Fragment.hh"
#include "G4ExcitationHandler.hh"
#include "G4DynamicParticleVector.hh"
#include "G4HadronicDeprecate.hh"
// Constructor
G4StopTheoDeexcitation::G4StopTheoDeexcitation()
{}
G4StopTheoDeexcitation::G4StopTheoDeexcitation() {
G4HadronicDeprecate("G4StopTheoDeexcitation");
}
// Destructor
G4StopTheoDeexcitation::~G4StopTheoDeexcitation()
{}
G4ReactionProductVector* G4StopTheoDeexcitation::BreakUp(G4double A, G4double Z,
G4double excitation,
const G4ThreeVector& p)
G4ReactionProductVector*
G4StopTheoDeexcitation::BreakUp(G4double A, G4double Z, G4double excitation,
const G4ThreeVector& p)
{
G4ExcitationHandler theHandler;
// MF and FB parameters modified by MGP to force evaporation
@@ -74,9 +76,9 @@ G4ReactionProductVector* G4StopTheoDeexcitation::BreakUp(G4double A, G4double Z,
// Deexcite the nucleus
G4double atomicMass = G4NucleiProperties::GetNuclearMass(static_cast<G4int>(A),static_cast<G4int>(Z));
G4double m = atomicMass + excitation;
G4double mass = atomicMass + excitation;
G4double pMag = p.mag();
G4LorentzVector initialMomentum(p.x(),p.y(),p.z(),std::sqrt(pMag*pMag + m*m));
G4LorentzVector initialMomentum(p.x(),p.y(),p.z(),std::sqrt(pMag*pMag + mass*mass));
G4Fragment theExcitedNucleus(static_cast<G4int>(A),static_cast<G4int>(Z),initialMomentum);
return theHandler.BreakItUp(theExcitedNucleus);