View on GitHub

GEARS | 齿轮组

Geant4 Example Application with Rich features and Small footprints

Download this project as a .zip file Download this project as a tar.gz file

Doxygen License Examples Get Started Get Involved

GEARS is a Geant4 Example Application with Rich features yet Small footprint. The entire C++ coding is minimized down to a single file with about 550 SLOC. This is achieved mainly by utilizing Geant4 plain text geometry description, built-in UI commands (macros), and C++ inheritance. It is ideal for student training and fast implementation of small to medium-sized experiments.

Features

How to contribute

Please fork GEARS on GitHub. Run the following to get a local copy of the forked repository and link it to the original GEARS repository:

$ git clone git@github.com:yourGitHubAccount/gears.git # get forked repository
$ git remote add upstream git@github.com:jintonic/gears.git # link to original repository
$ git remote -v # run a check

Run the following to keep your local repository updated with the original GEARS repository:

$ git fetch upstream # updates are saved in a new branch upstream/master
$ git merge upstream/master # merge 2 branches: upstream/master and master

If the merge is successful, run git push to update your forked GEARS repository on GitHub.

You can initiate a pull request on GitHub if you’d like to have your update being absorbed in the original GEARS repository.

Coding convention

G4cout VS std::cout

G4cout and G4endl is preferred over std:cout and std:endl because the former handle the output in Geant4 GUI correctly, while the later can only output to terminal.

Indentation

Two spaces instead of a tab are used to indent a line in gears.cc to insure a consistent appearance in different text editors, and to avoid wasting space in front of deeply nested code blocks. The following mode lines are added to the end of gears.cc to insure that in Vim and Emacs:

// -*- C++; indent-tabs-mode:nil; tab-width:2 -*-
// vim: ft=cpp:ts=2:sts=2:sw=2:et

To-do’s