Hands-on

Code for download: session3_start.tar.gz

Hands-on 3a:

  • Change the primary generator class with use of G4ParticleGun.
  • 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 B3::PrimaryGenerator class

Hands-on 3b:

Activate interactively storing of the 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.

Hands-on 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