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p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Name Size       Last modified (GMT) Description
Back Parent directory       2024-12-05 15:16:16
Folder include/       2024-12-05 15:16:16
Folder src/       2024-12-05 15:16:16
Folder xml/       2024-12-05 15:16:16
File CMakeLists.txt 4052 bytes       2024-12-05 15:16:16
File GNUmakefile 1597 bytes       2024-12-05 15:16:16
File History 4160 bytes       2024-12-05 15:16:16
File README 3607 bytes       2024-12-05 15:16:16
C++ file exampleP01.cc 4023 bytes       2024-12-05 15:16:16
File p01-read.out 47499 bytes       2024-12-05 15:16:16
File p01-write.out 209181 bytes       2024-12-05 15:16:16
File readHits.C 977 bytes       2024-12-05 15:16:16
C++ file readHits.cc 2540 bytes       2024-12-05 15:16:16
File run.mac 442 bytes       2024-12-05 15:16:16
File vis.mac 2028 bytes       2024-12-05 15:16:16

  1 
  2      =========================================================
  3      Geant4 - an Object-Oriented Toolkit for Simulation in HEP
  4      =========================================================
  5 
  6                             ExampleP01
  7                             ----------
  8 
  9 General description
 10 -------------------
 11 
 12 This example shows how to store produced hits in a file using
 13 the 'reflection' technique for persistency provided by the Reflex tool
 14 included in ROOT. The Reflex tool allows to create a dictionary
 15 for the hit class, making then possible to save hit objects in a .root
 16 file. The general simulation setup (geometry, physics list, user
 17 actions, etc...) is taken from ExampleN02. 
 18 
 19 The provided makefile produces two executables: 'exampleP01' and
 20 'readHits'. The first one is the actual Geant4 simulation application
 21 with hits persistency. The second one, is just a simple 'reader' for
 22 the produced .root file (you need to specify the name of the .root
 23 file as argument).
 24 
 25 
 26 Building and running the example
 27 --------------------------------
 28 
 29 This examples requires the ROOT toolkit of version 6 to be installed. The
 30 provided CMake file checks for the existence of the package and its version. 
 31 Once the CMake configuration has been succesfully done, the two executables
 32 for this example (exampleP01, readHits) should be built using make 
 33 (in your CMake build directory): 
 34 
 35       make 
 36 
 37 When the example is run (using the provided run.mac macro file) ten
 38 events are generated and the produced hits will be stored in 
 39 the hits.root file. In addition, the hits will be printed out on the
 40 screen so one can then compare them with the 'reader' output.
 41         
 42 In order to read the persistified hits, a small 'reader' application
 43 has been implemented. It can be run in the following way:
 44 
 45 <my_binary_directory>/readHits hits.root
 46 
 47 where the argument is the name of the file to be read. All the hits
 48 saved in that file will be then read and printed on the screen.
 49 
 50 In addition to that the readHits.C ROOT macro file is provides, which
 51 illustrates how one can read the hits file directly from the ROOT
 52 prompt. 
 53 
 54 
 55 Remark on dictionary generation
 56 -------------------------------
 57 
 58 The dictionary is generated by ${ROOTSYS}/bin/genreflex
 59 tool. The arguments that will be used by this tool are configured 
 60 in CMakeLists.txt using the CMake function REFLEX_GENERATE_DICTIONARY
 61 provided by ROOT. They include the header file including headers for
 62 all the classes we want to generate the dictionary, and additionally,
 63 a so called selection file (xml). The role of this file is to
 64 specify which classes we want to generate the dictionary for. The
 65 selection file for our dictionary is in xml/ directory. Please refer
 66 to genreflex manual for more details concerning the usage of that
 67 tool.  
 68 
 69 Concerning generating dictionary for the Geant4 objects, there are
 70 also two technical remarks that need to be made here. 
 71 The Reflex tool requires all the templated classes to be
 72 explicitely used somewhere in the included header files in order for
 73 the generation of the dictionary to be possible. For those templated
 74 classes for which it is not the case, the problem can be very easily
 75 solved by instaciating them in the headerfile which is given to
 76 genreflex (see includes/ExP01Classes.hh) as argument.
 77 The second remark is that there is an unfortunate clash of names as
 78 far as G4String class is concerned. The header of G4String class
 79 defines __G4String which happens to be the name of a variable used
 80 within the generated dictionary code. The solution for that is to do
 81 #undef __G4String in include/ExP01Classes.hh file.
 82 
 83