Introduction to GEANT4
From UCL HEP PBT Wiki
m |
m |
||
Line 164: | Line 164: | ||
- | GEANT4 provides a variety of physics processes. These processes are decoupled from one another and you can select those which are relevant to your simulation. The processes are grouped in seven categories and their | + | GEANT4 provides a variety of physics processes. These processes are decoupled from one another and you can select those which are relevant to your simulation. The processes are grouped in seven categories and their list is available [http://geant4.cern.ch/support/proc_mod_catalog/processes/ here]: |
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2"> | <div style="column-count:2;-moz-column-count:2;-webkit-column-count:2"> | ||
Line 177: | Line 177: | ||
- | + | For each particle defined in ConstructParticle() assign all the physics processes that you want to | |
+ | consider in your simulation: | ||
Line 246: | Line 247: | ||
=== <span style="color:#000080"> Detailed physics lists </span> === | === <span style="color:#000080"> Detailed physics lists </span> === | ||
- | If you want to build more realistic physics list you have to use the class <span style="color:#ff0000"> G4VModularPhysicsList </span>. For example, the photon from the example above can undergo compton scattering apart from conversion. In <span style="color:#ff0000"> G4VModularPhysicsList </span> you can group the physics processes into separate modules: EM physics, hadronic physics, | + | If you want to build more realistic physics list you have to use the class <span style="color:#ff0000"> G4VModularPhysicsList </span>. For example, the photon from the example above can undergo compton scattering apart from conversion. In <span style="color:#ff0000"> G4VModularPhysicsList </span> you can group the physics processes into separate modules: EM physics, hadronic physics, decay physics etc. |
Line 252: | Line 253: | ||
- | <span style="color:#800000"> class MyPhysicsList:public G4VModularPhysicsList { | + | <span style="color:#800000"> class MyPhysicsList:public G4VModularPhysicsList { </span> |
- | <span style="color:#800000"> public: | + | <span style="color:#800000"> public: </span> |
- | <span style="color:#800000"> MyPhysicsList(); | + | <span style="color:#800000"> MyPhysicsList(); </span> |
- | <span | + | |
- | <span style="color:#800000"> virtual void ConstructParticle(); | + | <span style="color:#800000"> ~MyPhysicsList(); </span> |
+ | |||
+ | <span style="color:#800000"> virtual void ConstructParticle(); </span> | ||
- | <span style="color:#800000"> virtual void SetCuts(); | + | <span style="color:#800000"> virtual void SetCuts(); </span> |
- | <span style="color:#800000"> void AddPhysicsList(const G4String& name); | + | <span style="color:#800000"> void AddPhysicsList(const G4String& name); </span> |
- | <span style="color:#800000"> virtual void ConstructProcess(); | + | |
+ | <span style="color:#800000"> virtual void ConstructProcess(); </span> | ||
- | <span style="color:#800000"> private: | + | <span style="color:#800000"> private: </span> |
- | <span style="color:#800000"> G4String fEmName; | + | <span style="color:#800000"> G4String fEmName; </span> |
- | <span | + | |
- | + | ||
- | + | ||
+ | <span style="color:#800000"> G4VPhysicsConstructor* fEmPhysicsList; </span> | ||
- | <span style="color:#800000"> | + | <span style="color:#800000"> G4VPhysicsConstructor* fDecPhysicsList; </span> |
- | <span style="color:#800000"> | + | <span style="color:#800000"> std::vector<G4VPhysicsConstructor*> fHadronPhysicsList; }; </span> |
- | |||
- | + | Now we can build the physics lists: | |
- | |||
+ | <span style="color:#800000"> void MyPhysicsList::AddPhysicsList(const G4String& name) { </span> | ||
- | + | <span style="color:#800000"> ... </span> | |
+ | <span style="color:#800000"> if (name == "emstandard_opt3") { </span> | ||
+ | |||
+ | <span style="color:#800000"> fEmName = name; </span> | ||
+ | |||
+ | <span style="color:#800000"> delete fEmPhysicsList; </span> | ||
+ | |||
+ | <span style="color:#800000"> fEmPhysicsList = new G4EmStandardPhysics_option3(); </span> | ||
- | <span style="color:#800000"> | + | <span style="color:#800000"> } else if (name == "emlivermore") { </span> |
+ | |||
+ | <span style="color:#800000"> fEmName = name; </span> | ||
+ | |||
+ | <span style="color:#800000"> delete fEmPhysicsList; </span> | ||
+ | |||
+ | <span style="color:#800000"> fEmPhysicsList = new G4EmLivermorePhysics(); </span> | ||
- | <span style="color:#800000"> | + | <span style="color:#800000"> } else if (name == "empenelope") { </span> |
+ | |||
+ | <span style="color:#800000"> fEmName = name; </span> | ||
+ | |||
+ | <span style="color:#800000"> delete fEmPhysicsList; </span> | ||
+ | |||
+ | <span style="color:#800000"> fEmPhysicsList = new G4EmPenelopePhysics(); </span> | ||
- | <span style="color:#800000"> | + | <span style="color:#800000"> } else if (name == "HElastic") { </span> |
+ | |||
+ | <span style="color:#800000"> fHadronPhysicsList.push_back( new G4HadronHElasticPhysics()); </span> | ||
- | <span style="color:#800000"> | + | <span style="color:#800000"> } else if (name == "HInelastic") { </span> |
+ | |||
+ | <span style="color:#800000"> fHadronPhysicsList.push_back(new G4HadronInelasticQBBC()); </span> | ||
+ | |||
+ | <span style="color:#800000"> } ... } </span> | ||
- | |||
- | + | and | |
- | + | <span style="color:#800000"> void MyPhysicsList::ConstructProcess() { </span> | |
- | + | ||
- | + | <span style="color:#800000"> AddTransportation(); // transportation </span> | |
- | <span style="color:#800000"> | + | |
- | + | <span style="color:#800000"> fEmPhysicsList->ConstructProcess(); // electromagnetic physics list </span> | |
- | <span style="color:#800000"> | + | |
+ | <span style="color:#800000"> fDecPhysicsList->ConstructProcess(); // decay physics list </span> | ||
+ | |||
+ | <span style="color:#800000"> for(size_t i=0; i<fHadronPhys.size(); i++) { // hadronic physics lists </span> | ||
+ | |||
+ | <span style="color:#800000"> fHadronPhys[i]->ConstructProcess(); } } </span> | ||
+ | |||
=== <span style="color:#000080"> Pre-packaged physics lists </span> === | === <span style="color:#000080"> Pre-packaged physics lists </span> === |