Introduction to GEANT4
From UCL HEP PBT Wiki
m |
m |
||
Line 74: | Line 74: | ||
- | Simple example of <span style="color:#ff0000"> MyDetectorConstruction </span> derived from <span style="color:#ff0000"> G4VUserDetectorConstruction </span>: | + | <u> Simple example of <span style="color:#ff0000"> MyDetectorConstruction </span> derived from <span style="color:#ff0000"> G4VUserDetectorConstruction </span> <u>: |
Line 181: | Line 181: | ||
- | <span style="color:#800000"> void MyPhysicsList :: ConstructProcess() </span> | + | <span style="color:#800000"> void MyPhysicsList :: ConstructProcess() { </span> |
- | <span style="color:#800000"> | + | <span style="color:#800000"> // Assign transportation process to all particles </span> |
<span style="color:#800000"> AddTransportation(); </span> | <span style="color:#800000"> AddTransportation(); </span> | ||
Line 201: | Line 201: | ||
- | <span style="color:#800000"> void MyPhysicsList::ConstructEM() </span> | + | <span style="color:#800000"> void MyPhysicsList :: ConstructEM() { </span> |
- | <span style="color:#800000"> | + | <span style="color:#800000"> aParticleIterator->reset(); </span> |
- | <span style="color:#800000"> while( (*aParticleIterator)() ){ </span> | + | <span style="color:#800000"> while((*aParticleIterator)()){ </span> |
<span style="color:#800000"> G4ParticleDefinition* particle = aParticleIterator->value(); </span> | <span style="color:#800000"> G4ParticleDefinition* particle = aParticleIterator->value(); </span> | ||
Line 218: | Line 218: | ||
- | <span style="color:#800000"> void MyPhysicsList::ConstructGeneral() </span> | + | <span style="color:#800000"> void MyPhysicsList :: ConstructGeneral() { </span> |
<span style="color:#800000"> G4Decay* theDecayProcess = new G4Decay() </span> | <span style="color:#800000"> G4Decay* theDecayProcess = new G4Decay() </span> | ||
- | <span style="color:#800000"> | + | <span style="color:#800000"> aParticleIterator->reset(); </span> |
- | <span style="color:#800000"> while( (*aParticleIterator)() ){ </span> | + | <span style="color:#800000"> while((*aParticleIterator)()) { </span> |
<span style="color:#800000"> G4ParticleDefinition* particle = aParticleIterator->value(); </span> | <span style="color:#800000"> G4ParticleDefinition* particle = aParticleIterator->value(); </span> | ||
Line 245: | Line 245: | ||
- | <span style="color:#800000"> void MyPhysicsList :: SetCuts() </span> | + | <span style="color:#800000"> void MyPhysicsList :: SetCuts() { </span> |
- | <span style="color:#800000"> | + | <span style="color:#800000"> defaultCutValue = 1.0*mm; </span> |
<span style="color:#800000"> SetCutValue(defaultCutValue, "gamma"); </span> | <span style="color:#800000"> SetCutValue(defaultCutValue, "gamma"); </span> | ||
Line 264: | Line 264: | ||
- | <span style="color:#800000"> MyModPhysList::MyModPhysList(): G4ModularPhysicsList() </span> | + | <span style="color:#800000"> MyModPhysList::MyModPhysList() : G4ModularPhysicsList() { </span> |
- | <span style="color:#800000"> | + | <span style="color:#800000"> defaultCutValue = 1.0*mm; </span> |
<span style="color:#800000"> RegisterPhysics(new ProtonPhysics()); </span> | <span style="color:#800000"> RegisterPhysics(new ProtonPhysics()); </span> | ||
Line 291: | Line 291: | ||
- | <span style="color:#800000"> class ProtonPhysics() : public G4VPhysicsConstructor </span> | + | <span style="color:#800000"> class ProtonPhysics() : public G4VPhysicsConstructor { </span> |
- | <span style="color:#800000"> | + | <span style="color:#800000"> public: </span> |
<span style="color:#800000"> ProtonPhysics(const G4String& name="proton"); </span> | <span style="color:#800000"> ProtonPhysics(const G4String& name="proton"); </span> |