Exercises and Solutions - Day 3

Exercises: Exercises of the day

Exercises and solutions - Part II

The solutions are indicated in blue.

Part II - Electromagnetic physics

Exercise 3-3*

You can find here the header file for a new physics constructor class (PhysicsEMElectronEEDL), which should construct electromagnetic (EM) processes of electrons. Implement the method ConstructPhysics (in a new file PhysicsEMElectronEEDL.cc), in order that it instantiates the classes representing:

The processes classes to be instantiated are: As the next step, assign the process objects to the process manager. Note: The implementation of ConstructPhysics is shown in the following (click here for the complete source file containing all required include statements):
 
void PhysicsEMElectronEEDL::ConstructProcess() {

  // ****************
  // *** Electron ***
  // ****************

  // The considered physics processes are instantiated:
  G4MultipleScattering* elecMultipScatProcess = new G4MultipleScattering();

  G4LowEnergyIonisation* elecIonisationProcess = 
                                               new G4LowEnergyIonisation();
  G4LowEnergyBremsstrahlung* elecBremsstrProcess = 
                                               new G4LowEnergyBremsstrahlung();

  // The step limiter process is instantiated:
  G4StepLimiter* elecStepLimiter = new G4StepLimiter();

  // Finally, the processes are added to the particles' process manager:
  G4ParticleDefinition* particle = G4Electron::Electron(); 
  G4ProcessManager* processManager = particle -> GetProcessManager();
  processManager -> AddProcess(elecMultipScatProcess, -1, 1, 1);
  processManager -> AddProcess(elecIonisationProcess, -1, 2, 2);
  processManager -> AddProcess(elecBremsstrProcess, -1, -1, 3);
  processManager -> AddProcess(elecStepLimiter, -1, -1, 4);
}

Exercise 3-4
Integrate the physics constructor class of the previous exercise into the example application: A user should be able to activate via a macro command the EM physics for electrons defined in PhysicsEMElectronEEDL as an alternative option to the penelope physics (PhysicsEMElectronPenelope):

The physics list class of the application example holds a pointer to a physics constructor which instantiates the EM physics of electrons:
static G4VPhysicsConstructor* emElectron; 
Add the code in green in the RegisterPhysConstructor to allow for the option to select the object to be assigned to emElectron (and to be registered as physics component):
void PhysicsList::RegisterPhysConstructor(const G4String& constrName) {

  if(emElectron == 0) { // The condition is only true if no electron physics 
                        // constructor was yet instantiated
 
     // If the physics constructor name is matching one of the strings,
     // the corresponding physics constructor is instantiated and assigned
     // to the data member emElectron
     
     if(constrName == "EM-Electron-EEDL") 
        emElectron = new PhysicsEMElectronEEDL();
     
     if(constrName == "EM-Electron-Penelope") 
        emElectron = new PhysicsEMElectronPenelope();

     if(constrName == "EM-Electron-Standard") 
        emElectron = new PhysicsEMElectronStandard();

     // The physics constructor is finally registered (The "if" statement is
     // required for cases where the constructor name was not matching any
     // option)
     if(emElectron) RegisterPhysics(emElectron);
  }
 ... // other physics instructions 
}
Don't forget to include the header file of the PhysicsEMElectronEEDL class. Click here for the complete source file.

Exercise 3-5
The physics constructor class PhysicsEMHadronIonLowEnergy instantiates electromagnetic physics processes for charged hadrons and ions. The included processes are:

The class G4hLowEnergyIonisation allows for the possibility of activating optional electron stopping power models for protons and alpha particles based on different parameterisations. Retrieve the names of these models from the Geant4 physics reference manual: The two last models in the table are the default ones for protons and alpha particles, respectively. In the PhysicsEMHadronIonLowEnergy class of the example application try to set an optional model for each by using the according public member function of G4hLowEnergyIonisation. Retrieve the class method in the Geant4 application developers manual (see the section "Low Energy Electromagnetic Processes"): Include the lines in green into the ConstrucProcess function of PhysicsEMHadronIonLowEnergy:
  G4hLowEnergyIonisation* hadronIonIonisProcess = 
                           new G4hLowEnergyIonisation("ionization-ionhadron");
  
  hadronIonIonisProcess -> 
        SetElectronicStoppingPowerModel(G4Proton::Definition(),"Ziegler1977p");

  hadronIonIonisProcess -> 
        SetElectronicStoppingPowerModel(G4Alpha::Definition(),"Ziegler1977He");
  
Click here for the source file.