Frequently Asked Questions

 


General

  1. How do I add a FAQ to this page?

    Solution:
    This is done manually at the moment. Please send your FAQ with solution to the editors.

Installation

  1. When I download the source from the web, and unpack the tar file, some files unpack into the top level directory.

    Solution:
    The problem you describe usually is the result of using "UNIX" tar to unpack the gtar ("GNU-tar") file, or vice versa, or using zip on either the gtar or tar file. Please make certain that you download the correct file for your system, and that you use the correct unpacking tool. Note that for Linux you must download the gtar.gz file.

  2. I cannot find CLHEP files or library and I have it installed in my system.

    Solution:
    If the standard CLHEP installation procedure has been adopted, the variable $CLHEP_BASE_DIR should point to the area where include/ and lib/ directories for CLHEP headers & lib are installed (i.e., it should be /usr/local for the default CLHEP installation). In case the library name is different than the one expected (libCLHEP.a), you should either create a symbolic link with the expected name, or define the variable CLHEP_LIB in your environment which explicitly sets the name of the CLHEP library. If a non-standard CLHEP installation has been adopted, define variables $CLHEP_INCLUDE_DIR, $CLHEP_LIB_DIR (and $CLHEP_LIB) to refer explicitly to the place where includes, library (and library-name) respectively are placed in your system.

  3. I installed CLHEP and the "Hist" package for histogramming is missing. Where can I find it and how can I do for making histograms.

    Solution:
    In Geant4, histogramming is done through the standard AIDA interface; these histograms can be displayed or otherwise manipulated using analysis tools based on the AIDA interface (JAS, Lizard, Open Scientist, ...). Examples are shown in examples/extended/analysis and examples/advanced applications.

    The obsolete and no-longer maintened "Hist" module can be downloaded from the CLHEP 1.5 distribution from web, but requires some modifications to the CLHEP installation scripts to be properly installed.

  4. While installing the Geant4 libraries I get the following message printed:
             gmake[1]: cernlib: Command not found
    Has Geant4 been installed properly ? What to do to solve this error ?

    Solution:
    The message:
             gmake[1]: cernlib: Command not found
    shows that you don't have the 'cernlib' command installed in your system; 'cernlib' is a command from the CERN program library (cernlib) returning a list of libraries needed to link a cernlib application. This command is only used in the 'g3tog4' module, however, if you do not make use of the 'g3tog4' tool, it's harmless. The cernlib script (and the needed cernlib libraries) are available from: http://cern.ch/cernlib.

  5. Trying building the Geant4 libraries I see several of these errors appearing and my installation fails:
             .....G4Exception.d:1: *** missing separator. Stop.
             ...../G4DalitzDecayChannel.d:1: *** missing separator. Stop.
               :
               :

    Has Geant4 been installed properly ? What to do to solve this error ?

    Solution:
    It looks like some file dependencies (.d) are corrupted, possibly due to previous build attempts which failed for some reason.
    You need to remove each of them; you can use:
           gmake dependencies='' clean
        
    from the affected module (i.e. for this case, from $G4INSTALL/source/global/management and $G4INSTALL/source/particles/management) and rebuild.
    Alternatively, you may use:
           gmake clean
        
    from geant4/source and rebuild.

  6. I'm trying to build Geant4 on Linux Red-Hat 7.0/7.1 with gcc-2.96.XX and get errors in compilation or when building the file dependencies.

    Solution:
    Geant4 is supported on Red Hat 6.1 with gcc-2.95.2. Moreover, note that on versions 7.X, Red Hat Linux is distributed with a flawed version of the gcc compiler which has -never- been officially released by GNU. The compiler gcc-2.96.XX may require strict ISO/ANSI setup. If so the following changes in Geant4 3.2 may help to build most of the modules in Geant4, although we cannot guarantee a correct behavior of a program built with such compiler. In geant4/config/sys/Linux-g++.gmk modify the line:
         CXXFLAGS := -pipe -fno-for-scope -DGNU_GCC
    to
         CXXFLAGS := -ansi -pedantic -pipe -fno-for-scope -DGNU_GCC

    And the following lines:
         ifdef G4USE_OSPACE
         CPPFLAGS += -DOS_LINUX_2 -DOS_NEW_CHECK -DOS_STL_ASSERT
         CPPFLAGS += -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
         CPPFLAGS += -I$(OSPACE_BASE_DIR)/ospace/std -I$(OSPACE_BASE_DIR)
         # else
         # G4USE_STD_NAMESPACE := yes
         # CPPFLAGS += -DG4USE_STD_NAMESPACE
         endif

    to:
         G4USE_STD_NAMESPACE := yes
         CPPFLAGS += -DG4USE_STD_NAMESPACE


    Rebuild from scratch:
          cd geant4/source
         gmake clean
         gmake

  7. Trying to install Geant4 on Linux with gcc-3.X compiler, I get compilation errors from CLHEP/DRand48Engine.

    Solution:
    To overcome this problem on gcc-3.X, you should reinstall CLHEP and comment out or remove the lines included between
         #if !defined(__GNUC__) || defined(__STRICT_ANSI__)
          ...
         #endif
    in DRand48Engine.h.
    This problem is fixed in a higher (>1.7) version of the CLHEP package.

Run Time Problems

  1. On Linux Red-Hat 6.1, I get a segmentation fault as soon as I run one of the official extended examples. I also noticed that random engine status is not stored on file.

    Solution:
    Check that the CLHEP library has been installed and compiled with Red-Hat 6.1. A binary object produced with Red-Hat 5.X is not fully compatible with binaries running on RH 6.X, due to a different libc used in the two configurations.

  2. I installed Geant4 libraries and built my application, when I try to run it I get:
             error in loading shared libraries:
             libCLHEP.so: cannot open shared object file:
             No such file or directory.


    Solution:
    Your installation of CLHEP includes shared libraries. You need to specify the path where libCLHEP.so is installed through your environment variable LD_LIBRARY_PATH.

  3. On my system I get a Floating Point Exception (FPE) since some physics processes sometimes return DBL_MAX as interaction length and this number is afterwards multiplied by a number greater than 1.

    Solution:
    Geant4 coding conventions and installation setup explicitly follow the ANSI/IEEE-754 Standard for the initialization of floating-point arithmetic hardware and portability. The Standard foresees floating-point arithmetic to be nonstop and underflows to be gradual. On DEC platforms, for example, the ANSI/IEEE-754 Standard compliance needs to be explicitly set (since deactivated by default); in this case we use infact the option "-ieee" on the DEC/cxx native C++ compiler to achieve this. You should check if your compiler provides compilation options for activating Standard initialization of FP arithmetic (it may be platform specific).

Geometry

  1. I have a generic point and I would like to know in which physical volume I'm located in my detector geometry.

    Solution:
    The best way of doing this is by invoking the G4Navigator. First get a pointer of the navigator through the G4TransportationManager, and then locate the point. i.e.
         #include "G4TransportationManager.hh" 
         #include "G4Navigator.hh" 
         G4ThreeVector myPoint = ....;
         G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
         G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint); 
      
  2. How can I access the daughter volumes of a specific physical volume?

    Solution:
    Through the associated logical volume.
          G4VPhysicalVolume* myPVolume = ....; 
          G4LogicalVolume* myLVolume = myPVolume->GetLogicalVolume(); 
          for (G4int i=0; iGetNoDaughters(); i++)  
            myPVolume = myLVolume->GetDaughter(i); 
      
  3. How can I identify the exact copy-number of a specific physical volume in my mass geometry? I tried with GetCopyNo() from my physical volume pointer, but it doesn't seem to work!

    Solution:
    The correct way to identify -uniquely- a physical volume in your mass geometry is by using the touchables (see also section 4.1.5 of the User's Guide for Application Developers), as follows:
          G4Step* aStep = ..;
          G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
          G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle();
          G4int copyNo = theTouchable->GetReplicaNumber();
          G4int motherCopyNo = theTouchable->GetReplicaNumber(1);
      
    where Replica here stays for any duplicated instance of a physical volume, either if it is a G4PVPlacement (multiple placements of the same logical volume) or a G4PVReplica/G4PVParameterised.
    The method GetCopyNo() is meant to return only the serial number of placements not duplicated in the geometry tree.

  4. How can I determine the exact position in global coordinates in my mass geometry during tracking and how can I convert it to coordinates local to the current volume ?

    Solution:
    You need again to do it through the touchables (see also section 4.1.5 of the User's Guide for Application Developers), as follows:
          G4Step* aStep = ..;
          G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
          G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle();
          G4ThreeVector worldPosition = preStepPoint->GetPosition();
          G4ThreeVector localPosition = theTouchable->GetHistory()->
                                        GetTopTransform().TransformPoint(worldPosition);
      
    where worldPosition here stays for the position related to the world volume, while localPosition refers to the coordinates local to the volume where the particle is currently placed.

Physics and cuts

  1. How do production cuts (in range) work in Geant4 ? Are they also used in tracking ? If a particle has an energy lower than the converted cut in energy for the given material and the distance to the next boundary is smaller than the cut in range, is the particle killed ?

    Answer:
    Geant4 does NOT have a "tracking cut". The toolkit's default behaviour is to track particles down to zero range (i.e. zero energy).
    Of course, it is possible for the user to create and register a process that kills particles below a certain energy or range; this is however NOT provided by default in Geant4. So there's NO "tracking cut".
    For example, suppose a particle that is nearing zero energy will at some point be proposed by its Ionisation process to undergo one final step, from its current energy down to zero energy. This is still only a proposal. If during this step the particle crosses a boundary, then the transportation will limit the step at a length smaller than the Ionisation -- so the particle will still see and cross the relevant boundary, and another step will occur on the other side of that boundary.
    In summary the "production threshold" range and its equivalent in energy are not utilised as a "tracking cut". A particle is not abandoned by Geant4 below a certain range/energy unless the user registers a process to do this by him/her-self.

Visualization

  1. I have set G4VIS... environmental variables but visualization does not appear to be enabled.

    Solution:
    This might be because you set the environment variables *after* already compiling. The environment variables control C-pre-processor macros of the same name and therefore influence what code gets compiled. I suggest: (setenv or export the environment variables)
         cd $G4INSTALL/source/visualization
         gmake clean
         gmake
         cd $G4INSTALL/source/interfaces
         gmake clean
         gmake
         cd $G4INSTALL/source
         gmake libmap
         cd [your working directory]
         gmake clean
         gmake
      
    Try environment variables G4VIS_BUILD_xxx_DRIVER and G4VIS_USE_xxx, where xxx = OPENGLX, DAWN, DANWFILE, VRML, VRMLFILE all set to 1.

  2. Geant4 crashes while trying to open an OpenGLX window.

    Solution:
    This might be because you are using Mesa-3.1. Mesa-3.0 works.

Wednesday, 21 May 2003 - GC, GF