Interactive CLI tool for generating Geant4 simulation projects
G4Starter is a command-line tool that generates ready-to-compile Geant4 C++ simulation projects through an interactive interface. No more copying boilerplate code or setting up project structure manually.
- No Installation Required: Single executable file (Windows/macOS/Linux)
- Interactive CLI: Select options with arrow keys
- Flexible Configuration:
- Multithreading support (optional)
- 3 physics list options (QBBC, PhysicsListFactory, Custom modular)
- ParticleGun or GPS source
- Optional UserAction classes (Run, Event, Stepping, Tracking, Stacking)
- SensitiveDetector support
- Advanced mode: Custom Run class, Hit class
- Production Ready: Generated projects compile with Geant4 out of the box
Windows (WinGet)
winget install evandde.G4StartermacOS/Linux (Homebrew)
brew tap evandde/tap
brew install g4startercurl -fsSL https://raw.githubusercontent.com/evandde/G4Starter/main/install.sh | bashThis will download the latest version to ~/.local/bin/g4starter.
Download the executable from Releases and run it directly.
Note: Unlike package manager installations (which use
g4starter), manually downloaded executables retain their original names (G4Starter.exe,G4Starter_mac,G4Starter_linux).
Using terminal:
Windows:
curl -L -o G4Starter.exe https://github.com/evandde/G4Starter/releases/latest/download/G4Starter.exe
.\G4Starter.exemacOS:
curl -L -o G4Starter https://github.com/evandde/G4Starter/releases/latest/download/G4Starter_mac
chmod +x G4Starter
./G4StarterLinux:
curl -L -o G4Starter https://github.com/evandde/G4Starter/releases/latest/download/G4Starter_linux
chmod +x G4Starter
./G4Starter-
Run G4Starter
# If installed via package manager g4starter # Or run the downloaded executable directly ./G4Starter_mac # macOS ./G4Starter_linux # Linux .\G4Starter.exe # Windows
-
Answer the interactive questions (use arrow keys to select)
-
Build your generated project
# Windows cd YourProject mkdir build cd build cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release ninja .\YourProject.exe # macOS/Linux cd YourProject mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release make ./YourProject
To run G4Starter: None (standalone executable)
To build generated projects:
- Geant4 11.0 or later (tested with 11.4)
- CMake 3.16 or later
- C++17 compatible compiler
- Windows: Ninja build system recommended
- macOS/Linux: Make (usually pre-installed)
Your project will include:
CMakeLists.txt- Build configurationmain.cc- Application entry pointDetectorConstruction- Geometry setup (World volume)ActionInitialization- Action registrationPrimaryGeneratorAction- Particle source (Gun or GPS)- Additional classes based on your configuration:
- Optional UserAction classes (Run, Event, Stepping, Tracking, Stacking)
- Optional PhysicsList (for custom modular physics)
- Optional SensitiveDetector, Run, and Hit classes (advanced mode)
vis.mac- Visualization macro (OpenGL)run.mac- Run macro (empty template for your commands)
Issue: Compilation errors in generated project
Solution: Ensure Geant4 environment is set up correctly (source geant4.sh on Unix, or use Geant4 command prompt on Windows)
See CONTRIBUTING.md for development setup and guidelines.
MIT License - see LICENSE file
G4Starter는 대화형 인터페이스를 통해 컴파일 가능한 Geant4 C++ 시뮬레이션 프로젝트를 생성하는 명령줄 도구입니다. 더 이상 보일러플레이트 코드를 복사하거나 프로젝트 구조를 수동으로 설정할 필요가 없습니다.
- 설치 불필요: 단일 실행 파일 (Windows/macOS/Linux)
- 대화형 인터페이스: 화살표 키로 옵션 선택
- 유연한 설정:
- 멀티스레딩 지원 (선택 사항)
- 3가지 물리 리스트 옵션 (QBBC, PhysicsListFactory, Custom)
- ParticleGun 또는 GPS 소스
- 선택적 UserAction 클래스들 (Run, Event, Stepping, Tracking, Stacking)
- SensitiveDetector 지원
- 고급 모드: Custom Run 클래스, Hit 클래스
- 즉시 사용 가능: 생성된 프로젝트는 바로 컴파일 가능
Windows (WinGet)
winget install evandde.G4StartermacOS/Linux (Homebrew)
brew tap evandde/tap
brew install g4startercurl -fsSL https://raw.githubusercontent.com/evandde/G4Starter/main/install.sh | bash최신 버전을 ~/.local/bin/g4starter에 자동 설치합니다.
Releases에서 실행 파일을 다운로드하여 직접 실행하세요.
참고: 패키지 매니저 설치(
g4starter명령어)와 달리, 수동 다운로드한 실행 파일은 원본 이름(G4Starter.exe,G4Starter_mac,G4Starter_linux)을 유지합니다.
터미널 사용:
Windows:
curl -L -o G4Starter.exe https://github.com/evandde/G4Starter/releases/latest/download/G4Starter.exe
.\G4Starter.exemacOS:
curl -L -o G4Starter https://github.com/evandde/G4Starter/releases/latest/download/G4Starter_mac
chmod +x G4Starter
./G4StarterLinux:
curl -L -o G4Starter https://github.com/evandde/G4Starter/releases/latest/download/G4Starter_linux
chmod +x G4Starter
./G4Starter-
G4Starter 실행
# 패키지 매니저로 설치한 경우 g4starter # 또는 다운로드한 실행 파일 직접 실행 ./G4Starter_mac # macOS ./G4Starter_linux # Linux .\G4Starter.exe # Windows
-
질문에 답변 (화살표 키로 선택)
-
프로젝트 빌드
# Windows cd YourProject mkdir build cd build cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release ninja .\YourProject.exe # macOS/Linux cd YourProject mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release make ./YourProject
G4Starter 실행: 없음 (독립 실행 파일)
생성된 프로젝트 빌드:
- Geant4 11.0 이상 (11.4에서 테스트됨)
- CMake 3.16 이상
- C++17 호환 컴파일러
- Windows: Ninja 빌드 시스템 권장
- macOS/Linux: Make (보통 기본 설치됨)
프로젝트에 포함되는 파일:
CMakeLists.txt- 빌드 설정main.cc- 애플리케이션 진입점DetectorConstruction- 지오메트리 설정 (World volume)ActionInitialization- 액션 등록PrimaryGeneratorAction- 입자 소스 (Gun 또는 GPS)- 설정에 따른 추가 클래스:
- 선택적 UserAction 클래스들 (Run, Event, Stepping, Tracking, Stacking)
- 선택적 PhysicsList (커스텀 모듈식 물리)
- 선택적 SensitiveDetector, Run, Hit 클래스 (고급 모드)
vis.mac- 시각화 매크로 (OpenGL)run.mac- 실행 매크로 (빈 템플릿)
문제: 생성된 프로젝트 컴파일 오류
해결: Geant4 환경이 올바르게 설정되었는지 확인 (Unix: source geant4.sh, Windows: Geant4 명령 프롬프트 사용)
개발 환경 설정 및 가이드라인은 CONTRIBUTING.md를 참조하세요.
MIT License - LICENSE 파일 참조