Geant4 User Interface (UI)

Download Report

Transcript Geant4 User Interface (UI)

IEEE Nuclear Science Symposium and Medical Imaging Conference
Short Course
The Geant4 Simulation Toolkit
Sunanda Banerjee (Saha Inst. Nucl. Phys., Kolkata, India)
Min Cheol Han (Hanyang Univ., Seoul, Korea)
Steffen Hauf (XFEL, Hamburg, Germany)
Maria Grazia Pia (INFN Genova, Italy)
[email protected]
Seoul, 27 October 2013
http://www.ge.infn.it/geant4/events/nss2013/geant4course.html
This course encompasses training material developed by several Geant4 members:
thanks to all of them!
Geant4 User Interface (UI)
Geant4 UI
 Geant4 supports various built-in UI commands.
 UI command consists of
command directory, command, and parameter.
Ex) /run/beamOn 10
 Geant4 has a two types of UI processing (batch mode,
interactive mode)
 We can check the list of built-in commands in this web site.
http://geant4.web.cern.ch/geant4/UserDocumentation/UsersG
uides/ForApplicationDeveloper/html/AllResources/Control/U
Icommands/_.html
2
Geant4 User Interface (UI)
‘Hard-coded’ batch mode
 Geant4 UI Command can be run in Geant4 source code.
(called ‘Hard-coded’ batch mode)
 Example:
int main(int argc, char** argv)
{…
G4UImanager* UImanager = G4UImanager::GetUIpointer();
UImanager->ApplyCommand("/run/verbose 1");
UImanager->ApplyCommand("/event/verbose 1");
UImanager->ApplyCommand("/tracking/verbose 1");
…
}
3
Geant4 User Interface (UI)
Batch mode with macro file
 Geant4 simulation will run in batch mode with macro file.
 Example:
int main(int argc, char** argv)
{…
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if(argc==1) {
// Define UI session for interactive mode
} else {
// Define batch mode using UImanager class
G4String command = "/control/execute " + argv[1];
UImanager->ApplyCommand(command);
}
…
}
4
Geant4 User Interface (UI)
Batch mode with macro file
 The example will be executed with below command:
> example run.mac
 Example - run.mac file:
# Macro file: run.mac
# set verbose level for this run
/run/verbose 2
/event/verbose 0
/tracking/verbose 1
/gun/particle e/gun/energy 1 GeV
/run/beamOn 100
※ First ‘#’ is used for comment line in macro file.
5
Geant4 User Interface (UI)
Interactive mode - Character UI (CUI)
 Geant4 provide character user interface (CUI) by using
G4UIterminal class (or G4UIWin32 in windows OS) as
interactive mode.
 Example:
int main(int argc, char** argv)
{…
if(argc==1) {
// Define UI session for interactive mode
G4UIsession* session = new G4UIterminal(new G4UItcsh);
session->SessionStart();
delete session;
}
…
}
6
Geant4 User Interface (UI)
Interactive mode - Character UI (CUI)
7
Geant4 User Interface (UI)
Interactive mode - Graphical UI (GUI)
 Geant4 supports various graphical user interface (GUI) by
using G4UIExecutive class.
 Example:
int main(int argc, char** argv)
{…
if(argc==1) {
// Define UI session for interactive mode
G4UIExecutive* ui = new G4UIExecutive(argc, argv, “XX”);
session->SessionStart();
delete session;
}
…
}
8
Geant4 User Interface (UI)
Interactive mode - Graphical UI (GUI)
 User can choose a specific interface initial parameter of
G4UIExecutive class.
ex) G4UIExecutive* ui = new G4UIExecutive(argc, argv, “xx”)
(where xx = qt, xm, win32, gag, tcsh, …)
Run with Xm GUI
9
Geant4 User Interface (UI)
Interactive mode - Qt UI
 The one of Geant4 GUI Application
 Qt (UI) with OpenGL (Graphic viewer)
 If GEANT4_USE_QT=1 when geant4 was installed, Qt is
default UI in Geant4.
 Homepage - http://qt.digia.com/
10
Geant4 User Interface (UI)
Interactive mode - Qt UI




Enable/Disable specific geometry using “Scene tree”
Command (or Command parameter) check
Geometry viewer
Run specific macro, command alias, etc…
11
Geant4 User Interface (UI)
Interactive mode - Qt Demo
12