The solutions are indicated in red.
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:
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):
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:
G4hLowEnergyIonisation* hadronIonIonisProcess =
new G4hLowEnergyIonisation("ionization-ionhadron");
if(particle == G4Proton::Definition())
hadronIonIonisProcess ->
SetElectronicStoppingPowerModel(G4Proton::Definition(),"Ziegler1977p");
if(particle == G4Alpha::Definition())
hadronIonIonisProcess ->
SetElectronicStoppingPowerModel(G4Alpha::Definition(),"Ziegler1977He");
Click here for the source file.