Import Geant4 6.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EnergyRangeManager.cc,v 1.8 2003/01/27 09:57:13 jwellisc Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4EnergyRangeManager.cc,v 1.11 2003/11/03 17:47:30 hpw Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// Hadronic Process: Energy Range Manager
|
||||
// original by H.P. Wellisch
|
||||
@@ -33,8 +33,8 @@
|
||||
|
||||
#include "G4EnergyRangeManager.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4NoModelFound.hh"
|
||||
|
||||
#include "G4HadronicException.hh"
|
||||
|
||||
G4EnergyRangeManager::G4EnergyRangeManager(
|
||||
const G4EnergyRangeManager &right )
|
||||
{
|
||||
@@ -66,8 +66,9 @@
|
||||
G4HadronicInteraction *a )
|
||||
{
|
||||
if( theHadronicInteractionCounter+1 > MAX_NUMBER_OF_MODELS )
|
||||
G4Exception(
|
||||
"EnergyRangeManager::RegisterMe: TOO MANY MODELS");
|
||||
{
|
||||
throw G4HadronicException(__FILE__, __LINE__,"RegisterMe: TOO MANY MODELS");
|
||||
}
|
||||
theHadronicInteraction[ theHadronicInteractionCounter++ ] = a;
|
||||
}
|
||||
|
||||
@@ -79,7 +80,8 @@
|
||||
{
|
||||
G4int counter = GetHadronicInteractionCounter();
|
||||
if( counter == 0 )
|
||||
G4Exception("GetHadronicInteraction: NO MODELS STORED");
|
||||
throw G4HadronicException(__FILE__, __LINE__,
|
||||
"GetHadronicInteraction: NO MODELS STORED");
|
||||
|
||||
G4int cou = 0, memory = 0, memor2 = 0;
|
||||
G4double emi1 = 0.0, ema1 = 0.0, emi2 = 0.0, ema2 = 0.0;
|
||||
@@ -105,14 +107,15 @@
|
||||
switch ( cou )
|
||||
{
|
||||
case 0:
|
||||
throw(new G4NoModelFound);
|
||||
throw G4HadronicException(__FILE__, __LINE__,
|
||||
"GetHadronicInteraction: No Model found");
|
||||
return 0;
|
||||
case 1:
|
||||
m = memory;
|
||||
break;
|
||||
case 2:
|
||||
if( (emi2<=emi1 && ema2>=ema1) || (emi2>=emi1 && ema2<=ema1) )
|
||||
G4Exception(
|
||||
throw G4HadronicException(__FILE__, __LINE__,
|
||||
"GetHadronicInteraction: Energy ranges of two models fully overlapping");
|
||||
rand = G4UniformRand();
|
||||
if( emi1 < emi2 )
|
||||
@@ -129,7 +132,7 @@
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G4Exception(
|
||||
throw G4HadronicException(__FILE__, __LINE__,
|
||||
"GetHadronicInteraction: More than two competing models in this energy range");
|
||||
}
|
||||
return theHadronicInteraction[m];
|
||||
|
||||
@@ -19,39 +19,37 @@
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
|
||||
//
|
||||
#include "G4HadLeadBias.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4PionZero.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4HadFinalState.hh"
|
||||
|
||||
G4VParticleChange * G4HadLeadBias::Bias(G4VParticleChange * result)
|
||||
G4HadFinalState * G4HadLeadBias::Bias(G4HadFinalState * result)
|
||||
{
|
||||
G4cerr << "bias enter"<<G4endl;
|
||||
// G4cerr << "bias enter"<<G4endl;
|
||||
G4int nMeson(0), nBaryon(0), npi0(0), ngamma(0), nLepton(0);
|
||||
G4int i(0);
|
||||
G4int maxE = -1;
|
||||
G4double emax = 0;
|
||||
G4ParticleChange * temp;
|
||||
if(result->GetStatusChange()==fAlive)
|
||||
if(result->GetStatusChange()==isAlive)
|
||||
{
|
||||
temp = dynamic_cast<G4ParticleChange *>(result);
|
||||
if(temp) emax = temp->GetEnergyChange();
|
||||
emax = result->GetEnergyChange();
|
||||
}
|
||||
G4cout << "max energy "<<G4endl;
|
||||
//G4cout << "max energy "<<G4endl;
|
||||
for(i=0;i<result->GetNumberOfSecondaries();i++)
|
||||
{
|
||||
if(result->GetSecondary(i)->GetKineticEnergy()>emax)
|
||||
if(result->GetSecondary(i)->GetParticle()->GetKineticEnergy()>emax)
|
||||
{
|
||||
maxE = i;
|
||||
emax = result->GetSecondary(i)->GetKineticEnergy();
|
||||
emax = result->GetSecondary(i)->GetParticle()->GetKineticEnergy();
|
||||
}
|
||||
}
|
||||
G4cout <<"loop1"<<G4endl;
|
||||
//G4cout <<"loop1"<<G4endl;
|
||||
for(i=0; i<result->GetNumberOfSecondaries(); i++)
|
||||
{
|
||||
G4Track* aSecTrack = result->GetSecondary(i);
|
||||
const G4DynamicParticle* aSecTrack = result->GetSecondary(i)->GetParticle();
|
||||
if(i==maxE)
|
||||
{
|
||||
}
|
||||
@@ -76,8 +74,8 @@
|
||||
nMeson++;
|
||||
}
|
||||
}
|
||||
G4cout << "BiasDebug 1 = "<<result->GetNumberOfSecondaries()<<" "
|
||||
<<nMeson<<" "<< nBaryon<<" "<< npi0<<" "<< ngamma<<" "<< nLepton<<G4endl;
|
||||
//G4cout << "BiasDebug 1 = "<<result->GetNumberOfSecondaries()<<" "
|
||||
// <<nMeson<<" "<< nBaryon<<" "<< npi0<<" "<< ngamma<<" "<< nLepton<<G4endl;
|
||||
G4double mesonWeight = nMeson;
|
||||
G4double baryonWeight = nBaryon;
|
||||
G4double gammaWeight = ngamma;
|
||||
@@ -89,19 +87,19 @@
|
||||
G4int randomPi0 = static_cast<G4int>((npi0+1)*G4UniformRand());
|
||||
G4int randomLepton = static_cast<G4int>((nLepton+1)*G4UniformRand());
|
||||
|
||||
std::vector<G4Track*> buffer;
|
||||
std::vector<G4HadSecondary *> buffer;
|
||||
G4int cMeson(0), cBaryon(0), cpi0(0), cgamma(0), cLepton(0);
|
||||
for(i=0; i<result->GetNumberOfSecondaries(); i++)
|
||||
{
|
||||
G4bool aCatch = false;
|
||||
G4double weight = 1;
|
||||
G4Track* aSecTrack = result->GetSecondary(i);
|
||||
G4HadSecondary * aSecTrack = result->GetSecondary(i);
|
||||
if(i==maxE)
|
||||
{
|
||||
aCatch = true;
|
||||
weight = 1;
|
||||
}
|
||||
else if(aSecTrack->GetDefinition()->GetBaryonNumber()!=0)
|
||||
else if(aSecTrack->GetParticle()->GetDefinition()->GetBaryonNumber()!=0)
|
||||
{
|
||||
if(++cBaryon==randomBaryon)
|
||||
{
|
||||
@@ -109,7 +107,7 @@
|
||||
weight = baryonWeight;
|
||||
}
|
||||
}
|
||||
else if(aSecTrack->GetDefinition()->GetLeptonNumber()!=0)
|
||||
else if(aSecTrack->GetParticle()->GetDefinition()->GetLeptonNumber()!=0)
|
||||
{
|
||||
if(++cLepton==randomLepton)
|
||||
{
|
||||
@@ -117,7 +115,7 @@
|
||||
weight = leptonWeight;
|
||||
}
|
||||
}
|
||||
else if(aSecTrack->GetDefinition()==G4Gamma::Gamma())
|
||||
else if(aSecTrack->GetParticle()->GetDefinition()==G4Gamma::Gamma())
|
||||
{
|
||||
if(++cgamma==randomGamma)
|
||||
{
|
||||
@@ -125,7 +123,7 @@
|
||||
weight = gammaWeight;
|
||||
}
|
||||
}
|
||||
else if(aSecTrack->GetDefinition()==G4PionZero::PionZero())
|
||||
else if(aSecTrack->GetParticle()->GetDefinition()==G4PionZero::PionZero())
|
||||
{
|
||||
if(++cpi0==randomPi0)
|
||||
{
|
||||
@@ -151,14 +149,13 @@
|
||||
delete aSecTrack;
|
||||
}
|
||||
}
|
||||
result->Clear();
|
||||
result->SetNumberOfSecondaries(buffer.size());
|
||||
result->ClearSecondaries();
|
||||
// G4cerr << "pre"<<G4endl;
|
||||
for(i=0;i<static_cast<G4int>(buffer.size());i++)
|
||||
{
|
||||
result->AddSecondary(buffer[i]);
|
||||
}
|
||||
G4cerr << "bias exit"<<G4endl;
|
||||
// G4cerr << "bias exit"<<G4endl;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -36,66 +36,53 @@
|
||||
|
||||
#include "G4HadronInelasticProcess.hh"
|
||||
#include "G4GenericIon.hh"
|
||||
|
||||
G4double G4HadronInelasticProcess::GetMeanFreePath(
|
||||
const G4Track &aTrack,
|
||||
G4double ,
|
||||
G4ForceCondition *)
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4HadronicException.hh"
|
||||
|
||||
void G4HadronInelasticProcess::BuildThePhysicsTable()
|
||||
{
|
||||
const G4DynamicParticle *aParticle = aTrack.GetDynamicParticle();
|
||||
if( aParticle->GetDefinition() != theParticle &&
|
||||
theParticle != G4GenericIon::GenericIon())
|
||||
G4Exception( this->GetProcessName()+
|
||||
" called for "+
|
||||
aParticle->GetDefinition()->GetParticleName() );
|
||||
G4Material *aMaterial = aTrack.GetMaterial();
|
||||
G4int nElements = aMaterial->GetNumberOfElements();
|
||||
|
||||
// returns the mean free path in GEANT4 internal units
|
||||
|
||||
const G4double *theAtomicNumDensityVector =
|
||||
aMaterial->GetAtomicNumDensityVector();
|
||||
|
||||
G4double aTemp = aMaterial->GetTemperature();
|
||||
|
||||
G4double sigma = 0.0;
|
||||
for( G4int i=0; i<nElements; ++i )
|
||||
{
|
||||
G4double xSection =
|
||||
GetMicroscopicCrossSection( aParticle, (*aMaterial->GetElementVector())[i], aTemp);
|
||||
sigma += theAtomicNumDensityVector[i] * xSection;
|
||||
}
|
||||
sigma *= aScaleFactor;
|
||||
theLastCrossSection = sigma;
|
||||
if( sigma > 0.0 )
|
||||
return 1.0/sigma;
|
||||
else
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
void
|
||||
G4HadronInelasticProcess::BuildThePhysicsTable()
|
||||
{
|
||||
if (!theCrossSectionDataStore) {
|
||||
// G4Exception("G4HadronInelasticProcess::BuildThePhysicsTable: "
|
||||
// "no CrossSectionDataStore");
|
||||
if (!G4HadronicProcess::GetCrossSectionDataStore()) {
|
||||
return;
|
||||
}
|
||||
|
||||
theCrossSectionDataStore->BuildPhysicsTable(*theParticle);
|
||||
|
||||
// G4int numberOfElements = G4Element::GetNumberOfElements();
|
||||
// thePhysicsTable = new G4PhysicsTable( numberOfElements );
|
||||
//
|
||||
// // make a PhysicsVector for each element
|
||||
//
|
||||
// static const G4ElementTable *theElementTable = G4Element::GetElementTable();
|
||||
// for( G4int i=0; i<numberOfElements; ++i )
|
||||
// (*thePhysicsTable)(i) =
|
||||
// theCrossSectionData.MakePhysicsVector( *this, *theParticle,
|
||||
// (*theElementTable)[i] );
|
||||
}
|
||||
G4HadronicProcess::GetCrossSectionDataStore()->BuildPhysicsTable(*theParticle);
|
||||
}
|
||||
|
||||
G4HadronInelasticProcess::G4HadronInelasticProcess(
|
||||
const G4String &processName,
|
||||
G4ParticleDefinition *aParticle ) :
|
||||
G4HadronicProcess( processName )
|
||||
{
|
||||
G4HadronicProcess::AddDataSet(new G4HadronInelasticDataSet);
|
||||
theParticle = aParticle;
|
||||
}
|
||||
|
||||
G4HadronInelasticProcess::~G4HadronInelasticProcess() { }
|
||||
|
||||
G4VParticleChange *G4HadronInelasticProcess::
|
||||
PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
|
||||
{
|
||||
if(0==GetLastCrossSection()&&!getenv("DebugNeutronHP"))
|
||||
{
|
||||
G4cerr << "G4HadronInelasticProcess: called for final state, while cross-section was zero"<<G4endl;
|
||||
G4cerr << " Returning empty particle change...."<<G4endl;
|
||||
G4double dummy=0;
|
||||
G4ForceCondition condition;
|
||||
G4double it = GetMeanFreePath(aTrack, dummy, &condition);
|
||||
G4cerr << " current MeanFreePath is "<<it<<G4endl;
|
||||
theParticleChange.Initialize(aTrack);
|
||||
return &theParticleChange;
|
||||
}
|
||||
SetDispatch( this );
|
||||
return G4HadronicProcess::GeneralPostStepDoIt( aTrack, aStep );
|
||||
}
|
||||
|
||||
G4bool G4HadronInelasticProcess::
|
||||
IsApplicable(const G4ParticleDefinition& aP)
|
||||
{
|
||||
return theParticle == &aP || theParticle == G4GenericIon::GenericIon();
|
||||
}
|
||||
|
||||
G4double G4HadronInelasticProcess::GetMicroscopicCrossSection(
|
||||
const G4DynamicParticle *aParticle,
|
||||
const G4Element *anElement,
|
||||
@@ -103,19 +90,15 @@
|
||||
{
|
||||
// returns the microscopic cross section in GEANT4 internal units
|
||||
|
||||
if (!theCrossSectionDataStore) {
|
||||
G4Exception("G4HadronInelasticProcess::GetMicroscopicCrossSection:"
|
||||
if (!G4HadronicProcess::GetCrossSectionDataStore())
|
||||
{
|
||||
throw G4HadronicException(__FILE__, __LINE__,
|
||||
"G4HadronInelasticProcess::GetMicroscopicCrossSection: "
|
||||
"no CrossSectionDataStore");
|
||||
return DBL_MIN;
|
||||
}
|
||||
return theCrossSectionDataStore->GetCrossSection(aParticle, anElement, aTemp);
|
||||
return G4HadronicProcess::GetCrossSectionDataStore()->GetCrossSection(aParticle, anElement, aTemp);
|
||||
|
||||
// G4bool isOutRange;
|
||||
// G4int j = anElement->GetIndex();
|
||||
//
|
||||
// G4double s = (*((*thePhysicsTable)(j))).GetValue(
|
||||
// aParticle->GetTotalMomentum()/GeV, isOutRange );
|
||||
// return s;
|
||||
}
|
||||
|
||||
/* end of file */
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Hadronic Interaction base class
|
||||
// original by H.P. Wellisch
|
||||
// modified by J.L. Chuma, TRIUMF, 21-Mar-1997
|
||||
// Last modified: 04-Apr-1997
|
||||
|
||||
#include "G4HadronicInteraction.hh"
|
||||
|
||||
G4double
|
||||
G4HadronicInteraction::GetMinEnergy(
|
||||
const G4Material *aMaterial, const G4Element *anElement ) const
|
||||
{
|
||||
G4int i;
|
||||
if( IsBlocked(aMaterial) )return 0.*GeV;
|
||||
if( IsBlocked(anElement) )return 0.*GeV;
|
||||
for( i=0; i<theMinCounterElements; ++i )
|
||||
{
|
||||
if( anElement == theMinElements[i] )return theMinEnergyListElements[i];
|
||||
}
|
||||
for( i=0; i<theMinCounter; ++i )
|
||||
{
|
||||
if( aMaterial == theMinMaterials[i] )return theMinEnergyList[i];
|
||||
}
|
||||
if(IsBlocked()) return 0.*GeV;
|
||||
if( verboseLevel > 0 )
|
||||
G4cout << "*** Warning from HadronicInteraction::GetMinEnergy" << G4endl
|
||||
<< " material " << aMaterial->GetName()
|
||||
<< " not found in min energy List" << G4endl;
|
||||
return theMinEnergy;
|
||||
}
|
||||
|
||||
void
|
||||
G4HadronicInteraction::SetMinEnergy(
|
||||
G4double anEnergy,
|
||||
G4Element *anElement )
|
||||
{
|
||||
if( IsBlocked(anElement) )
|
||||
G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
|
||||
<< " The model is not active for the Element "
|
||||
<< anElement->GetName() << "." << G4endl;
|
||||
|
||||
for( G4int i=0; i<theMinCounterElements; ++i )
|
||||
{
|
||||
if( anElement == theMinElements[i] )
|
||||
{
|
||||
theMinEnergyListElements[i] = anEnergy;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( theMinCounterElements == MAX_LIST_SIZE )
|
||||
G4Exception("SetMinEnergy: exceeded size of min energy element List");
|
||||
theMinElements[theMinCounterElements] = anElement;
|
||||
theMinEnergyListElements[theMinCounterElements++] = anEnergy;
|
||||
}
|
||||
|
||||
void
|
||||
G4HadronicInteraction::SetMinEnergy(
|
||||
G4double anEnergy,
|
||||
G4Material *aMaterial )
|
||||
{
|
||||
if( IsBlocked(aMaterial) )
|
||||
G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
|
||||
<< " The model is not active for the Material "
|
||||
<< aMaterial->GetName() << "." << G4endl;
|
||||
|
||||
for( G4int i=0; i<theMinCounter; ++i )
|
||||
{
|
||||
if( aMaterial == theMinMaterials[i] )
|
||||
{
|
||||
theMinEnergyList[i] = anEnergy;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( theMinCounter == MAX_LIST_SIZE )
|
||||
G4Exception("SetMinEnergy: exceeded size of min energy material List");
|
||||
theMinMaterials[theMinCounter] = aMaterial;
|
||||
theMinEnergyList[theMinCounter++] = anEnergy;
|
||||
}
|
||||
|
||||
G4double
|
||||
G4HadronicInteraction::GetMaxEnergy(
|
||||
const G4Material *aMaterial, const G4Element *anElement ) const
|
||||
{
|
||||
G4int i;
|
||||
if( IsBlocked(aMaterial) )return 0.0*GeV;
|
||||
if( IsBlocked(anElement) )return 0.0*GeV;
|
||||
for( i=0; i<theMaxCounterElements; ++i )
|
||||
{
|
||||
if( anElement == theMaxElements[i] )return theMaxEnergyListElements[i];
|
||||
}
|
||||
for( i=0; i<theMaxCounter; ++i )
|
||||
{
|
||||
if( aMaterial == theMaxMaterials[i] )return theMaxEnergyList[i];
|
||||
}
|
||||
if(IsBlocked()) return 0.*GeV;
|
||||
if( verboseLevel > 0 )
|
||||
G4cout << "*** Warning from HadronicInteraction::GetMaxEnergy" << G4endl
|
||||
<< " material " << aMaterial->GetName()
|
||||
<< " not found in min energy List" << G4endl;
|
||||
|
||||
return theMaxEnergy;
|
||||
}
|
||||
|
||||
void
|
||||
G4HadronicInteraction::SetMaxEnergy(
|
||||
G4double anEnergy,
|
||||
G4Element *anElement )
|
||||
{
|
||||
if( IsBlocked(anElement) )
|
||||
G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
|
||||
<< "Warning: The model is not active for the Element "
|
||||
<< anElement->GetName() << "." << G4endl;
|
||||
|
||||
for( G4int i=0; i<theMaxCounterElements; ++i )
|
||||
{
|
||||
if( anElement == theMaxElements[i] )
|
||||
{
|
||||
theMaxEnergyListElements[i] = anEnergy;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( theMaxCounterElements == MAX_LIST_SIZE )
|
||||
G4Exception("SetMaxEnergy: exceeded size of max energy element List");
|
||||
theMaxElements[theMaxCounterElements] = anElement;
|
||||
theMaxEnergyListElements[theMaxCounterElements++] = anEnergy;
|
||||
}
|
||||
|
||||
void
|
||||
G4HadronicInteraction::SetMaxEnergy(
|
||||
G4double anEnergy,
|
||||
G4Material *aMaterial )
|
||||
{
|
||||
if( IsBlocked(aMaterial) )
|
||||
G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
|
||||
<< "Warning: The model is not active for the Material "
|
||||
<< aMaterial->GetName() << "." << G4endl;
|
||||
|
||||
for( G4int i=0; i<theMaxCounter; ++i )
|
||||
{
|
||||
if( aMaterial == theMaxMaterials[i] )
|
||||
{
|
||||
theMaxEnergyList[i] = anEnergy;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( theMaxCounter == MAX_LIST_SIZE )
|
||||
G4Exception("SetMaxEnergy: exceeded size of max energy material List");
|
||||
theMaxMaterials[theMaxCounter] = aMaterial;
|
||||
theMaxEnergyList[theMaxCounter++] = anEnergy;
|
||||
}
|
||||
|
||||
void
|
||||
G4HadronicInteraction::DeActivateFor( G4Material *aMaterial )
|
||||
{
|
||||
if( theBlockedCounter == MAX_LIST_SIZE )
|
||||
G4Exception("DeActivateFor: exceeded size of blocked material List");
|
||||
theBlockedList[ theBlockedCounter++ ] = aMaterial;
|
||||
}
|
||||
|
||||
void
|
||||
G4HadronicInteraction::DeActivateFor( G4Element *anElement )
|
||||
{
|
||||
if( theBlockedCounterElements == MAX_LIST_SIZE )
|
||||
G4Exception("DeActivateFor: exceeded size of blocked elements List");
|
||||
theBlockedListElements[ theBlockedCounterElements++ ] = anElement;
|
||||
}
|
||||
|
||||
G4bool
|
||||
G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const
|
||||
{
|
||||
G4bool tt = false;
|
||||
for( G4int i=0; i<theBlockedCounter; ++i )
|
||||
{
|
||||
if( aMaterial == theBlockedList[i] )
|
||||
{
|
||||
tt = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tt;
|
||||
}
|
||||
|
||||
G4bool
|
||||
G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const
|
||||
{
|
||||
G4bool tt = false;
|
||||
for( G4int i=0; i<theBlockedCounterElements; ++i )
|
||||
{
|
||||
if( anElement == theBlockedListElements[i] )
|
||||
{
|
||||
tt = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tt;
|
||||
}
|
||||
|
||||
/* end of file */
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "G4HadronicInteractionRegistry.hh"
|
||||
#include "G4HadronicInteraction.hh"
|
||||
|
||||
G4HadronicInteractionRegistry G4HadronicInteractionRegistry::
|
||||
theRegistry;
|
||||
|
||||
void G4HadronicInteractionRegistry::
|
||||
RegisterMe(G4HadronicInteraction * aModel)
|
||||
{
|
||||
theRegistry.AddModel(aModel);
|
||||
}
|
||||
|
||||
void G4HadronicInteractionRegistry::
|
||||
RemoveMe(G4HadronicInteraction * aModel)
|
||||
{
|
||||
theRegistry.allModels.erase(std::find(theRegistry.allModels.begin(), theRegistry.allModels.end(), aModel));
|
||||
theRegistry.nModels = theRegistry.allModels.size();
|
||||
}
|
||||
|
||||
G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry()
|
||||
{
|
||||
while(allModels.size()!=0)
|
||||
{
|
||||
delete allModels.front();
|
||||
}
|
||||
}
|
||||
|
||||
void G4HadronicInteractionRegistry::
|
||||
AddModel(G4HadronicInteraction * aModel)
|
||||
{
|
||||
G4bool alreadyThere = false;
|
||||
for(G4int i=0; i<nModels; i++)
|
||||
{
|
||||
if(allModels[i]==aModel)
|
||||
{
|
||||
alreadyThere = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!alreadyThere)
|
||||
{
|
||||
nModels++;
|
||||
allModels.push_back(aModel);
|
||||
}
|
||||
}
|
||||
@@ -31,28 +31,175 @@
|
||||
#include <stdlib.h>
|
||||
#include "G4HadronicProcess.hh"
|
||||
#include "G4EffectiveCharge.hh"
|
||||
#include "G4NoModelFound.hh"
|
||||
#include "G4HadProjectile.hh"
|
||||
#include "G4ElementVector.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4StableIsotopes.hh"
|
||||
#include "G4HadTmpUtil.hh"
|
||||
|
||||
#include "G4HadLeadBias.hh"
|
||||
#include "G4HadronicException.hh"
|
||||
#include "G4HadReentrentException.hh"
|
||||
|
||||
//@@ add model name info, once typeinfo available #include <typeinfo.h>
|
||||
|
||||
G4IsoParticleChange * G4HadronicProcess::theIsoResult = NULL;
|
||||
G4IsoParticleChange * G4HadronicProcess::theOldIsoResult = NULL;
|
||||
G4bool G4HadronicProcess::isoIsEnabled = true;
|
||||
void G4HadronicProcess::EnableIsotopeProductionGlobally() {isoIsEnabled = true;}
|
||||
void G4HadronicProcess::DisableIsotopeProductionGlobally() {isoIsEnabled = false;}
|
||||
|
||||
void G4HadronicProcess::
|
||||
EnableIsotopeProductionGlobally() {isoIsEnabled = true;}
|
||||
|
||||
void G4HadronicProcess::
|
||||
DisableIsotopeProductionGlobally() {isoIsEnabled = false;}
|
||||
|
||||
G4HadronicProcess::G4HadronicProcess( const G4String &processName) :
|
||||
G4VDiscreteProcess( processName )
|
||||
{
|
||||
isoIsOnAnyway = 0;
|
||||
theTotalResult = new G4ParticleChange();
|
||||
theCrossSectionDataStore = new G4CrossSectionDataStore();
|
||||
aScaleFactor = 1;
|
||||
xBiasOn = false;
|
||||
if(getenv("SwitchLeadBiasOn")) theBias.push_back(new G4HadLeadBias());
|
||||
}
|
||||
|
||||
G4HadronicProcess::~G4HadronicProcess()
|
||||
{
|
||||
delete theTotalResult;
|
||||
std::for_each(theProductionModels.begin(),
|
||||
theProductionModels.end(),
|
||||
G4Delete());
|
||||
std::for_each(theBias.begin(),
|
||||
theBias.end(),
|
||||
G4Delete());
|
||||
}
|
||||
|
||||
void G4HadronicProcess::RegisterMe( G4HadronicInteraction *a )
|
||||
{
|
||||
try{GetManagerPointer()->RegisterMe( a );}
|
||||
catch(G4HadronicException & aE)
|
||||
{
|
||||
aE.Report(std::cout);
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"Could not register G4HadronicInteraction");
|
||||
}
|
||||
}
|
||||
|
||||
G4double G4HadronicProcess::
|
||||
GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
|
||||
{
|
||||
G4double sigma = 0.0;
|
||||
try
|
||||
{
|
||||
const G4DynamicParticle *aParticle = aTrack.GetDynamicParticle();
|
||||
if( !IsApplicable(*aParticle->GetDefinition()))
|
||||
{
|
||||
G4cout << "Unrecoverable error: "<<G4endl;
|
||||
G4ProcessManager * it = aParticle->GetDefinition()->GetProcessManager();
|
||||
G4ProcessVector * itv = it->GetProcessList();
|
||||
G4cout <<aParticle->GetDefinition()->GetParticleName()<<
|
||||
" has the following processes:"<<G4endl;
|
||||
for(G4int i=0; i<itv->size(); i++)
|
||||
{
|
||||
G4cout <<" "<<(*itv)[i]->GetProcessName()<<G4endl;
|
||||
}
|
||||
G4cout << "for kinetic energy "<<aParticle->GetKineticEnergy()<<G4endl;
|
||||
G4cout << "and material "<<aTrack.GetMaterial()->GetName()<<G4endl;
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
std::string(this->GetProcessName()+
|
||||
" was called for "+
|
||||
aParticle->GetDefinition()->GetParticleName()).c_str() );
|
||||
}
|
||||
G4Material *aMaterial = aTrack.GetMaterial();
|
||||
G4int nElements = aMaterial->GetNumberOfElements();
|
||||
|
||||
// returns the mean free path in GEANT4 internal units
|
||||
|
||||
const G4double *theAtomicNumDensityVector =
|
||||
aMaterial->GetAtomicNumDensityVector();
|
||||
|
||||
G4double aTemp = aMaterial->GetTemperature();
|
||||
|
||||
for( G4int i=0; i<nElements; ++i )
|
||||
{
|
||||
G4double xSection =
|
||||
GetMicroscopicCrossSection( aParticle, (*aMaterial->GetElementVector())[i], aTemp);
|
||||
sigma += theAtomicNumDensityVector[i] * xSection;
|
||||
}
|
||||
sigma *= aScaleFactor;
|
||||
theLastCrossSection = sigma;
|
||||
}
|
||||
catch(G4HadronicException aR)
|
||||
{
|
||||
aR.Report(G4cout);
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"G4HadronicProcess::GetMeanFreePath failed");
|
||||
}
|
||||
if( sigma > 0.0 )
|
||||
return 1.0/sigma;
|
||||
else
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
G4double G4HadronicProcess::GetDistanceToBoundary(const G4Track & aT)
|
||||
{
|
||||
G4TransportationManager * aTM =
|
||||
G4TransportationManager::GetTransportationManager();
|
||||
G4Navigator * aN = aTM->GetNavigatorForTracking();
|
||||
G4ThreeVector pGlobalPoint = aT.GetStep()->GetPreStepPoint()->GetPosition();
|
||||
G4ThreeVector pDirection = aT.GetMomentumDirection();
|
||||
G4double dummy(0);
|
||||
G4double result = aN->ComputeStep(pGlobalPoint, pDirection, DBL_MAX, dummy);
|
||||
aN->LocateGlobalPointAndSetup(pGlobalPoint);
|
||||
return result;
|
||||
}
|
||||
|
||||
G4Element * G4HadronicProcess::ChooseAandZ(
|
||||
const G4DynamicParticle *aParticle, const G4Material *aMaterial )
|
||||
{
|
||||
static G4bool noIsotopeWiseCrossSections=getenv("GHAD_DISABLE_ISOTOPE_WISE_CROSS_SECTIONS");
|
||||
static G4StableIsotopes theIso;
|
||||
currentZ = 0;
|
||||
currentN = 0;
|
||||
const G4int numberOfElements = aMaterial->GetNumberOfElements();
|
||||
const G4ElementVector *theElementVector = aMaterial->GetElementVector();
|
||||
|
||||
G4int i;
|
||||
if( numberOfElements == 1 )
|
||||
{
|
||||
currentZ = G4double( ((*theElementVector)[0])->GetZ());
|
||||
currentN = (*theElementVector)[0]->GetN();
|
||||
G4int localZ = G4lrint(currentZ);
|
||||
if(noIsotopeWiseCrossSections)
|
||||
{
|
||||
currentN = (*theElementVector)[0]->GetN();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double * running = new G4double[theIso.GetNumberOfIsotopes(localZ)];
|
||||
for (i=0; i<theIso.GetNumberOfIsotopes(localZ); i++)
|
||||
{
|
||||
G4double fracInPercent=theIso.GetAbundance(theIso.GetFirstIsotope(localZ)+i);
|
||||
G4double runningA=theIso.GetIsotopeNucleonCount(theIso.GetFirstIsotope(localZ)+i);
|
||||
running[i]=fracInPercent*pow(runningA, 2./3.);
|
||||
// rough approximation; to get it better, redesign getMSC to not use G4Element, see also below
|
||||
if(i!=0) running[i] += running[i-1];
|
||||
}
|
||||
G4double trial = G4UniformRand();
|
||||
G4double sum = running[theIso.GetNumberOfIsotopes(localZ)-1];
|
||||
for(i=0; i<theIso.GetNumberOfIsotopes(localZ); i++)
|
||||
{
|
||||
currentN = theIso.GetIsotopeNucleonCount(theIso.GetFirstIsotope(localZ)+i);
|
||||
if(running[i]/sum>trial) break;
|
||||
}
|
||||
delete [] running;
|
||||
}
|
||||
targetNucleus.SetParameters(currentN, currentZ);
|
||||
return (*theElementVector)[0];
|
||||
}
|
||||
@@ -60,7 +207,6 @@
|
||||
const G4double *theAtomicNumberDensity = aMaterial->GetAtomicNumDensityVector();
|
||||
G4double aTemp = aMaterial->GetTemperature();
|
||||
G4double crossSectionTotal = 0;
|
||||
G4int i;
|
||||
std::vector<G4double> runningSum;
|
||||
for( i=0; i < numberOfElements; ++i )
|
||||
{
|
||||
@@ -72,16 +218,62 @@
|
||||
G4double random = G4UniformRand();
|
||||
for( i=0; i < numberOfElements; ++i )
|
||||
{
|
||||
if(i!=0) runningSum[i]+=runningSum[i-1];
|
||||
if( random<=runningSum[i]/crossSectionTotal )
|
||||
{
|
||||
currentZ = G4double( ((*theElementVector)[i])->GetZ());
|
||||
currentN = ((*theElementVector)[i])->GetN();
|
||||
targetNucleus.SetParameters(currentN, currentZ);
|
||||
G4int localZ = G4lrint(currentZ);
|
||||
if(noIsotopeWiseCrossSections)
|
||||
{
|
||||
currentN = ((*theElementVector)[i])->GetN();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double * running = new G4double[theIso.GetNumberOfIsotopes(localZ)];
|
||||
for (i=0; i<theIso.GetNumberOfIsotopes(localZ); i++)
|
||||
{
|
||||
G4double fracInPercent=theIso.GetAbundance(theIso.GetFirstIsotope(localZ)+i);
|
||||
G4double runningA=theIso.GetIsotopeNucleonCount(theIso.GetFirstIsotope(localZ)+i);
|
||||
running[i]=fracInPercent*pow(runningA, 2./3.);
|
||||
if(i!=0) running[i] += running[i-1];
|
||||
}
|
||||
G4double trial = G4UniformRand();
|
||||
for(i=0; i<theIso.GetNumberOfIsotopes(localZ); i++)
|
||||
{
|
||||
currentN = theIso.GetIsotopeNucleonCount(theIso.GetFirstIsotope(localZ)+i);
|
||||
if(running[i]/running[theIso.GetNumberOfIsotopes(localZ)-1]>trial) break;
|
||||
}
|
||||
delete [] running;
|
||||
}
|
||||
targetNucleus.SetParameters(currentN, currentZ);
|
||||
return (*theElementVector)[i];
|
||||
}
|
||||
}
|
||||
currentZ = G4double((*theElementVector)[numberOfElements-1]->GetZ());
|
||||
currentN = (*theElementVector)[numberOfElements-1]->GetN();
|
||||
G4int localZ = G4lrint(currentZ);
|
||||
if(noIsotopeWiseCrossSections)
|
||||
{
|
||||
currentN = (*theElementVector)[numberOfElements-1]->GetN();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double * running = new G4double[theIso.GetNumberOfIsotopes(localZ)];
|
||||
for (i=0; i<theIso.GetNumberOfIsotopes(localZ); i++)
|
||||
{
|
||||
G4double fracInPercent=theIso.GetAbundance(theIso.GetFirstIsotope(localZ)+i);
|
||||
G4double runningA=theIso.GetIsotopeNucleonCount(theIso.GetFirstIsotope(localZ)+i);
|
||||
running[i]=fracInPercent*pow(runningA, 2./3.);
|
||||
// rough approximation; to get it better, redesign getMSC to not use G4Element
|
||||
if(i!=0) running[i] += running[i-1];
|
||||
}
|
||||
G4double trial = G4UniformRand();
|
||||
for(i=0; i<theIso.GetNumberOfIsotopes(localZ); i++)
|
||||
{
|
||||
currentN = theIso.GetIsotopeNucleonCount(theIso.GetFirstIsotope(localZ)+i);
|
||||
if(running[i]/running[theIso.GetNumberOfIsotopes(localZ)-1]>trial) break;
|
||||
}
|
||||
delete [] running;
|
||||
}
|
||||
targetNucleus.SetParameters(currentN, currentZ);
|
||||
return (*theElementVector)[numberOfElements-1];
|
||||
}
|
||||
@@ -89,36 +281,106 @@
|
||||
G4VParticleChange *G4HadronicProcess::GeneralPostStepDoIt(
|
||||
const G4Track &aTrack, const G4Step &)
|
||||
{
|
||||
// G4cout << theNumberOfInteractionLengthLeft<<G4endl;
|
||||
const G4DynamicParticle *aParticle = aTrack.GetDynamicParticle();
|
||||
G4Material *aMaterial = aTrack.GetMaterial();
|
||||
G4double kineticEnergy = aParticle->GetKineticEnergy();
|
||||
G4Element * anElement = ChooseAandZ( aParticle, aMaterial );
|
||||
G4double originalEnergy = aParticle->GetKineticEnergy();
|
||||
G4double kineticEnergy = originalEnergy;
|
||||
if(aParticle->GetDefinition()->GetBaryonNumber()>1.5)
|
||||
{
|
||||
kineticEnergy/=aParticle->GetDefinition()->GetBaryonNumber();
|
||||
}
|
||||
G4Element * anElement = 0;
|
||||
try
|
||||
{
|
||||
anElement = ChooseAandZ( aParticle, aMaterial );
|
||||
}
|
||||
catch(G4HadronicException & aR)
|
||||
{
|
||||
aR.Report(G4cout);
|
||||
G4cout << "Unrecoverable error for:"<<G4endl;
|
||||
G4cout << " - Particle energy[GeV] = "<< originalEnergy/GeV<<G4endl;
|
||||
G4cout << " - Material = "<<aMaterial->GetName()<<G4endl;
|
||||
G4cout << " - Particle type = "
|
||||
<<aParticle->GetDefinition()->GetParticleName()<<G4endl;
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"GeneralPostStepDoIt failed on element selection.");
|
||||
}
|
||||
try
|
||||
{
|
||||
theInteraction = ChooseHadronicInteraction( kineticEnergy,
|
||||
aMaterial, anElement );
|
||||
}
|
||||
catch(G4NoModelFound * it)
|
||||
catch(G4HadronicException & aE)
|
||||
{
|
||||
delete it;
|
||||
aE.Report(std::cout);
|
||||
G4cout << "Unrecoverable error for:"<<G4endl;
|
||||
G4cout << " - Particle energy[GeV] = "<< kineticEnergy/GeV<<G4endl;
|
||||
G4cout << " - Particle energy[GeV] = "<< originalEnergy/GeV<<G4endl;
|
||||
G4cout << " - Material = "<<aMaterial->GetName()<<G4endl;
|
||||
G4cout << " - Particle type = "<<aParticle->GetDefinition()->GetParticleName()<<G4endl;
|
||||
G4Exception("GetHadronicProcess: No model found for this energy range");
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"ChooseHadronicInteraction failed.");
|
||||
}
|
||||
G4VParticleChange *result =
|
||||
theInteraction->ApplyYourself( aTrack, targetNucleus);
|
||||
G4HadProjectile thePro(aTrack);
|
||||
|
||||
G4HadFinalState *result = 0;
|
||||
G4int reentryCount = 0;
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
result = theInteraction->ApplyYourself( thePro, targetNucleus);
|
||||
}
|
||||
catch(G4HadReentrentException aR)
|
||||
{
|
||||
aR.Report(G4cout);
|
||||
G4cout << " G4HadronicProcess re-entering the ApplyYourself call for"<<G4endl;
|
||||
G4cout << " - Particle energy[GeV] = "<< originalEnergy/GeV<<G4endl;
|
||||
G4cout << " - Material = "<<aMaterial->GetName()<<G4endl;
|
||||
G4cout << " - Particle type = "<<aParticle->GetDefinition()->GetParticleName()<<G4endl;
|
||||
result = 0; // here would still be leaking...
|
||||
if(reentryCount>100)
|
||||
{
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"GetHadronicProcess: Reentering ApplyYourself too often - GeneralPostStepDoIt failed.");
|
||||
}
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"GetHadronicProcess: GeneralPostStepDoIt failed (Reentering ApplyYourself not yet supported.)");
|
||||
}
|
||||
catch(G4HadronicException aR)
|
||||
{
|
||||
aR.Report(G4cout);
|
||||
G4cout << " G4HadronicProcess failed in ApplyYourself call for"<<G4endl;
|
||||
G4cout << " - Particle energy[GeV] = "<< originalEnergy/GeV<<G4endl;
|
||||
G4cout << " - Material = "<<aMaterial->GetName()<<G4endl;
|
||||
G4cout << " - Particle type = "<<aParticle->GetDefinition()->GetParticleName()<<G4endl;
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"GeneralPostStepDoIt failed.");
|
||||
}
|
||||
}
|
||||
while(!result);
|
||||
if(result->GetStatusChange() == isAlive && thePro.GetDefinition() != aTrack.GetDefinition())
|
||||
{
|
||||
G4DynamicParticle * aP = const_cast<G4DynamicParticle *>(aTrack.GetDynamicParticle());
|
||||
aP->SetDefinition(const_cast<G4ParticleDefinition *>(thePro.GetDefinition()));
|
||||
}
|
||||
result->SetTrafoToLab(thePro.GetTrafoToLab());
|
||||
for(G4int i=0; i<result->GetNumberOfSecondaries(); i++)
|
||||
{
|
||||
G4Track* aSecTrack = result->GetSecondary(i);
|
||||
G4DynamicParticle* aSecTrack = result->GetSecondary(i)->GetParticle();
|
||||
if(aSecTrack->GetDefinition()->GetPDGCharge()>1.5)
|
||||
{
|
||||
G4EffectiveCharge aCalculator;
|
||||
G4double charge = aCalculator.GetCharge(aMaterial, kineticEnergy,
|
||||
G4double charge = aCalculator.GetCharge(aMaterial, aSecTrack->GetKineticEnergy(),
|
||||
aSecTrack->GetDefinition()->GetPDGMass(),
|
||||
aSecTrack->GetDefinition()->GetPDGCharge());
|
||||
(const_cast<G4DynamicParticle *>(aSecTrack->GetDynamicParticle()))->SetCharge(charge);
|
||||
if(getenv("GHADChargeDebug"))
|
||||
{
|
||||
std::cout << "Recoil fractional charge is "
|
||||
<< charge/aSecTrack->GetDefinition()->GetPDGCharge()<<" "
|
||||
<< charge <<" "<<aSecTrack->GetDefinition()->GetPDGCharge()<<std::endl;
|
||||
}
|
||||
aSecTrack->SetCharge(charge);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +389,7 @@
|
||||
G4cout << "HadronicDoitLogging "
|
||||
<< GetProcessName() <<" "
|
||||
<< aParticle->GetDefinition()->GetPDGEncoding()<<" "
|
||||
<< kineticEnergy<<" "
|
||||
<< originalEnergy<<" "
|
||||
<< aParticle->GetMomentum()<<" "
|
||||
<< targetNucleus.GetN()<<" "
|
||||
<< targetNucleus.GetZ()<<" "
|
||||
@@ -141,12 +403,21 @@
|
||||
result = DoIsotopeCounting(result, aTrack, targetNucleus);
|
||||
}
|
||||
}
|
||||
if(getenv("LeadingParticleBiasingActivated")) result = theBias->Bias(result);
|
||||
return result;
|
||||
|
||||
G4double e=aTrack.GetKineticEnergy();
|
||||
if(e<5*GeV)
|
||||
{
|
||||
for(size_t i=0; i<theBias.size(); i++)
|
||||
{
|
||||
result = theBias[i]->Bias(result);
|
||||
}
|
||||
}
|
||||
FillTotalResult(result, aTrack);
|
||||
return theTotalResult;
|
||||
}
|
||||
|
||||
G4VParticleChange * G4HadronicProcess::
|
||||
DoIsotopeCounting(G4VParticleChange * aResult,
|
||||
G4HadFinalState * G4HadronicProcess::
|
||||
DoIsotopeCounting(G4HadFinalState * aResult,
|
||||
const G4Track & aTrack,
|
||||
const G4Nucleus & aNucleus)
|
||||
{
|
||||
@@ -186,7 +457,7 @@
|
||||
G4IsoResult * G4HadronicProcess::
|
||||
ExtractResidualNucleus(const G4Track & ,
|
||||
const G4Nucleus & aNucleus,
|
||||
G4VParticleChange * aResult)
|
||||
G4HadFinalState * aResult)
|
||||
{
|
||||
G4double A = aNucleus.GetN();
|
||||
G4double Z = aNucleus.GetZ();
|
||||
@@ -197,14 +468,14 @@
|
||||
// cash the max
|
||||
for(G4int i=0; i<aResult->GetNumberOfSecondaries(); i++)
|
||||
{
|
||||
G4Track* aSecTrack = aResult->GetSecondary(i);
|
||||
if(bufferA<aSecTrack->GetDefinition()->GetBaryonNumber())
|
||||
G4HadSecondary* aSecTrack = aResult->GetSecondary(i);
|
||||
if(bufferA<aSecTrack->GetParticle()->GetDefinition()->GetBaryonNumber())
|
||||
{
|
||||
bufferA = aSecTrack->GetDefinition()->GetBaryonNumber();
|
||||
bufferZ = aSecTrack->GetDefinition()->GetPDGCharge();
|
||||
bufferA = aSecTrack->GetParticle()->GetDefinition()->GetBaryonNumber();
|
||||
bufferZ = aSecTrack->GetParticle()->GetDefinition()->GetPDGCharge();
|
||||
}
|
||||
Z-=aSecTrack->GetDefinition()->GetPDGCharge();
|
||||
A-=aSecTrack->GetDefinition()->GetBaryonNumber();
|
||||
Z-=aSecTrack->GetParticle()->GetDefinition()->GetPDGCharge();
|
||||
A-=aSecTrack->GetParticle()->GetDefinition()->GetBaryonNumber();
|
||||
}
|
||||
|
||||
// if the fragment was part of the final state, it is
|
||||
@@ -228,5 +499,152 @@
|
||||
return theResult;
|
||||
}
|
||||
|
||||
G4double G4HadronicProcess::
|
||||
XBiasSurvivalProbability()
|
||||
{
|
||||
G4double result = 0;
|
||||
G4double nLTraversed = GetTotalNumberOfInteractionLengthTraversed();
|
||||
G4double biasedProbability = 1.-exp(-nLTraversed);
|
||||
G4double realProbability = 1-exp(-nLTraversed/aScaleFactor);
|
||||
result = (biasedProbability-realProbability)/biasedProbability;
|
||||
return result;
|
||||
}
|
||||
|
||||
G4double G4HadronicProcess::
|
||||
XBiasSecondaryWeight()
|
||||
{
|
||||
G4double result = 0;
|
||||
G4double nLTraversed = GetTotalNumberOfInteractionLengthTraversed();
|
||||
result = 1./aScaleFactor*exp(-nLTraversed/aScaleFactor*(1-1./aScaleFactor));
|
||||
return result;
|
||||
}
|
||||
|
||||
void G4HadronicProcess::FillTotalResult(G4HadFinalState * aR, const G4Track & aT)
|
||||
{
|
||||
// G4cout << "############# Entry debug "
|
||||
// <<GetProcessName()<<" "
|
||||
// <<aT.GetDynamicParticle()->GetDefinition()->GetParticleName()<<" "
|
||||
// <<aT.GetDynamicParticle()<<" "
|
||||
// <<aScaleFactor<<" "
|
||||
// <<aT.GetWeight()<<" "
|
||||
// <<G4endl;
|
||||
theTotalResult->Clear();
|
||||
theTotalResult->SetLocalEnergyDeposit(0.);
|
||||
theTotalResult->Initialize(aT);
|
||||
theTotalResult->SetSecondaryWeightByProcess(true);
|
||||
theTotalResult->SetStatusChange(fAlive);
|
||||
G4double rotation = 2.*pi*G4UniformRand();
|
||||
G4ThreeVector it(0., 0., 1.);
|
||||
/*
|
||||
if(xBiasOn)
|
||||
{
|
||||
G4cout << "BiasDebug "<<GetProcessName()<<" "
|
||||
<<aScaleFactor<<" "
|
||||
<<XBiasSurvivalProbability()<<" "
|
||||
<<XBiasSecondaryWeight()<<" "
|
||||
<<G4endl;
|
||||
}
|
||||
*/
|
||||
if(aR->GetStatusChange()==stopAndKill)
|
||||
{
|
||||
if( xBiasOn && G4UniformRand()<XBiasSurvivalProbability() )
|
||||
{
|
||||
theTotalResult->SetWeightChange( XBiasSurvivalProbability()*aT.GetWeight() );
|
||||
}
|
||||
else
|
||||
{
|
||||
theTotalResult->SetStatusChange(fStopAndKill);
|
||||
theTotalResult->SetEnergyChange( 0.0 );
|
||||
}
|
||||
}
|
||||
else if(aR->GetStatusChange()==suspend)
|
||||
{
|
||||
theTotalResult->SetStatusChange(fSuspend);
|
||||
if(xBiasOn)
|
||||
{
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"Cannot cross-section bias a process that suspends tracks.");
|
||||
}
|
||||
}
|
||||
else if(aR->GetStatusChange()!=stopAndKill )
|
||||
{
|
||||
if(xBiasOn && G4UniformRand()<XBiasSurvivalProbability())
|
||||
{
|
||||
theTotalResult->SetWeightChange( XBiasSurvivalProbability()*aT.GetWeight() );
|
||||
G4double newWeight = aR->GetWeightChange()*aT.GetWeight();
|
||||
G4DynamicParticle * aNew = new G4DynamicParticle(aT.GetDefinition(),
|
||||
aR->GetEnergyChange(),
|
||||
aR->GetMomentumChange());
|
||||
G4HadSecondary * theSec = new G4HadSecondary(aNew, newWeight);
|
||||
aR->AddSecondary(theSec);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double newWeight = aR->GetWeightChange()*aT.GetWeight();
|
||||
theTotalResult->SetWeightChange(newWeight); // This is multiplicative
|
||||
if(aR->GetEnergyChange()>-.5) theTotalResult->SetEnergyChange(aR->GetEnergyChange());
|
||||
G4LorentzVector newDirection(aR->GetMomentumChange().unit(), 1.);
|
||||
newDirection*=aR->GetTrafoToLab();
|
||||
theTotalResult->SetMomentumDirectionChange(newDirection.vect());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "Track status is "<< aR->GetStatusChange()<<G4endl;
|
||||
G4Exception("G4HadronicProcess", "007", FatalException,
|
||||
"use of unsupported track-status.");
|
||||
}
|
||||
|
||||
theTotalResult->SetLocalEnergyDeposit(aR->GetLocalEnergyDeposit());
|
||||
theTotalResult->SetNumberOfSecondaries(aR->GetNumberOfSecondaries());
|
||||
|
||||
for(G4int i=0; i<aR->GetNumberOfSecondaries(); i++)
|
||||
{
|
||||
G4LorentzVector theM = aR->GetSecondary(i)->GetParticle()->Get4Momentum();
|
||||
theM.rotate(rotation, it);
|
||||
theM*=aR->GetTrafoToLab();
|
||||
aR->GetSecondary(i)->GetParticle()->Set4Momentum(theM);
|
||||
G4double time = aR->GetSecondary(i)->GetTime();
|
||||
if(time<0) time = aT.GetGlobalTime();
|
||||
G4Track* track = new G4Track(aR->GetSecondary(i)->GetParticle(),
|
||||
aT.GetGlobalTime(),
|
||||
aT.GetPosition());
|
||||
G4double newWeight = aT.GetWeight()*aR->GetSecondary(i)->GetWeight();
|
||||
//static G4double pinelcount=0;
|
||||
if(xBiasOn) newWeight *= XBiasSecondaryWeight();
|
||||
/* G4cout << "#### ParticleDebug "
|
||||
<<GetProcessName()<<" "
|
||||
<<aR->GetSecondary(i)->GetParticle()->GetDefinition()->GetParticleName()<<" "
|
||||
<<aScaleFactor<<" "
|
||||
<<XBiasSurvivalProbability()<<" "
|
||||
<<XBiasSecondaryWeight()<<" "
|
||||
<<aT.GetWeight()<<" "
|
||||
<<aR->GetSecondary(i)->GetWeight()<<" "
|
||||
<<aR->GetSecondary(i)->GetParticle()<<" "
|
||||
<<G4endl;*/
|
||||
track->SetWeight(newWeight);
|
||||
G4double trackDeb = track->GetKineticEnergy();
|
||||
if( ( trackDeb<0
|
||||
|| (trackDeb>aT.GetKineticEnergy()+1*GeV) ) && getenv("GHADEnergyBalanceDebug") )
|
||||
{
|
||||
G4cout << "Debugging hadronic processes: "<<track->GetKineticEnergy()
|
||||
<<" "<<aT.GetKineticEnergy()
|
||||
<<" "<<GetProcessName()
|
||||
<<" "<<aT.GetDefinition()->GetParticleName()
|
||||
<<G4endl;
|
||||
}
|
||||
/*if(GetProcessName()=="PhotonInelastic")
|
||||
{
|
||||
if(aR->GetSecondary(i)->GetParticle()->GetDefinition()==G4Neutron::NeutronDefinition())
|
||||
{
|
||||
pinelcount+= newWeight;
|
||||
G4cout << "=======> Neutrons from gamma-nuclear "<<pinelcount<<G4endl;
|
||||
}
|
||||
}*/
|
||||
|
||||
theTotalResult->AddSecondary(track);
|
||||
}
|
||||
aR->Clear();
|
||||
return;
|
||||
}
|
||||
/* end of file */
|
||||
|
||||
@@ -1,422 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Hadronic Process: Inelastic Interaction
|
||||
// original by H.P. Wellisch
|
||||
// modified by J.L. Chuma, TRIUMF, 22-Nov-1996
|
||||
// Last modified: 27-Mar-1997
|
||||
// J.P. Wellisch: 23-Apr-97: G4Exception removed
|
||||
// J.P. Wellisch: 24-Apr-97: correction for SetUpPions
|
||||
// Modified by J.L. Chuma, 30-Apr-97: added originalTarget to CalculateMomenta
|
||||
// since TwoBody needed to reset the target particle
|
||||
// J.L. Chuma, 20-Jun-97: Modified CalculateMomenta to correct the decision process
|
||||
// for whether to use GenerateXandPt or TwoCluster
|
||||
// J.L. Chuma, 06-Aug-97: added original incident particle, before Fermi motion and
|
||||
// evaporation effects are included, needed for calculating
|
||||
// self absorption and corrections for single particle spectra
|
||||
// HPW removed misunderstanding of LocalEnergyDeposit, 11.04.98.
|
||||
|
||||
#include "G4InelasticInteraction.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
G4double
|
||||
G4InelasticInteraction::Pmltpc( // used in Cascade functions
|
||||
G4int np, G4int nm, G4int nz, G4int n, G4double b, G4double c )
|
||||
{
|
||||
const G4double expxu = 82.; // upper bound for arg. of exp
|
||||
const G4double expxl = -expxu; // lower bound for arg. of exp
|
||||
G4double npf = 0.0;
|
||||
G4double nmf = 0.0;
|
||||
G4double nzf = 0.0;
|
||||
G4int i;
|
||||
for( i=2; i<=np; i++ )npf += log((double)i);
|
||||
for( i=2; i<=nm; i++ )nmf += log((double)i);
|
||||
for( i=2; i<=nz; i++ )nzf += log((double)i);
|
||||
G4double r;
|
||||
r = std::min( expxu, std::max( expxl, -(np-nm+nz+b)*(np-nm+nz+b)/(2*c*c*n*n)-npf-nmf-nzf ) );
|
||||
return exp(r);
|
||||
}
|
||||
|
||||
G4bool
|
||||
G4InelasticInteraction::MarkLeadingStrangeParticle(
|
||||
const G4ReactionProduct ¤tParticle,
|
||||
const G4ReactionProduct &targetParticle,
|
||||
G4ReactionProduct &leadParticle )
|
||||
{
|
||||
// the following was in GenerateXandPt and TwoCluster
|
||||
// add a parameter to the GenerateXandPt function telling it about the strange particle
|
||||
//
|
||||
// assumes that the original particle was a strange particle
|
||||
//
|
||||
G4bool lead = false;
|
||||
if( (currentParticle.GetMass() >= G4KaonPlus::KaonPlus()->GetPDGMass()) &&
|
||||
(currentParticle.GetDefinition() != G4Proton::Proton()) &&
|
||||
(currentParticle.GetDefinition() != G4Neutron::Neutron()) )
|
||||
{
|
||||
lead = true;
|
||||
leadParticle = currentParticle; // set lead to the incident particle
|
||||
}
|
||||
else if( (targetParticle.GetMass() >= G4KaonPlus::KaonPlus()->GetPDGMass()) &&
|
||||
(targetParticle.GetDefinition() != G4Proton::Proton()) &&
|
||||
(targetParticle.GetDefinition() != G4Neutron::Neutron()) )
|
||||
{
|
||||
lead = true;
|
||||
leadParticle = targetParticle; // set lead to the target particle
|
||||
}
|
||||
return lead;
|
||||
}
|
||||
|
||||
void
|
||||
G4InelasticInteraction::SetUpPions(
|
||||
const G4int np,
|
||||
const G4int nm,
|
||||
const G4int nz,
|
||||
G4FastVector<G4ReactionProduct,128> &vec,
|
||||
G4int &vecLen )
|
||||
{
|
||||
if( np+nm+nz == 0 )return;
|
||||
G4int i;
|
||||
G4ReactionProduct *p;
|
||||
for( i=0; i<np; ++i )
|
||||
{
|
||||
p = new G4ReactionProduct;
|
||||
p->SetDefinition( G4PionPlus::PionPlus() );
|
||||
(G4UniformRand() < 0.5) ? p->SetSide( -1 ) : p->SetSide( 1 );
|
||||
vec.SetElement( vecLen++, p );
|
||||
}
|
||||
for( i=np; i<np+nm; ++i )
|
||||
{
|
||||
p = new G4ReactionProduct;
|
||||
p->SetDefinition( G4PionMinus::PionMinus() );
|
||||
(G4UniformRand() < 0.5) ? p->SetSide( -1 ) : p->SetSide( 1 );
|
||||
vec.SetElement( vecLen++, p );
|
||||
}
|
||||
for( i=np+nm; i<np+nm+nz; ++i )
|
||||
{
|
||||
p = new G4ReactionProduct;
|
||||
p->SetDefinition( G4PionZero::PionZero() );
|
||||
(G4UniformRand() < 0.5) ? p->SetSide( -1 ) : p->SetSide( 1 );
|
||||
vec.SetElement( vecLen++, p );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
G4InelasticInteraction::GetNormalizationConstant(
|
||||
const G4double energy, // MeV, <0 means annihilation channels
|
||||
G4double &n,
|
||||
G4double &anpn )
|
||||
{
|
||||
const G4double expxu = 82.; // upper bound for arg. of exp
|
||||
const G4double expxl = -expxu; // lower bound for arg. of exp
|
||||
const G4int numSec = 60;
|
||||
//
|
||||
// the only difference between the calculation for annihilation channels
|
||||
// and normal is the starting value, iBegin, for the loop below
|
||||
//
|
||||
G4int iBegin = 1;
|
||||
G4double en = energy;
|
||||
if( energy < 0.0 )
|
||||
{
|
||||
iBegin = 2;
|
||||
en *= -1.0;
|
||||
}
|
||||
//
|
||||
// number of total particles vs. centre of mass Energy - 2*proton mass
|
||||
//
|
||||
G4double aleab = log(en/GeV);
|
||||
n = 3.62567 + aleab*(0.665843 + aleab*(0.336514 + aleab*(0.117712 + 0.0136912*aleab)));
|
||||
n -= 2.0;
|
||||
//
|
||||
// normalization constant for kno-distribution
|
||||
//
|
||||
anpn = 0.0;
|
||||
G4double test, temp;
|
||||
for( G4int i=iBegin; i<=numSec; ++i )
|
||||
{
|
||||
temp = pi*i/(2.0*n*n);
|
||||
test = exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(i*i)/(n*n) ) ) );
|
||||
if( temp < 1.0 )
|
||||
{
|
||||
if( test >= 1.0e-10 )anpn += temp*test;
|
||||
}
|
||||
else
|
||||
anpn += temp*test;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
G4InelasticInteraction::CalculateMomenta(
|
||||
G4FastVector<G4ReactionProduct,128> &vec,
|
||||
G4int &vecLen,
|
||||
const G4DynamicParticle *originalIncident, // the original incident particle
|
||||
const G4DynamicParticle *originalTarget,
|
||||
G4ReactionProduct &modifiedOriginal, // Fermi motion and evap. effects included
|
||||
G4Nucleus &targetNucleus,
|
||||
G4ReactionProduct ¤tParticle,
|
||||
G4ReactionProduct &targetParticle,
|
||||
G4bool &incidentHasChanged,
|
||||
G4bool &targetHasChanged,
|
||||
G4bool quasiElastic )
|
||||
{
|
||||
what = originalIncident->GetMomentum();
|
||||
cache = 0;
|
||||
theReactionDynamics.ProduceStrangeParticlePairs( vec, vecLen,
|
||||
modifiedOriginal, originalTarget,
|
||||
currentParticle, targetParticle,
|
||||
incidentHasChanged, targetHasChanged );
|
||||
if( quasiElastic )
|
||||
{
|
||||
theReactionDynamics.TwoBody( vec, vecLen,
|
||||
modifiedOriginal, originalTarget,
|
||||
currentParticle, targetParticle,
|
||||
targetNucleus, targetHasChanged );
|
||||
return;
|
||||
}
|
||||
G4ReactionProduct leadingStrangeParticle;
|
||||
G4bool leadFlag = MarkLeadingStrangeParticle( currentParticle,
|
||||
targetParticle,
|
||||
leadingStrangeParticle );
|
||||
//
|
||||
// Note: the number of secondaries can be reduced in GenerateXandPt and TwoCluster
|
||||
//
|
||||
G4bool finishedGenXPt = false;
|
||||
G4bool annihilation = false;
|
||||
if( originalIncident->GetDefinition()->GetPDGEncoding() < 0 &&
|
||||
currentParticle.GetMass() == 0.0 && targetParticle.GetMass() == 0.0 )
|
||||
{
|
||||
// original was an anti-particle and annihilation has taken place
|
||||
annihilation = true;
|
||||
G4double ekcor = 1.0;
|
||||
G4double ek = originalIncident->GetKineticEnergy();
|
||||
G4double ekOrg = ek;
|
||||
|
||||
const G4double tarmas = originalTarget->GetDefinition()->GetPDGMass();
|
||||
if( ek > 1.0*GeV )ekcor = 1./(ek/GeV);
|
||||
const G4double atomicWeight = targetNucleus.GetN();
|
||||
ek = 2*tarmas + ek*(1.+ekcor/atomicWeight);
|
||||
|
||||
G4double tkin = targetNucleus.Cinema( ek );
|
||||
ek += tkin;
|
||||
ekOrg += tkin;
|
||||
modifiedOriginal.SetKineticEnergy( ekOrg );
|
||||
|
||||
//
|
||||
// evaporation -- re-calculate black track energies
|
||||
// this was Done already just before the cascade
|
||||
//
|
||||
tkin = targetNucleus.EvaporationEffects( ek );
|
||||
ekOrg -= tkin;
|
||||
ekOrg = std::max( 0.0001*GeV, ekOrg );
|
||||
modifiedOriginal.SetKineticEnergy( ekOrg );
|
||||
G4double amas = originalIncident->GetDefinition()->GetPDGMass();
|
||||
G4double et = ekOrg + amas;
|
||||
G4double p = sqrt( abs(et*et-amas*amas) );
|
||||
G4double pp = modifiedOriginal.GetMomentum().mag();
|
||||
if( pp > 0.0 )
|
||||
{
|
||||
G4ThreeVector momentum = modifiedOriginal.GetMomentum();
|
||||
modifiedOriginal.SetMomentum( momentum * (p/pp) );
|
||||
}
|
||||
if( ekOrg <= 0.0001 )
|
||||
{
|
||||
modifiedOriginal.SetKineticEnergy( 0.0 );
|
||||
modifiedOriginal.SetMomentum( 0.0, 0.0, 0.0 );
|
||||
}
|
||||
}
|
||||
const G4double twsup[] = { 1.0, 0.7, 0.5, 0.3, 0.2, 0.1 };
|
||||
G4double rand1 = G4UniformRand();
|
||||
G4double rand2 = G4UniformRand();
|
||||
if( annihilation || (vecLen >= 6) ||
|
||||
(modifiedOriginal.GetKineticEnergy()/GeV >= 1.0) &&
|
||||
(((originalIncident->GetDefinition() == G4KaonPlus::KaonPlus() ||
|
||||
originalIncident->GetDefinition() == G4KaonMinus::KaonMinus() ||
|
||||
originalIncident->GetDefinition() == G4KaonZeroLong::KaonZeroLong() ||
|
||||
originalIncident->GetDefinition() == G4KaonZeroShort::KaonZeroShort()) &&
|
||||
rand1 < 0.5) || rand2 > twsup[vecLen]) )
|
||||
finishedGenXPt =
|
||||
theReactionDynamics.GenerateXandPt( vec, vecLen,
|
||||
modifiedOriginal, originalIncident,
|
||||
currentParticle, targetParticle,
|
||||
targetNucleus, incidentHasChanged,
|
||||
targetHasChanged, leadFlag,
|
||||
leadingStrangeParticle );
|
||||
if( finishedGenXPt )
|
||||
{
|
||||
Rotate(vec, vecLen);
|
||||
return;
|
||||
}
|
||||
G4bool finishedTwoClu = false;
|
||||
if( modifiedOriginal.GetTotalMomentum()/MeV < 1.0 )
|
||||
{
|
||||
for(G4int i=0; i<vecLen; i++) delete vec[i];
|
||||
vecLen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
theReactionDynamics.SuppressChargedPions( vec, vecLen,
|
||||
modifiedOriginal, currentParticle,
|
||||
targetParticle, targetNucleus,
|
||||
incidentHasChanged, targetHasChanged );
|
||||
finishedTwoClu = theReactionDynamics.TwoCluster( vec, vecLen,
|
||||
modifiedOriginal, originalIncident,
|
||||
currentParticle, targetParticle,
|
||||
targetNucleus, incidentHasChanged,
|
||||
targetHasChanged, leadFlag,
|
||||
leadingStrangeParticle );
|
||||
}
|
||||
if( finishedTwoClu )
|
||||
{
|
||||
Rotate(vec, vecLen);
|
||||
return;
|
||||
}
|
||||
//
|
||||
// PNBlackTrackEnergy is the kinetic energy available for
|
||||
// proton/neutron black track particles [was enp(1) in fortran code]
|
||||
// DTABlackTrackEnergy is the kinetic energy available for
|
||||
// deuteron/triton/alpha particles [was enp(3) in fortran code]
|
||||
//const G4double pnCutOff = 0.1;
|
||||
//const G4double dtaCutOff = 0.1;
|
||||
//if( (targetNucleus.GetN() >= 1.5)
|
||||
// && !(incidentHasChanged || targetHasChanged)
|
||||
// && (targetNucleus.GetPNBlackTrackEnergy()/MeV <= pnCutOff)
|
||||
// && (targetNucleus.GetDTABlackTrackEnergy()/MeV <= dtaCutOff) )
|
||||
//{
|
||||
// the atomic weight of the target nucleus is >= 1.5 AND
|
||||
// neither the incident nor the target particles have changed AND
|
||||
// there is no kinetic energy available for either proton/neutron
|
||||
// or for deuteron/triton/alpha black track particles
|
||||
// For diffraction scattering on heavy nuclei use elastic routines instead
|
||||
//G4cerr << "*** Error in G4InelasticInteraction::CalculateMomenta" << G4endl;
|
||||
//G4cerr << "*** the elastic scattering would be better here ***" <<G4endl;
|
||||
//}
|
||||
theReactionDynamics.TwoBody( vec, vecLen,
|
||||
modifiedOriginal, originalTarget,
|
||||
currentParticle, targetParticle,
|
||||
targetNucleus, targetHasChanged );
|
||||
}
|
||||
|
||||
void G4InelasticInteraction::
|
||||
Rotate(G4FastVector<G4ReactionProduct,128> &vec, G4int &vecLen)
|
||||
{
|
||||
G4double rotation = 2.*pi*G4UniformRand();
|
||||
cache = rotation;
|
||||
G4int i;
|
||||
for( i=0; i<vecLen; ++i )
|
||||
{
|
||||
G4ThreeVector momentum = vec[i]->GetMomentum();
|
||||
momentum = momentum.rotate(rotation, what);
|
||||
vec[i]->SetMomentum(momentum);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
G4InelasticInteraction::SetUpChange(
|
||||
G4FastVector<G4ReactionProduct,128> &vec,
|
||||
G4int &vecLen,
|
||||
G4ReactionProduct ¤tParticle,
|
||||
G4ReactionProduct &targetParticle,
|
||||
G4bool &incidentHasChanged )
|
||||
{
|
||||
G4ParticleDefinition *aKaonZL = G4KaonZeroLong::KaonZeroLong();
|
||||
G4ParticleDefinition *aKaonZS = G4KaonZeroShort::KaonZeroShort();
|
||||
G4int i;
|
||||
if( currentParticle.GetDefinition() == aKaonZL )
|
||||
{
|
||||
if( G4UniformRand() <= 0.5 )
|
||||
{
|
||||
currentParticle.SetDefinition( aKaonZS );
|
||||
incidentHasChanged = true;
|
||||
}
|
||||
}
|
||||
else if( currentParticle.GetDefinition() == aKaonZS )
|
||||
{
|
||||
if( G4UniformRand() > 0.5 )
|
||||
{
|
||||
currentParticle.SetDefinition( aKaonZL );
|
||||
incidentHasChanged = true;
|
||||
}
|
||||
}
|
||||
if( targetParticle.GetDefinition() == aKaonZL )
|
||||
{
|
||||
if( G4UniformRand() <= 0.5 )targetParticle.SetDefinition( aKaonZS );
|
||||
}
|
||||
else if( targetParticle.GetDefinition() == aKaonZS )
|
||||
{
|
||||
if( G4UniformRand() > 0.5 )targetParticle.SetDefinition( aKaonZL );
|
||||
}
|
||||
for( i=0; i<vecLen; ++i )
|
||||
{
|
||||
if( vec[i]->GetDefinition() == aKaonZL )
|
||||
{
|
||||
if( G4UniformRand() <= 0.5 )vec[i]->SetDefinition( aKaonZS );
|
||||
}
|
||||
else if( vec[i]->GetDefinition() == aKaonZS )
|
||||
{
|
||||
if( G4UniformRand() > 0.5 )vec[i]->SetDefinition( aKaonZL );
|
||||
}
|
||||
}
|
||||
if( incidentHasChanged )
|
||||
{
|
||||
theParticleChange.SetNumberOfSecondaries( vecLen+2 );
|
||||
G4DynamicParticle* p0 = new G4DynamicParticle;
|
||||
p0->SetDefinition( currentParticle.GetDefinition() );
|
||||
p0->SetMomentum( currentParticle.GetMomentum() );
|
||||
theParticleChange.AddSecondary( p0 );
|
||||
theParticleChange.SetStatusChange( fStopAndKill );
|
||||
theParticleChange.SetEnergyChange( 0.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
theParticleChange.SetNumberOfSecondaries( vecLen+1 );
|
||||
G4double p = currentParticle.GetMomentum().mag()/MeV;
|
||||
G4ThreeVector m = currentParticle.GetMomentum();
|
||||
if( p > DBL_MIN )
|
||||
theParticleChange.SetMomentumChange( m.x()/p, m.y()/p, m.z()/p );
|
||||
else
|
||||
theParticleChange.SetMomentumChange( 0.0, 0.0, 0.0 );
|
||||
|
||||
theParticleChange.SetEnergyChange( currentParticle.GetKineticEnergy() );
|
||||
}
|
||||
if( targetParticle.GetMass() > 0.0 ) // targetParticle can be eliminated in TwoBody
|
||||
{
|
||||
G4DynamicParticle *p1 = new G4DynamicParticle;
|
||||
p1->SetDefinition( targetParticle.GetDefinition() );
|
||||
G4ThreeVector momentum = targetParticle.GetMomentum();
|
||||
momentum = momentum.rotate(cache, what);
|
||||
p1->SetMomentum( momentum );
|
||||
theParticleChange.AddSecondary( p1 );
|
||||
}
|
||||
G4DynamicParticle *p;
|
||||
for( i=0; i<vecLen; ++i )
|
||||
{
|
||||
p = new G4DynamicParticle();
|
||||
p->SetDefinition( vec[i]->GetDefinition() );
|
||||
p->SetMomentum( vec[i]->GetMomentum() );
|
||||
theParticleChange.AddSecondary( p );
|
||||
delete vec[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* end of file */
|
||||
|
||||
Reference in New Issue
Block a user