Tsld012

    virtual G4VPhysicalVolume* construct() = 0


    • invoked by G4RunManager
    • to do
      • define materials
      • define geometry
      • define sensitive detectors
      • define visualization attributes
    • return the pointer to the “world” physical volume

Tsld014

    virtual void beginOfRunAction(G4Run*)


    • invoked by G4RunManager
      • after “close geometry” before event loop
    • to do
      • start timer
      • set Run ID to G4Run object

    virtual void endOfRunAction(G4Run*)

    • invoked by G4RunManager
      • after event loop
      • geometry is still closed
    • to do
      • stop and print the timer

Tsld011

  • Mandatory action class

    • G4VUserPrimaryGeneratorAction
        Invoke event generator(s) and/or interface(s) and define a primary event
  • Optional action classes

    • G4UserRunAction
    • G4UserEventAction
    • G4UserStackingAction
    • G4UserTrackingAction
    • G4UserSteppingAction

Tsld010

  • Mandatory initialization class

    • G4VUserDetectorConstruction
        Define materials and geometry
  • Optional initialization classes

    • G4UserParticleList
        Define particles

        Set cut-off
    • G4UserProcessList
        Define processes

Tsld008

    // Initialization of G4


    runManager->initialize();


    // Number of events

    G4int n_event = 10000;

    // Execution of event loop

    runManager->beamOn(n_event);

    // Clean up

    delete runManager;

    return 0;

    }

Tsld009

    // Instantiation of VisManager


    G4VisManager::GetInstance();


    // (G)UI Session

    G4UIsession * session = new G4UItcl;

    session->startSession();

    // Clean up

    delete runManager;

    delete session;

    return 0;

    }

Tsld006

  • Pause

      This state is the only exception, i.e. G4 kernel will not set this state from any other states. User can explicitly set G4 application to this state. The method the user can set this state is

      G4StateManager::getStateManager()->pause();
      The G4 state will toggle from the previous state to Pause and then go back to the previous state automatically. The G4VStateDependent::notify() method will be invoked with the state change to Pause state. Be careful that Pause->previousState will not be notified.