Import Geant4 10.7.2 source tree

This commit is contained in:
Gabriele Cosmo
2021-06-14 10:01:31 +02:00
parent 3dfcdb544e
commit c968e26a39
271 changed files with 26365 additions and 21942 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr02/src/CRMCPiKBuilder.cc
/// \file hadronic/Hadr02/src/CRMCKaonBuilder.cc
/// \brief Implementation of the CRMCKaonBuilder class
//
//
@@ -34,6 +34,7 @@
// Author: 2018 Alberto Ribon
//
// Modified:
// - 21-May-2021 Alberto Ribon : Used the latest Geant4-CRMC interface.
//
//----------------------------------------------------------------------------
//
@@ -47,15 +48,16 @@
#include "G4KaonMinusInelasticProcess.hh"
#include "G4KaonZeroLInelasticProcess.hh"
#include "G4KaonZeroSInelasticProcess.hh"
#include "HadronicInelasticModelCRMC.hh"
#include "G4HadronicParameters.hh"
#include "G4SystemOfUnits.hh"
CRMCKaonBuilder::CRMCKaonBuilder() {
CRMCKaonBuilder::CRMCKaonBuilder( const G4int crmcModelId, const std::string & crmcModelName ) {
fMin = 0.0*MeV; // This value does not matter in practice because we are going
// to use this model only at high energies.
fMax = G4HadronicParameters::Instance()->GetMaxEnergy();
fModel = new G4CRMCModel;
fModel = new HadronicInelasticModelCRMC( crmcModelId, crmcModelName );
}
@@ -93,4 +95,3 @@ void CRMCKaonBuilder::Build( G4KaonZeroSInelasticProcess* aP ) {
}
#endif //G4_USE_CRMC
@@ -34,6 +34,7 @@
// Author: 2018 Alberto Ribon
//
// Modified:
// - 21-May-2021 Alberto Ribon : Used the latest Geant4-CRMC interface.
//
//----------------------------------------------------------------------------
//
@@ -46,24 +47,21 @@
#include "G4NeutronInelasticProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4NeutronRadCapture.hh"
#include "G4LFission.hh"
#include "HadronicInelasticModelCRMC.hh"
#include "G4HadronicParameters.hh"
#include "G4SystemOfUnits.hh"
CRMCNeutronBuilder::CRMCNeutronBuilder() {
CRMCNeutronBuilder::CRMCNeutronBuilder( const G4int crmcModelId, const std::string & crmcModelName ) {
fMin = 0.0*MeV; // For CRMC, this value does not matter in practice because
// we are going to use this model only at high energies.
fMax = G4HadronicParameters::Instance()->GetMaxEnergy();
fModel = new G4CRMCModel;
captureModel = new G4NeutronRadCapture;
fissionModel = new G4LFission;
}
void CRMCNeutronBuilder::Build( G4NeutronInelasticProcess* aP ) {
fModel->SetMinEnergy( fMin );
fModel->SetMaxEnergy( fMax );
aP->RegisterMe( fModel );
fModel = new HadronicInelasticModelCRMC( crmcModelId, crmcModelName );
fCaptureModel = new G4NeutronRadCapture;
fFissionModel = new G4LFission;
}
@@ -73,16 +71,22 @@ CRMCNeutronBuilder::~CRMCNeutronBuilder() {}
void CRMCNeutronBuilder::Build( G4HadronElasticProcess* ) {}
void CRMCNeutronBuilder::Build( G4NeutronInelasticProcess* aP ) {
fModel->SetMinEnergy( fMin );
fModel->SetMaxEnergy( fMax );
aP->RegisterMe( fModel );
}
void CRMCNeutronBuilder::Build( G4HadronFissionProcess* aP ) {
fissionModel->SetMinEnergy( 0.0 );
fissionModel->SetMaxEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() );
aP->RegisterMe( fissionModel );
fFissionModel->SetMinEnergy( 0.0 );
fFissionModel->SetMaxEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() );
aP->RegisterMe( fFissionModel );
}
void CRMCNeutronBuilder::Build( G4HadronCaptureProcess* aP ) {
aP->RegisterMe( captureModel );
aP->RegisterMe( fCaptureModel );
}
#endif //G4_USE_CRMC
@@ -34,6 +34,7 @@
// Author: 2018 Alberto Ribon
//
// Modified:
// - 21-May-2021 Alberto Ribon : Used the latest Geant4-CRMC interface.
//
//----------------------------------------------------------------------------
//
@@ -49,15 +50,16 @@
#include "G4KaonMinusInelasticProcess.hh"
#include "G4KaonZeroLInelasticProcess.hh"
#include "G4KaonZeroSInelasticProcess.hh"
#include "HadronicInelasticModelCRMC.hh"
#include "G4HadronicParameters.hh"
#include "G4SystemOfUnits.hh"
CRMCPiKBuilder::CRMCPiKBuilder() {
CRMCPiKBuilder::CRMCPiKBuilder( const G4int crmcModelId, const std::string & crmcModelName ) {
fMin = 0.0*MeV; // This value does not matter in practice because we are going
// to use this model only at high energies.
fMax = G4HadronicParameters::Instance()->GetMaxEnergy();
fModel = new G4CRMCModel;
fModel = new HadronicInelasticModelCRMC( crmcModelId, crmcModelName );
}
@@ -109,4 +111,3 @@ void CRMCPiKBuilder::Build( G4KaonZeroSInelasticProcess* aP ) {
}
#endif //G4_USE_CRMC
@@ -34,6 +34,7 @@
// Author: 2018 Alberto Ribon
//
// Modified:
// - 21-May-2021 Alberto Ribon : Used the latest Geant4-CRMC interface.
//
//----------------------------------------------------------------------------
//
@@ -45,15 +46,16 @@
#include "G4ProcessManager.hh"
#include "G4PionPlusInelasticProcess.hh"
#include "G4PionMinusInelasticProcess.hh"
#include "HadronicInelasticModelCRMC.hh"
#include "G4HadronicParameters.hh"
#include "G4SystemOfUnits.hh"
CRMCPionBuilder::CRMCPionBuilder() {
CRMCPionBuilder::CRMCPionBuilder( const G4int crmcModelId, const std::string & crmcModelName ) {
fMin = 0.0*MeV; // This value does not matter in practice because we are going
// to use this model only at high energies.
fMax = G4HadronicParameters::Instance()->GetMaxEnergy();
fModel = new G4CRMCModel;
fModel = new HadronicInelasticModelCRMC( crmcModelId, crmcModelName );
}
@@ -77,4 +79,3 @@ void CRMCPionBuilder::Build( G4PionMinusInelasticProcess* aP ) {
}
#endif //G4_USE_CRMC
@@ -34,6 +34,7 @@
// Author: 2018 Alberto Ribon
//
// Modified:
// - 21-May-2021 Alberto Ribon : Used the latest Geant4-CRMC interface.
//
//----------------------------------------------------------------------------
//
@@ -44,15 +45,16 @@
#include "G4ParticleTable.hh"
#include "G4ProcessManager.hh"
#include "G4ProtonInelasticProcess.hh"
#include "HadronicInelasticModelCRMC.hh"
#include "G4HadronicParameters.hh"
#include "G4SystemOfUnits.hh"
CRMCProtonBuilder::CRMCProtonBuilder() {
CRMCProtonBuilder::CRMCProtonBuilder( const G4int crmcModelId, const std::string & crmcModelName ) {
fMin = 0.0*MeV; // This value does not matter in practice because we are going
// to use this model only at high energies.
fMax = G4HadronicParameters::Instance()->GetMaxEnergy();
fModel = new G4CRMCModel();
fModel = new HadronicInelasticModelCRMC( crmcModelId, crmcModelName );
}
@@ -69,4 +71,3 @@ void CRMCProtonBuilder::Build( G4ProtonInelasticProcess* aP ) {
}
#endif //G4_USE_CRMC
@@ -0,0 +1,83 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr02/src/CRMC_FTFP_BERT.cc
/// \brief Implementation of the CRMC_FTFP_BERT class methods
//
//---------------------------------------------------------------------------
//
// ClassName: CRMC_FTFP_BERT
//
// Author: 2018 Alberto Ribon
//
// Modified:
// - 18-May-2021 Alberto Ribon : Migrated to non-templated physics list.
//
//----------------------------------------------------------------------------
//
#include <iomanip>
#include <CLHEP/Units/SystemOfUnits.h>
#include "globals.hh"
#include "G4ios.hh"
#include "CRMC_FTFP_BERT.hh"
#ifdef G4_USE_CRMC
#include "G4DecayPhysics.hh"
#include "G4EmStandardPhysics.hh"
#include "G4EmExtraPhysics.hh"
#include "G4StoppingPhysics.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4NeutronTrackingCut.hh"
#include "HadronPhysicsCRMC_FTFP_BERT.hh"
#include "IonCRMCPhysics.hh"
CRMC_FTFP_BERT::CRMC_FTFP_BERT( G4int ver ) {
if ( ver > 0 ) {
G4cout << "<<< Geant4 Physics List simulation engine: CRMC_FTFP_BERT" << G4endl << G4endl;
}
defaultCutValue = 0.7*CLHEP::mm;
SetVerboseLevel( ver );
RegisterPhysics( new G4EmStandardPhysics( ver ) ); // EM Physics
RegisterPhysics( new G4EmExtraPhysics( ver ) ); // Synchroton Radiation & GN Physics
RegisterPhysics( new G4DecayPhysics( ver ) ); // Decays
RegisterPhysics( new G4HadronElasticPhysics( ver ) ); // Hadron Elastic physics
RegisterPhysics( new HadronPhysicsCRMC_FTFP_BERT( ver ) ); // Hadron Inelastic physics
RegisterPhysics( new G4StoppingPhysics( ver ) ); // Stopping Physics
RegisterPhysics( new IonCRMCPhysics( ver ) ); // Ion Physics
RegisterPhysics( new G4NeutronTrackingCut( ver ) ); // Neutron tracking cut
}
#else //i.e. G4_USE_CRMC not defined
CRMC_FTFP_BERT::CRMC_FTFP_BERT( G4int ) {
G4ExceptionDescription de;
de << "Support for CRMC_FTFP_BERT not enabled" << G4endl;
G4Exception( __FILE__, "CRMC_FTFP_BERT-01", FatalException, de,
"Code should be compiled with G4_USE_CRMC environment variable set." );
}
#endif //G4_USE_CRMC
@@ -1,242 +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. *
// * *
// * Parts of this code which have been developed by Abdel-Waged *
// * et al under contract (31-465) to the King Abdul-Aziz City for *
// * Science and Technology (KACST), the National Centre of *
// * Mathematics and Physics (NCMP), Saudi Arabia. *
// * *
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr02/src/G4UrQMD1_3Model.cc
/// \brief Implementation of the G4CRMCModel class
//
//
//---------------------------------------------------------------------------
//
// ClassName: CRMCNeutronBuilder
//
// Author: 2018 Alberto Ribon
//
// Modified:
//
//----------------------------------------------------------------------------
//
#ifdef G4_USE_CRMC
#include "G4CRMCModel.hh"
#include "globals.hh"
#include "G4DynamicParticle.hh"
#include "G4IonTable.hh"
#include "G4CollisionOutput.hh"
#include "G4V3DNucleus.hh"
#include "G4Track.hh"
#include "G4Nucleus.hh"
#include "G4LorentzRotation.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Version.hh"
#include "G4AntiHe3.hh"
#include "G4AntiDeuteron.hh"
#include "G4AntiTriton.hh"
#include "G4AntiAlpha.hh"
#include <fstream>
#include <string>
#include "G4HadronicParameters.hh"
G4CRMCModel::G4CRMCModel( const int model ) : G4HadronicInteraction( "CRMC" ), verbose( 0 ),
fModel( model ) {
if (verbose > 3) {
G4cout << " >>> G4CRMCModel default constructor" << G4endl;
}
WelcomeMessage();
CurrentEvent = 0;
G4int ranseed = 1234567;
G4cout << "\n seed: " << ranseed << G4endl;
const char* crmc_param = "crmc.param"; // CRMC default, see CRMCoptions.cc in the CRMC package
fInterface = new CRMCinterface;
fInterface->init( model );
// Open FORTRAN IO at first call.
// Notice that the energy unit must be GeV.
fInterface->crmc_init( G4HadronicParameters::Instance()->GetMaxEnergy()/GeV,
ranseed, model, 0, 0, crmc_param, "", 0 );
fParticleTable = G4ParticleTable::GetParticleTable();
fIonTable = fParticleTable->GetIonTable();
}
G4CRMCModel::~G4CRMCModel() {}
/*
const std::pair< G4double, G4double > G4CRMCModel::GetFatalEnergyCheckLevels() const {
// The default in the base class, G4HadronicInteraction, is 2% and 1 GeV .
// Note that when both relative and absolute need fail the final-state is rejected
// and the interaction is re-sampled.
return std::pair< G4double, G4double >( 10.0*perCent, DBL_MAX );
}
*/
G4HadFinalState* G4CRMCModel::ApplyYourself( const G4HadProjectile &theProjectile,
G4Nucleus &theTarget ) {
// Clean up data vectors
gCRMC_data.Clean();
// The original track will always be discontinued and secondaries followed.
fFinalState.Clear();
fFinalState.SetStatusChange( stopAndKill );
// Get relevant information about the projectile and target (A, Z, energy/nuc, momentum, etc)
const G4ParticleDefinition* definitionP = theProjectile.GetDefinition();
G4int AP = G4lrint( definitionP->GetBaryonNumber() );
G4int ZP = G4lrint( definitionP->GetPDGCharge() );
G4int AT = theTarget.GetA_asInt();
G4int ZT = theTarget.GetZ_asInt();
G4int idProj = definitionP->GetPDGEncoding();
G4int idTarg = ZT*10000 + AT*10;
G4ThreeVector pBefore = theProjectile.Get4Momentum().vect();
G4double E = theProjectile.GetTotalEnergy();
G4double totalEbefore = E*AP + theTarget.AtomicMass( AT, ZT ) + theTarget.GetEnergyDeposit();
// Note: because of the rotation of the projectile along the z-axis (made by
// the calling method G4HadronicProcess::PostStepDoIt), it is equivalent
// to take the momentum component along the z-axis or the whole momentum.
G4double pProj = theProjectile.Get4Momentum().vect().mag() / GeV; // Energy unit must be GeV
// Note: from my understanding of the CRMC interface, it seems that in the case
// of nucleus projectile, the energy per nucleon (instead of the energy of
// the whole projectile) should be provided.
// We consider the absolute value of the baryon number to cover also the
// case of anti-nuclei.
if ( std::abs( AP ) > 1 ) pProj /= static_cast< G4double >( std::abs( AP ) ); // Energy per nucleon
G4double pTarg = 0.0;
fInterface->crmc_set( 1, // fNCollision,
pProj, // fCfg.fProjectileMomentum,
pTarg, // fCfg.fTargetMomentum,
idProj, // fCfg.fProjectileId,
idTarg ); // fCfg.fTargetId);
// Sample 1 interaction
fInterface->crmc_generate( 0, // fCfg.fTypoaut,
1, // iColl+1,
gCRMC_data.fNParticles,
gCRMC_data.fImpactParameter,
gCRMC_data.fPartId[0],
gCRMC_data.fPartPx[0],
gCRMC_data.fPartPy[0],
gCRMC_data.fPartPz[0],
gCRMC_data.fPartEnergy[0],
gCRMC_data.fPartMass[0],
gCRMC_data.fPartStatus[0] );
// Save secondary particles for output
for ( G4int i = 0; i < gCRMC_data.fNParticles; i++ ) {
// Keep only final state particles
// (-9 is the beam, 2 is a particle which decayed and 1 is final)
if ( gCRMC_data.fPartStatus[i] != 1 ) continue;
G4ParticleDefinition* pdef = GetParticleDefinition( gCRMC_data.fPartId[i] );
G4DynamicParticle* part = new G4DynamicParticle( pdef,
G4ThreeVector( gCRMC_data.fPartPx[i]*GeV,
gCRMC_data.fPartPy[i]*GeV,
gCRMC_data.fPartPz[i]*GeV ) );
fFinalState.AddSecondary( part );
}
if ( verbose >= 3 ) {
G4double totalEafter = 0.0;
G4ThreeVector totalPafter;
G4double charge = 0.0;
G4int baryon = 0;
G4int nSecondaries = fFinalState.GetNumberOfSecondaries();
for ( G4int j = 0; j < nSecondaries; j++ ) {
totalEafter += fFinalState.GetSecondary(j)->GetParticle()->GetTotalEnergy();
totalPafter += fFinalState.GetSecondary(j)->GetParticle()->GetMomentum();
G4ParticleDefinition* pd = fFinalState.GetSecondary(j)->GetParticle()->GetDefinition();
charge += pd->GetPDGCharge();
baryon += pd->GetBaryonNumber();
}
G4cout << "----------------------------------------" << G4endl
<< "Total energy before collision = " << totalEbefore << " MeV" << G4endl
<< "Total energy after collision = " << totalEafter << " MeV" << G4endl
<< "Total momentum before collision = " << pBefore << " MeV/c" << G4endl
<< "Total momentum after collision = " << totalPafter << " MeV/c" << G4endl;
if ( verbose >= 4 ) {
G4cout << "Total charge before collision = " << (ZP + ZT)*eplus << G4endl
<< "Total charge after collision = " << charge <<G4endl
<< "Total baryon number before collision = " << (AP + AT) << G4endl
<< "Total baryon number after collision = "<< baryon << G4endl;
}
G4cout << "----------------------------------------" << G4endl;
}
return &fFinalState;
}
void G4CRMCModel::WelcomeMessage () const {
G4cout << G4endl
<< " *****************************************************************" << G4endl;
if ( fModel == 0 ) {
G4cout << " CRMC - EPOS LHC " << G4endl;
} else if ( fModel == 1 ) {
G4cout << " CRMC - EPOS 1.99" << G4endl;
} else if ( fModel == 6 ) {
G4cout << " CRMC - SIBYLL 2.3c" << G4endl;
} else if ( fModel == 12 ) {
G4cout << " CRMC - DPMJET 3" << G4endl;
}
G4cout << " *****************************************************************" << G4endl
<< G4endl;
return;
}
G4ParticleDefinition* G4CRMCModel::GetParticleDefinition( long particle_id ) {
// CRMC ion definition : id = crmc_ion_coef_0 + crmc_ion_coef_z*Z + crmc_ion_coef_a*A
const G4int crmc_ion_coef_0 = 1000000000;
const G4int crmc_ion_coef_z = 10000;
const G4int crmc_ion_coef_a = 10;
G4ParticleDefinition* pdef = fParticleTable->FindParticle( particle_id );
if ( ! pdef && particle_id > crmc_ion_coef_0 ) {
int Z = ( particle_id - crmc_ion_coef_0 ) / crmc_ion_coef_z;
int A = ( particle_id - crmc_ion_coef_0 - crmc_ion_coef_z*Z ) / crmc_ion_coef_a;
pdef = fIonTable->GetIon( Z, A );
}
return pdef;
}
#endif //G4_USE_CRMC
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr02/src/HIJING.cc
/// \brief Implementation of the HIJING class methods
//
//---------------------------------------------------------------------------
//
// ClassName:
//
// Author: 2012 Andrea Dotti
// created from FTFP_BERT
//
// Modified:
// - 18-May-2021 Alberto Ribon : Migrated to non-templated physics list.
//
//----------------------------------------------------------------------------
//
#include <iomanip>
#include <CLHEP/Units/SystemOfUnits.h>
#include "globals.hh"
#include "G4ios.hh"
#include "HIJING.hh"
#ifdef G4_USE_HIJING
#include "G4DecayPhysics.hh"
#include "G4EmStandardPhysics.hh"
#include "G4EmExtraPhysics.hh"
#include "G4StoppingPhysics.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4NeutronTrackingCut.hh"
#include "HadronPhysicsHIJING.hh"
#include "IonHIJINGPhysics.hh"
HIJING::HIJING( G4int ver ) {
if ( ver > 0 ) {
G4cout << "<<< Geant4 Physics List simulation engine: HIJING" << G4endl << G4endl;
}
defaultCutValue = 0.7*CLHEP::mm;
SetVerboseLevel( ver );
RegisterPhysics( new G4EmStandardPhysics( ver ) ); // EM Physics
RegisterPhysics( new G4EmExtraPhysics( ver ) ); // Synchroton Radiation & GN Physics
RegisterPhysics( new G4DecayPhysics( ver ) ); // Decays
RegisterPhysics( new G4HadronElasticPhysics( ver ) ); // Hadron Elastic physics
RegisterPhysics( new HadronPhysicsHIJING( ver ) ); // Hadron Inelastic physics
RegisterPhysics( new G4StoppingPhysics( ver ) ); // Stopping Physics
RegisterPhysics( new IonHIJINGPhysics( ver ) ); // Ion Physics
RegisterPhysics( new G4NeutronTrackingCut( ver ) ); // Neutron tracking cut
}
#else //i.e. G4_USE_HIJING not defined
HIJING::HIJING( G4int ) {
G4ExceptionDescription de;
de << "Support for HIJING not enabled" << G4endl;
G4Exception( __FILE__, "HIJING-01", FatalException, de,
"Code should be compiled with G4_USE_HIJING environment variable set." );
}
#endif //G4_USE_HIJING
@@ -23,6 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr02/src/HadronPhysicsCRMC_FTFP_BERT.cc
/// \brief Implementation of the CRMC_FTFP_BERT class methods
//
//
//---------------------------------------------------------------------------
//
@@ -31,6 +34,9 @@
// Authors: 2018 Alberto Ribon
//
// Modified:
// - 18-May-2021 Alberto Ribon : Migrated to newer physics constructor
// and used the latest Geant4-CRMC interface.
//
//----------------------------------------------------------------------------
//
#ifdef G4_USE_CRMC
@@ -43,225 +49,135 @@
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4PionBuilder.hh"
#include "G4FTFPPionBuilder.hh"
#include "CRMCPionBuilder.hh"
#include "G4BertiniPionBuilder.hh"
#include "G4KaonBuilder.hh"
#include "G4FTFPKaonBuilder.hh"
#include "CRMCKaonBuilder.hh"
#include "G4BertiniPionBuilder.hh"
#include "G4BertiniKaonBuilder.hh"
#include "G4FTFPPionBuilder.hh"
#include "G4FTFPKaonBuilder.hh"
#include "CRMCPionBuilder.hh"
#include "CRMCKaonBuilder.hh"
#include "G4ProtonBuilder.hh"
#include "G4BertiniProtonBuilder.hh"
#include "G4FTFPProtonBuilder.hh"
#include "CRMCProtonBuilder.hh"
#include "G4BertiniProtonBuilder.hh"
#include "G4NeutronBuilder.hh"
#include "G4BertiniNeutronBuilder.hh"
#include "G4FTFPNeutronBuilder.hh"
#include "CRMCNeutronBuilder.hh"
#include "G4BertiniNeutronBuilder.hh"
#include "G4HyperonBuilder.hh"
#include "G4HyperonFTFPBuilder.hh"
#include "G4AntiBarionBuilder.hh"
#include "G4FTFPAntiBarionBuilder.hh"
#include "G4MesonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4IonConstructor.hh"
#include "G4ComponentGGHadronNucleusXsc.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4NeutronRadCapture.hh"
#include "G4NeutronInelasticXS.hh"
#include "G4NeutronCaptureXS.hh"
#include "G4CrossSectionInelastic.hh"
#include "G4CrossSectionDataSetRegistry.hh"
#include "G4PhysListUtil.hh"
#include "G4ProcessManager.hh"
#include "G4HadronicParameters.hh"
#include "G4HadParticles.hh"
#include "G4PhysicsConstructorFactory.hh"
//
G4_DECLARE_PHYSCONSTR_FACTORY( HadronPhysicsCRMC_FTFP_BERT );
HadronPhysicsCRMC_FTFP_BERT::HadronPhysicsCRMC_FTFP_BERT( G4int ) :
HadronPhysicsCRMC_FTFP_BERT( "hInelastic CRMC_FTFP_BERT" ) {}
const std::array< std::string, 13 > HadronPhysicsCRMC_FTFP_BERT::modelNames = {
"EPOS-LHC", "EPOS-1.99", "QGSJET-01", "", "", "",
"SIBYLL-2.3", "QGSJETII-04", "", "", "", "QGSJETII-03", "DPMJET-3.06" };
HadronPhysicsCRMC_FTFP_BERT::HadronPhysicsCRMC_FTFP_BERT( const G4String& name ) :
G4VPhysicsConstructor( name ) {
minCRMC = 100.0*GeV;
maxFTFP = 110.0*GeV;
minFTFP = G4HadronicParameters::Instance()->GetMinEnergyTransitionFTF_Cascade();
maxBERT = G4HadronicParameters::Instance()->GetMaxEnergyTransitionFTF_Cascade();
minBERT = 0.0*GeV;
HadronPhysicsCRMC_FTFP_BERT::HadronPhysicsCRMC_FTFP_BERT( G4int )
: HadronPhysicsCRMC_FTFP_BERT( "hInelastic CRMC_FTFP_BERT", false ) {}
HadronPhysicsCRMC_FTFP_BERT::HadronPhysicsCRMC_FTFP_BERT( const G4String& name, G4bool qe )
: G4HadronPhysicsFTFP_BERT( name, qe ) {
model = 0; //***LOOKHERE*** CRMC model: 0:EPOS-LHC, 1:EPOS-1.99, 2:QGSJET:01, 6:SIBYLL-2.3,
// 7:QGSJETII-04, 11:QGSJETII-03, 12:DPMJET-3.06
minCRMC = 100.0*GeV; //***LOOKHERE*** CRMC model is applied only above this projectile lab energy
maxFTFP = 110.0*GeV; //***LOOKHERE*** FTFP model is applied only below this projectile lab energy
}
HadronPhysicsCRMC_FTFP_BERT::~HadronPhysicsCRMC_FTFP_BERT() {
}
void HadronPhysicsCRMC_FTFP_BERT::ConstructParticle() {
G4MesonConstructor pMesonConstructor;
pMesonConstructor.ConstructParticle();
G4BaryonConstructor pBaryonConstructor;
pBaryonConstructor.ConstructParticle();
G4ShortLivedConstructor pShortLivedConstructor;
pShortLivedConstructor.ConstructParticle();
}
void HadronPhysicsCRMC_FTFP_BERT::DumpBanner() {
G4cout << G4endl
<< " CRMC_FTFP_BERT : thresholds for pions, kaons, protons & neutrons " << G4endl
<< "\t BERT : " << minBERT/GeV << " to " << maxBERT/GeV << " GeV" << G4endl
<< "\t FTFP : " << minFTFP/GeV << " to " << maxFTFP/GeV << " GeV" << G4endl
<< "\t CRMC : above " << minCRMC/GeV << " GeV" << G4endl
<< G4endl;
}
void HadronPhysicsCRMC_FTFP_BERT::CreateModels() {
Neutron();
Proton();
Pion();
Kaon();
Others();
}
HadronPhysicsCRMC_FTFP_BERT::~HadronPhysicsCRMC_FTFP_BERT() {}
void HadronPhysicsCRMC_FTFP_BERT::Neutron() {
// General schema:
// 1) Create a builder
// 2) Call AddBuilder
// 3) Configure the builder, possibly with sub-builders
// 4) Call builder->Build()
auto neu = new G4NeutronBuilder;
AddBuilder( neu );
auto epos_n = new CRMCNeutronBuilder;
AddBuilder( epos_n );
epos_n->SetMinEnergy( minCRMC );
neu->RegisterMe( epos_n );
auto ftfp_n = new G4FTFPNeutronBuilder( true );
AddBuilder( ftfp_n );
ftfp_n->SetMinEnergy( minFTFP );
ftfp_n->SetMaxEnergy( maxFTFP );
neu->RegisterMe( ftfp_n );
auto bert_n = new G4BertiniNeutronBuilder;
AddBuilder( bert_n );
bert_n->SetMinEnergy( minBERT );
bert_n->SetMaxEnergy( maxBERT );
neu->RegisterMe( bert_n );
neu->Build();
}
void HadronPhysicsCRMC_FTFP_BERT::Proton() {
auto pro = new G4ProtonBuilder;
AddBuilder( pro );
auto epos_p = new CRMCProtonBuilder;
AddBuilder( epos_p );
epos_p->SetMinEnergy( minCRMC );
pro->RegisterMe( epos_p );
auto ftfp_p = new G4FTFPProtonBuilder( true );
AddBuilder( ftfp_p );
ftfp_p->SetMinEnergy( minFTFP );
ftfp_p->SetMaxEnergy( maxFTFP );
pro->RegisterMe( ftfp_p );
auto bert_p = new G4BertiniProtonBuilder;
AddBuilder( bert_p );
bert_p->SetMinEnergy( minBERT );
bert_p->SetMaxEnergy( maxBERT );
pro->RegisterMe( bert_p );
pro->Build();
}
void HadronPhysicsCRMC_FTFP_BERT::Pion() {
auto pi = new G4PionBuilder;
AddBuilder( pi );
auto epos_pi = new CRMCPionBuilder;
AddBuilder( epos_pi );
epos_pi->SetMinEnergy( minCRMC );
pi->RegisterMe( epos_pi );
auto ftfp_pi = new G4FTFPPionBuilder( true );
AddBuilder( ftfp_pi );
pi->RegisterMe( ftfp_pi );
ftfp_pi->SetMinEnergy( minFTFP );
ftfp_pi->SetMaxEnergy( maxFTFP );
auto bert_pi = new G4BertiniPionBuilder;
AddBuilder( bert_pi );
pi->RegisterMe( bert_pi );
bert_pi->SetMinEnergy( minBERT );
bert_pi->SetMaxEnergy( maxBERT );
pi->Build();
}
void HadronPhysicsCRMC_FTFP_BERT::Kaon() {
auto k = new G4KaonBuilder;
AddBuilder( k );
auto epos_k = new CRMCKaonBuilder;
AddBuilder( epos_k );
epos_k->SetMinEnergy( minCRMC );
k->RegisterMe( epos_k );
auto ftfp_k = new G4FTFPKaonBuilder( true );
AddBuilder( ftfp_k );
k->RegisterMe( ftfp_k );
ftfp_k->SetMinEnergy( minFTFP );
ftfp_k->SetMaxEnergy( maxFTFP );
auto bert_k = new G4BertiniKaonBuilder;
AddBuilder( bert_k );
k->RegisterMe( bert_k );
bert_k->SetMinEnergy( minBERT );
bert_k->SetMaxEnergy( maxBERT );
k->Build();
}
void HadronPhysicsCRMC_FTFP_BERT::Others() {
// Hyperons
auto hyp = new G4HyperonBuilder;
AddBuilder( hyp );
auto ftfp_hyp = new G4HyperonFTFPBuilder;
AddBuilder( ftfp_hyp );
hyp->RegisterMe( ftfp_hyp );
hyp->Build();
// Anti-baryons
auto abar = new G4AntiBarionBuilder;
AddBuilder( abar );
auto ftfp_abar = new G4FTFPAntiBarionBuilder( true );
AddBuilder( ftfp_abar );
abar->RegisterMe( ftfp_abar );
abar->Build();
}
void HadronPhysicsCRMC_FTFP_BERT::ExtraConfiguration() {
// Modify cross sections for kaons
auto xsk = new G4ComponentGGHadronNucleusXsc;
xs_k.Put( xsk );
G4VCrossSectionDataSet* kaonxs = new G4CrossSectionInelastic( xsk );
xs_ds.Push_back( kaonxs );
G4PhysListUtil::FindInelasticProcess( G4KaonMinus::KaonMinus() )->AddDataSet( kaonxs );
G4PhysListUtil::FindInelasticProcess( G4KaonPlus::KaonPlus() )->AddDataSet( kaonxs );
G4PhysListUtil::FindInelasticProcess( G4KaonZeroShort::KaonZeroShort() )->AddDataSet( kaonxs );
G4PhysListUtil::FindInelasticProcess( G4KaonZeroLong::KaonZeroLong() )->AddDataSet( kaonxs );
// Modify Neutrons
auto neutronBuilder = new G4NeutronBuilder;
AddBuilder( neutronBuilder );
auto ftfpnBuilder = new G4FTFPNeutronBuilder( QuasiElastic );
ftfpnBuilder->SetMinEnergy( minFTFP_neutron );
ftfpnBuilder->SetMaxEnergy( maxFTFP );
AddBuilder( ftfpnBuilder );
neutronBuilder->RegisterMe( ftfpnBuilder );
auto bertnBuilder = new G4BertiniNeutronBuilder;
bertnBuilder->SetMaxEnergy( maxBERT_neutron );
AddBuilder( bertnBuilder );
neutronBuilder->RegisterMe( bertnBuilder );
auto crmcnBuilder = new CRMCNeutronBuilder( model, modelNames[model] );
crmcnBuilder->SetMinEnergy( minCRMC );
AddBuilder( crmcnBuilder );
neutronBuilder->RegisterMe( crmcnBuilder );
neutronBuilder->Build();
const G4ParticleDefinition* neutron = G4Neutron::Neutron();
G4HadronicProcess* inel = G4PhysListUtil::FindInelasticProcess( neutron );
if ( inel ) inel->AddDataSet( new G4NeutronInelasticXS );
if ( inel ) inel->AddDataSet( new G4NeutronInelasticXS );
G4HadronicProcess* capture = G4PhysListUtil::FindCaptureProcess( neutron );
if ( capture ) capture->RegisterMe( new G4NeutronRadCapture );
}
void HadronPhysicsCRMC_FTFP_BERT::ConstructProcess() {
if ( G4Threading::IsMasterThread() ) {
DumpBanner();
}
CreateModels();
ExtraConfiguration();
void HadronPhysicsCRMC_FTFP_BERT::Proton() {
auto protonBuilder = new G4ProtonBuilder;
AddBuilder( protonBuilder );
auto ftfppBuilder = new G4FTFPProtonBuilder( QuasiElastic );
ftfppBuilder->SetMinEnergy( minFTFP_proton );
ftfppBuilder->SetMaxEnergy( maxFTFP );
AddBuilder( ftfppBuilder );
protonBuilder->RegisterMe( ftfppBuilder );
auto bertpBuilder = new G4BertiniProtonBuilder;
bertpBuilder->SetMaxEnergy( maxBERT_proton );
AddBuilder( bertpBuilder );
protonBuilder->RegisterMe( bertpBuilder );
auto crmcpBuilder = new CRMCProtonBuilder( model, modelNames[model] );
crmcpBuilder->SetMinEnergy( minCRMC );
AddBuilder( crmcpBuilder );
protonBuilder->RegisterMe( crmcpBuilder );
protonBuilder->Build();
}
void HadronPhysicsCRMC_FTFP_BERT::Pion() {
auto pionBuilder = new G4PionBuilder;
AddBuilder( pionBuilder );
auto ftfppiBuilder = new G4FTFPPionBuilder( QuasiElastic );
ftfppiBuilder->SetMinEnergy( minFTFP_pion );
ftfppiBuilder->SetMaxEnergy( maxFTFP );
AddBuilder( ftfppiBuilder );
pionBuilder->RegisterMe( ftfppiBuilder );
auto bertpiBuilder = new G4BertiniPionBuilder;
bertpiBuilder->SetMaxEnergy( maxBERT_pion );
AddBuilder( bertpiBuilder );
pionBuilder->RegisterMe( bertpiBuilder );
auto crmcpiBuilder = new CRMCPionBuilder( model, modelNames[model] );
crmcpiBuilder->SetMinEnergy( minCRMC );
AddBuilder( crmcpiBuilder );
pionBuilder->RegisterMe( crmcpiBuilder );
pionBuilder->Build();
}
void HadronPhysicsCRMC_FTFP_BERT::Kaon() {
auto kaonBuilder = new G4KaonBuilder;
AddBuilder( kaonBuilder );
auto ftfpkBuilder = new G4FTFPKaonBuilder( QuasiElastic );
ftfpkBuilder->SetMinEnergy( minFTFP_kaon );
ftfpkBuilder->SetMaxEnergy( maxFTFP );
AddBuilder( ftfpkBuilder );
kaonBuilder->RegisterMe( ftfpkBuilder );
auto bertkBuilder = new G4BertiniKaonBuilder;
bertkBuilder->SetMaxEnergy( maxBERT_kaon );
AddBuilder( bertkBuilder );
kaonBuilder->RegisterMe( bertkBuilder );
auto crmckBuilder = new CRMCKaonBuilder( model, modelNames[model] );
crmckBuilder->SetMinEnergy( minCRMC );
AddBuilder( crmckBuilder );
kaonBuilder->RegisterMe( crmckBuilder );
kaonBuilder->Build();
}
#endif //G4_USE_CRMC
@@ -0,0 +1,483 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr02/src/HadronicInelasticModelCRMC.cc
/// \brief Implementation of the HadronicInelasticModelCRMC class methods
//
//
//---------------------------------------------------------------------------
//
#ifdef G4_USE_CRMC
#include "HadronicInelasticModelCRMC.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4ThreeVector.hh"
#include "G4NucleiProperties.hh"
#include "Randomize.hh"
#include <cstdlib>
#include <iostream>
#include <string>
#include <math.h>
#define MAX_ENERGY_LAB_GEV 10000000.
#define MAX_ENERGY_CMS_GEV 30000. // assuming that the target is <=100 times heavier than the projectile
#define IGNORE_PARTICLE_UNKNOWN_PDGID false
#define USE_ENERGY_CORR false
#define ENERGY_NON_CONSERVATION_RESAMPLE false
#define ENERGY_NON_CONSERVATION_EMAX_GEV 0.999
#define ENERGY_NON_CONSERVATION_FRACTION_MAX 0.00001
#define ENERGY_NON_CONSERVATION_FRACTION_MAX_ATTEMPT 10
#define ENERGY_NON_CONSERVATION_FRACTION_MAX_ENERGYTRY ENERGY_NON_CONSERVATION_EMAX_GEV
#define SPLIT_MULTI_NEUTRONS_MAXN 10
#define PARTICLE_MULTI_NEUTRONS_ERRORCODE -1
#define ERROR_REPORT_EMAIL "andrii.tykhonov@SPAMNOTcern.ch"
#define CRMC_CONFIG_FILE_ENV_VARIABLE "CRMC_CONFIG_FILE"
//***********************************
// CRMC ION DEFINITION
// ID = CRMC_ION_COEF_0 +
// CRMC_ION_COEF_Z * Z +
// CRMC_ION_COEF_A * A
//
#define CRMC_ION_COEF_0 1000000000
#define CRMC_ION_COEF_Z 10000
#define CRMC_ION_COEF_A 10
//***********************************
HadronicInelasticModelCRMC::HadronicInelasticModelCRMC(int model, const G4String& modelName):
G4HadronicInteraction(modelName), fPrintDebug(false)
{
SetMaxEnergy(MAX_ENERGY_LAB_GEV * GeV);
//int model = 1; // Epos (use temporary), it is faster
//int model = 12; // Dpmjet
int seed = 123456789;
//int seed = CLHEP::HepRandom::getTheSeed(); // Returns 0 which is invalid
int produce_tables = 0; // CRMC default, see CRMCoptions.cc in the CRMC package
fTypeOutput = 0; // CRMC default, see CRMCoptions.cc in the CRMC package
static std::string crmc_param = GetCrmcParamPath(); //"crmc.param"; // CRMC default, see CRMCoptions.cc in the CRMC package
fInterface = new CRMCinterface();
fInterface->init(model);
// open FORTRAN IO at first call
fInterface->crmc_init(MAX_ENERGY_CMS_GEV,seed,model,produce_tables,fTypeOutput,crmc_param.c_str(),"",0);
// final state
finalState = new G4HadFinalState();
// geant4 particle helpers (tables)
fParticleTable = G4ParticleTable::GetParticleTable();
fIonTable = fParticleTable->GetIonTable();
}
std::string HadronicInelasticModelCRMC::GetCrmcParamPath(){
std::string crmcParamPath = std::getenv(CRMC_CONFIG_FILE_ENV_VARIABLE);
if (crmcParamPath==""){
std::ostringstream errorstr;
errorstr<<"CRMC ERROR: could not find crmc param file, please check "<< CRMC_CONFIG_FILE_ENV_VARIABLE <<" envornoment variable!";
std::string error(errorstr.str());
std::cout<<error<<std::endl;
throw error;
}
std::cout<< "Using CRMC parameter file: " << crmcParamPath << std::endl;
return crmcParamPath;
}
HadronicInelasticModelCRMC::~HadronicInelasticModelCRMC()
{}
G4HadFinalState * HadronicInelasticModelCRMC::ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &targetNucleus){
//* leanup data vectors
gCRMC_data.Clean();
//* cleanup geant4 final state vector
finalState->Clear();
finalState->SetStatusChange(G4HadFinalStateStatus::stopAndKill); // TODO: check: inelastic collisions kills previos particles?
//* git input particles parameters
int id_proj = aTrack.GetDefinition()->GetPDGEncoding();
int id_targ = targetNucleus.GetZ_asInt()*10000 + targetNucleus.GetA_asInt()*10;
double p_proj = aTrack.Get4Momentum().pz() / GeV;
double e_proj = aTrack.Get4Momentum().e() / GeV;
double p_targ = 0.;
double e_targ = G4NucleiProperties::GetNuclearMass(targetNucleus.GetA_asInt(),targetNucleus.GetZ_asInt()) / GeV;
double e_initial = e_proj + e_targ;
// ... bug fix (March 2, 2020 - momentum per nucleon!)
double a_proj = (double)(aTrack.GetDefinition()->GetAtomicMass()); // GetAtomicNumber());
if(a_proj<1.0) a_proj = 1.0; // explanation: if particle is not an ion/proton, the GetAtomicMass returns 0
double a_targ = (double)(targetNucleus.GetA_asInt());
//* DEBUG messages
if(fPrintDebug){
std::cout<<"\n\n\n\n\n\n\n=============================================="<<std::endl;
std::cout<<"Start interaction"<<std::endl;
std::cout<<"id_proj="<<id_proj<<std::endl;
std::cout<<"id_targ="<<id_targ<<std::endl;
std::cout<<"p_proj="<<p_proj<<std::endl;
std::cout<<"p_targ="<<p_targ<<std::endl;
}
// set up input particle type and energy
fInterface->crmc_set(
1, //fNCollision,
p_proj / a_proj, //fCfg.fProjectileMomentum (per nucleon!!!),
p_targ / a_targ, //fCfg.fTargetMomentum (per nucleon!!!),
id_proj, //fCfg.fProjectileId,
id_targ); //fCfg.fTargetId);
//=================================================
// sample 1 interaction until the energy
// conservation is fulfilled
int resample_attampts = 1;
double max_energy_diff = ENERGY_NON_CONSERVATION_EMAX_GEV;
double energy_diff_coef =1.;
double forbid_energy_corr = false;
while(true){
// run one interaction
fInterface->crmc_generate(
fTypeOutput, // fCfg.fTypoaut,
1, // iColl+1,
gCRMC_data.fNParticles,
gCRMC_data.fImpactParameter,
gCRMC_data.fPartId[0],
gCRMC_data.fPartPx[0],
gCRMC_data.fPartPy[0],
gCRMC_data.fPartPz[0],
gCRMC_data.fPartEnergy[0],
gCRMC_data.fPartMass[0],
gCRMC_data.fPartStatus[0]);
// split Z=0 A>1 "particles" into multiple neutrons
SplitMultiNeutrons(gCRMC_data);
// energy check
double e_final =0;
for(int i=0; i<gCRMC_data.fNParticles;i++){
if (gCRMC_data.fPartStatus[i]!=1) continue; // only final state particles
G4ParticleDefinition* pdef;
int Z_test = (gCRMC_data.fPartId[i] - CRMC_ION_COEF_0)/CRMC_ION_COEF_Z;
int A_test = (gCRMC_data.fPartId[i] - CRMC_ION_COEF_0 - CRMC_ION_COEF_Z*Z_test)/CRMC_ION_COEF_A;
if(fPrintDebug){
std::cout<<std::endl;
std::cout<<"**********************************************************************"<<std::endl;
std::cout<<"PDG test: " << gCRMC_data.fPartId[i] << std::endl;
std::cout<<"fIonTable->GetIon(Z_test, A_test) = " << fIonTable->GetIon(Z_test, A_test) << std::endl;
std::cout<<"ParticleTable->FindParticle(gCRMC_data.fPartId[i]) = " << fParticleTable->FindParticle(gCRMC_data.fPartId[i]) << std::endl;
std::cout<<"**********************************************************************"<<std::endl;
}
//pdef = fParticleTable->FindParticle(gCRMC_data.fPartId[i]);
int pdef_errorcode;
pdef = GetParticleDefinition(gCRMC_data.fPartId[i],pdef_errorcode);
if(!pdef && IGNORE_PARTICLE_UNKNOWN_PDGID){
continue;
}
double p2 = std::pow(gCRMC_data.fPartPx[i],2) + std::pow(gCRMC_data.fPartPy[i],2) + std::pow(gCRMC_data.fPartPz[i],2);
double mass = pdef->GetPDGMass()/GeV;
e_final += std::sqrt(mass*mass + p2);
}
// Check if we need to resample again...
double diff = fabs(e_final - e_initial);
if(e_final!=0. && e_initial!=0. && USE_ENERGY_CORR) energy_diff_coef = e_final / e_initial;
if(fPrintDebug){
std::cout<< "# e_initial = " << e_initial << " GeV" << std::endl;
std::cout<< "# e_final = " << e_final << " GeV" << std::endl;
std::cout<< "# energy_diff_coef = " << energy_diff_coef << std::endl;
}
// energy conservation check, if yes
if(!ENERGY_NON_CONSERVATION_RESAMPLE){
// ===== NOCHECK ========== NOCHECK ============== NOCHECK ========
break;
// ===== NOCHECK ========== NOCHECK ============== NOCHECK ========
}
else if(diff<max_energy_diff || diff/e_initial < ENERGY_NON_CONSERVATION_FRACTION_MAX){
// ===== OK ========== OK ============== OK ========
forbid_energy_corr = true;
break; // everything is fine, no need to resample, break the re-sampling loop
// ===== OK ========== OK ============== OK ========
}
else if (resample_attampts<ENERGY_NON_CONSERVATION_FRACTION_MAX_ATTEMPT){
resample_attampts++;
std::cout<< std::endl;
std::cout<< "#==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ====#" << std::endl;
std::cout<< "# #" << std::endl;
std::cout<< "# [HadronicInelasticModelCRMC::ApplyYourself]: Energy non conservation detected: #" << std::endl;
std::cout<< "# e_initial = " << e_initial << " GeV" << std::endl;
std::cout<< "# e_final = " << e_final << " GeV" << std::endl;
std::cout<< "# diff = " << diff << " GeV" << std::endl;
std::cout<< "# Running attempt #" << resample_attampts << std::endl;
std::cout<< "# #" << std::endl;
std::cout<< "#==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ====#" << std::endl;
std::cout<< std::endl;
}
else if (max_energy_diff<ENERGY_NON_CONSERVATION_FRACTION_MAX_ENERGYTRY){
std::cout<< std::endl;
std::cout<< "#==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ====#" << std::endl;
std::cout<< "# reached maximum number of attempts = " << ENERGY_NON_CONSERVATION_FRACTION_MAX_ATTEMPT << " ==> increasing twice the energy threshold!" << std::endl;
max_energy_diff *= 2.;
std::cout<< "# max_energy_diff = " << max_energy_diff << std::endl;
std::cout<< "#==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ====#" << std::endl;
std::cout<< std::endl;
resample_attampts = 1;
}
else{
std::cout<< std::endl;
std::cout<< "#==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ====#" << std::endl;
std::cout<< "# reached maximum number of attempts = " << ENERGY_NON_CONSERVATION_FRACTION_MAX_ATTEMPT << "not resampling any more!" << std::endl;
std::cout<< "#==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ==== WARNING ====#" << std::endl;
std::cout<< std::endl;
// ===== FAIL ========== FAIL ============== FAIl ========
break;
// ===== FAIL ========== FAIL ============== FAIl ========
}
}
// ... finished sampling one interaction
//=================================================
// ... for DEBUG messages
double totalenergy = 0;
double totalz = 0;
double eaftertest0 = 0.;
double eaftertest1 = 0.;
double eaftertest2 = 0.;
// save secondary particles for outputa
for(int i=0; i<gCRMC_data.fNParticles;i++){
//* Keep only final state particles
// .. (-9 is the beam, 2 is a particle which decayed and 1 is final)
if (gCRMC_data.fPartStatus[i]!=1) continue;
if(fPrintDebug){
std::cout<<"\n\nSecondary:"<< std::endl <<
gCRMC_data.fPartId[i] << std::endl <<
gCRMC_data.fPartPx[i] << std::endl <<
gCRMC_data.fPartPy[i] << std::endl <<
gCRMC_data.fPartPz[i] << std::endl <<
gCRMC_data.fPartEnergy[i] << " ENERGY " << std::endl;
}
//G4ParticleDefinition* pdef = fParticleTable->FindParticle(gCRMC_data.fPartId[i]);
int pdef_errorcode;
G4ParticleDefinition* pdef = GetParticleDefinition(gCRMC_data.fPartId[i],pdef_errorcode);
if(!pdef){
if(IGNORE_PARTICLE_UNKNOWN_PDGID){
std::cout<<std::endl;
std::cout<<"********************************************************************************************************"<<std::endl;
std::cout<<" -- WARNING ----------------------------------------------------------------------------------- WARNING -- "<<std::endl;
std::cout<<" [HadronicInelasticModelCRMC] Geant4 could not find particle definition for PDG ID = " << gCRMC_data.fPartId[i] << std::endl;
std::cout<<" [HadronicInelasticModelCRMC] Ignoring this particle. This might cause energy non-conservation!" << std::endl;
std::cout<<" -- WARNING ----------------------------------------------------------------------------------- WARNING -- "<<std::endl;
std::cout<<"********************************************************************************************************"<<std::endl;
continue;
}else{
std::cout<<std::endl;
std::cout<<"********************************************************************************************************"<<std::endl;
std::cout<<" -- ERROR ----------------------------------------------------------------------------------- ERROR -- "<<std::endl;
std::cout<<" [HadronicInelasticModelCRMC] Geant4 could not find particle definition for PDG ID = " << gCRMC_data.fPartId[i] << std::endl;
std::cout<<" [HadronicInelasticModelCRMC] Throwing exception! Please report to: " << ERROR_REPORT_EMAIL << std::endl;
std::cout<<" -- ERROR ----------------------------------------------------------------------------------- ERROR -- "<<std::endl;
std::cout<<"********************************************************************************************************"<<std::endl;
throw;
}
}
double part_e_corr = 1.;
double part_p_corr = 1.;
if(USE_ENERGY_CORR && !forbid_energy_corr && energy_diff_coef!=0){
part_e_corr = 1./energy_diff_coef;
double pbefore2 = std::pow(gCRMC_data.fPartPx[i],2) + std::pow(gCRMC_data.fPartPy[i],2) + std::pow(gCRMC_data.fPartPz[i],2);
double mass2 = std::pow(pdef->GetPDGMass()/GeV,2); //std::pow(gCRMC_data.fPartEnergy[i],2) - pbefore2;
double ebefore2 = pbefore2 + mass2;
double pafter2 = ebefore2 * part_e_corr * part_e_corr - mass2;
if(pbefore2) part_p_corr = std::sqrt(std::fabs(pafter2/pbefore2));
if(fPrintDebug) std::cout<< "part_p_corr="<< part_p_corr << std::endl;
eaftertest0 += std::sqrt(mass2 + pbefore2);
eaftertest1 += std::sqrt(mass2 + pafter2);
}
G4DynamicParticle* part = new G4DynamicParticle(pdef,G4ThreeVector(
gCRMC_data.fPartPx[i]*GeV * part_p_corr,
gCRMC_data.fPartPy[i]*GeV * part_p_corr,
gCRMC_data.fPartPz[i]*GeV * part_p_corr
));
eaftertest2 += part->GetTotalEnergy ();
finalState->AddSecondary(part);
totalenergy += gCRMC_data.fPartEnergy[i];
totalz += gCRMC_data.fPartPz[i];
}
if(fPrintDebug){
std::cout<<"totalenergy (GeV) = " << totalenergy<<std::endl;
std::cout<<"totalz (GeV) = " << totalz<<std::endl;
std::cout<<"initialz (GeV) = " << p_proj + p_targ <<std::endl;
std::cout<<"eaftertest0 = " << eaftertest0 <<std::endl;
std::cout<<"eaftertest1 = " << eaftertest1 <<std::endl;
std::cout<<"eaftertest2 = " << eaftertest2 <<std::endl;
std::cout<<"Finishing interaction: "<<std::endl;
const G4LorentzVector & p1 = aTrack.Get4Momentum ();
std::cout<< "e=" << p1.e()<< " px=" <<p1.px() << " py=" << p1.py() << " pz="<<p1.pz() << std::endl;
std::cout<< aTrack.GetDefinition()->GetAtomicNumber() << std::endl;
std::cout<< aTrack.GetDefinition()->GetPDGCharge() << std::endl;
std::cout<< targetNucleus.GetA_asInt() << std::endl;
std::cout<< targetNucleus.GetZ_asInt() << std::endl;
std::cout<<"Stop interaction"<<std::endl;
std::cout<<"==============================================\n\n\n\n\n\n"<<std::endl;
}
//std::cout<<"finalState->GetNumberOfSecondaries()="<<finalState->GetNumberOfSecondaries()<< std::endl; // Debugging info
return finalState;
}
G4bool HadronicInelasticModelCRMC::IsApplicable (const G4HadProjectile &, G4Nucleus &){
return true;
}
G4ParticleDefinition* HadronicInelasticModelCRMC::GetParticleDefinition(long particle_id,int& error_code){
G4ParticleDefinition* pdef = fParticleTable->FindParticle(particle_id);
if(!pdef && particle_id > CRMC_ION_COEF_0){
int Z = (particle_id - CRMC_ION_COEF_0)/CRMC_ION_COEF_Z;
int A = (particle_id - CRMC_ION_COEF_0 - CRMC_ION_COEF_Z*Z)/CRMC_ION_COEF_A;
if(IsMultiNeutron(Z,A)){
error_code = PARTICLE_MULTI_NEUTRONS_ERRORCODE;
pdef = NULL;
}
else{
pdef = fIonTable->GetIon(Z, A);
}
}
return pdef;
}
bool HadronicInelasticModelCRMC::IsMultiNeutron(int Z, int A){
bool result = false;
if (!Z && A>1){
if(A<= SPLIT_MULTI_NEUTRONS_MAXN){
result = true;
}
else{
std::cout<<" [HadronicInelasticModelCRMC::IsMultiNeutron] ERROR A="<<
A<<" is higher than "<< SPLIT_MULTI_NEUTRONS_MAXN <<
" throwing exception!" << std::endl;
throw;
}
}
return result;
}
void HadronicInelasticModelCRMC::SplitMultiNeutrons(CRMCdata& CRMC_data){
for(int i=0; i<CRMC_data.fNParticles;i++){
// check if it is a final-state secondary particle
if (CRMC_data.fPartStatus[i]!=1) continue;
int pdef_errorcode;
GetParticleDefinition(CRMC_data.fPartId[i],pdef_errorcode);
if(pdef_errorcode!=PARTICLE_MULTI_NEUTRONS_ERRORCODE) continue;
//
int particle_id = gCRMC_data.fPartId[i];
int Z = (particle_id - CRMC_ION_COEF_0)/CRMC_ION_COEF_Z;
int A = (particle_id - CRMC_ION_COEF_0 - CRMC_ION_COEF_Z*Z)/CRMC_ION_COEF_A;
if(Z!=0 || A<2){
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] ERROR consistency check failed! Throwing exception! " << std::endl;
throw;
}
//
std::cout<<std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO splitting the floowing particle into neutrons: " << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO Z = " << Z << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO A = " << A << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO fPartId = " << CRMC_data.fPartId[i] << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO fPartPx = " << CRMC_data.fPartPx[i] << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO fPartPy = " << CRMC_data.fPartPy[i] << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO fPartPz = " << CRMC_data.fPartPz[i] << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO fPartEnergy = " << CRMC_data.fPartEnergy[i] << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO fPartMass = " << CRMC_data.fPartMass[i] << std::endl;
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] INFO fPartStatus = " << CRMC_data.fPartStatus[i] << std::endl;
//
int NEUTRON_PDG_ID = 2112;
G4ParticleDefinition* p_n_def = fParticleTable->FindParticle(NEUTRON_PDG_ID);
double m_n = p_n_def->GetPDGMass()/GeV;
double e_n = CRMC_data.fPartEnergy[i]/A;
int status_n = CRMC_data.fPartStatus[i];
if(e_n<m_n){
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] WARNING neutron energy " <<
e_n << " lower than neutron mass " <<
m_n << " assigning e_n = m_n " << std::endl;
e_n = m_n;
}
double p_tot_before = std::sqrt(
CRMC_data.fPartPx[i]*CRMC_data.fPartPx[i] +
CRMC_data.fPartPy[i]*CRMC_data.fPartPy[i] +
CRMC_data.fPartPz[i]*CRMC_data.fPartPz[i]
);
double p_tot_after = std::sqrt(e_n*e_n - m_n*m_n);
double px_n = 0;
double py_n = 0;
double pz_n = 0;
if (p_tot_before>0. && p_tot_after>0.){
px_n = CRMC_data.fPartPx[i] * p_tot_after / p_tot_before;
py_n = CRMC_data.fPartPy[i] * p_tot_after / p_tot_before;
pz_n = CRMC_data.fPartPz[i] * p_tot_after / p_tot_before;
}
for(int j=0;j<A;j++){
int i_neutron = j ? CRMC_data.fNParticles+j : i;
CRMC_data.fPartId[i_neutron] = NEUTRON_PDG_ID;
CRMC_data.fPartPx[i_neutron] = px_n;
CRMC_data.fPartPy[i_neutron] = py_n;
CRMC_data.fPartPz[i_neutron] = pz_n;
CRMC_data.fPartEnergy[i_neutron] = e_n;
CRMC_data.fPartMass[i_neutron] = m_n;
CRMC_data.fPartStatus[i_neutron] = status_n;
}
CRMC_data.fNParticles+=A-1;
//
std::cout<<" [HadronicInelasticModelCRMC::SplitMultiNeutrons] done for a particle. " << std::endl;
std::cout<<std::endl;
}
}
#endif //G4_USE_CRMC
@@ -34,8 +34,9 @@
// Author: 2018 Alberto Ribon
//
// Modified:
// - 18-May-2021 Alberto Ribon : Used the latest Geant4-CRMC interface.
//
// ------------------------------------------------------------
//---------------------------------------------------------------------------
//
#ifdef G4_USE_CRMC
@@ -60,7 +61,7 @@
#include "G4HadronicInteraction.hh"
#include "G4BuilderType.hh"
#include "G4HadronicInteractionRegistry.hh"
#include "G4CRMCModel.hh"
#include "HadronicInelasticModelCRMC.hh"
#include "G4HadronicParameters.hh"
using namespace std;
@@ -70,32 +71,21 @@ using namespace std;
//
G4_DECLARE_PHYSCONSTR_FACTORY( IonCRMCPhysics );
G4ThreadLocal G4bool IonCRMCPhysics::wasActivated = false;
G4ThreadLocal G4BinaryLightIonReaction* IonCRMCPhysics::theIonBC = 0;
G4ThreadLocal G4HadronicInteraction* IonCRMCPhysics::theFTFP = 0;
G4ThreadLocal G4VCrossSectionDataSet* IonCRMCPhysics::theNuclNuclData = 0;
G4ThreadLocal G4VComponentCrossSection* IonCRMCPhysics::theGGNuclNuclXS = 0;
G4ThreadLocal G4FTFBuilder* IonCRMCPhysics::theBuilder = 0;
G4ThreadLocal G4CRMCModel* IonCRMCPhysics::theCRMC = 0;
const std::array< std::string, 13 > IonCRMCPhysics::fModelNames = {
"EPOS-LHC", "EPOS-1.99", "QGSJET-01", "", "", "",
"SIBYLL-2.3", "QGSJETII-04", "", "", "", "QGSJETII-03", "DPMJET-3.06" };
IonCRMCPhysics::IonCRMCPhysics( G4int ver ) : G4VPhysicsConstructor( "ionInelasticCRMC"),
verbose( ver ) {
IonCRMCPhysics::IonCRMCPhysics( G4int ver ) : G4VPhysicsConstructor( "ionInelasticCRMC" ) {
fModel = 0; //***LOOKHERE*** CRMC model: 0:EPOS-LHC, 1:EPOS-1.99, 2:QGSJET:01, 6:SIBYLL-2.3,
// 7:QGSJETII-04, 11:QGSJETII-03, 12:DPMJET-3.06
fVerbose = ver;
if ( fVerbose > 1 ) G4cout << "### IonCRMCPhysics" << G4endl;
SetPhysicsType( bIons );
if ( verbose > 1 ) G4cout << "### G4IonPhysics" << G4endl;
}
IonCRMCPhysics::~IonCRMCPhysics() {
// Explictly setting pointers to zero is actually needed.
// These are static variables, in case we restart threads we need to re-create objects
delete theCRMC; theCRMC = 0;
delete theBuilder; theBuilder = 0;
delete theGGNuclNuclXS; theGGNuclNuclXS = 0;
delete theNuclNuclData; theNuclNuclData = 0;
delete theIonBC; theIonBC = 0;
delete theFTFP; theFTFP = 0;
}
IonCRMCPhysics::~IonCRMCPhysics() {}
void IonCRMCPhysics::ConstructParticle() {
@@ -106,51 +96,48 @@ void IonCRMCPhysics::ConstructParticle() {
void IonCRMCPhysics::ConstructProcess() {
if ( wasActivated ) return;
wasActivated = true;
fModel = 0; //***LOOKHERE*** 0:EPOS-LHC, 1:EPOS-1.99, 2:QGSJET:01, 6:SIBYLL-2.3,
// 7:QGSJETII-04, 11:QGSJETII-03, 12:DPMJET-3.06
const G4double minCRMC = 100.0*GeV; //***LOOKHERE*** CRMC model is applied only above this projectile lab energy per nucleon
const G4double maxFTFP = 110.0*GeV; //***LOOKHERE*** FTFP model is applied only below this projectile lab energy per nucleon
G4HadronicInteraction* p = G4HadronicInteractionRegistry::Instance()->FindModel( "PRECO" );
G4PreCompoundModel* thePreCompound = static_cast< G4PreCompoundModel* >( p );
if ( ! thePreCompound ) thePreCompound = new G4PreCompoundModel;
// Transition energies per nucleon
const G4double minCRMC = 100.0*GeV;
const G4double maxFTFP = 110.0*GeV;
const G4double minFTFP = 2.0*GeV;
const G4double maxBIC = 4.0*GeV;
const G4double minBIC = 0.0*GeV;
// Binary Cascade
theIonBC = new G4BinaryLightIonReaction( thePreCompound );
theIonBC->SetMinEnergy( minBIC );
theIonBC->SetMaxEnergy( maxBIC );
G4HadronicInteraction* theIonBC = new G4BinaryLightIonReaction( thePreCompound );
theIonBC->SetMinEnergy( 0.0 );
theIonBC->SetMaxEnergy( G4HadronicParameters::Instance()->GetMaxEnergyTransitionFTF_Cascade() );
// FTFP
theBuilder = new G4FTFBuilder( "FTFP", thePreCompound );
theFTFP = theBuilder->GetModel();
theFTFP->SetMinEnergy( minFTFP );
G4FTFBuilder theBuilder( "FTFP", thePreCompound );
G4HadronicInteraction* theFTFP = theBuilder.GetModel();
theFTFP->SetMinEnergy( G4HadronicParameters::Instance()->GetMinEnergyTransitionFTF_Cascade() );
theFTFP->SetMaxEnergy( maxFTFP );
// CRMC
theCRMC = new G4CRMCModel;
G4HadronicInteraction* theCRMC = new HadronicInelasticModelCRMC( fModel, fModelNames[fModel] );
theCRMC->SetMinEnergy( minCRMC );
theCRMC->SetMaxEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() );
// Cross section
theNuclNuclData = new G4CrossSectionInelastic( theGGNuclNuclXS = new G4ComponentGGNuclNuclXsc );
G4CrossSectionInelastic* theXS = new G4CrossSectionInelastic( new G4ComponentGGNuclNuclXsc );
// Processes
AddProcess( "dInelastic", G4Deuteron::Deuteron(), false );
AddProcess( "tInelastic", G4Triton::Triton(), false );
AddProcess( "He3Inelastic", G4He3::He3(), true );
AddProcess( "alphaInelastic", G4Alpha::Alpha(), true );
AddProcess( "ionInelastic", G4GenericIon::GenericIon(), true );
if ( verbose > 1 ) G4cout << "G4IonPhysics::ConstructProcess done! " << G4endl;
AddProcess( "dInelastic", G4Deuteron::Deuteron(), theIonBC, theFTFP, theCRMC , theXS );
AddProcess( "tInelastic", G4Triton::Triton(), theIonBC, theFTFP, theCRMC , theXS );
AddProcess( "He3Inelastic", G4He3::He3(), theIonBC, theFTFP, theCRMC , theXS );
AddProcess( "alphaInelastic", G4Alpha::Alpha(), theIonBC, theFTFP, theCRMC , theXS );
AddProcess( "ionInelastic", G4GenericIon::GenericIon(), theIonBC, theFTFP, theCRMC , theXS );
if ( fVerbose > 1 ) G4cout << "IonCRMCPhysics::ConstructProcess done! " << G4endl;
}
void IonCRMCPhysics::AddProcess( const G4String& name, G4ParticleDefinition* part, G4bool ) {
void IonCRMCPhysics::AddProcess( const G4String& name, G4ParticleDefinition* part,
G4HadronicInteraction* theIonBC, G4HadronicInteraction* theFTFP,
G4HadronicInteraction* theCRMC, G4VCrossSectionDataSet* xs ) {
G4HadronInelasticProcess* hadi = new G4HadronInelasticProcess( name, part );
G4ProcessManager* pManager = part->GetProcessManager();
pManager->AddDiscreteProcess( hadi );
hadi->AddDataSet( theNuclNuclData );
hadi->RegisterMe( theIonBC );
hadi->RegisterMe( theFTFP );
hadi->RegisterMe( theCRMC );
if ( xs ) hadi->AddDataSet( xs );
if ( theIonBC) hadi->RegisterMe( theIonBC );
if ( theFTFP ) hadi->RegisterMe( theFTFP );
if ( theCRMC ) hadi->RegisterMe( theCRMC );
}
#endif //G4_USE_CRMC
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/// \file hadronic/Hadr02/src/UrQMD.cc
/// \brief Implementation of the UrQMD class methods
//
//---------------------------------------------------------------------------
//
// ClassName:
//
// Author: 2012 Andrea Dotti
// created from FTFP_BERT
//
// Modified:
// - 18-May-2021 Alberto Ribon : Migrated to non-templated physics list.
//
//----------------------------------------------------------------------------
//
#include <iomanip>
#include <CLHEP/Units/SystemOfUnits.h>
#include "globals.hh"
#include "G4ios.hh"
#include "UrQMD.hh"
#ifdef G4_USE_URQMD
#include "G4DecayPhysics.hh"
#include "G4EmStandardPhysics.hh"
#include "G4EmExtraPhysics.hh"
#include "G4StoppingPhysics.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4NeutronTrackingCut.hh"
#include "HadronPhysicsUrQMD.hh"
#include "IonUrQMDPhysics.hh"
UrQMD::UrQMD( G4int ver ) {
if ( ver > 0 ) {
G4cout << "<<< Geant4 Physics List simulation engine: UrQMD" << G4endl << G4endl;
}
defaultCutValue = 0.7*CLHEP::mm;
SetVerboseLevel( ver );
RegisterPhysics( new G4EmStandardPhysics( ver ) ); // EM Physics
RegisterPhysics( new G4EmExtraPhysics( ver ) ); // Synchroton Radiation & GN Physics
RegisterPhysics( new G4DecayPhysics( ver ) ); // Decays
RegisterPhysics( new G4HadronElasticPhysics( ver ) ); // Hadron Elastic physics
RegisterPhysics( new HadronPhysicsUrQMD( ver ) ); // Hadron Inelastic physics
RegisterPhysics( new G4StoppingPhysics( ver ) ); // Stopping Physics
RegisterPhysics( new IonUrQMDPhysics( ver ) ); // Ion Physics
RegisterPhysics( new G4NeutronTrackingCut( ver ) ); // Neutron tracking cut
}
#else //i.e. G4_USE_URQMD not defined
UrQMD::UrQMD( G4int ) {
G4ExceptionDescription de;
de << "Support for UrQMD not enabled" << G4endl;
G4Exception( __FILE__, "UrQMD-01", FatalException, de,
"Code should be compiled with G4_USE_URQMD environment variable set." );
}
#endif //G4_USE_URQMD