Geant4 VMC


Implementation Source code documentation Geometry descriptions

Implementation

Introduction

Geant4 VMC represents the realisation of the Virtual Monte Carlo (VMC) for Geant4 . It can be also seen as a Geant4 application implemented via the VMC interfaces. It implements all Geant4 user mandatory classes and user action classes, which provide the default Geant4 VMC behaviour.

Geometry definition and navigation

The VMC support two ways of geometry definition:

The first (newer) way is recommended for new users, the way via VMC is kept for a backward compatibility.

Since the version 2.0, user can choose between Geant4 native navigation and G4Root navigation, if geometry is define via TGeo. The choice of the navigation is done via the option specified with creating TG4RunConfiguration object (see examples for more details):

Below we shortly comment the implementation of these options:

"MANY" positions

As Geant4 does not support overlapping geometries, the positions with MANY option are not allowed with Geant4 navigation.

In case of geomVMCtoGeant4 option, user has a possibility to identify all ONLY volumes that overlap with the MANY ones using TVirtualMC::Gsbool() function for each overlap. This info is then used to perform automatically Boolean operations on the concerned solids. The volume with a "MANY" position can have only this position if Gsbool is used.

In case of geomRoottoGeant4 option, the MANY option is ignored and if present in geometry, Gean4 geometry will be incorrect.

There is no limitation on use of the MANY option with G4Root navigation (options geomVMCtoRoot, geomRoot .

Physics list selection

Since the version 2.4, the default Geant4 VMC physics list has been removed and user can choose the physics list from the physics lists provided in Geant4 or include theit own physics list. The choice of the of the physics list is done via the option specified with creating TG4RunConfiguration object. This option is passed as second argument in TG4RunConfiguration constructor (see examples for more details):

In order to activate the support of VMC features like the VMC cuts, VMC process controls, user has to activate the special processes defined in TG4SpecialPhysicsList. The selection of special processes is passed as third argument in TG4RunConfiguration constructor (see examples for more details): When more than one options are selected, they should be separated with '+' character: eg. stepLimit+specialCuts , stepLimit+specialCuts+stackPopper , etc.

Stacking of particles

The user VMC stack is used differently in Geant3 VMC and Geant4 VMC. Geant3 VMC pops both primary and secondary particles as they are provided by TVirtualMCStack::PopNextTrack(), while Geant4 VMC pops only primary particles using TVirtualMCStack::PopPrimaryForTracking() from the VMC stack. Stacking of secondary particles is then handled by Geant4 kernel and the user VMC stack only monitors this stacking.

The consequence of this is that, by default, the particles added to the VMC stack in other than TVirtualMCApplication::GeneratePrimaries() functions are ignored in Geant4 tracking. User has to activate the stack popper special process (see paragraph on Physics list selection), if he wants to add particles to the stack during tracking. The added particles are then handled as secondaries of the current track.

The stack classes in the VMC examples provide the same stacking mechanism for both Geant3 and Geant4 MCs and they are recommended to be used in a user application.

User Geant4 classes
(physics list, detector construction, primary generator)

The default Geant4 VMC behaviour, defined by the Geant4 user mandatory classes and user action classes implemented in Geant4 VMC, can be customized by a user by providing his own class derived from TG4RunConfiguration.
Such customization is recommended for including a user own physics list; an example of including user own physics list is provided in the VMC example E03.

User has also the possibility to override detector construction and/or primary generation action classes and use an existing Geant4 geometry/primary generator definition with VMC. Including of user geometry construction is also demonstrated in the example E03.

In other cases, though the customisation is possible and allowed by the design, it has not been tested and so it is not recommended especially for the novice users.

Special cuts

By default, Geant3 defines cuts in kinetic energy while Geant4 cuts in range, the corresponding values of cuts in kinetic energy are then calculated for each material. The VMC provides a possibility for a user to define cuts in Geant3 way. In order to activate these cuts in Geant4 VMC a user has to switch on the special cuts process in his g4Config.C:

// Switch on special cuts (not activated by default)
TG4PhysicsListOptions options;
options.SetSpecialCutsPhysics(true);
runConfiguration->SetPhysicsListOptions(options);

Analogically user can switch on/off other physics options.

In case, a user has registered his own physics list, he has a possibility to register the special cuts physics constructor (class TG4PhysicsConstructorSpecialCuts) in his own modular physics list to get this functionality.

Visualization

Geant4 VMC does not implement all TVirtualMC functions for visualization satisfactorily. User can better set visualization options directly using Geant4 visualization commands, as it is illustrated in the VMC examples in g4vis.in macro.

By default, Geant4 VMC supports only this VIS/UI setting:
OPENGLX, OPENGLXM, XM, TCSH .
In order to get supported all Geant4 visualization/UI drivers user can customise the geant4_vmc/source/Makefile as described in the comments in this file. All Geant4 graphics drivers and UIs can be then used within Geant4 VMC, however not all these options were tested in this environment and even though a correct behaviour is expected, it is not guaranteed.

Geant4 UI

The VMC interface provides a common denominator for all implemented MC's and cannot cover all commands available in a Geant4 user session through Geant4 UI. Switching between the Root UI and the Geant4 UI gives a user the possibility of working with the native Geant4 UI when needed or desired.It is also possible to process a foreign command or a foreign macro in both UIs:


Source code documentation

Source code documentation has been generated from the source code by Doxygen .


Geometry in XML

The VGM provides also the XML exporters which enable to generate XML files with geometry description in the AGDD or GDML formats. If Geant4 VMC is compiled with USE_VGM option, geometry can be exported to XML using the built-in commands:
/vgm/generateAGDD [volumeName]
/vgm/generateGDML [volumeName]
If volumeName is not specified, the whole geometry volume tree is exported.

The geometry can be then browsed and visualized using GraXML tool .


Contact: vmc@root.cern.ch

Page maintained by: Ivana Hrivnacova
Last update: 03/10/2007