Hands-on
Code for download: session4_start.tar.gz
Hands-on 4a:
Explore processes defined for proton, e-, e+, gamma particles via UI commands and add these commands in run.mac.
* Hint: See the commands /particle/select and /particle/process/*
In the main() function, replace the explicit creation of the FTFP_BERT physics list with the use of the physics list factory, G4PhysListFactory.
Hands-on 4b:
-
Add a command line option to select any Geant4 physics list using
G4PhysListFactoryclass when starting the example application, for example:./exampleED -p FTFP_BERT_EMV- The command line options were already added in the
main()function. See the documentation for the basic example B4 , where use of a similar code is described in the section “How to run”.
- The command line options were already added in the
-
Check the availability of the physics list via
G4bool IsReferencePhysList(const G4String& physListName);in themainfunction -
Test the added option and run the program both interactivel and in batch mode.
Hands-on 4c:
-
Inspect the implementation of a command using
G4GenericMessengerin theEventActionclass, execute the command to inactivate verbose mode and run a new event -
Implement a command to activate or inactivate the randomizing of the particle direction in the primary generator action using
G4GenericMessengerin an analogous way as the command inEventAction- Add a
G4GenericMessengerobject inPrimaryGeneratorAction - Call its
DeclarePropertymethod to createsetRandomizecommand associated with already existing data memberfRandomizeof aG4booltype
- Add a
Hands-on 4d:
Add a menu in GUI using the 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 the Theta/Phi values (define a command without parameters)