Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -23,12 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: WLSPhysicsList.cc 78066 2013-12-03 11:08:36Z gcosmo $
//
/// \file optical/wls/src/WLSPhysicsList.cc
/// \brief Implementation of the WLSPhysicsList class
//
//
//
#include "WLSPhysicsList.hh"
#include "WLSPhysicsListMessenger.hh"
@@ -41,7 +41,9 @@
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4PhysListFactory.hh"
//#include "G4PhysListFactory.hh"
#include "FTFP_BERT.hh"
#include "QGSP_BERT_HP.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
@@ -62,6 +64,8 @@
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
WLSPhysicsList::WLSPhysicsList(G4String physName) : G4VModularPhysicsList()
{
G4LossTableManager::Instance();
@@ -71,14 +75,19 @@ WLSPhysicsList::WLSPhysicsList(G4String physName) : G4VModularPhysicsList()
fCutForElectron = defaultCutValue;
fCutForPositron = defaultCutValue;
G4PhysListFactory factory;
// G4PhysListFactory factory;
G4VModularPhysicsList* phys = NULL;
if (factory.IsReferencePhysList(physName)) {
phys = factory.GetReferencePhysList(physName);
if(!phys)G4Exception("WLSPhysicsList::WLSPhysicsList","InvalidSetup",
FatalException,"PhysicsList does not exist");
fMessenger = new WLSPhysicsListMessenger(this);
if (physName == "QGSP_BERT_HP") {
phys = new QGSP_BERT_HP;
} else {
phys = new FTFP_BERT;
}
// if (factory.IsReferencePhysList(physName)) {
// phys = factory.GetReferencePhysList(physName);
// if(!phys)G4Exception("WLSPhysicsList::WLSPhysicsList","InvalidSetup",
// FatalException,"PhysicsList does not exist");
fMessenger = new WLSPhysicsListMessenger(this);
// }
for (G4int i = 0; ; ++i) {
G4VPhysicsConstructor* elem =
@@ -88,32 +97,47 @@ WLSPhysicsList::WLSPhysicsList(G4String physName) : G4VModularPhysicsList()
RegisterPhysics(elem);
}
AbsorptionOn = true;
fAbsorptionOn = true;
//This looks complex, but it is not:
//Get from base-class the pointer of the phsyicsVector
//to be used. Remember: G4VModularPhysicsList is now a split class.
//Why G4VModularPhysicsList::RegisterPhysics method is not used instead?
//If possible we can remove this...
fPhysicsVector =
GetSubInstanceManager().offset[GetInstanceID()].physicsVector;
fPhysicsVector->push_back(new WLSExtraPhysics());
fPhysicsVector->push_back(fOpticalPhysics =
new WLSOpticalPhysics(fAbsorptionOn));
physicsVector->push_back(new WLSExtraPhysics());
physicsVector->push_back(opticalPhysics = new WLSOpticalPhysics(AbsorptionOn));
fPhysicsVector->push_back(new G4RadioactiveDecayPhysics());
physicsVector->push_back(new G4RadioactiveDecayPhysics());
stepMaxProcess = new WLSStepMax();
fStepMaxProcess = new WLSStepMax();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
WLSPhysicsList::~WLSPhysicsList()
{
delete fMessenger;
delete stepMaxProcess;
delete fStepMaxProcess;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::ClearPhysics()
{
for (G4PhysConstVector::iterator p = physicsVector->begin();
p != physicsVector->end(); ++p) {
for (G4PhysConstVector::iterator p = fPhysicsVector->begin();
p != fPhysicsVector->end(); ++p) {
delete (*p);
}
physicsVector->clear();
fPhysicsVector->clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::ConstructParticle()
{
G4VModularPhysicsList::ConstructParticle();
@@ -134,6 +158,8 @@ void WLSPhysicsList::ConstructParticle()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::ConstructProcess()
{
G4VModularPhysicsList::ConstructProcess();
@@ -147,67 +173,69 @@ void WLSPhysicsList::ConstructProcess()
G4VProcess* decay;
decay = processTable->FindProcess("Decay",G4MuonPlus::MuonPlus());
G4ProcessManager* fManager;
fManager = G4MuonPlus::MuonPlus()->GetProcessManager();
G4ProcessManager* pManager;
pManager = G4MuonPlus::MuonPlus()->GetProcessManager();
if (fManager) {
if (decay) fManager->RemoveProcess(decay);
fManager->AddProcess(decayWithSpin);
if (pManager) {
if (decay) pManager->RemoveProcess(decay);
pManager->AddProcess(decayWithSpin);
// set ordering for PostStepDoIt and AtRestDoIt
fManager ->SetProcessOrdering(decayWithSpin, idxPostStep);
fManager ->SetProcessOrdering(decayWithSpin, idxAtRest);
pManager ->SetProcessOrdering(decayWithSpin, idxPostStep);
pManager ->SetProcessOrdering(decayWithSpin, idxAtRest);
}
decay = processTable->FindProcess("Decay",G4MuonMinus::MuonMinus());
fManager = G4MuonMinus::MuonMinus()->GetProcessManager();
pManager = G4MuonMinus::MuonMinus()->GetProcessManager();
if (fManager) {
if (decay) fManager->RemoveProcess(decay);
fManager->AddProcess(decayWithSpin);
if (pManager) {
if (decay) pManager->RemoveProcess(decay);
pManager->AddProcess(decayWithSpin);
// set ordering for PostStepDoIt and AtRestDoIt
fManager ->SetProcessOrdering(decayWithSpin, idxPostStep);
fManager ->SetProcessOrdering(decayWithSpin, idxAtRest);
pManager ->SetProcessOrdering(decayWithSpin, idxPostStep);
pManager ->SetProcessOrdering(decayWithSpin, idxAtRest);
}
G4PionDecayMakeSpin* poldecay = new G4PionDecayMakeSpin();
decay = processTable->FindProcess("Decay",G4PionPlus::PionPlus());
fManager = G4PionPlus::PionPlus()->GetProcessManager();
pManager = G4PionPlus::PionPlus()->GetProcessManager();
if (fManager) {
if (decay) fManager->RemoveProcess(decay);
fManager->AddProcess(poldecay);
if (pManager) {
if (decay) pManager->RemoveProcess(decay);
pManager->AddProcess(poldecay);
// set ordering for PostStepDoIt and AtRestDoIt
fManager ->SetProcessOrdering(poldecay, idxPostStep);
fManager ->SetProcessOrdering(poldecay, idxAtRest);
pManager ->SetProcessOrdering(poldecay, idxPostStep);
pManager ->SetProcessOrdering(poldecay, idxAtRest);
}
decay = processTable->FindProcess("Decay",G4PionMinus::PionMinus());
fManager = G4PionMinus::PionMinus()->GetProcessManager();
pManager = G4PionMinus::PionMinus()->GetProcessManager();
if (fManager) {
if (decay) fManager->RemoveProcess(decay);
fManager->AddProcess(poldecay);
if (pManager) {
if (decay) pManager->RemoveProcess(decay);
pManager->AddProcess(poldecay);
// set ordering for PostStepDoIt and AtRestDoIt
fManager ->SetProcessOrdering(poldecay, idxPostStep);
fManager ->SetProcessOrdering(poldecay, idxAtRest);
pManager ->SetProcessOrdering(poldecay, idxPostStep);
pManager ->SetProcessOrdering(poldecay, idxAtRest);
}
AddStepMax();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::RemoveFromPhysicsList(const G4String& name)
{
G4bool success = false;
for (G4PhysConstVector::iterator p = physicsVector->begin();
p != physicsVector->end(); ++p) {
for (G4PhysConstVector::iterator p = fPhysicsVector->begin();
p != fPhysicsVector->end(); ++p) {
G4VPhysicsConstructor* e = (*p);
if (e->GetPhysicsName() == name) {
physicsVector->erase(p);
fPhysicsVector->erase(p);
success = true;
break;
}
@@ -220,14 +248,19 @@ void WLSPhysicsList::RemoveFromPhysicsList(const G4String& name)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::SetAbsorption(G4bool toggle)
{
AbsorptionOn = toggle;
fAbsorptionOn = toggle;
RemoveFromPhysicsList("Optical");
physicsVector->push_back(opticalPhysics = new WLSOpticalPhysics(toggle));
opticalPhysics->ConstructProcess();
fPhysicsVector->
push_back(fOpticalPhysics = new WLSOpticalPhysics(toggle));
fOpticalPhysics->ConstructProcess();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::SetCuts()
{
if (verboseLevel >0) {
@@ -245,35 +278,46 @@ void WLSPhysicsList::SetCuts()
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::SetCutForGamma(G4double cut)
{
fCutForGamma = cut;
SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::SetCutForElectron(G4double cut)
{
fCutForElectron = cut;
SetParticleCuts(fCutForElectron, G4Electron::Electron());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::SetCutForPositron(G4double cut)
{
fCutForPositron = cut;
SetParticleCuts(fCutForPositron, G4Positron::Positron());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::SetStepMax(G4double step)
{
MaxChargedStep = step;
stepMaxProcess->SetStepMax(MaxChargedStep);
fStepMaxProcess->SetStepMax(step);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
WLSStepMax* WLSPhysicsList::GetStepMaxProcess()
{
return stepMaxProcess;
return fStepMaxProcess;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::AddStepMax()
{
// Step limitation seen as a process
@@ -283,24 +327,28 @@ void WLSPhysicsList::AddStepMax()
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
{
if (pmanager) pmanager ->AddDiscreteProcess(stepMaxProcess);
if (pmanager) pmanager ->AddDiscreteProcess(fStepMaxProcess);
}
}
}
void WLSPhysicsList::SetNbOfPhotonsCerenkov(G4int MaxNumber)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::SetNbOfPhotonsCerenkov(G4int maxNumber)
{
opticalPhysics->SetNbOfPhotonsCerenkov(MaxNumber);
fOpticalPhysics->SetNbOfPhotonsCerenkov(maxNumber);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void WLSPhysicsList::SetVerbose(G4int verbose)
{
opticalPhysics->GetCerenkovProcess()->SetVerboseLevel(verbose);
opticalPhysics->GetScintillationProcess()->SetVerboseLevel(verbose);
opticalPhysics->GetAbsorptionProcess()->SetVerboseLevel(verbose);
opticalPhysics->GetRayleighScatteringProcess()->SetVerboseLevel(verbose);
opticalPhysics->GetMieHGScatteringProcess()->SetVerboseLevel(verbose);
opticalPhysics->GetBoundaryProcess()->SetVerboseLevel(verbose);
fOpticalPhysics->GetCerenkovProcess()->SetVerboseLevel(verbose);
fOpticalPhysics->GetScintillationProcess()->SetVerboseLevel(verbose);
fOpticalPhysics->GetAbsorptionProcess()->SetVerboseLevel(verbose);
fOpticalPhysics->GetRayleighScatteringProcess()->SetVerboseLevel(verbose);
fOpticalPhysics->GetMieHGScatteringProcess()->SetVerboseLevel(verbose);
fOpticalPhysics->GetBoundaryProcess()->SetVerboseLevel(verbose);
}