From b94a914b126b8691c98d134056e2ae2138578582 Mon Sep 17 00:00:00 2001 From: ivana Date: Tue, 13 Feb 2001 14:17:25 +0000 Subject: [PATCH 1/1] Initial version --- TGeant4/TG4PhysicsConstructorEM.cxx | 157 ++++++ TGeant4/TG4PhysicsConstructorEM.h | 28 ++ TGeant4/TG4PhysicsConstructorHadron.cxx | 450 ++++++++++++++++++ TGeant4/TG4PhysicsConstructorHadron.h | 28 ++ TGeant4/TG4PhysicsConstructorOptical.cxx | 86 ++++ TGeant4/TG4PhysicsConstructorOptical.h | 27 ++ .../TG4PhysicsConstructorSpecialControls.cxx | 88 ++++ .../TG4PhysicsConstructorSpecialControls.h | 27 ++ TGeant4/TG4PhysicsConstructorSpecialCuts.cxx | 99 ++++ TGeant4/TG4PhysicsConstructorSpecialCuts.h | 26 + 10 files changed, 1016 insertions(+) create mode 100644 TGeant4/TG4PhysicsConstructorEM.cxx create mode 100644 TGeant4/TG4PhysicsConstructorEM.h create mode 100644 TGeant4/TG4PhysicsConstructorHadron.cxx create mode 100644 TGeant4/TG4PhysicsConstructorHadron.h create mode 100644 TGeant4/TG4PhysicsConstructorOptical.cxx create mode 100644 TGeant4/TG4PhysicsConstructorOptical.h create mode 100644 TGeant4/TG4PhysicsConstructorSpecialControls.cxx create mode 100644 TGeant4/TG4PhysicsConstructorSpecialControls.h create mode 100644 TGeant4/TG4PhysicsConstructorSpecialCuts.cxx create mode 100644 TGeant4/TG4PhysicsConstructorSpecialCuts.h diff --git a/TGeant4/TG4PhysicsConstructorEM.cxx b/TGeant4/TG4PhysicsConstructorEM.cxx new file mode 100644 index 00000000000..fea4a67ea5b --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorEM.cxx @@ -0,0 +1,157 @@ +// $Id$ +// Category: physics +// +// According to corresponding part of: +// ExN04PhysicsList.cc,v 1.7 1999/12/15 14:49:26 gunter +// GEANT4 tag Name: geant4-01-01 + +#include "TG4PhysicsConstructorEM.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +TG4PhysicsConstructorEM::TG4PhysicsConstructorEM(const G4String& name) + : G4VPhysicsConstructor(name) +{ +// + SetVerboseLevel(1); +} + +TG4PhysicsConstructorEM::~TG4PhysicsConstructorEM() { +// +} + +// protected methods + +void TG4PhysicsConstructorEM::ConstructParticle() +{ +// The particles are constructed in the +// TG4ModularPhysicsList. +// --- +} + +void TG4PhysicsConstructorEM::ConstructProcess() +{ +// Constructs electromagnetic processes. +// --- + + theParticleIterator->reset(); + while( (*theParticleIterator)() ){ + G4ParticleDefinition* particle = theParticleIterator->value(); + G4ProcessManager* pmanager = particle->GetProcessManager(); + G4String particleName = particle->GetParticleName(); + + if (particleName == "gamma") { + // gamma + // Construct processes for gamma + pmanager->AddDiscreteProcess(new G4GammaConversion()); + pmanager->AddDiscreteProcess(new G4ComptonScattering()); + pmanager->AddDiscreteProcess(new G4PhotoElectricEffect()); + + } else if (particleName == "e-") { + //electron + // Construct processes for electron + G4VProcess* theeminusMultipleScattering = new G4MultipleScattering(); + G4VProcess* theeminusIonisation = new G4eIonisation(); + G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung(); + // add processes + pmanager->AddProcess(theeminusMultipleScattering); + pmanager->AddProcess(theeminusIonisation); + pmanager->AddProcess(theeminusBremsstrahlung); + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep, 1); + pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep, 2); + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1); + pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2); + pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3); + + } else if (particleName == "e+") { + //positron + // Construct processes for positron + G4VProcess* theeplusMultipleScattering = new G4MultipleScattering(); + G4VProcess* theeplusIonisation = new G4eIonisation(); + G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung(); + G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation(); + // add processes + pmanager->AddProcess(theeplusMultipleScattering); + pmanager->AddProcess(theeplusIonisation); + pmanager->AddProcess(theeplusBremsstrahlung); + pmanager->AddProcess(theeplusAnnihilation); + // set ordering for AtRestDoIt + pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest); + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep, 1); + pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep, 2); + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1); + pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2); + pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3); + pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4); + + } else if( particleName == "mu+" || + particleName == "mu-" ) { + //muon + // Construct processes for muon+ + G4VProcess* aMultipleScattering = new G4MultipleScattering(); + G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung(); + G4VProcess* aPairProduction = new G4MuPairProduction(); + G4VProcess* anIonisation = new G4MuIonisation(); + // add processes + pmanager->AddProcess(anIonisation); + pmanager->AddProcess(aMultipleScattering); + pmanager->AddProcess(aBremsstrahlung); + pmanager->AddProcess(aPairProduction); + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1); + pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2); + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1); + pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2); + pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3); + pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4); + + } else if( particleName == "GenericIon" ) { + G4VProcess* aionIonization = new G4hIonisation; + G4VProcess* aMultipleScattering = new G4MultipleScattering(); + pmanager->AddProcess(aionIonization); + pmanager->AddProcess(aMultipleScattering); + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1); + pmanager->SetProcessOrdering(aionIonization, idxAlongStep, 2); + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1); + pmanager->SetProcessOrdering(aionIonization, idxPostStep, 2); + + } else if ((!particle->IsShortLived()) && + (particle->GetPDGCharge() != 0.0) && + (particle->GetParticleName() != "chargedgeantino")) { + // all others charged particles except geantino + G4VProcess* aMultipleScattering = new G4MultipleScattering(); + G4VProcess* anIonisation = new G4hIonisation(); + // add processes + pmanager->AddProcess(anIonisation); + pmanager->AddProcess(aMultipleScattering); + // set ordering for AlongStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1); + pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2); + // set ordering for PostStepDoIt + pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1); + pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2); + } + } + + if (verboseLevel>0) + G4cout << "### Electromagnetic physics constructed." << G4endl; +} diff --git a/TGeant4/TG4PhysicsConstructorEM.h b/TGeant4/TG4PhysicsConstructorEM.h new file mode 100644 index 00000000000..951a668f073 --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorEM.h @@ -0,0 +1,28 @@ +// $Id$ +// Category: physics +// +// Constructor of electromagnetic physics. +// According to the corresponding part of: +// ExN04PhysicsList.hh, GEANT4 tag Name: geant4-01-01 + +#ifndef TG4_PHYSICS_CONSTRUCTOR_EM_H +#define TG4_PHYSICS_CONSTRUCTOR_EM_H + +#include +#include + +class TG4PhysicsConstructorEM: public G4VPhysicsConstructor +{ + public: + TG4PhysicsConstructorEM(const G4String& name = "EM"); + virtual ~TG4PhysicsConstructorEM(); + + protected: + // methods + // construct particle and physics + virtual void ConstructParticle(); + virtual void ConstructProcess(); +}; + +#endif //TG4_PHYSICS_CONSTRUCTOR_H + diff --git a/TGeant4/TG4PhysicsConstructorHadron.cxx b/TGeant4/TG4PhysicsConstructorHadron.cxx new file mode 100644 index 00000000000..96aa3bc6390 --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorHadron.cxx @@ -0,0 +1,450 @@ +// $Id$ +// Category: physics +// +// According to corresponding part of: +// ExN04PhysicsList.cc,v 1.7 1999/12/15 14:49:26 gunter +// GEANT4 tag Name: geant4-01-01 + +#include "TG4PhysicsConstructorHadron.h" + +#include +#include + +// Hadron Processes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Low-energy Models +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// High-energy Models +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Stopping processes +#ifdef TRIUMF_STOP_PIMINUS +#include +#else +#include +#endif +#ifdef TRIUMF_STOP_KMINUS +#include +#else +#include +#endif + +TG4PhysicsConstructorHadron::TG4PhysicsConstructorHadron(const G4String& name) + : G4VPhysicsConstructor(name) +{ +// + SetVerboseLevel(1); +} + +TG4PhysicsConstructorHadron::~TG4PhysicsConstructorHadron() { +// +} + +// protected methods + +void TG4PhysicsConstructorHadron::ConstructParticle() +{ +// The particles are constructed in the +// TG4ModularPhysicsList. +// --- +} + +void TG4PhysicsConstructorHadron::ConstructProcess() +{ +// Makes discrete physics processes for the hadrons, at present limited +// to those particles with GHEISHA interactions (INTRC > 0). +// The processes are: Elastic scattering and Inelastic scattering. +// +// F.W.Jones 09-JUL-1998 +// --- + + G4HadronElasticProcess* theElasticProcess = + new G4HadronElasticProcess; + G4LElastic* theElasticModel = new G4LElastic; + theElasticProcess->RegisterMe(theElasticModel); + + theParticleIterator->reset(); + while ((*theParticleIterator)()) { + G4ParticleDefinition* particle = theParticleIterator->value(); + G4ProcessManager* pmanager = particle->GetProcessManager(); + G4String particleName = particle->GetParticleName(); + + if (particleName == "pi+") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4PionPlusInelasticProcess* theInelasticProcess = + new G4PionPlusInelasticProcess("inelastic"); + G4LEPionPlusInelastic* theLEInelasticModel = + new G4LEPionPlusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEPionPlusInelastic* theHEInelasticModel = + new G4HEPionPlusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "pi-") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4PionMinusInelasticProcess* theInelasticProcess = + new G4PionMinusInelasticProcess("inelastic"); + G4LEPionMinusInelastic* theLEInelasticModel = + new G4LEPionMinusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEPionMinusInelastic* theHEInelasticModel = + new G4HEPionMinusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); +#ifdef TRIUMF_STOP_PIMINUS + pmanager->AddRestProcess(new G4PionMinusAbsorptionAtRest, ordDefault); +#else + G4String prcNam; + pmanager->AddRestProcess( + new G4PiMinusAbsorptionAtRest( + prcNam="PiMinusAbsorptionAtRest"), ordDefault); +#endif + } + else if (particleName == "kaon+") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4KaonPlusInelasticProcess* theInelasticProcess = + new G4KaonPlusInelasticProcess("inelastic"); + G4LEKaonPlusInelastic* theLEInelasticModel = + new G4LEKaonPlusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEKaonPlusInelastic* theHEInelasticModel = + new G4HEKaonPlusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "kaon0S") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4KaonZeroSInelasticProcess* theInelasticProcess = + new G4KaonZeroSInelasticProcess("inelastic"); + G4LEKaonZeroSInelastic* theLEInelasticModel = + new G4LEKaonZeroSInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEKaonZeroInelastic* theHEInelasticModel = + new G4HEKaonZeroInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "kaon0L") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4KaonZeroLInelasticProcess* theInelasticProcess = + new G4KaonZeroLInelasticProcess("inelastic"); + G4LEKaonZeroLInelastic* theLEInelasticModel = + new G4LEKaonZeroLInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEKaonZeroInelastic* theHEInelasticModel = + new G4HEKaonZeroInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "kaon-") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4KaonMinusInelasticProcess* theInelasticProcess = + new G4KaonMinusInelasticProcess("inelastic"); + G4LEKaonMinusInelastic* theLEInelasticModel = + new G4LEKaonMinusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEKaonMinusInelastic* theHEInelasticModel = + new G4HEKaonMinusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); +#ifdef TRIUMF_STOP_KMINUS + pmanager->AddRestProcess(new G4KaonMinusAbsorption, ordDefault); +#else + pmanager->AddRestProcess(new G4KaonMinusAbsorptionAtRest, ordDefault); +#endif + } + else if (particleName == "proton") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4ProtonInelasticProcess* theInelasticProcess = + new G4ProtonInelasticProcess("inelastic"); + G4LEProtonInelastic* theLEInelasticModel = new G4LEProtonInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEProtonInelastic* theHEInelasticModel = new G4HEProtonInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "anti_proton") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AntiProtonInelasticProcess* theInelasticProcess = + new G4AntiProtonInelasticProcess("inelastic"); + G4LEAntiProtonInelastic* theLEInelasticModel = + new G4LEAntiProtonInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEAntiProtonInelastic* theHEInelasticModel = + new G4HEAntiProtonInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "neutron") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4NeutronInelasticProcess* theInelasticProcess = + new G4NeutronInelasticProcess("inelastic"); + G4LENeutronInelastic* theLEInelasticModel = + new G4LENeutronInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HENeutronInelastic* theHEInelasticModel = + new G4HENeutronInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "anti_neutron") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AntiNeutronInelasticProcess* theInelasticProcess = + new G4AntiNeutronInelasticProcess("inelastic"); + G4LEAntiNeutronInelastic* theLEInelasticModel = + new G4LEAntiNeutronInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEAntiNeutronInelastic* theHEInelasticModel = + new G4HEAntiNeutronInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "lambda") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4LambdaInelasticProcess* theInelasticProcess = + new G4LambdaInelasticProcess("inelastic"); + G4LELambdaInelastic* theLEInelasticModel = new G4LELambdaInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HELambdaInelastic* theHEInelasticModel = new G4HELambdaInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "anti_lambda") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AntiLambdaInelasticProcess* theInelasticProcess = + new G4AntiLambdaInelasticProcess("inelastic"); + G4LEAntiLambdaInelastic* theLEInelasticModel = + new G4LEAntiLambdaInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEAntiLambdaInelastic* theHEInelasticModel = + new G4HEAntiLambdaInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "sigma+") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4SigmaPlusInelasticProcess* theInelasticProcess = + new G4SigmaPlusInelasticProcess("inelastic"); + G4LESigmaPlusInelastic* theLEInelasticModel = + new G4LESigmaPlusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HESigmaPlusInelastic* theHEInelasticModel = + new G4HESigmaPlusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "sigma-") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4SigmaMinusInelasticProcess* theInelasticProcess = + new G4SigmaMinusInelasticProcess("inelastic"); + G4LESigmaMinusInelastic* theLEInelasticModel = + new G4LESigmaMinusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HESigmaMinusInelastic* theHEInelasticModel = + new G4HESigmaMinusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "anti_sigma+") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AntiSigmaPlusInelasticProcess* theInelasticProcess = + new G4AntiSigmaPlusInelasticProcess("inelastic"); + G4LEAntiSigmaPlusInelastic* theLEInelasticModel = + new G4LEAntiSigmaPlusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEAntiSigmaPlusInelastic* theHEInelasticModel = + new G4HEAntiSigmaPlusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "anti_sigma-") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AntiSigmaMinusInelasticProcess* theInelasticProcess = + new G4AntiSigmaMinusInelasticProcess("inelastic"); + G4LEAntiSigmaMinusInelastic* theLEInelasticModel = + new G4LEAntiSigmaMinusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEAntiSigmaMinusInelastic* theHEInelasticModel = + new G4HEAntiSigmaMinusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "xi0") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4XiZeroInelasticProcess* theInelasticProcess = + new G4XiZeroInelasticProcess("inelastic"); + G4LEXiZeroInelastic* theLEInelasticModel = + new G4LEXiZeroInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEXiZeroInelastic* theHEInelasticModel = + new G4HEXiZeroInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "xi-") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4XiMinusInelasticProcess* theInelasticProcess = + new G4XiMinusInelasticProcess("inelastic"); + G4LEXiMinusInelastic* theLEInelasticModel = + new G4LEXiMinusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEXiMinusInelastic* theHEInelasticModel = + new G4HEXiMinusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "anti_xi0") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AntiXiZeroInelasticProcess* theInelasticProcess = + new G4AntiXiZeroInelasticProcess("inelastic"); + G4LEAntiXiZeroInelastic* theLEInelasticModel = + new G4LEAntiXiZeroInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEAntiXiZeroInelastic* theHEInelasticModel = + new G4HEAntiXiZeroInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "anti_xi-") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AntiXiMinusInelasticProcess* theInelasticProcess = + new G4AntiXiMinusInelasticProcess("inelastic"); + G4LEAntiXiMinusInelastic* theLEInelasticModel = + new G4LEAntiXiMinusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEAntiXiMinusInelastic* theHEInelasticModel = + new G4HEAntiXiMinusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "deuteron") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4DeuteronInelasticProcess* theInelasticProcess = + new G4DeuteronInelasticProcess("inelastic"); + G4LEDeuteronInelastic* theLEInelasticModel = + new G4LEDeuteronInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "triton") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4TritonInelasticProcess* theInelasticProcess = + new G4TritonInelasticProcess("inelastic"); + G4LETritonInelastic* theLEInelasticModel = + new G4LETritonInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "alpha") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AlphaInelasticProcess* theInelasticProcess = + new G4AlphaInelasticProcess("inelastic"); + G4LEAlphaInelastic* theLEInelasticModel = + new G4LEAlphaInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "omega-") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4OmegaMinusInelasticProcess* theInelasticProcess = + new G4OmegaMinusInelasticProcess("inelastic"); + G4LEOmegaMinusInelastic* theLEInelasticModel = + new G4LEOmegaMinusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEOmegaMinusInelastic* theHEInelasticModel = + new G4HEOmegaMinusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + else if (particleName == "anti_omega-") { + pmanager->AddDiscreteProcess(theElasticProcess); + G4AntiOmegaMinusInelasticProcess* theInelasticProcess = + new G4AntiOmegaMinusInelasticProcess("inelastic"); + G4LEAntiOmegaMinusInelastic* theLEInelasticModel = + new G4LEAntiOmegaMinusInelastic; + theInelasticProcess->RegisterMe(theLEInelasticModel); + G4HEAntiOmegaMinusInelastic* theHEInelasticModel = + new G4HEAntiOmegaMinusInelastic; + theInelasticProcess->RegisterMe(theHEInelasticModel); + pmanager->AddDiscreteProcess(theInelasticProcess); + } + } + + if (verboseLevel>0) + G4cout << "### Hadron physics constructed." << G4endl; +} + diff --git a/TGeant4/TG4PhysicsConstructorHadron.h b/TGeant4/TG4PhysicsConstructorHadron.h new file mode 100644 index 00000000000..9239b04dc68 --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorHadron.h @@ -0,0 +1,28 @@ +// $Id$ +// Category: physics +// +// Constructor of hadron physics. +// According to corresponding part of: +// ExN04PhysicsList.hh, GEANT4 tag Name: geant4-01-01 + +#ifndef TG4_PHYSICS_CONSTRUCTOR_HADRON_H +#define TG4_PHYSICS_CONSTRUCTOR_HADRON_H + +#include +#include + +class TG4PhysicsConstructorHadron: public G4VPhysicsConstructor +{ + public: + TG4PhysicsConstructorHadron(const G4String& name = "Hadron"); + virtual ~TG4PhysicsConstructorHadron(); + + protected: + // methods + // construct particle and physics + virtual void ConstructParticle(); + virtual void ConstructProcess(); +}; + +#endif //TG4_PHYSICS_CONSTRUCTOR_HADRON_H + diff --git a/TGeant4/TG4PhysicsConstructorOptical.cxx b/TGeant4/TG4PhysicsConstructorOptical.cxx new file mode 100644 index 00000000000..517f8e53396 --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorOptical.cxx @@ -0,0 +1,86 @@ +// $Id$ +// Category: physics +// +// According to ExN06PhysicsList (geant4 1.1) + +#include "TG4PhysicsConstructorOptical.h" + +#include +#include +#include +#include +#include +#include + +TG4PhysicsConstructorOptical::TG4PhysicsConstructorOptical(const G4String& name) + : G4VPhysicsConstructor(name) +{ +// + SetVerboseLevel(1); +} + +TG4PhysicsConstructorOptical::~TG4PhysicsConstructorOptical() { +// +} + +// protected methods + +void TG4PhysicsConstructorOptical::ConstructParticle() +{ +// The particles are constructed in the +// TG4ModularPhysicsList. +// --- +} + +void TG4PhysicsConstructorOptical::ConstructProcess() +{ +// Constructs optical processes. +// According to ExN06PhysicsList.cc. +// (geant4 1.1) +// --- + + G4Cerenkov* theCerenkovProcess = new G4Cerenkov("Cerenkov"); + G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption(); + G4OpRayleigh* theRayleighScatteringProcess = new G4OpRayleigh(); + G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess(); + + theCerenkovProcess->DumpPhysicsTable(); + //theAbsorptionProcess->DumpPhysicsTable(); + //theRayleighScatteringProcess->DumpPhysicsTable(); + + // add verbose + //theCerenkovProcess->SetVerboseLevel(1); + //theAbsorptionProcess->SetVerboseLevel(1); + //theRayleighScatteringProcess->SetVerboseLevel(1); + //theBoundaryProcess->SetVerboseLevel(1); + + G4int maxNumPhotons = 300; + + theCerenkovProcess->SetTrackSecondariesFirst(true); + theCerenkovProcess->SetMaxNumPhotonsPerStep(maxNumPhotons); + + //G4OpticalSurfaceModel themodel = unified; + // model from GEANT3 + G4OpticalSurfaceModel themodel = glisur; + theBoundaryProcess->SetModel(themodel); + + theParticleIterator->reset(); + while( (*theParticleIterator)() ){ + G4ParticleDefinition* particle = theParticleIterator->value(); + G4ProcessManager* processManager = particle->GetProcessManager(); + G4String particleName = particle->GetParticleName(); + if (theCerenkovProcess->IsApplicable(*particle)) { + processManager->AddContinuousProcess(theCerenkovProcess); + } + if (particleName == "opticalphoton") { + G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl; + processManager->AddDiscreteProcess(theAbsorptionProcess); + processManager->AddDiscreteProcess(theRayleighScatteringProcess); + processManager->AddDiscreteProcess(theBoundaryProcess); + } + } + + if (verboseLevel>0) + G4cout << "### " << namePhysics << " physics constructed." << G4endl; +} + diff --git a/TGeant4/TG4PhysicsConstructorOptical.h b/TGeant4/TG4PhysicsConstructorOptical.h new file mode 100644 index 00000000000..6fcbff377bc --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorOptical.h @@ -0,0 +1,27 @@ +// $Id$ +// Category: physics +// +// Constructor of optical physics. +// According to ExN06PhysicsList (geant4 1.1) + +#ifndef TG4_PHYSICS_CONSTRUCTOR_OPTICAL_H +#define TG4_PHYSICS_CONSTRUCTOR_OPTICAL_H + +#include +#include + +class TG4PhysicsConstructorOptical: public G4VPhysicsConstructor +{ + public: + TG4PhysicsConstructorOptical(const G4String& name = "Optical"); + virtual ~TG4PhysicsConstructorOptical(); + + protected: + // methods + // construct particle and physics + virtual void ConstructParticle(); + virtual void ConstructProcess(); +}; + +#endif //TG4_PHYSICS_CONSTRUCTOR_OPTICAL_H + diff --git a/TGeant4/TG4PhysicsConstructorSpecialControls.cxx b/TGeant4/TG4PhysicsConstructorSpecialControls.cxx new file mode 100644 index 00000000000..851e81cc49e --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorSpecialControls.cxx @@ -0,0 +1,88 @@ +// $Id$ +// Category: physics +// +// See the class description in the header file. + +#include "TG4PhysicsConstructorSpecialControls.h" +#include "TG4SpecialControls.h" +#include "TG4G3PhysicsManager.h" +#include "TG4G3ControlVector.h" + +#include +#include +#include + +TG4PhysicsConstructorSpecialControls::TG4PhysicsConstructorSpecialControls( + const G4String& name) + : G4VPhysicsConstructor(name) +{ +// + SetVerboseLevel(1); +} + +TG4PhysicsConstructorSpecialControls::~TG4PhysicsConstructorSpecialControls() { +// +} + +// protected methods + +void TG4PhysicsConstructorSpecialControls::ConstructParticle() +{ +// The particles are constructed in the +// TG4ModularPhysicsList. +// --- +} + +void TG4PhysicsConstructorSpecialControls::ConstructProcess() +{ +// Adds TG4SpecialControls "process" that activates +// the control process controls defined in TG4Limits. +// --- + + TG4G3PhysicsManager* g3PhysicsManager + = TG4G3PhysicsManager::Instance(); + + if (g3PhysicsManager->IsSpecialControls()) + { + G4cout << "IsSpecialControls started" << G4endl; + TG4boolVector* isControlVector + = g3PhysicsManager->GetIsControlVector(); + + theParticleIterator->reset(); + while ((*theParticleIterator)()) + { + G4ParticleDefinition* particle = theParticleIterator->value(); + TG4G3ParticleWSP particleWSP + = g3PhysicsManager->GetG3ParticleWSP(particle); + //G4String name; + //GetG3ParticleWSPName(particleWSP, name); + + // special process is set in case + // the special control is set by TG4Limits + if ((particleWSP !=kNofParticlesWSP) && + ((*isControlVector)[particleWSP])) { + // check if process already exists + G4String processName = "specialControl"; + G4VProcess* process = g3PhysicsManager->FindProcess(processName); + if (!process) { + process = new TG4SpecialControls(processName); + } + //particle->GetProcessManager()->AddProcess(process, 0, -1, 1); + particle->GetProcessManager()->AddDiscreteProcess(process); + } + } + + if (verboseLevel>0) { + G4cout << "TG4PhysicsConstructorSpecialControls::ConstructProcess: " << G4endl; + G4cout << " Special controls process is defined for: " << G4endl + << " "; + for (G4int i=0; iGetG3ParticleWSPName(i, name); + if ((*isControlVector)[i]) G4cout << name << " "; + } + G4cout << G4endl; + } + } +} + diff --git a/TGeant4/TG4PhysicsConstructorSpecialControls.h b/TGeant4/TG4PhysicsConstructorSpecialControls.h new file mode 100644 index 00000000000..d66a2edf6bc --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorSpecialControls.h @@ -0,0 +1,27 @@ +// $Id$ +// Category: physics +// +// Constructor of special controls of physics processes. + +#ifndef TG4_PHYSICS_CONSTRUCTOR_SPECIAL_CONTROLS_H +#define TG4_PHYSICS_CONSTRUCTOR_SPECIAL_CONTROLS_H + +#include +#include + +class TG4PhysicsConstructorSpecialControls: public G4VPhysicsConstructor +{ + public: + TG4PhysicsConstructorSpecialControls( + const G4String& name = "Special controls"); + virtual ~TG4PhysicsConstructorSpecialControls(); + + protected: + // methods + // construct particle and physics + virtual void ConstructParticle(); + virtual void ConstructProcess(); +}; + +#endif //TG4_PHYSICS_CONSTRUCTOR_SPECIAL_CONTROLS_H + diff --git a/TGeant4/TG4PhysicsConstructorSpecialCuts.cxx b/TGeant4/TG4PhysicsConstructorSpecialCuts.cxx new file mode 100644 index 00000000000..67a136ade8b --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorSpecialCuts.cxx @@ -0,0 +1,99 @@ +// $Id$ +// Category: physics +// +// See the class description in the header file. + +#include "TG4PhysicsConstructorSpecialCuts.h" +#include "TG4G3PhysicsManager.h" +#include "TG4SpecialCuts.h" + +#include +#include +#include + + +TG4PhysicsConstructorSpecialCuts::TG4PhysicsConstructorSpecialCuts( + const G4String& name) + : G4VPhysicsConstructor(name) +{ +// + SetVerboseLevel(1); +} + +TG4PhysicsConstructorSpecialCuts::~TG4PhysicsConstructorSpecialCuts() { +// +} + +// protected methods + +void TG4PhysicsConstructorSpecialCuts::ConstructParticle() +{ +// The particles are constructed in the +// TG4ModularPhysicsList. +// --- +} + +void TG4PhysicsConstructorSpecialCuts::ConstructProcess() +{ +// Adds TG4SpecialCuts "process" that activates +// the kinetic energy cuts defined in +// the vector of cuts (PhysicsManager::fCutVector) or in TG4Limits. +// --- + + TG4G3PhysicsManager* g3PhysicsManager + = TG4G3PhysicsManager::Instance(); + + if (g3PhysicsManager->IsSpecialCuts()) + { + TG4G3CutVector* cutVector + = g3PhysicsManager->GetCutVector(); + TG4boolVector* isCutVector + = g3PhysicsManager->GetIsCutVector(); + + theParticleIterator->reset(); + while ((*theParticleIterator)()) + { + G4ParticleDefinition* particle = theParticleIterator->value(); + TG4G3ParticleWSP particleWSP + = g3PhysicsManager->GetG3ParticleWSP(particle); + G4String name; + g3PhysicsManager->GetG3ParticleWSPName(particleWSP, name); + + // uncomment this to see all particles "WSP" + //G4cout << "Iterating particle: " + // << particle->GetParticleName() << " " << particleWSP << " " + // << name << G4endl; + + // special process is created in case + // cutVector (vector of kinetic energy cuts) is set + // or the special cut is set by TG4Limits + if ((particleWSP !=kNofParticlesWSP) && + ((*isCutVector)[particleWSP])) { + // check if process already exists + G4String processName = "specialCutFor" + name; + G4VProcess* process = g3PhysicsManager->FindProcess(processName); + if (!process) { + process = new TG4SpecialCuts(particleWSP, cutVector, processName); + } + //particle->GetProcessManager()->AddProcess(process, 0, -1, 1); + particle->GetProcessManager()->AddDiscreteProcess(process); + } + } + + if (verboseLevel>0) { + G4cout << "TG4PhysicsList::ConstructSpecialCuts: " << G4endl; + if (cutVector) + G4cout << " Global kinetic energy cuts are set." << G4endl; + G4cout << " Special cuts process is defined for: " << G4endl + << " "; + for (G4int i=0; iGetG3ParticleWSPName(i, name); + if ((*isCutVector)[i]) G4cout << name << " "; + } + G4cout << G4endl; + } + } +} + + diff --git a/TGeant4/TG4PhysicsConstructorSpecialCuts.h b/TGeant4/TG4PhysicsConstructorSpecialCuts.h new file mode 100644 index 00000000000..c1caeea2c2e --- /dev/null +++ b/TGeant4/TG4PhysicsConstructorSpecialCuts.h @@ -0,0 +1,26 @@ +// $Id$ +// Category: physics +// +// Constructor of special cuts. + +#ifndef TG4_PHYSICS_CONSTRUCTOR_SPECIAL_CUTS_H +#define TG4_PHYSICS_CONSTRUCTOR_SPECIAL_CUTS_H + +#include +#include + +class TG4PhysicsConstructorSpecialCuts: public G4VPhysicsConstructor +{ + public: + TG4PhysicsConstructorSpecialCuts(const G4String& name = "Special cuts"); + virtual ~TG4PhysicsConstructorSpecialCuts(); + + protected: + // methods + // construct particle and physics + virtual void ConstructParticle(); + virtual void ConstructProcess(); +}; + +#endif //TG4_PHYSICS_CONSTRUCTOR_SPECIAL_CUTS_H + -- 2.39.3