Import Geant4 10.0.0 source tree
This commit is contained in:
-159
@@ -1,159 +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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
// Author : Gunter Folger Nov 2007
|
||||
// Class Description
|
||||
// Final state production model for theoretical models of hadron inelastic
|
||||
// projectile diffractive scattering in geant4;
|
||||
// Class Description - End
|
||||
//
|
||||
// Modified:
|
||||
|
||||
#include "G4ProjectileDiffractiveChannel.hh"
|
||||
|
||||
#include "G4HadTmpUtil.hh" //lrint
|
||||
#include "G4QHadronVector.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4Lambda.hh"
|
||||
|
||||
//#define debug_getFraction 1
|
||||
//#define debug_scatter 1
|
||||
|
||||
G4ProjectileDiffractiveChannel::G4ProjectileDiffractiveChannel()
|
||||
{
|
||||
theQDiffraction=G4QDiffractionRatio::GetPointer();
|
||||
}
|
||||
|
||||
G4ProjectileDiffractiveChannel::~G4ProjectileDiffractiveChannel()
|
||||
{}
|
||||
|
||||
G4double G4ProjectileDiffractiveChannel::GetFraction(G4Nucleus &theNucleus,
|
||||
const G4DynamicParticle & thePrimary)
|
||||
{
|
||||
G4double ratio;
|
||||
ratio=theQDiffraction->GetRatio(thePrimary.GetTotalMomentum(),
|
||||
thePrimary.GetDefinition()->GetPDGEncoding(),
|
||||
theNucleus.GetZ_asInt(), theNucleus.GetN_asInt() );
|
||||
#ifdef debug_getFraction
|
||||
G4cout << "G4ProjectileDiffractiveChannel::ratio " << ratio << G4endl;
|
||||
#endif
|
||||
|
||||
return ratio;
|
||||
}
|
||||
|
||||
G4KineticTrackVector * G4ProjectileDiffractiveChannel::Scatter(G4Nucleus &theNucleus,
|
||||
const G4DynamicParticle & thePrimary)
|
||||
{
|
||||
|
||||
|
||||
G4int A=theNucleus.GetA_asInt();
|
||||
G4int Z=theNucleus.GetZ_asInt();
|
||||
|
||||
G4ParticleDefinition * pDef=thePrimary.GetDefinition();
|
||||
#ifdef debug_scatter
|
||||
G4cout << " ProjectileDiffractive: A, Z, proj-pdg" <<" "<< A <<" "<<Z
|
||||
<< " "<<" " << pDef->GetParticleName()<< G4endl;
|
||||
#endif
|
||||
|
||||
G4QHadronVector * result(0);
|
||||
G4KineticTrackVector * ktv(0);
|
||||
G4bool tryAgain;
|
||||
|
||||
do {
|
||||
tryAgain = false;
|
||||
result=theQDiffraction->ProjFragment(pDef->GetPDGEncoding(),
|
||||
thePrimary.Get4Momentum(),Z, A-Z);
|
||||
|
||||
if ( result && result->size() > 0 )
|
||||
{
|
||||
ktv=new G4KineticTrackVector();
|
||||
std::vector<G4QHadron *>::iterator i;
|
||||
#ifdef debug_scatter
|
||||
G4int count(0);
|
||||
#endif
|
||||
for (i=result->begin(); i!=result->end(); i++)
|
||||
{
|
||||
G4int pdgCode=(*i)->GetPDGCode();
|
||||
G4ParticleDefinition * secDef(0);
|
||||
if ( pdgCode < 80000000) { // check if ion; should be 90Million, but 89Million is possible
|
||||
secDef= G4ParticleTable::GetParticleTable()->FindParticle(pdgCode);
|
||||
}else {
|
||||
G4int qN = pdgCode % 1000;
|
||||
G4int qZ = (pdgCode/1000) %1000;
|
||||
if ( qZ < 500 && qN < 500){ // protect for delta being coded as/in nucleus
|
||||
secDef = G4ParticleTable::GetParticleTable()->GetIon(qZ,qN+qZ, 0);
|
||||
if ( ! secDef )
|
||||
{ // exceptions to the rule!
|
||||
if ( pdgCode == 90000001 ) secDef= G4Neutron::Neutron();
|
||||
if ( pdgCode == 91000000 ) secDef= G4Lambda::Lambda();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( secDef ){
|
||||
|
||||
G4ThreeVector pos=(*i)->GetPosition(); //GetPosition returns const &
|
||||
G4LorentzVector mom=(*i)->Get4Momentum();
|
||||
|
||||
G4KineticTrack * sPrim=new G4KineticTrack(secDef,
|
||||
(*i)->GetFormationTime(), pos, mom);
|
||||
ktv->push_back(sPrim);
|
||||
|
||||
#ifdef debug_scatter
|
||||
G4cout << "G4ProjectileDiffractive sec # " << ++count << ", "
|
||||
<< "ChipsPDGCode=" << pdgCode << ", "
|
||||
<< secDef->GetParticleName()
|
||||
<< ", time(ns) " << (*i)->GetFormationTime()/ns
|
||||
<< ", pos " << pos
|
||||
<< ", 4mom " << (*i)->Get4Momentum()
|
||||
<< G4endl;
|
||||
#endif
|
||||
} else {
|
||||
#ifdef debug_scatter
|
||||
G4cout << "G4ProjectileDiffractiveChannel: Particle with PDG code "<< pdgCode <<" does not converted!!!"<<G4endl;
|
||||
#endif
|
||||
tryAgain=true;
|
||||
}
|
||||
}
|
||||
std::for_each(result->begin(), result->end(), DeleteQHadron());
|
||||
delete result;
|
||||
result=0;
|
||||
}
|
||||
|
||||
if ( result ) delete result;
|
||||
if ( tryAgain ) { // QDiffraction returned a "difficult" particle in nucleus
|
||||
std::for_each(ktv->begin(), ktv->end(), DeleteKineticTrack());
|
||||
delete ktv;
|
||||
ktv=0;
|
||||
}
|
||||
} while ( ! ktv);
|
||||
|
||||
return ktv;
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: G4QuasiElasticChannel.cc 70688 2013-06-04 09:01:01Z gcosmo $
|
||||
//
|
||||
|
||||
// Author : Gunter Folger March 2007
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "G4Nucleus.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4QuasiElRatios.hh"
|
||||
#include "globals.hh"
|
||||
#include <vector>
|
||||
@@ -114,7 +115,7 @@ G4KineticTrackVector * G4QuasiElasticChannel::Scatter(G4Nucleus &theNucleus,
|
||||
G4double residualNucleusMass;
|
||||
if(resZ)
|
||||
{
|
||||
resDef=G4ParticleTable::GetParticleTable()->FindIon(resZ,resA,0,resZ);
|
||||
resDef=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(resZ,resA,0);
|
||||
residualNucleusMass=resDef->GetPDGMass();
|
||||
}
|
||||
else {
|
||||
@@ -145,7 +146,7 @@ G4KineticTrackVector * G4QuasiElasticChannel::Scatter(G4Nucleus &theNucleus,
|
||||
//return 0; //no scatter
|
||||
scatteredHadron4Mom=thePrimary.Get4Momentum();
|
||||
residualNucleus4Mom=G4LorentzVector(0.,0.,0.,targetNucleusMass);
|
||||
resDef=G4ParticleTable::GetParticleTable()->FindIon(Z,A,0,Z);
|
||||
resDef=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(Z,A,0);
|
||||
}
|
||||
|
||||
#ifdef debug_scatter
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
G4TheoFSGenerator::G4TheoFSGenerator(const G4String& name)
|
||||
: G4HadronicInteraction(name)
|
||||
, theTransport(0), theHighEnergyGenerator(0)
|
||||
, theQuasielastic(0), theProjectileDiffraction(0)
|
||||
, theQuasielastic(0)
|
||||
{
|
||||
theParticleChange = new G4HadFinalState;
|
||||
}
|
||||
@@ -108,39 +108,7 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
|
||||
return theParticleChange;
|
||||
}
|
||||
}
|
||||
if ( theProjectileDiffraction) {
|
||||
|
||||
if ( theProjectileDiffraction->GetFraction(theNucleus, *aPart) > G4UniformRand() )
|
||||
// strictly, this returns fraction on inelastic, so quasielastic should
|
||||
// already be substracted, ie. quasielastic should always be used
|
||||
// before diffractive
|
||||
{
|
||||
//G4cout << "____G4TheoFSGenerator: before Scatter (2) " << G4endl;
|
||||
G4KineticTrackVector *result= theProjectileDiffraction->Scatter(theNucleus, *aPart);
|
||||
//G4cout << "^^^^G4TheoFSGenerator: after Scatter (2) " << G4endl;
|
||||
if (result)
|
||||
{
|
||||
for(unsigned int i=0; i<result->size(); i++)
|
||||
{
|
||||
G4DynamicParticle * aNew =
|
||||
new G4DynamicParticle(result->operator[](i)->GetDefinition(),
|
||||
result->operator[](i)->Get4Momentum().e(),
|
||||
result->operator[](i)->Get4Momentum().vect());
|
||||
theParticleChange->AddSecondary(aNew);
|
||||
delete result->operator[](i);
|
||||
}
|
||||
delete result;
|
||||
|
||||
} else
|
||||
{
|
||||
theParticleChange->SetStatusChange(isAlive);
|
||||
theParticleChange->SetEnergyChange(thePrimary.GetKineticEnergy());
|
||||
theParticleChange->SetMomentumChange(thePrimary.Get4Momentum().vect().unit());
|
||||
|
||||
}
|
||||
return theParticleChange;
|
||||
}
|
||||
}
|
||||
|
||||
G4KineticTrackVector * theInitialResult =
|
||||
theHighEnergyGenerator->Scatter(theNucleus, *aPart);
|
||||
|
||||
@@ -157,7 +125,9 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
|
||||
G4double init_mass= ionTable->GetIonMass(theNucleus.GetZ_asInt(),theNucleus.GetA_asInt());
|
||||
G4double init_E=aPart->Get4Momentum().e();
|
||||
// residual nucleus
|
||||
|
||||
const std::vector<G4Nucleon> & thy = theHighEnergyGenerator->GetWoundedNucleus()->GetNucleons();
|
||||
|
||||
G4int resZ(0),resA(0);
|
||||
G4double delta_m(0);
|
||||
for(size_t them=0; them<thy.size(); them++)
|
||||
@@ -172,6 +142,7 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4double final_mass(0);
|
||||
if ( theNucleus.GetA_asInt() ) {
|
||||
final_mass=ionTable->GetIonMass(theNucleus.GetZ_asInt()-resZ,theNucleus.GetA_asInt()- resA);
|
||||
@@ -183,6 +154,12 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
|
||||
#endif
|
||||
|
||||
G4ReactionProductVector * theTransportResult = NULL;
|
||||
|
||||
// Uzhi Nov. 2012
|
||||
G4V3DNucleus* theProjectileNucleus = theHighEnergyGenerator->GetProjectileNucleus();
|
||||
if(theProjectileNucleus == 0) // Uzhi Nov. 2012
|
||||
{ // Uzhi Nov. 2012
|
||||
|
||||
G4int hitCount = 0;
|
||||
const std::vector<G4Nucleon>& they = theHighEnergyGenerator->GetWoundedNucleus()->GetNucleons();
|
||||
for(size_t them=0; them<they.size(); them++)
|
||||
@@ -208,6 +185,19 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
|
||||
}
|
||||
}
|
||||
|
||||
} else // Uzhi Nov. 2012
|
||||
{ // Uzhi Nov. 2012
|
||||
theTransport->SetPrimaryProjectile(thePrimary);
|
||||
theTransportResult =
|
||||
theTransport->PropagateNuclNucl(theInitialResult,
|
||||
theHighEnergyGenerator->GetWoundedNucleus(),
|
||||
theHighEnergyGenerator->GetProjectileNucleus());
|
||||
if ( !theTransportResult ) {
|
||||
G4cout << "G4TheoFSGenerator: null ptr from transport propagate " << G4endl;
|
||||
throw G4HadronicException(__FILE__, __LINE__, "Null ptr from transport propagate");
|
||||
}
|
||||
} // Uzhi Nov. 2012
|
||||
|
||||
// Fill particle change
|
||||
unsigned int i;
|
||||
for(i=0; i<theTransportResult->size(); i++)
|
||||
|
||||
Reference in New Issue
Block a user