Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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 ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization() : G4VUserActionInitialization() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::~ActionInitialization() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::Build() const {
SetUserAction( new PrimaryGeneratorAction );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,147 @@
//
// ********************************************************************
// * 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 BiasingOperation.cc
/// \brief Implementation of the BiasingOperation class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "BiasingOperation.hh"
#include "G4BiasingProcessInterface.hh"
#include "G4VParticleChange.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4PionPlusInelasticProcess.hh"
#include "G4PionMinusInelasticProcess.hh"
#include "G4HadronicParameters.hh"
#include "G4FTFModel.hh"
#include "G4LundStringFragmentation.hh"
#include "G4ExcitedStringDecay.hh"
#include "G4GeneratorPrecompoundInterface.hh"
#include "G4TheoFSGenerator.hh"
#include "G4HadronicInteractionRegistry.hh"
#include "G4VPreCompoundModel.hh"
#include "G4INCLXXInterface.hh"
#include "G4HadronInelasticDataSet.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
BiasingOperation::BiasingOperation( G4String name ) : G4VBiasingOperation( name ) {
// Create the inelastic processes for p , n , pi+ , pi-
fProtonInelasticProcess = new G4ProtonInelasticProcess;
fNeutronInelasticProcess = new G4NeutronInelasticProcess;
fPionPlusInelasticProcess = new G4PionPlusInelasticProcess;
fPionMinusInelasticProcess = new G4PionMinusInelasticProcess;
// Set the energy ranges
const G4double minPreco = 0.0;
const G4double maxPreco = 2.0 * CLHEP::MeV;
const G4double maxBERT = 12.0 * CLHEP::GeV;
const G4double minINCLXX = 1.0 * CLHEP::MeV;
const G4double minFTFP = 3.0 * CLHEP::GeV;
const G4double maxFTFP = G4HadronicParameters::Instance()->GetMaxEnergy();
// Create the hadronic models (to replace FTFP_BERT with "FTFP_INCLXX",
// keeping the same energy ranges for the transition between models).
// Notice that it is better to create the models here from scratch,
// instead of reusing the existing ones, because we might pick up the
// existing ones associated to the wrong particles...
// --- FTFP model ---
G4FTFModel* theStringModel = new G4FTFModel;
G4LundStringFragmentation* theLund = new G4LundStringFragmentation;
G4ExcitedStringDecay* theStringDecay = new G4ExcitedStringDecay( theLund );
theStringModel->SetFragmentationModel( theStringDecay );
G4GeneratorPrecompoundInterface* thePrecoInterface = new G4GeneratorPrecompoundInterface;
G4TheoFSGenerator* theHighEnergyModel = new G4TheoFSGenerator( "FTFP" );
theHighEnergyModel->SetHighEnergyGenerator( theStringModel );
theHighEnergyModel->SetTransport( thePrecoInterface );
theHighEnergyModel->SetMinEnergy( minFTFP );
theHighEnergyModel->SetMaxEnergy( maxFTFP );
// Preco : create a new model to be used only for INCLXX for nucleons
G4VPreCompoundModel* thePreCompoundModel = new G4PreCompoundModel;
thePreCompoundModel->SetMinEnergy( minPreco );
thePreCompoundModel->SetMaxEnergy( maxPreco );
// --- Preco ---
// --- INCLXX model ---
// The instance for nucleons:
G4INCLXXInterface* theInclxxModel = new G4INCLXXInterface( thePreCompoundModel );
theInclxxModel->SetMinEnergy( minINCLXX );
theInclxxModel->SetMaxEnergy( maxBERT ); // Use the same as for Bertini
// The instance for pions:
G4INCLXXInterface* theInclxxModel_forPions = new G4INCLXXInterface;
theInclxxModel_forPions->SetMinEnergy( minPreco );
theInclxxModel_forPions->SetMaxEnergy( maxBERT ); // Use the same as for Bertini
// Register the models
fProtonInelasticProcess->RegisterMe( theHighEnergyModel );
fProtonInelasticProcess->RegisterMe( theInclxxModel );
fProtonInelasticProcess->RegisterMe( thePreCompoundModel );
fNeutronInelasticProcess->RegisterMe( theHighEnergyModel );
fNeutronInelasticProcess->RegisterMe( theInclxxModel );
fNeutronInelasticProcess->RegisterMe( thePreCompoundModel );
fPionPlusInelasticProcess->RegisterMe( theHighEnergyModel );
fPionPlusInelasticProcess->RegisterMe( theInclxxModel_forPions );
fPionMinusInelasticProcess->RegisterMe( theHighEnergyModel );
fPionMinusInelasticProcess->RegisterMe( theInclxxModel_forPions );
// Register the cross sections: this is mandatory starting from G4 10.6
// because the default Gheisha inelastic cross sections have been removed.
// It is convenient to use the Gheisha inelastic cross sections here
// because they do not require any special initialization.
fProtonInelasticProcess->AddDataSet( new G4HadronInelasticDataSet );
fNeutronInelasticProcess->AddDataSet( new G4HadronInelasticDataSet );
fPionPlusInelasticProcess->AddDataSet( new G4HadronInelasticDataSet );
fPionMinusInelasticProcess->AddDataSet( new G4HadronInelasticDataSet );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
BiasingOperation::~BiasingOperation() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange* BiasingOperation::
ApplyFinalStateBiasing( const G4BiasingProcessInterface* ,
const G4Track* track, const G4Step* step, G4bool& ) {
if ( track->GetParticleDefinition() == G4Proton::Definition() ) {
return fProtonInelasticProcess->PostStepDoIt( *track, *step );
} else if ( track->GetParticleDefinition() == G4Neutron::Definition() ) {
return fNeutronInelasticProcess->PostStepDoIt( *track, *step );
} else if ( track->GetParticleDefinition() == G4PionPlus::Definition() ) {
return fPionPlusInelasticProcess->PostStepDoIt( *track, *step );
} else if ( track->GetParticleDefinition() == G4PionMinus::Definition() ) {
return fPionMinusInelasticProcess->PostStepDoIt( *track, *step );
} else {
G4cerr << "ERROR in BiasingOperation::ApplyFinalStateBiasing : unexpected particle = "
<< track->GetParticleDefinition()->GetParticleName() << G4endl;
return 0;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * 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 BiasingOperator.cc
/// \brief Implementation of the BiasingOperator class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "BiasingOperator.hh"
#include "G4BiasingProcessInterface.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "BiasingOperation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
BiasingOperator::BiasingOperator() : G4VBiasingOperator( "BiasingOperator" ) {
fBiasingOperation = new BiasingOperation( "BiasingOperation" );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void BiasingOperator::AddParticle( G4String particleName ) {
const G4ParticleDefinition* particle =
G4ParticleTable::GetParticleTable()->FindParticle( particleName );
if ( particle == 0 ) {
G4ExceptionDescription ed;
ed << "Particle `" << particleName << "' not found !" << G4endl;
G4Exception( "BiasingOperator::AddParticle(...)", "BiasError", JustWarning, ed );
return;
}
fParticlesToBias.push_back( particle );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VBiasingOperation* BiasingOperator::
ProposeFinalStateBiasingOperation( const G4Track* ,
const G4BiasingProcessInterface* callingProcess ) {
// Apply the biasing operation only for inelastic processes of:
// proton, neutron, pion+ and pion-
if ( callingProcess && callingProcess->GetWrappedProcess() &&
( callingProcess->GetWrappedProcess()->GetProcessName() == "protonInelastic" ||
callingProcess->GetWrappedProcess()->GetProcessName() == "neutronInelastic" ||
callingProcess->GetWrappedProcess()->GetProcessName() == "pi+Inelastic" ||
callingProcess->GetWrappedProcess()->GetProcessName() == "pi-Inelastic" ) ) {
return fBiasingOperation;
} else {
return 0;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,144 @@
//
// ********************************************************************
// * 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 DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ProductionCuts.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4Region.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4NistManager.hh"
#include "G4RegionStore.hh"
#include "BiasingOperator.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction() : G4VUserDetectorConstruction(),
fSiliconTrackerLogical( nullptr ), fEmCaloLogical( nullptr ), fHadCaloLogical( nullptr ) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct() {
G4cout << "\nDetectorConstruction....\n" << G4endl;
//--------- Material definition ---------
G4NistManager* nistManager = G4NistManager::Instance();
G4Material* air = nistManager->FindOrBuildMaterial( "G4_AIR" );
G4Material* csi = nistManager->FindOrBuildMaterial( "G4_CESIUM_IODIDE" );
G4Material* silicon = nistManager->FindOrBuildMaterial( "G4_Si" );
G4Material* iron = nistManager->FindOrBuildMaterial( "G4_Fe" );
// World
G4Box* worldBox = new G4Box( "WorldBox", 200.0*cm, 200.0*cm, 200.0*cm );
G4LogicalVolume* worldLogical = new G4LogicalVolume( worldBox, air, "WorldLogical", 0, 0, 0 );
G4PVPlacement* worldPhys = new G4PVPlacement( 0, G4ThreeVector(), "WorldPhysical",
worldLogical, 0, false, 0 );
// Silicon Tracker: for simplicity and to have more hadronic interactions,
// it is single layer of silicon (20 cm thick)
G4double halfDetectorXYsize = 100.0*cm;
G4Box* siliconBox = new G4Box( "siliconBox", halfDetectorXYsize, halfDetectorXYsize, 10.0*cm );
fSiliconTrackerLogical = new G4LogicalVolume( siliconBox, silicon,
"SiliconTrackerLogical", 0, 0, 0 );
new G4PVPlacement( 0, G4ThreeVector( 0.0, 0.0, 0.0 ), "SiliconTrackerPhysical",
fSiliconTrackerLogical, worldPhys, false, 0 );
// Electromagnetic (EM) calorimeter: an homogeneous crystal (40 cm thick)
G4Box* emCaloBox = new G4Box( "EmCaloBox", halfDetectorXYsize, halfDetectorXYsize, 20.0*cm );
fEmCaloLogical = new G4LogicalVolume( emCaloBox, csi, "EmCalorimeterLogical", 0, 0, 0 );
new G4PVPlacement( 0, G4ThreeVector( 0.0, 0.0, 35.0*cm ), "EmCalorimeterPhysical",
fEmCaloLogical, worldPhys, false, 0 );
// The hadronic (HAD) calorimeter: an homogeneous block of metal (100 cm thick)
G4Box* hadCaloBox = new G4Box( "HadCaloBox", halfDetectorXYsize, halfDetectorXYsize, 50.0*cm );
fHadCaloLogical = new G4LogicalVolume( hadCaloBox, iron, "HadCaloLogical", 0, 0, 0 );
new G4PVPlacement( 0, G4ThreeVector( 0.0, 0.0, 110.0*cm ), "HadCaloPhysical",
fHadCaloLogical, worldPhys, false, 0 );
// Define the tracker region
G4Region* trackerRegion = new G4Region( "Tracker_region" );
trackerRegion->AddRootLogicalVolume( fSiliconTrackerLogical );
std::vector< double > cuts;
cuts.push_back( 10.0*cm ); cuts.push_back( 10.0*cm );
cuts.push_back( 10.0*cm ); cuts.push_back( 10.0*cm );
trackerRegion->SetProductionCuts( new G4ProductionCuts );
trackerRegion->GetProductionCuts()->SetProductionCuts( cuts );
// Define the EM calorimeter region
G4Region* emCaloRegion = new G4Region( "EM_calo_region" );
emCaloRegion->AddRootLogicalVolume( fEmCaloLogical );
cuts.clear();
cuts.push_back( 20.0*cm ); cuts.push_back( 20.0*cm );
cuts.push_back( 20.0*cm ); cuts.push_back( 20.0*cm );
emCaloRegion->SetProductionCuts( new G4ProductionCuts );
emCaloRegion->GetProductionCuts()->SetProductionCuts( cuts );
// Define the HAD calorimeter region
G4Region* hadCaloRegion = new G4Region( "HAD_calo_region" );
hadCaloRegion->AddRootLogicalVolume( fHadCaloLogical );
cuts.clear();
cuts.push_back( 50.0*cm ); cuts.push_back( 50.0*cm );
cuts.push_back( 50.0*cm ); cuts.push_back( 50.0*cm );
hadCaloRegion->SetProductionCuts( new G4ProductionCuts );
hadCaloRegion->GetProductionCuts()->SetProductionCuts( cuts );
return worldPhys;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::ConstructSDandField() {
// Instanciate the biasing operator and specify the particles of interest (i.e. p, n, pi+, pi-)
// and the logical volume(s) where this operator should be applied.
BiasingOperator* biasingOperator = new BiasingOperator;
biasingOperator->AddParticle( "proton" );
biasingOperator->AddParticle( "neutron" );
biasingOperator->AddParticle( "pi+" );
biasingOperator->AddParticle( "pi-" );
biasingOperator->AttachTo( fSiliconTrackerLogical );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * 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 PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction() : G4VUserPrimaryGeneratorAction(),
fParticleGun( nullptr ) {
G4int n_particle = 1;
fParticleGun = new G4ParticleGun( n_particle );
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle = particleTable->FindParticle( particleName="pi+" );
fParticleGun->SetParticleDefinition( particle );
fParticleGun->SetParticleMomentumDirection( G4ThreeVector( 0.0, 0.0, 1.0 ) );
fParticleGun->SetParticleEnergy( 5.0*GeV );
fParticleGun->SetParticlePosition( G4ThreeVector( 0.0, 0.0, -50.0*cm ) );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction() {
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries( G4Event* anEvent ) {
fParticleGun->GeneratePrimaryVertex( anEvent );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParticleGun* PrimaryGeneratorAction::GetParticleGun() {
return fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......