Introduction to GEANT4

From UCL HEP PBT Wiki

Jump to: navigation, search
m
m
Line 115: Line 115:
-
Two kinds of base physics list classes are available for users to derive from <span style="color:#ff0000"> G4VUserPhysicsList </span> and <span style="color:#ff0000"> G4ModularPhysicsList </span>. There exist also prepackaged physics list.  
+
Two kinds of base physics list classes are available for users to derive from <span style="color:#ff0000"> G4VUserPhysicsList </span> and <span style="color:#ff0000"> G4ModularPhysicsList </span>. There exist also pre-packaged physics list.  
Line 256: Line 256:
=== <span style="color:#000080"> Detailed physics lists </span> ===  
=== <span style="color:#000080"> Detailed physics lists </span> ===  
 +
A realistic physics list has a lot of different physics processes. Therefore it is better to define a new class G4VModularPhysicsList derived from G4VUserPhysicsList where you can group the physics processes into EM physics, hadronic physics, optical physics etc. In addition the method AddTransportation() is called for all particles.
 +
 +
 +
Simple example of G4VModularPhysicsList:
 +
 +
 +
<span style="color:#800000"> MyModPhysList::MyModPhysList(): G4ModularPhysicsList() </span>
 +
 +
<span style="color:#800000"> { defaultCutValue = 1.0*mm; </span>
 +
 +
<span style="color:#800000"> RegisterPhysics(new ProtonPhysics()); </span>
 +
 +
<span style="color:#800000"> //all physics processes having to do with protons </span>
 +
 +
 +
<span style="color:#800000"> RegisterPhysics(new ElectronPhysics()); </span>
 +
 +
<span style="color:#800000"> //all physics processes having to do with electrons </span>
 +
 +
 +
<span style="color:#800000"> RegisterPhysics(new DecayPhysics()); </span>
 +
 +
<span style="color:#800000"> // physics of unstable particles ...} </span>
 +
 +
 +
<span style="color:#800000"> void MyModPhysList::SetCuts() </span>
 +
 +
<span style="color:#800000"> {SetCutsWithDefault();} </span>
 +
 +
where the class ProtonPhysics() is defined as
 +
 +
<span style="color:#800000"> class ProtonPhysics() : public G4VPhysicsConstructor </span>
 +
 +
<span style="color:#800000"> { public: </span>
 +
 +
<span style="color:#800000"> ProtonPhysics(const G4String& name="proton"); </span>
 +
 +
<span style="color:#800000"> virtual ~ProtonPhysics(); </span>
 +
 +
<span style="color:#800000"> virtual void ConstructParticle(); </span>
 +
 +
<span style="color:#800000"> virtual void ConstructProcess(); </span>
 +
 +
<span style="color:#800000"> //all processes a proton can have } </span>

Revision as of 13:33, 7 July 2014

Personal tools