Code Monkey home page Code Monkey logo

geant4_vmc's Introduction

Geant4 VMC

Geant4 VMC implements the Virtual Monte Carlo (VMC) for Geant4, see more:
https://root.cern.ch/vmc

It also includes G4Root and MTRoot packages, which are independent from Geant4 VMC and can be build and used stand-alone.

License: GPL v2

Files and directories

  README.md  - this file
  history    - the tags history
  source     - Geant4 VMC source code
  g4root     - G4Root package
  mtroot     - MTRoot package
  examples   - examples demonstrating use of VMC

Installation

Geant4 VMC requires ROOT and Geant4 installed, and optionally, it can be built with VGM.

Since version 3.00, Geant4 VMC is installed with CMake. To install geant4_vmc:

  1. First get the Geant4 VMC source from the Download page. We will assume that the Geant4 VMC package sits in a subdirectory /mypath/geant4_vmc

  2. Create build directory alongside our source directory

$ cd /mypath
$ mkdir geant4_vmc_build
$ ls
geant4_vmc geant4_vmc_build
  1. To configure the build, change into the build directory and run CMake:
$ cd /mypath/geant4_vmc_build
$ cmake -DCMAKE_INSTALL_PREFIX=/mypath/geant4_vmc_install /mypath/geant4_vmc

If ROOT and Geant4 environment was defined using thisroot.[c]sh and geant4.[c]sh scripts, there is no need to provide path to their installations. Otherwise, they can be provided using -DROOT_DIR and -DGeant4_DIR cmake options.

  1. After the configuration has run, CMake will have generated Unix Makefiles for building Geant4 VMC. To run the build, simply execute make in the build directory:
$ make -jN

where N is the number of parallel jobs you require (e.g. if your machine has a dual core processor, you could set N to 2). If you need more output to help resolve issues or simply for information, run make as

$ make -jN VERBOSE=1
  1. Once the build has completed, you can install Geant4 VMC to the directory you specified earlier in CMAKE_INSTALL_PREFIX by running
$ make install

This will build geant4_vmc, g4root and mtroot packages. For VMC examples see VMC examples installation page.

Build Options

Geant4 VMC includes G4Root and MTRoot packages, which are independent from Geant4 VMC and can be build and used stand-alone. Use of G4Root, VGM, Geant4 G3toG4, UI and VIS packages in Geant4 VMC library is optional and can be switched on/off during CMake build.

Overview of available options and their default values:

  Geant4VMC_BUILD_G4Root       Build G4Root        ON
  Geant4VMC_BUILD_MTRoot       Build MTRoot        ON
  Geant4VMC_BUILD_Geant4VMC    Build Geant4VMC     ON
  Geant4VMC_BUILD_EXAMPLES     Build VMC examples  ON

  Geant4VMC_USE_G4Root         Build with G4Root                ON
  Geant4VMC_USE_VGM            Build with VGM                   OFF
  Geant4VMC_USE_GEANT4_UI      Build with Geant4 UI drivers     ON
  Geant4VMC_USE_GEANT4_VIS     Build with Geant4 Vis drivers    ON
  Geant4VMC_USE_GEANT4_G3TOG4  Build with Geant4 G3toG4 library OFF

  Geant4VMC_INSTALL_EXAMPLES   Install examples    ON

Required and optional packages:

Geant4 VMC requires the Root and Geant4 installations, and optionally VGM in case you want to run with Geant4 native navigation with geometry defined via Root TGeo.

The path to required and optional packages installations can be defined in these complementary ways:

a) Via path to the CMake configuration file

  ROOT_DIR              ... path to ROOTConfig.cmake
  Geant4_DIR            ... path to Geant4Config.cmake
  VGM_DIR               ... path to VGMConfig.cmake

b) Using their configuration script which is available in your PATH (Geant4 and Root):

  geant4-config         ... Geant4 configuration script
  root-config           ... Root configuration script

To make these configuration scripts available in your PATH, you should source the relevant script from the packages installation:

  bin/geant4.[c]sh      ... Geant4
  bin/thisroot.[c]sh    ... Root

c) With the environment variable ROOTSYS (Root only)

  ROOTSYS         ... path to Root

The compilation with VGM (optional) can be selected via the CMake option:

  -DGeant4VMC_USE_VGM=ON

Examples

Since Geant4 VMC 3.00, VMC examples are installed with CMake. The VMC examples libraries require ROOT installation, the VMC examples programs are built against Geant3 with VMC or Geant4 VMC libraries.

More details about provided configuration macros and tests can be found in examples/README.

The instructions how to build and run examples are provided in examples/README_INSTALL.

Root and Geant4 UI

Switching UI

When running Geant4 with Virtual MC a user can switch between Root UI and Geant4 UI:

From Root to Geant4 UI:

  root [0] ((TGeant4*)gMC)->StartGeantUI();

From Geant4 to Root UI:

  PreInit> /mcControl/root

Calling macros

Call Geant4 macro "myMacro.in" from Root:

  root [0] ((TGeant4*)gMC)->ProcessGeantMacro("myMacro.in");

Call Root macro "myMacro.C" from Geant4:

  PreInit> /mcControl/rootMacro myMacro

Calling commands

Call Geant4 command from Root:

  root [0] ((TGeant4*)gMC)->ProcessGeantCommand("/tracking/verbose 1");

Call Root command from Geant4:

  Idle> /mcControl/rootCmd TBrowser b;

geant4_vmc's People

Contributors

benedikt-voelkel avatar christiantackegsi avatar dennisklein avatar fonsrademakers avatar ihrivnac avatar ktf avatar olifre avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.