Code for download: session3_start.tar.gz
Exercise 3a:
- Change primary generator class with use of
G4ParticleGun
.
See eg. example basic/B2 README page and its B2PrimaryGenerator class - 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:
- Start application and run command:
/random/setSavingFlag true
- Select a particle type and run 3 events:
/gun/particle proton
/run/beamOn 3
CopycurrentRun.rndm
inRun0.rndm
(by hand) and save a scene with 3 events. - Run more events with varying the primary particle, eg. run your
run.mac
. - Restore random status from the
Run0.rndm
file:/random/resetEngineFrom Run0.rndm
repeat commands in step 2) and compare the scene with the saved one.
- Start application and run command:
Exercise 3c:
- Manipulate geometry
- 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
- Add menu in GUI using command line interface
- Add a menu « View » in the toolbar (on apple computers, the menu bar is always at the top of the screen)
- In this View menu, add two buttons for setting the viewPoint at Theta/Phi (0,0) and (90,0)
- In this View menu, add a button for setting a viewPoint and ask for it (define a command without parameters)
Solution: session3_solution.tar.gz