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/*

  • Add a command line option to select any Geant4 physics list using G4PhysListFactory class 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”.
  • Check availability of the physics list via G4bool IsReferencePhysList(const G4String& physListName);

Hands-on 4b:

  • Inspect the implementation of a command using G4GenericMessenger in the EventAction class, 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 G4GenericMessenger in an analogous way as the command in EventAction

    • Add a G4GenericMessenger object in PrimaryGeneratorAction
    • Call its DeclareProperty method to create setRandomize command associated with already existing data member fRandomize of a G4bool type

Hands-on 4c:

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)

Solution: session4_solution.tar.gz