Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -27,7 +27,7 @@
/// \brief Implementation of the DetectorConstruction class
//
//
// $Id: DetectorConstruction.cc 98761 2016-08-09 14:07:11Z gcosmo $
// $Id: DetectorConstruction.cc 109103 2018-03-27 07:39:04Z gcosmo $
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -56,13 +56,11 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:G4VUserDetectorConstruction(),
fNLtot(40),fNRtot(50),fDLradl(0.5),fDRradl(0.1),
fDLlength(0.),fDRlength(0.),
fMaterial(0),
fEcalLength(0.),fEcalRadius(0.),
fSolidEcal(0),fLogicEcal(0),fPhysiEcal(0),
fDetectorMessenger(0)
:G4VUserDetectorConstruction(),
fNLtot(40),fNRtot(50),fDLradl(0.5),fDRradl(0.1),
fDLlength(0.),fDRlength(0.),fMaterial(nullptr),
fEcalLength(0.),fEcalRadius(0.),
fSolidEcal(nullptr),fLogicEcal(nullptr),fPhysiEcal(nullptr)
{
DefineMaterials();
SetMaterial("G4_PbWO4");
@@ -72,13 +70,8 @@ DetectorConstruction::DetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{ delete fDetectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructVolumes();
{
delete fDetectorMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -123,35 +116,40 @@ void DetectorConstruction::DefineMaterials()
BGO->AddElement(O , natoms=12);
BGO->AddElement(Ge, natoms= 3);
BGO->AddElement(Bi, natoms= 4);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
void DetectorConstruction::UpdateParameters()
{
G4double Radl = fMaterial->GetRadlen();
fDLlength = fDLradl*Radl; fDRlength = fDRradl*Radl;
fEcalLength = fNLtot*fDLlength; fEcalRadius = fNRtot*fDRlength;
if(fSolidEcal) {
fSolidEcal->SetOuterRadius(fEcalRadius);
fSolidEcal->SetZHalfLength(0.5*fEcalLength);
}
}
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
UpdateParameters();
//
// Ecal
//
fSolidEcal = new G4Tubs("Ecal",0.,fEcalRadius,0.5*fEcalLength,0.,360*deg);
fLogicEcal = new G4LogicalVolume( fSolidEcal,fMaterial,"Ecal",0,0,0);
fPhysiEcal = new G4PVPlacement(0,G4ThreeVector(),
fLogicEcal,"Ecal",0,false,0);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
if(!fPhysiEcal) {
fSolidEcal = new G4Tubs("Ecal",0.,fEcalRadius,0.5*fEcalLength,0.,360*deg);
fLogicEcal = new G4LogicalVolume( fSolidEcal,fMaterial,"Ecal",0,0,0);
fPhysiEcal = new G4PVPlacement(0,G4ThreeVector(),
fLogicEcal,"Ecal",0,false,0);
}
G4cout << "Absorber is " << G4BestUnit(fEcalLength,"Length")
<< " of " << fMaterial->GetName() << G4endl;
<< " of " << fMaterial->GetName()
<< " R= " << fEcalRadius/cm << " cm" << G4endl;
//
//always return the physical World
//
@@ -184,7 +182,7 @@ void DetectorConstruction::SetLBining(G4ThreeVector Value)
fNLtot = kMaxBin;
}
fDLradl = Value(1);
G4RunManager::GetRunManager()->ReinitializeGeometry();
UpdateParameters();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -198,24 +196,23 @@ void DetectorConstruction::SetRBining(G4ThreeVector Value)
fNRtot = kMaxBin;
}
fDRradl = Value(1);
G4RunManager::GetRunManager()->ReinitializeGeometry();
UpdateParameters();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::ConstructSDandField()
{
if ( fFieldMessenger.Get() == 0 ) {
// Create global magnetic field messenger.
// Uniform magnetic field is then created automatically if
// the field value is not zero.
G4ThreeVector fieldValue = G4ThreeVector();
G4GlobalMagFieldMessenger* msg =
new G4GlobalMagFieldMessenger(fieldValue);
//msg->SetVerboseLevel(1);
G4AutoDelete::Register(msg);
fFieldMessenger.Put( msg );
}
if ( fFieldMessenger.Get() == nullptr ) {
// Create global magnetic field messenger.
// Uniform magnetic field is then created automatically if
// the field value is not zero.
G4ThreeVector fieldValue = G4ThreeVector();
G4GlobalMagFieldMessenger* msg =
new G4GlobalMagFieldMessenger(fieldValue);
//msg->SetVerboseLevel(1);
G4AutoDelete::Register(msg);
fFieldMessenger.Put( msg );
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,349 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: $
//
//---------------------------------------------------------------------------
//
// ClassName: PhysListEm5DStandard
//
// Author: IgS 07.11.2017
//
// Modified:
// 17.11.2017 Created using PhysListEm5DStandard from V.Ivanchenko
//
//----------------------------------------------------------------------------
//
#include "PhysListEm5DStandard.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleDefinition.hh"
#include "G4EmParameters.hh"
#include "G4LossTableManager.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4RayleighScattering.hh"
#include "G4BetheHeitler5DModel.hh"
#include "G4eMultipleScattering.hh"
#include "G4MuMultipleScattering.hh"
#include "G4hMultipleScattering.hh"
#include "G4CoulombScattering.hh"
#include "G4eCoulombScatteringModel.hh"
#include "G4WentzelVIModel.hh"
#include "G4UrbanMscModel.hh"
#include "G4MuBremsstrahlungModel.hh"
#include "G4MuPairProductionModel.hh"
#include "G4hBremsstrahlungModel.hh"
#include "G4hPairProductionModel.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
#include "G4alphaIonisation.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4Alpha.hh"
#include "G4GenericIon.hh"
#include "G4PhysicsListHelper.hh"
#include "G4BuilderType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEm5DStandard::PhysListEm5DStandard(G4int ver, const G4String&)
: G4VPhysicsConstructor("G4EmStandard_5D"), verbose(ver)
{
G4EmParameters* param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(verbose);
param->SetNumberOfBinsPerDecade(10);
param->SetMscStepLimitType(fUseSafetyPlus);
param->SetLateralDisplacementAlg96(false);
param->SetFluo(true);
SetPhysicsType(bElectromagnetic);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEm5DStandard::~PhysListEm5DStandard()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEm5DStandard::ConstructParticle()
{
// gamma
G4Gamma::Gamma();
// leptons
G4Electron::Electron();
G4Positron::Positron();
G4MuonPlus::MuonPlus();
G4MuonMinus::MuonMinus();
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
// barions
G4Proton::Proton();
G4AntiProton::AntiProton();
// ions
G4Deuteron::Deuteron();
G4Triton::Triton();
G4He3::He3();
G4Alpha::Alpha();
G4GenericIon::GenericIonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEm5DStandard::ConstructProcess()
{
if(verbose > 1) {
G4cout << "### " << GetPhysicsName() << " Construct Processes " << G4endl;
}
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
// muon & hadron bremsstrahlung and pair production
G4MuBremsstrahlung* mub = new G4MuBremsstrahlung();
G4MuPairProduction* mup = new G4MuPairProduction();
G4hBremsstrahlung* pib = new G4hBremsstrahlung();
G4hPairProduction* pip = new G4hPairProduction();
G4hBremsstrahlung* kb = new G4hBremsstrahlung();
G4hPairProduction* kp = new G4hPairProduction();
G4hBremsstrahlung* pb = new G4hBremsstrahlung();
G4hPairProduction* pp = new G4hPairProduction();
// muon & hadron multiple scattering
G4MuMultipleScattering* mumsc = new G4MuMultipleScattering();
mumsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* muss = new G4CoulombScattering();
G4MuMultipleScattering* pimsc = new G4MuMultipleScattering();
pimsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* piss = new G4CoulombScattering();
G4MuMultipleScattering* kmsc = new G4MuMultipleScattering();
kmsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* kss = new G4CoulombScattering();
G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc");
// high energy limit for e+- scattering models
G4double highEnergyLimit = 100*MeV;
// Add standard EM Processes
auto myParticleIterator=GetParticleIterator();
myParticleIterator->reset();
while( (*myParticleIterator)() ){
G4ParticleDefinition* particle = myParticleIterator->value();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// photo-effect and Compton
ph->RegisterProcess(new G4PhotoElectricEffect(), particle);
ph->RegisterProcess(new G4ComptonScattering(), particle);
// Gamma conversion
G4GammaConversion* gc = new G4GammaConversion();
G4VEmModel* theGC5DModel = new G4BetheHeitler5DModel();
gc->SetEmModel(theGC5DModel);
ph->RegisterProcess(gc, particle);
// Rayleigh scattering
ph->RegisterProcess(new G4RayleighScattering(), particle);
} else if (particleName == "e-") {
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "e+") {
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(new G4eplusAnnihilation(), particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "mu+" ||
particleName == "mu-" ) {
ph->RegisterProcess(mumsc, particle);
ph->RegisterProcess(new G4MuIonisation(), particle);
ph->RegisterProcess(mub, particle);
ph->RegisterProcess(mup, particle);
ph->RegisterProcess(muss, particle);
} else if (particleName == "alpha" ||
particleName == "He3") {
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4ionIonisation(), particle);
} else if (particleName == "GenericIon") {
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4ionIonisation(), particle);
} else if (particleName == "pi+" ||
particleName == "pi-" ) {
ph->RegisterProcess(pimsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(pib, particle);
ph->RegisterProcess(pip, particle);
ph->RegisterProcess(piss, particle);
} else if (particleName == "kaon+" ||
particleName == "kaon-" ) {
ph->RegisterProcess(kmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(kb, particle);
ph->RegisterProcess(kp, particle);
ph->RegisterProcess(kss, particle);
} else if (particleName == "proton" ||
particleName == "anti_proton") {
G4hMultipleScattering* pmsc = new G4hMultipleScattering();
pmsc->SetEmModel(new G4WentzelVIModel());
G4hIonisation* hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.1, 10*um);
ph->RegisterProcess(pmsc, particle);
ph->RegisterProcess(hIoni, particle);
ph->RegisterProcess(pb, particle);
ph->RegisterProcess(pp, particle);
ph->RegisterProcess(new G4CoulombScattering(), particle);
} else if (particleName == "B+" ||
particleName == "B-" ||
particleName == "D+" ||
particleName == "D-" ||
particleName == "Ds+" ||
particleName == "Ds-" ||
particleName == "anti_He3" ||
particleName == "anti_alpha" ||
particleName == "anti_deuteron" ||
particleName == "anti_lambda_c+" ||
particleName == "anti_omega-" ||
particleName == "anti_sigma_c+" ||
particleName == "anti_sigma_c++" ||
particleName == "anti_sigma+" ||
particleName == "anti_sigma-" ||
particleName == "anti_triton" ||
particleName == "anti_xi_c+" ||
particleName == "anti_xi-" ||
particleName == "deuteron" ||
particleName == "lambda_c+" ||
particleName == "omega-" ||
particleName == "sigma_c+" ||
particleName == "sigma_c++" ||
particleName == "sigma+" ||
particleName == "sigma-" ||
particleName == "tau+" ||
particleName == "tau-" ||
particleName == "triton" ||
particleName == "xi_c+" ||
particleName == "xi-" ) {
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
}
}
// Deexcitation
//
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,10 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/src/PhysicsList.cc
/// \file electromagnetic/TestEm5/src/PhysicsList.cc
/// \brief Implementation of the PhysicsList class
//
// $Id: PhysicsList.cc 100289 2016-10-17 08:46:50Z gcosmo $
// $Id: PhysicsList.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,6 +35,7 @@
#include "PhysicsListMessenger.hh"
#include "PhysListEmStandard.hh"
#include "PhysListEm5DStandard.hh"
#include "G4EmStandardPhysics.hh"
#include "G4EmStandardPhysics_option1.hh"
@@ -44,33 +45,53 @@
#include "G4EmStandardPhysicsWVI.hh"
#include "G4EmStandardPhysicsGS.hh"
#include "G4EmStandardPhysicsSS.hh"
#include "G4EmLivermorePhysics.hh"
#include "G4EmPenelopePhysics.hh"
#include "G4EmLowEPPhysics.hh"
#include "G4EmDNAPhysics.hh"
#include "G4EmDNAPhysics_option2.hh"
#include "G4EmDNAPhysics_option4.hh"
#include "G4EmDNAPhysics_option6.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4DecayPhysics.hh"
#include "StepMax.hh"
#include "G4LossTableManager.hh"
#include "G4ProcessManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
// particles
#include "G4BosonConstructor.hh"
#include "G4LeptonConstructor.hh"
#include "G4MesonConstructor.hh"
#include "G4BosonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4IonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4DNAGenericIonsManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList()
: G4VModularPhysicsList(),fEmPhysicsList(0),fDecay(0),fMessenger(0)
{
PhysicsList::PhysicsList() : G4VModularPhysicsList(),
fHadPhysicsList(nullptr)
{
fMessenger = new PhysicsListMessenger(this);
SetVerboseLevel(1);
fMessenger = new PhysicsListMessenger(this);
// EM physics
fEmName = "emstandard_opt0";
fEmPhysicsList = new G4EmStandardPhysics();
fDecay = new G4DecayPhysics();
fEmName = G4String("emstandard_opt4");
fEmPhysicsList = new G4EmStandardPhysics_option4();
// Decay physics
fDecayPhysics = new G4DecayPhysics(1);
G4LossTableManager::Instance();
SetDefaultCutValue(1*mm);
}
@@ -78,48 +99,78 @@ PhysicsList::PhysicsList()
PhysicsList::~PhysicsList()
{
delete fMessenger;
delete fEmPhysicsList;
delete fDecay;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructParticle()
{
fEmPhysicsList->ConstructParticle();
fDecay->ConstructParticle();
G4BosonConstructor pBosonConstructor;
pBosonConstructor.ConstructParticle();
G4LeptonConstructor pLeptonConstructor;
pLeptonConstructor.ConstructParticle();
G4MesonConstructor pMesonConstructor;
pMesonConstructor.ConstructParticle();
G4BaryonConstructor pBaryonConstructor;
pBaryonConstructor.ConstructParticle();
G4IonConstructor pIonConstructor;
pIonConstructor.ConstructParticle();
G4ShortLivedConstructor sLivedConstructor;
sLivedConstructor.ConstructParticle();
// Geant4-DNA
G4DNAGenericIonsManager* genericIonsManager;
genericIonsManager=G4DNAGenericIonsManager::Instance();
genericIonsManager->GetIon("alpha++");
genericIonsManager->GetIon("alpha+");
genericIonsManager->GetIon("helium");
genericIonsManager->GetIon("hydrogen");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructProcess()
{
if (verboseLevel > -1) {
G4cout << "PhysicsList::ConstructProcess start" << G4endl;
}
// transportation
//
AddTransportation();
// electromagnetic physics list
//
fEmPhysicsList->ConstructProcess();
// decay process
//
fDecay->ConstructProcess();
// step limitation (as a full process)
//
fDecayPhysics->ConstructProcess();
if(fHadPhysicsList) { fHadPhysicsList->ConstructProcess(); }
AddStepMax();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::AddStepMax()
{
// Step limitation seen as a process
StepMax* stepMaxProcess = new StepMax(fMessenger);
auto particleIterator=GetParticleIterator();
particleIterator->reset();
while ((*particleIterator)()){
G4ParticleDefinition* particle = particleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (stepMaxProcess->IsApplicable(*particle))
{
pmanager ->AddDiscreteProcess(stepMaxProcess);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::AddPhysicsList(const G4String& name)
{
if (verboseLevel>0) {
if (verboseLevel>-1) {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
}
@@ -130,7 +181,7 @@ void PhysicsList::AddPhysicsList(const G4String& name)
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new PhysListEmStandard(name);
} else if (name == "emstandard_opt0") {
fEmName = name;
@@ -148,52 +199,81 @@ void PhysicsList::AddPhysicsList(const G4String& name)
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option2();
} else if (name == "emstandard_opt3") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option3();
} else if (name == "emstandard_opt4") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option4();
} else if (name == "emstandardWVI") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsWVI();
} else if (name == "emstandardGS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsGS();
} else if (name == "emstandardSS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsSS();
} else if (name == "empenelope"){
} else if (name == "emstandard5D") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new PhysListEm5DStandard();
} else if (name == "emstandardWVI") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsWVI();
} else if (name == "emstandardGS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsGS();
} else if (name == "empenelope") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmPenelopePhysics();
} else if (name == "emlivermore"){
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePhysics();
} else if (name == "emlowenergy"){
} else if (name == "emlowenergy") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLowEPPhysics();
} else if (name == "emlivermore") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePhysics();
} else if (name == "dna") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmDNAPhysics();
} else if (name == "dna_opt2") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmDNAPhysics_option2();
} else if (name == "dna_opt4") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmDNAPhysics_option4();
} else if (name == "dna_opt6") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmDNAPhysics_option6();
} else if (name == "had_elastic" && !fHadPhysicsList) {
fHadPhysicsList = new G4HadronElasticPhysics();
} else {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
@@ -203,23 +283,3 @@ void PhysicsList::AddPhysicsList(const G4String& name)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::AddStepMax()
{
// Step limitation seen as a process
StepMax* stepMaxProcess = new StepMax();
auto particleIterator=GetParticleIterator();
particleIterator->reset();
while ((*particleIterator)()){
G4ParticleDefinition* particle = particleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (stepMaxProcess->IsApplicable(*particle))
{
pmanager ->AddDiscreteProcess(stepMaxProcess);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,10 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/src/PhysicsListMessenger.cc
/// \file electromagnetic/TestEm5/src/PhysicsListMessenger.cc
/// \brief Implementation of the PhysicsListMessenger class
//
// $Id: PhysicsListMessenger.cc 78550 2014-01-07 09:43:41Z gcosmo $
// $Id: PhysicsListMessenger.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,22 +35,29 @@
#include "PhysicsList.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
:G4UImessenger(),fPhysicsList(pPhys)
:G4UImessenger(),fPhysicsList(pPhys),fMaxChargedStep(DBL_MAX)
{
fPhysDir = new G4UIdirectory("/testem/phys/");
fPhysDir->SetGuidance("physics list commands");
fListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics",this);
fListCmd->SetGuidance("Add modula physics list.");
fListCmd->SetParameterName("PList",false);
fListCmd->AvailableForStates(G4State_PreInit);
fListCmd->SetToBeBroadcasted(false);
fListCmd->SetToBeBroadcasted(false);
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
fStepMaxCmd->SetGuidance("Set max allowed step length");
fStepMaxCmd->SetParameterName("mxStep",false);
fStepMaxCmd->SetRange("mxStep>0.");
fStepMaxCmd->SetUnitCategory("Length");
fStepMaxCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -58,15 +65,18 @@ PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
PhysicsListMessenger::~PhysicsListMessenger()
{
delete fListCmd;
delete fPhysDir;
delete fPhysDir;
delete fStepMaxCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
{
if( command == fListCmd )
{ fPhysicsList->AddPhysicsList(newValue);}
{ fPhysicsList->AddPhysicsList(newValue); }
if (command == fStepMaxCmd)
{ fMaxChargedStep = fStepMaxCmd->GetNewDoubleValue(newValue); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm2/src/PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
// $Id: PrimaryGeneratorAction.cc 83431 2014-08-21 15:49:56Z gcosmo $
// $Id: PrimaryGeneratorAction.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -70,7 +70,7 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
//this function is called at the begin of event
//
G4double position = -0.5*(fDetector->GetfullLength());
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,position));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -76,12 +76,12 @@ void Run::Reset()
//initialize arrays of cumulative energy deposition
//
for (G4int i=0; i<f_nLbin; i++)
fSumELongit[i]=fSumE2Longit[i]=fSumELongitCumul[i]=fSumE2LongitCumul[i]=0.;
for (G4int j=0; j<f_nRbin; j++)
fSumERadial[j]=fSumE2Radial[j]=fSumERadialCumul[j]=fSumE2RadialCumul[j]=0.;
for (G4int i=0; i<f_nLbin; ++i) {
fSumELongit[i]=fSumE2Longit[i]=fSumELongitCumul[i]=fSumE2LongitCumul[i]=0.;
}
for (G4int j=0; j<f_nRbin; ++j) {
fSumERadial[j]=fSumE2Radial[j]=fSumERadialCumul[j]=fSumE2RadialCumul[j]=0.;
}
//initialize track length
fSumChargTrLength=fSum2ChargTrLength=fSumNeutrTrLength=fSum2NeutrTrLength=0.;
@@ -97,11 +97,11 @@ Run::~Run()
void Run::InitializePerEvent()
{
//initialize arrays of energy deposit per bin
for (G4int i=0; i<f_nLbin; i++)
{ f_dEdL[i] = 0.; }
for (G4int i=0; i<f_nLbin; ++i)
{ f_dEdL[i] = 0.; }
for (G4int j=0; j<f_nRbin; j++)
{ f_dEdR[j] = 0.; }
for (G4int j=0; j<f_nRbin; ++j)
{ f_dEdR[j] = 0.; }
//initialize tracklength
fChargTrLength = fNeutrTrLength = 0.;
@@ -114,7 +114,7 @@ void Run::FillPerEvent()
//accumulate statistic
//
G4double dLCumul = 0.;
for (G4int i=0; i<f_nLbin; i++)
for (G4int i=0; i<f_nLbin; ++i)
{
fSumELongit[i] += f_dEdL[i];
fSumE2Longit[i] += f_dEdL[i]*f_dEdL[i];
@@ -153,12 +153,12 @@ void Run::FillPerEvent()
//profiles
G4double norm = 100./(Ekin+mass);
G4double dLradl = fDet->GetdLradl();
for (G4int i=0; i<f_nLbin; i++) {
for (G4int i=0; i<f_nLbin; ++i) {
G4double bin = (i+0.5)*dLradl;
analysisManager->FillP1(0, bin, norm*f_dEdL[i]/dLradl);
}
G4double dRradl = fDet->GetdRradl();
for (G4int j=0; j<f_nRbin; j++) {
for (G4int j=0; j<f_nRbin; ++j) {
G4double bin = (j+0.5)*dRradl;
analysisManager->FillP1(1, bin, norm*f_dEdR[j]/dRradl);
}
@@ -173,14 +173,14 @@ void Run::Merge(const G4Run* run)
fChargedStep += localRun->fChargedStep;
fNeutralStep += localRun->fNeutralStep;
for (G4int i=0; i<f_nLbin; i++) {
for (G4int i=0; i<f_nLbin; ++i) {
fSumELongit[i] += localRun->fSumELongit[i];
fSumE2Longit[i] += localRun->fSumE2Longit[i];
fSumELongitCumul[i] += localRun->fSumELongitCumul[i];
fSumE2LongitCumul[i] += localRun->fSumE2LongitCumul[i];
}
for (G4int j=0; j<f_nRbin; j++) {
for (G4int j=0; j<f_nRbin; ++j) {
fSumERadial[j] += localRun->fSumERadial[j];
fSumE2Radial[j] += localRun->fSumE2Radial[j];
fSumERadialCumul[j] += localRun->fSumERadialCumul[j];
@@ -220,7 +220,7 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
G4int i;
for (i=0; i<f_nLbin; i++) {
for (i=0; i<f_nLbin; ++i) {
MeanELongit[i] = norme*fSumELongit[i];
rmsELongit[i] =
norme*std::sqrt(std::abs(NbOfEvents*fSumE2Longit[i]
@@ -244,7 +244,7 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
MyVector MeanERadial(f_nRbin), rmsERadial(f_nRbin);
MyVector MeanERadialCumul(f_nRbin), rmsERadialCumul(f_nRbin);
for (i=0; i<f_nRbin; i++) {
for (i=0; i<f_nRbin; ++i) {
MeanERadial[i] = norme*fSumERadial[i];
rmsERadial[i] = norme*std::sqrt(std::abs(NbOfEvents*fSumE2Radial[i]
- fSumERadial[i]*fSumERadial[i]));
@@ -281,12 +281,12 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
norme = 1./(NbOfEvents*(fDet->GetMaterial()->GetRadlen()));
G4double MeanChargTrLength = norme*fSumChargTrLength;
G4double rmsChargTrLength =
norme*std::sqrt(std::fabs(NbOfEvents*fSum2ChargTrLength
norme*std::sqrt(std::abs(NbOfEvents*fSum2ChargTrLength
- fSumChargTrLength*fSumChargTrLength));
G4double MeanNeutrTrLength = norme*fSumNeutrTrLength;
G4double rmsNeutrTrLength =
norme*std::sqrt(std::fabs(NbOfEvents*fSum2NeutrTrLength
norme*std::sqrt(std::abs(NbOfEvents*fSum2NeutrTrLength
- fSumNeutrTrLength*fSumNeutrTrLength));
//print
@@ -302,7 +302,7 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
G4cout << " bin " << " Mean rms "
<< " bin " << " Mean rms \n" << G4endl;
for (i=0; i<f_nLbin; i++) {
for (i=0; i<f_nLbin; ++i) {
G4double inf=i*dLradl, sup=inf+dLradl;
G4cout << std::setw(8) << inf << "->"
@@ -323,7 +323,7 @@ void Run::EndOfRun(G4double edep, G4double rms, G4double& limit)
G4cout << " bin " << " Mean rms "
<< " bin " << " Mean rms \n" << G4endl;
for (i=0; i<f_nRbin; i++) {
for (i=0; i<f_nRbin; ++i) {
G4double inf=i*dRradl, sup=inf+dRradl;
G4cout << std::setw(8) << inf << "->"
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm2/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// $Id: RunAction.cc 83431 2014-08-21 15:49:56Z gcosmo $
// $Id: RunAction.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,7 +49,7 @@
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin)
:G4UserRunAction(),
fDet(det),fKin(kin),fRunMessenger(0), fAnalysisManager(0),fRun(0),
fDet(det),fKin(kin),fAnalysisManager(nullptr),fRun(nullptr),
fVerbose(0), fEdeptrue(1.), fRmstrue(1.), fLimittrue(DBL_MAX)
{
fRunMessenger = new RunActionMessenger(this);
@@ -23,52 +23,74 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/src/StepMax.cc
/// \brief Implementation of the StepMax class
//
// $Id: StepMax.cc 98761 2016-08-09 14:07:11Z gcosmo $
// $Id: StepMax.cc 109103 2018-03-27 07:39:04Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "StepMax.hh"
#include "StepMaxMessenger.hh"
#include "PhysicsListMessenger.hh"
#include "G4VPhysicalVolume.hh"
#include "G4TransportationProcessType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMax::StepMax(const G4String& processName)
: G4VDiscreteProcess(processName),fMaxChargedStep(DBL_MAX),fMess(0)
StepMax::StepMax(PhysicsListMessenger* mess)
: G4VEmProcess("UserMaxStep", fGeneral),fMessenger(mess),
fMaxChargedStep(DBL_MAX),isInitialised(false)
{
fMess = new StepMaxMessenger(this);
SetProcessSubType(static_cast<G4int>(STEP_LIMITER));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMax::~StepMax() { delete fMess; }
StepMax::~StepMax()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool StepMax::IsApplicable(const G4ParticleDefinition& particle)
G4bool StepMax::IsApplicable(const G4ParticleDefinition& part)
{
return (particle.GetPDGCharge() != 0. && !particle.IsShortLived());
return (part.GetPDGCharge() != 0. && !part.IsShortLived());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void StepMax::SetMaxStep(G4double step)
void StepMax::PreparePhysicsTable(const G4ParticleDefinition&)
{
fMaxChargedStep = step;
if(isInitialised) {
isInitialised = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double StepMax::PostStepGetPhysicalInteractionLength( const G4Track&,
G4double,
G4ForceCondition* condition )
void StepMax::BuildPhysicsTable(const G4ParticleDefinition&)
{
if(!isInitialised) {
fMaxChargedStep = fMessenger->GetMaxChargedStep();
isInitialised = true;
if(fMaxChargedStep < DBL_MAX) {
G4cout << GetProcessName() << ": SubType= " << GetProcessSubType()
<< " Step limit(mm)= " << fMaxChargedStep << G4endl;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void StepMax::InitialiseProcess(const G4ParticleDefinition*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double
StepMax::PostStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4ForceCondition* condition)
{
// condition is set to "Not Forced"
*condition = NotForced;
return fMaxChargedStep;
}
@@ -76,9 +98,9 @@ G4double StepMax::PostStepGetPhysicalInteractionLength( const G4Track&,
G4VParticleChange* StepMax::PostStepDoIt(const G4Track& aTrack, const G4Step&)
{
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,66 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm2/src/StepMaxMessenger.cc
/// \brief Implementation of the StepMaxMessenger class
//
// $Id: StepMaxMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "StepMaxMessenger.hh"
#include "StepMax.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMaxMessenger::StepMaxMessenger(StepMax* stepM)
:G4UImessenger(),fStepMax(stepM),fStepMaxCmd(0)
{
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
fStepMaxCmd->SetGuidance("Set max allowed step length");
fStepMaxCmd->SetParameterName("mxStep",false);
fStepMaxCmd->SetRange("mxStep>0.");
fStepMaxCmd->SetUnitCategory("Length");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMaxMessenger::~StepMaxMessenger()
{
delete fStepMaxCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void StepMaxMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == fStepMaxCmd)
{ fStepMax->SetMaxStep(fStepMaxCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......