Chapter 9.  Analysis

9.1.  g4tools

9.1.1.  inlib, exlib, g4tools

g4tools is a "namespace protected" part of inlib and exlib which is of some interest for Geant4, mainly the histograms, the ntuples and the code to write them at the ROOT, AIDA XML, CSV and HBOOK file formats. The idea of g4tools is to cover, with a very light and easy to install package, what is needed to do analysis in a "Geant4 batch program".

As g4tools is distributed through Geant4 and in order to avoid potential namespace clashes with other codes that use the inlib/exlib to do Geant4 visualization (as for the g4view application or some of the exlib examples), the inlib and exlib namespaces had been automatically changed to tools in the g4tools distribution. Since in principle Geant4 users will not have to deal directly with the g4tools classes, but will manipulate histograms and ntuples through the G4AnalysisManager, we are not going to extensively document the g4tools classes here. Interested people are encouraged to go at the inlib/exlib web pages for that (see inlib/exlib site ).

9.1.2.  g4tools code is pure header

As explained in inlib/exlib, the code found in g4tools is "pure header". This comes from the need to have an easy way to build applications, as the ioda one, from smartphone, passing by tablets and up to various desktops (UNIX and Windows). For example, if building an application targeted to the AppStore and GooglePlay, the simplest way is to pass through Xcode and the Android make system (or Eclipse), and having not to build libraries simplifies a lot the handling of all these IDEs for the same application. A fallback of that is that the installation of g4tools (if not using the one coming with Geant4) is straightforward, you simply unzip the file containing the source code! To build an application using g4tools, as for inlib/exlib, you simply have to declare to your build system the "-I" toward the unfolded directory and do "Build and Run".

Note that there is no need to have CLHEP and Geant4 installed to use g4tools, but you may have to install CERNLIB (and a FORTRAN77 compiler!) if wanting to use the classes dealing with HBOOK.

9.1.3.  g4tools test

g4tools comes with test programs of its own that may be useful in case of problems (for example porting on a not yet covered platform). You can build and run them with :

     UNIX> <get g4tools.zip>
     UNIX> <unzip g4tools.zip>
     UNIX> cd g4tools/test/cpp
     UNIX> ./build
     UNIX> ./tools_test_histo
     UNIX> ./tools_test_wroot
     UNIX> etc...
and on Windows :
      DOS> <get g4tools.zip>
      DOS> <unzip g4tools.zip> (you can use the unzip.exe of CYGWIN)
      DOS> cd g4tools\test\cpp
      DOS> .\build.bat
      DOS> .\tools_test_histo.exe
      DOS> .\tools_test_wroot.exe
      DOS> etc...

Note that there is no need to have CLHEP and Geant4 installed to build and run the g4tools test programs, but you may have to install the CERNLIB (and a FORTRAN77 compiler!) if wanting to use the classes related to HBOOK.

9.1.4.  g4tools in Geant4

The g4tools header files are distributed in the Geant4 source in the source/analysis/include/tools directory and in the Geant4 installation, they are installed in include/tools directory. The g4tools test programs, included only in Geant4 development versions, can be downloaded with the g4tools-[version].zip file from the inexlib download page).