2020 Session 3 : Exercise

Code for download: session3_start.tar.gz

Exercise 3a:

  • Change the primary generator class with use of G4ParticleGun.
    See eg. example basic/B2 README page and its B2PrimaryGenerator class; note that you need to update both .cc and .hh files
  • Update run.mac and add runs with following primaries:
    proton, positron, pion-, muon+
    Run the macro from your interactive session (Qt).
  • Add randomizing the particle direction with theta in [0,2*deg], phi [0.,360*deg].
    See example basic/B3 README page and its B3PrimaryGenerator class

Exercise 3b:

  • Activate interactively storing of random generator status, run simulation with a retrieved status and check results:
    1. Start application and run command:
      /random/setSavingFlag true
    2. Select a particle type and run 3 events:
      /gun/particle proton
      /run/beamOn 3
      Copy currentRun.rndm in Run0.rndm (by hand) and save a scene with 3 events.
    3. Run more events with varying the primary particle, eg. run your run.mac.
    4. Restore the random status from the Run0.rndm file: /random/resetEngineFrom Run0.rndm
      and repeat the commands in step 2) and compare the scene with the saved one.

Exercise 3c:

  • Visualization
    • Add axes at the middle of the EmCalorimeter
    • Add date on your scene
    • Add text in red near your tube withe the « tube » label
    • Set background to « gray »
    • Make an 8000*6000 EPS file (with 100 events) and look at it
    • Complete vis.mac with these commands

Solution: session3_solution.tar.gz