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
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm3/src/DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
// $Id: DetectorConstruction.cc 98762 2016-08-09 14:08:07Z gcosmo $
// $Id: DetectorConstruction.cc 109115 2018-03-28 07:14:10Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -56,12 +56,20 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:G4VUserDetectorConstruction(),
fDefaultMaterial(0),fSolidWorld(0),fLogicWorld(0),fPhysiWorld(0),
fSolidCalor(0),fLogicCalor(0),fPhysiCalor(0),
fSolidLayer(0),fLogicLayer(0),fPhysiLayer(0),
fDetectorMessenger(0)
:G4VUserDetectorConstruction(),
fWorldMaterial(nullptr),fSolidWorld(nullptr),fLogicWorld(nullptr),
fPhysiWorld(nullptr),fSolidCalor(nullptr),fLogicCalor(nullptr),
fPhysiCalor(nullptr),fSolidLayer(nullptr),fLogicLayer(nullptr),
fPhysiLayer(nullptr)
{
for(G4int i=0; i<kMaxAbsor; ++i) {
fAbsorMaterial[i] = nullptr;
fAbsorThickness[i] = 0.0;
fSolidAbsor[i] = nullptr;
fLogicAbsor[i] = nullptr;
fPhysiAbsor[i] = nullptr;
}
// default parameter values of the calorimeter
fNbOfAbsor = 2;
fAbsorThickness[1] = 2.3*mm;
@@ -73,8 +81,8 @@ fDetectorMessenger(0)
// materials
DefineMaterials();
SetWorldMaterial("Galactic");
SetAbsorMaterial(1,"Lead");
SetAbsorMaterial(2,"liquidArgon");
SetAbsorMaterial(1,"G4_Pb");
SetAbsorMaterial(2,"G4_lAr");
// create commands for interactive definition of the calorimeter
fDetectorMessenger = new DetectorMessenger(this);
@@ -89,13 +97,6 @@ DetectorConstruction::~DetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructCalorimeter();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::DefineMaterials()
{
// This function illustrates the possible ways to define materials using
@@ -299,35 +300,29 @@ void DetectorConstruction::ComputeCalorParameters()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
G4VPhysicalVolume* DetectorConstruction::Construct()
{
if(fPhysiWorld) { return fPhysiWorld; }
// complete the Calor parameters definition
ComputeCalorParameters();
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
//
// World
//
fSolidWorld = new G4Box("World", //its name
fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2); //its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
fDefaultMaterial, //its material
"World"); //its name
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
fWorldMaterial, //its material
"World"); //its name
fPhysiWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicWorld, //its fLogical volume
"World", //its name
0, //its mother volume
false, //no boolean operation
0); //copy number
fPhysiWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicWorld, //its fLogical volume
"World", //its name
0, //its mother volume
false, //no boolean operation
0); //copy number
//
// Calorimeter
//
@@ -336,8 +331,8 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fLogicCalor = new G4LogicalVolume(fSolidCalor,
fDefaultMaterial,
"Calorimeter");
fWorldMaterial,
"Calorimeter");
fPhysiCalor = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
@@ -352,19 +347,19 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
//
fSolidLayer = new G4Box("Layer",
fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fLogicLayer = new G4LogicalVolume(fSolidLayer,
fDefaultMaterial,
"Layer");
if (fNbOfLayers > 1)
fWorldMaterial,
"Layer");
if (fNbOfLayers > 1) {
fPhysiLayer = new G4PVReplica("Layer",
fLogicLayer,
fLogicCalor,
kXAxis,
fNbOfLayers,
fLayerThickness);
else
fLogicLayer,
fLogicCalor,
kXAxis,
fNbOfLayers,
fLayerThickness);
} else {
fPhysiLayer = new G4PVPlacement(0,
G4ThreeVector(),
fLogicLayer,
@@ -372,19 +367,19 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
fLogicCalor,
false,
0);
}
//
// Absorbers
//
G4double xfront = -0.5*fLayerThickness;
for (G4int k=1; k<=fNbOfAbsor; k++) {
for (G4int k=1; k<=fNbOfAbsor; ++k) {
fSolidAbsor[k] = new G4Box("Absorber", //its name
fAbsorThickness[k]/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fAbsorThickness[k]/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fLogicAbsor[k] = new G4LogicalVolume(fSolidAbsor[k], //its solid
fAbsorMaterial[k], //its material
fAbsorMaterial[k]->GetName());
fAbsorMaterial[k], //its material
fAbsorMaterial[k]->GetName());
G4double xcenter = xfront+0.5*fAbsorThickness[k];
xfront += fAbsorThickness[k];
@@ -411,17 +406,16 @@ void DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n-------------------------------------------------------------"
<< "\n ---> The calorimeter is " << fNbOfLayers << " layers of:";
for (G4int i=1; i<=fNbOfAbsor; i++)
{
G4cout << "\n \t" << std::setw(12) << fAbsorMaterial[i]->GetName() <<": "
<< std::setw(6) << G4BestUnit(fAbsorThickness[i],"Length");
}
for (G4int i=1; i<=fNbOfAbsor; ++i) {
G4cout << "\n \t" << std::setw(12) << fAbsorMaterial[i]->GetName() <<": "
<< std::setw(6) << G4BestUnit(fAbsorThickness[i],"Length");
}
G4cout << "\n-------------------------------------------------------------\n";
G4cout << "\n" << fDefaultMaterial << G4endl;
for (G4int j=1; j<=fNbOfAbsor; j++)
G4cout << "\n" << fAbsorMaterial[j] << G4endl;
G4cout << "\n" << fWorldMaterial << G4endl;
for (G4int j=1; j<=fNbOfAbsor; ++j) {
G4cout << "\n" << fAbsorMaterial[j] << G4endl;
}
G4cout << "\n-------------------------------------------------------------\n";
}
@@ -432,8 +426,14 @@ void DetectorConstruction::SetWorldMaterial(const G4String& material)
// search the material by its name
G4Material* pttoMaterial =
G4NistManager::Instance()->FindOrBuildMaterial(material);
if (pttoMaterial) fDefaultMaterial = pttoMaterial;
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
if(pttoMaterial) {
fWorldMaterial = pttoMaterial;
if(fLogicWorld) {
fLogicWorld->SetMaterial(fWorldMaterial);
fLogicLayer->SetMaterial(fWorldMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -448,7 +448,6 @@ void DetectorConstruction::SetNbOfLayers(G4int ival)
return;
}
fNbOfLayers = ival;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -464,13 +463,12 @@ void DetectorConstruction::SetNbOfAbsor(G4int ival)
return;
}
fNbOfAbsor = ival;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorMaterial(G4int ival,
const G4String& material)
const G4String& material)
{
// search the material by its name
//
@@ -482,13 +480,18 @@ void DetectorConstruction::SetAbsorMaterial(G4int ival,
G4Material* pttoMaterial =
G4NistManager::Instance()->FindOrBuildMaterial(material);
if (pttoMaterial) fAbsorMaterial[ival] = pttoMaterial;
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
if (pttoMaterial) {
fAbsorMaterial[ival] = pttoMaterial;
if(fLogicAbsor[ival]) {
fLogicAbsor[ival]->SetMaterial(pttoMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorThickness(G4int ival,G4double val)
void DetectorConstruction::SetAbsorThickness(G4int ival, G4double val)
{
// change Absorber thickness
//
@@ -503,7 +506,6 @@ void DetectorConstruction::SetAbsorThickness(G4int ival,G4double val)
return;
}
fAbsorThickness[ival] = val;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -518,7 +520,6 @@ void DetectorConstruction::SetCalorSizeYZ(G4double val)
return;
}
fCalorSizeYZ = val;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -528,18 +529,17 @@ void DetectorConstruction::SetCalorSizeYZ(G4double val)
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......
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm3/src/DetectorMessenger.cc
/// \brief Implementation of the DetectorMessenger class
//
// $Id: DetectorMessenger.cc 98762 2016-08-09 14:08:07Z gcosmo $
// $Id: DetectorMessenger.cc 109096 2018-03-26 14:46:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -65,21 +65,21 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
fSizeYZCmd->SetParameterName("Size",false);
fSizeYZCmd->SetRange("Size>0.");
fSizeYZCmd->SetUnitCategory("Length");
fSizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSizeYZCmd->AvailableForStates(G4State_PreInit);
fSizeYZCmd->SetToBeBroadcasted(false);
fNbLayersCmd = new G4UIcmdWithAnInteger("/testem/det/setNbOfLayers",this);
fNbLayersCmd->SetGuidance("Set number of layers.");
fNbLayersCmd->SetParameterName("NbLayers",false);
fNbLayersCmd->SetRange("NbLayers>0");
fNbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNbLayersCmd->AvailableForStates(G4State_PreInit);
fNbLayersCmd->SetToBeBroadcasted(false);
fNbAbsorCmd = new G4UIcmdWithAnInteger("/testem/det/setNbOfAbsor",this);
fNbAbsorCmd->SetGuidance("Set number of Absorbers.");
fNbAbsorCmd->SetParameterName("NbAbsor",false);
fNbAbsorCmd->SetRange("NbAbsor>0");
fNbAbsorCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNbAbsorCmd->AvailableForStates(G4State_PreInit);
fNbAbsorCmd->SetToBeBroadcasted(false);
fAbsorCmd = new G4UIcommand("/testem/det/setAbsor",this);
@@ -108,7 +108,7 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
unitPrm->SetParameterCandidates(unitList);
fAbsorCmd->SetParameter(unitPrm);
//
fAbsorCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAbsorCmd->AvailableForStates(G4State_PreInit);
fAbsorCmd->SetToBeBroadcasted(false);
}
@@ -23,10 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm3/src/PhysicsList.cc
/// \file electromagnetic/TestEm5/src/PhysicsList.cc
/// \brief Implementation of the PhysicsList class
//
// $Id: PhysicsList.cc 100288 2016-10-17 08:45:43Z gcosmo $
// $Id: PhysicsList.cc 109096 2018-03-26 14:46:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,10 +49,22 @@
#include "G4EmPenelopePhysics.hh"
#include "G4EmLowEPPhysics.hh"
#include "G4LossTableManager.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 "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
// particles
#include "G4BosonConstructor.hh"
@@ -62,86 +74,102 @@
#include "G4BaryonConstructor.hh"
#include "G4IonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4DNAGenericIonsManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList() : G4VModularPhysicsList(),
fEmPhysicsList(0), fStepMaxProcess(0), fMessenger(0)
{
G4LossTableManager::Instance();
SetDefaultCutValue(1*mm);
fMessenger = new PhysicsListMessenger(this);
fHadPhysicsList(nullptr)
{
fMessenger = new PhysicsListMessenger(this);
SetVerboseLevel(1);
// EM physics
fEmName = G4String("local");
fEmPhysicsList = new PhysListEmStandard(fEmName);
fEmName = G4String("emstandard_opt4");
fEmPhysicsList = new G4EmStandardPhysics_option4();
// Decay physics
fDecayPhysics = new G4DecayPhysics(1);
SetDefaultCutValue(1*mm);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::~PhysicsList()
{
delete fMessenger;
delete fEmPhysicsList;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructParticle()
{
G4BosonConstructor pBosonConstructor;
pBosonConstructor.ConstructParticle();
G4BosonConstructor pBosonConstructor;
pBosonConstructor.ConstructParticle();
G4LeptonConstructor pLeptonConstructor;
pLeptonConstructor.ConstructParticle();
G4LeptonConstructor pLeptonConstructor;
pLeptonConstructor.ConstructParticle();
G4MesonConstructor pMesonConstructor;
pMesonConstructor.ConstructParticle();
G4MesonConstructor pMesonConstructor;
pMesonConstructor.ConstructParticle();
G4BaryonConstructor pBaryonConstructor;
pBaryonConstructor.ConstructParticle();
G4BaryonConstructor pBaryonConstructor;
pBaryonConstructor.ConstructParticle();
G4IonConstructor pIonConstructor;
pIonConstructor.ConstructParticle();
G4IonConstructor pIonConstructor;
pIonConstructor.ConstructParticle();
G4ShortLivedConstructor pShortLivedConstructor;
pShortLivedConstructor.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......
#include "G4ProcessManager.hh"
void PhysicsList::ConstructProcess()
{
// Transportation
//
AddTransportation();
// electromagnetic Physics List
//
fEmPhysicsList->ConstructProcess();
fDecayPhysics->ConstructProcess();
if(fHadPhysicsList) { fHadPhysicsList->ConstructProcess(); }
AddStepMax();
}
// decay Process
//
AddDecay();
// radioactive decay Process
//
////AddRadioactiveDecay();
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// stepLimitation (as a full process)
//
AddStepMax();
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>1) {
if (verboseLevel>-1) {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
}
@@ -182,43 +210,63 @@ void PhysicsList::AddPhysicsList(const G4String& name)
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 == "emlivermore") {
} else if (name == "emstandardWVI") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePhysics();
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 == "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 << ">"
@@ -226,69 +274,5 @@ void PhysicsList::AddPhysicsList(const G4String& name)
<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4PhysicsListHelper.hh"
#include "G4Decay.hh"
void PhysicsList::AddDecay()
{
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
// Decay Process
//
G4Decay* fDecayProcess = new G4Decay();
auto particleIterator=GetParticleIterator();
particleIterator->reset();
while( (*particleIterator)() ){
G4ParticleDefinition* particle = particleIterator->value();
if (fDecayProcess->IsApplicable(*particle))
ph->RegisterProcess(fDecayProcess, particle);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4PhysicsListHelper.hh"
#include "G4RadioactiveDecay.hh"
#include "G4GenericIon.hh"
#include "G4NuclideTable.hh"
void PhysicsList::AddRadioactiveDecay()
{
G4RadioactiveDecay* radioactiveDecay = new G4RadioactiveDecay();
radioactiveDecay->SetARM(true); //Atomic Rearangement
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
ph->RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon());
// mandatory for G4NuclideTable
//
G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(0.1*picosecond);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "StepMax.hh"
void PhysicsList::AddStepMax()
{
// Step limitation seen as a process
fStepMaxProcess = new StepMax();
auto particleIterator=GetParticleIterator();
particleIterator->reset();
while ((*particleIterator)()){
G4ParticleDefinition* particle = particleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (fStepMaxProcess->IsApplicable(*particle))
{
pmanager ->AddDiscreteProcess(fStepMaxProcess);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,10 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm3/src/PhysicsListMessenger.cc
/// \file electromagnetic/TestEm5/src/PhysicsListMessenger.cc
/// \brief Implementation of the PhysicsListMessenger class
//
// $Id: PhysicsListMessenger.cc 82038 2014-06-10 07:58:08Z gcosmo $
// $Id: PhysicsListMessenger.cc 109096 2018-03-26 14:46:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,23 +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),
fPhysDir(0),
fListCmd(0)
: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->AvailableForStates(G4State_PreInit);
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......
@@ -59,16 +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)
{
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......
@@ -54,7 +54,7 @@
Run::Run(DetectorConstruction* det)
: G4Run(),
fDetector(det),
fParticle(0), fEkin(0.),
fParticle(nullptr), fEkin(0.),
fChargedStep(0), fNeutralStep(0),
fN_gamma(0), fN_elec(0), fN_pos(0),
fApplyLimit(false)
@@ -293,8 +293,8 @@ void Run::EndOfRun()
G4int nbOfAbsor = fDetector->GetNbOfAbsor();
for (G4int Id=1; Id<=Idmax; Id++) {
G4int iAbsor = Id%nbOfAbsor; if (iAbsor==0) iAbsor = nbOfAbsor;
EdepTot[iAbsor] += (fEnergyFlow[Id] - fEnergyFlow[Id+1] - fLateralEleak[Id]);
G4int iAbsor = Id%nbOfAbsor; if (iAbsor==0) iAbsor = nbOfAbsor;
EdepTot[iAbsor] += (fEnergyFlow[Id]-fEnergyFlow[Id+1]-fLateralEleak[Id]);
}
G4cout << std::setprecision(3)
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm3/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// $Id: RunAction.cc 90969 2015-06-12 08:12:57Z gcosmo $
// $Id: RunAction.cc 109096 2018-03-26 14:46:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -45,8 +45,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim)
:G4UserRunAction(), fDetector(det), fPrimary(prim), fRun(0), fRunMessenger(0),
fHistoManager(0), fTimer(0)
:G4UserRunAction(), fDetector(det), fPrimary(prim), fRun(nullptr),
fTimer(nullptr)
{
fRunMessenger = new RunActionMessenger(this);
fHistoManager = new HistoManager();
@@ -23,40 +23,85 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file electromagnetic/TestEm3/src/StepMax.cc
/// \brief Implementation of the StepMax class
//
// $Id: StepMax.cc 98762 2016-08-09 14:08:07Z gcosmo $
// $Id: StepMax.cc 109096 2018-03-26 14:46:51Z 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),fMess(0)
StepMax::StepMax(PhysicsListMessenger* mess)
: G4VEmProcess("UserMaxStep", fGeneral),fMessenger(mess),
fMaxChargedStep(DBL_MAX),isInitialised(false)
{
for (G4int k=0; k<kMaxAbsor; k++) fStepMax[k] = DBL_MAX;
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::SetStepMax(G4int k,G4double step) {fStepMax[k] = step;}
void StepMax::PreparePhysicsTable(const G4ParticleDefinition&)
{
if(isInitialised) {
isInitialised = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VParticleChange* StepMax::PostStepDoIt(const G4Track& aTrack, const G4Step&)
{
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,90 +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/TestEm3/src/StepMaxMessenger.cc
/// \brief Implementation of the StepMaxMessenger class
//
// $Id: fStepMaxMessenger.cc,v 1.3 2006-06-29 16:53:21 gunter Exp $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "StepMaxMessenger.hh"
#include "StepMax.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMaxMessenger::StepMaxMessenger(StepMax* stepM)
:G4UImessenger(),fStepMax(stepM),
fStepMaxDir(0),
fStepMaxCmd(0)
{
fStepMaxDir = new G4UIdirectory("/testem/stepMax/");
fStepMaxDir->SetGuidance("histograms control");
fStepMaxCmd = new G4UIcommand("/testem/stepMax/absorber",this);
fStepMaxCmd->SetGuidance("Set max allowed step length in absorber k");
//
G4UIparameter* k = new G4UIparameter("k",'i',false);
k->SetGuidance("absorber number : from 1 to MaxHisto-1");
k->SetParameterRange("k>0");
fStepMaxCmd->SetParameter(k);
//
G4UIparameter* sMax = new G4UIparameter("sMax",'d',false);
sMax->SetGuidance("stepMax, expressed in choosen unit");
sMax->SetParameterRange("sMax>0.");
fStepMaxCmd->SetParameter(sMax);
//
G4UIparameter* unit = new G4UIparameter("unit",'s',false);
fStepMaxCmd->SetParameter(unit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StepMaxMessenger::~StepMaxMessenger()
{
delete fStepMaxCmd;
delete fStepMaxDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void StepMaxMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if (command == fStepMaxCmd)
{ G4int k; G4double sMax;
G4String unts;
std::istringstream is(newValues);
is >> k >> sMax >> unts;
G4String unit = unts;
G4double vUnit = G4UIcommand::ValueOf(unit);
fStepMax->SetStepMax(k,sMax*vUnit);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm3/src/SteppingAction.cc
/// \brief Implementation of the SteppingAction class
//
// $Id: SteppingAction.cc 98762 2016-08-09 14:08:07Z gcosmo $
// $Id: SteppingAction.cc 109096 2018-03-26 14:46:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -59,15 +59,16 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
//track informations
const G4StepPoint* prePoint = aStep->GetPreStepPoint();
const G4StepPoint* endPoint = aStep->GetPostStepPoint();
const G4ParticleDefinition* particle = aStep->GetTrack()->GetDefinition();
//if World, return
//
G4VPhysicalVolume* volume = prePoint->GetTouchableHandle()->GetVolume();
//if sum of absorbers do not fill exactly a layer: check material, not volume.
G4Material* mat = volume->GetLogicalVolume()->GetMaterial();
const G4Material* mat = volume->GetLogicalVolume()->GetMaterial();
if (mat == fDetector->GetWorldMaterial()) return;
const G4StepPoint* endPoint = aStep->GetPostStepPoint();
const G4ParticleDefinition* particle = aStep->GetTrack()->GetDefinition();
//here we are in an absorber. Locate it
//
@@ -110,8 +111,8 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
G4ThreeVector direction = endPoint->GetMomentumDirection();
G4double sizeYZ = 0.5*fDetector->GetCalorSizeYZ();
G4double Eflow = endPoint->GetKineticEnergy();
if (particle == G4Positron::Positron()) Eflow += 2*electron_mass_c2;
if ((std::abs(position.y()) >= sizeYZ) || (std::abs(position.z()) >= sizeYZ))
if(particle == G4Positron::Positron()) Eflow += 2*electron_mass_c2;
if((std::abs(position.y()) >= sizeYZ) || (std::abs(position.z()) >= sizeYZ))
run->SumLateralEleak(Idnow, Eflow);
else if (direction.x() >= 0.) run->SumEnergyFlow(plane=Idnow+1, Eflow);
else run->SumEnergyFlow(plane=Idnow, -Eflow);
@@ -27,7 +27,7 @@
/// \brief Implementation of the TrackingAction class
//
//
// $Id: TrackingAction.cc 78655 2014-01-14 11:13:41Z gcosmo $
// $Id: TrackingAction.cc 109096 2018-03-26 14:46:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -68,11 +68,12 @@ void TrackingAction::PreUserTrackingAction(const G4Track* track )
}
G4double Eflow = track->GetKineticEnergy();
if (track->GetDefinition() == G4Positron::Positron())
Eflow += 2*electron_mass_c2;
if (track->GetDefinition() == G4Positron::Positron()) {
Eflow += 2*electron_mass_c2;
}
//flux artefact, if primary vertex is inside the calorimeter
for (G4int pl=1; pl<=Idnow; pl++) {run->SumEnergyFlow(pl, Eflow);}
for (G4int pl=1; pl<=Idnow; ++pl) {run->SumEnergyFlow(pl, Eflow);}
} else {
run->AddSecondaryTrack(track);
}