Session 9 : Enoncé

Code for download: session9_start.tar.gz

Exercise:

  1. Add an option in EDScreenSD class to account only primary particles (see the implementation of the option fRandom in EDPrimaryGeneratorAction):
    • add a data member G4bool fOnlyPrimariesand its « setter »
      function
    • add a command /ED/screen/onlyPrimaries with use of G4GenericMessenger
    • test new command interactively and, after it works ok, add it in runProtons.mac to activate scoring of primaries only

    Run 1000 protons with  activated option to score only primaries from batch:
    ./exampleED -m runProtons.mac
    and save your ED.root as, eg, ED-primaries.root

  2. Complete EDStackingAction class and implement an option to kill all secondary particles:
    • add EDStackingAction to the user action classes set to G4RunManager in main (exampleED.cc)
    • add a data member G4bool fKillSecondaries and its « setter » function
    • add a command /ED/stacking/killSecondaries with use of
      G4GenericMessenger
    • Implement EDStackingAction::Classify() to kill all secondary particles if fKillSecondaries is activated

    Run 1000 protons with activated option to killing all secondaries and save your ED.root as, eg, ED-killSeconadries.root

    Compare the spectrum of primary particles in both files.
    Compare the time of simulation with both options. (The time of run is measured by G4Timer object added in EDRunAction).

  3. Visualization:
    • Implement drawing hits in chambers:
      • Up to now we were storing only a local position in EDChamberHit class; add a data member fGlobalPosition and its « setter » and « getter » functions in EDChamberHit
      • Update EDChamberSD::ProcessHit() to store also a global position in the hit
      • Add and implement EDChamberHit::Draw() function.
        (See B2TrackerHit class in basic/B2/B2a example).
    • Activate drawing hits in vis.mac macro

Solution: session9_solution.tar.gz

Exercise ++:

The exercises marked as ++ are optional; they are recommended for participants who have already some experience with Geant4 and

There is no exercise++ for this session.