Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/extended/persistency/P01/README is written in an unsupported language. File is not indexed.

0001 
0002      =========================================================
0003      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
0004      =========================================================
0005 
0006                             ExampleP01
0007                             ----------
0008 
0009 General description
0010 -------------------
0011 
0012 This example shows how to store produced hits in a file using
0013 the 'reflection' technique for persistency provided by the Reflex tool
0014 included in ROOT. The Reflex tool allows to create a dictionary
0015 for the hit class, making then possible to save hit objects in a .root
0016 file. The general simulation setup (geometry, physics list, user
0017 actions, etc...) is taken from ExampleN02. 
0018 
0019 The provided makefile produces two executables: 'exampleP01' and
0020 'readHits'. The first one is the actual Geant4 simulation application
0021 with hits persistency. The second one, is just a simple 'reader' for
0022 the produced .root file (you need to specify the name of the .root
0023 file as argument).
0024 
0025 
0026 Building and running the example
0027 --------------------------------
0028 
0029 This examples requires the ROOT toolkit of version 6 to be installed. The
0030 provided CMake file checks for the existence of the package and its version. 
0031 Once the CMake configuration has been succesfully done, the two executables
0032 for this example (exampleP01, readHits) should be built using make 
0033 (in your CMake build directory): 
0034 
0035             make 
0036 
0037 When the example is run (using the provided run.mac macro file) ten
0038 events are generated and the produced hits will be stored in 
0039 the hits.root file. In addition, the hits will be printed out on the
0040 screen so one can then compare them with the 'reader' output.
0041         
0042 In order to read the persistified hits, a small 'reader' application
0043 has been implemented. It can be run in the following way:
0044 
0045 <my_binary_directory>/readHits hits.root
0046 
0047 where the argument is the name of the file to be read. All the hits
0048 saved in that file will be then read and printed on the screen.
0049 
0050 In addition to that the readHits.C ROOT macro file is provides, which
0051 illustrates how one can read the hits file directly from the ROOT
0052 prompt. 
0053 
0054 
0055 Remark on dictionary generation
0056 -------------------------------
0057 
0058 The dictionary is generated by ${ROOTSYS}/bin/genreflex
0059 tool. The arguments that will be used by this tool are configured 
0060 in CMakeLists.txt using the CMake function REFLEX_GENERATE_DICTIONARY
0061 provided by ROOT. They include the header file including headers for
0062 all the classes we want to generate the dictionary, and additionally,
0063 a so called selection file (xml). The role of this file is to
0064 specify which classes we want to generate the dictionary for. The
0065 selection file for our dictionary is in xml/ directory. Please refer
0066 to genreflex manual for more details concerning the usage of that
0067 tool.  
0068 
0069 Concerning generating dictionary for the Geant4 objects, there are
0070 also two technical remarks that need to be made here. 
0071 The Reflex tool requires all the templated classes to be
0072 explicitely used somewhere in the included header files in order for
0073 the generation of the dictionary to be possible. For those templated
0074 classes for which it is not the case, the problem can be very easily
0075 solved by instaciating them in the headerfile which is given to
0076 genreflex (see includes/ExP01Classes.hh) as argument.
0077 The second remark is that there is an unfortunate clash of names as
0078 far as G4String class is concerned. The header of G4String class
0079 defines __G4String which happens to be the name of a variable used
0080 within the generated dictionary code. The solution for that is to do
0081 #undef __G4String in include/ExP01Classes.hh file.
0082 
0083