Files
geant4/examples/extended/radioactivedecay/exrdm/src/exrdmPhysicsList.cc
T
2016-06-09 15:37:50 +02:00

268 lines
8.7 KiB
C++

//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "exrdmPhysicsList.hh"
#include "exrdmPhysicsListMessenger.hh"
#include "exrdmPhysListParticles.hh"
#include "G4EmStandardPhysics.hh"
#include "exrdmPhysListEmLowEnergy.hh"
#include "exrdmPhysListHadron.hh"
#include "G4RegionStore.hh"
#include "G4Region.hh"
#include "G4ProductionCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4UnitsTable.hh"
#include "G4LossTableManager.hh"
#include "HadronPhysicsQGSP_BERT.hh"
#include "HadronPhysicsQGSP_BIC.hh"
#include "HadronPhysicsQGSP_BERT_HP.hh"
#include "HadronPhysicsQGSP_BIC_HP.hh"
#include "G4EmExtraPhysics.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4QStoppingPhysics.hh"
#include "G4IonBinaryCascadePhysics.hh"
#include "G4RadioactiveDecayPhysics.hh"
#include "G4NeutronTrackingCut.hh"
#include "G4DecayPhysics.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
exrdmPhysicsList::exrdmPhysicsList() : G4VModularPhysicsList()
{
G4LossTableManager::Instance();
defaultCutValue = 1.*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForPositron = defaultCutValue;
DetectorCuts = 0;
TargetCuts = 0;
pMessenger = new exrdmPhysicsListMessenger(this);
SetVerboseLevel(2);
//default physics
particleList = new G4DecayPhysics();
//default physics
raddecayList = new G4RadioactiveDecayPhysics();
// EM physics
emPhysicsList = new G4EmStandardPhysics();
// Had physics
hadPhysicsList = new exrdmPhysListHadron("hadron");
nhadcomp = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
exrdmPhysicsList::~exrdmPhysicsList()
{
delete pMessenger;
delete raddecayList;
delete emPhysicsList;
if (hadPhysicsList) delete hadPhysicsList;
if (nhadcomp > 0) {
for(G4int i=0; i<nhadcomp; i++) {
delete hadronPhys[i];
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::ConstructParticle()
{
particleList->ConstructParticle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::ConstructProcess()
{
AddTransportation();
// em
emPhysicsList->ConstructProcess();
// decays
particleList->ConstructProcess();
raddecayList->ConstructProcess();
// had
if (nhadcomp > 0) {
for(G4int i=0; i<nhadcomp; i++) {
(hadronPhys[i])->ConstructProcess();
}
}
if (hadPhysicsList) hadPhysicsList->ConstructProcess();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::SelectPhysicsList(const G4String& name)
{
if (verboseLevel>1) {
G4cout << "exrdmPhysicsList::SelectPhysicsList: <" << name << ">" << G4endl;
}
// default Had physics
if (name == "Hadron" && nhadcomp == 0) {
if (hadPhysicsList) delete hadPhysicsList;
hadPhysicsList = new exrdmPhysListHadron("hadron");
} else if (name == "QGSP_BERT") {
AddExtraBuilders(false);
hadPhysicsList = new HadronPhysicsQGSP_BERT("std-hadron");
} else if (name == "QGSP_BIC" && nhadcomp == 0) {
AddExtraBuilders(false);
hadPhysicsList = new HadronPhysicsQGSP_BIC("std-hadron");
} else if (name == "QGSP_BERT_HP" && nhadcomp == 0) {
AddExtraBuilders(true);
hadPhysicsList = new HadronPhysicsQGSP_BERT_HP("std-hadron");
} else if (name == "QGSP_BIC_HP" && nhadcomp == 0) {
AddExtraBuilders(true);
hadPhysicsList = new HadronPhysicsQGSP_BIC_HP("std-hadron");
} else if (name == "LowEnergy_EM") {
if (!hadPhysicsList ||(hadPhysicsList->GetPhysicsName()=="hadron") ) {
if (emPhysicsList) delete emPhysicsList;
emPhysicsList = new exrdmPhysListEmLowEnergy("lowe-em");
} else {
G4cout << "exrdmPhysicsList: using EM comes with Std-hadron" <<G4endl;
}
} else if (name == "Standard_EM") {
if (!hadPhysicsList ||(hadPhysicsList->GetPhysicsName()=="hadron") ) {
if (emPhysicsList) delete emPhysicsList;
emPhysicsList = new G4EmStandardPhysics();
} else {
G4cout << "exrdmPhysicsList: using EM comes with Std-hadron" <<G4endl;
}
} else {
G4cout << "exrdmPhysicsList WARNING wrong or unkonwn <"
<< name << "> Physics " << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::AddExtraBuilders(G4bool flagHP)
{
if (emPhysicsList) delete emPhysicsList;
emPhysicsList = new G4EmStandardPhysics();
if (hadPhysicsList) {
delete hadPhysicsList;
hadPhysicsList = 0;
}
nhadcomp = 6;
hadronPhys.push_back( new G4EmExtraPhysics("extra EM"));
hadronPhys.push_back( new G4HadronElasticPhysics("elastic",verboseLevel,
flagHP));
hadronPhys.push_back( new G4QStoppingPhysics("stopping",verboseLevel));
hadronPhys.push_back( new G4IonBinaryCascadePhysics("ionBIC"));
hadronPhys.push_back( new G4RadioactiveDecayPhysics("radioactiveDecay"));
hadronPhys.push_back( new G4NeutronTrackingCut("Neutron tracking cut"));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::SetCuts()
{
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForPositron, "e+");
G4cout << "world cuts are set" << G4endl;
if( !TargetCuts ) SetTargetCut(cutForElectron);
G4Region* region = (G4RegionStore::GetInstance())->GetRegion("Target");
region->SetProductionCuts(TargetCuts);
G4cout << "Target cuts are set" << G4endl;
if( !DetectorCuts ) SetDetectorCut(cutForElectron);
region = (G4RegionStore::GetInstance())->GetRegion("Detector");
region->SetProductionCuts(DetectorCuts);
G4cout << "Detector cuts are set" << G4endl;
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::SetCutForGamma(G4double cut)
{
cutForGamma = cut;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::SetCutForElectron(G4double cut)
{
cutForElectron = cut;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::SetCutForPositron(G4double cut)
{
cutForPositron = cut;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::SetTargetCut(G4double cut)
{
if( !TargetCuts ) TargetCuts = new G4ProductionCuts();
TargetCuts->SetProductionCut(cut, idxG4GammaCut);
TargetCuts->SetProductionCut(cut, idxG4ElectronCut);
TargetCuts->SetProductionCut(cut, idxG4PositronCut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void exrdmPhysicsList::SetDetectorCut(G4double cut)
{
if( !DetectorCuts ) DetectorCuts = new G4ProductionCuts();
DetectorCuts->SetProductionCut(cut, idxG4GammaCut);
DetectorCuts->SetProductionCut(cut, idxG4ElectronCut);
DetectorCuts->SetProductionCut(cut, idxG4PositronCut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......