Back to home page

EIC code displayed by LXR

 
 

    


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

0001 \page ExampleP02 Example P02
0002 
0003 ## General description
0004 
0005 
0006 This example shows how to store in a binary file and how to
0007 read back the geometry tree using the 'reflection' technique for
0008 persistency provided by the Reflex tool also included in ROOT. The
0009 Reflex tool allows to create a dictionary for the geometry classes,
0010 making then possible to save the entire tree in a .root file.  
0011 
0012 The provided makefile produces the executable: 'exampleP02'. In order
0013 to run it one has to specify the argument, either 'write' or
0014 'read'. In the first case the geometry is instaciated in the standard
0015 way and then saved into the root file (geo.root). In the second case,
0016 the geometry is read from geo.root file.
0017 
0018 
0019 ## Building and running the example
0020 
0021 This examples requires the ROOT toolkit of version 6 to be installed. The
0022 provided CMake file checks for the existence of the package and its version. 
0023 Once the CMake configuration has been succesfully done, the executable
0024 for this example should be built using make 
0025 (in your CMake build directory):
0026 ```
0027 make
0028 ```
0029 
0030 ## Remark on dictionary generation
0031 
0032 The dictionary is generated by ${ROOTSYS}/bin/genreflex
0033 tool. The arguments that will be used by this tool are configured 
0034 in CMakeLists.txt using the CMake function REFLEX_GENERATE_DICTIONARY
0035 provided by ROOT. They include the header file including headers for
0036 all the classes we want to generate the dictionary, and additionally,
0037 a so called selection file (xml). The role of this file is to
0038 specify which classes we want to generate the dictionary for. The
0039 selection file for our dictionary is in xml/ directory. Please refer
0040 to genreflex manual for more details concerning the usage of that
0041 tool.  
0042 
0043 Concerning generating dictionary for the Geant4 objects, there are
0044 also two technical remarks that need to be made here. 
0045 The Reflex tool requires all the templated classes to be
0046 explicitely used somewhere in the included header files in order for
0047 the generation of the dictionary to be possible. For those templated
0048 classes for which it is not the case, the problem can be very easily
0049 solved by instaciating them in the headerfile which is given to
0050 genreflex (see ExP02Classes.hh) as argument.  
0051 The second remark is that there is an unfortunate clash of names as
0052 far as G4String class is concerned. The header of G4String class
0053 defines __G4String which happens to be the name of a variable used
0054 within the generated dictionary code. The solution for that is to do
0055 ```cpp
0056 #undef __G4String
0057 ```
0058 in include/ExP02Classes.hh file.
0059 
0060