4 ====================================================================
5 ====================================================================
6 READ-ME-FLUGG - Sara Vanini - June 2000
7 Upgrade to Geant4 3.1, I. Hrivnacova, 30 May 2001
9 (FLUGG documentation: ATL-SOFT-98-039 and ATL-SOFT-99-004.)
10 ====================================================================
11 ====================================================================
14 ====================================================================
15 = 1. Flugg Installation =
16 ====================================================================
18 1.1 Supported computers and operating systems
19 --------------------------------------------------------------------
20 FLUGG is supported under the following operating systems:
22 - Flavors of Unix (from vendors HP, DEC)
23 - Linux on PC with g++ (egcs compiler)
25 Currently, this is the set of flavors which can be associated with
26 the environment variable $G4SYSTEM to
27 identify the system architecture and compiler used:
29 UNIX - HP-UX v.10.20, aCC v.1.23 G4SYSTEM: HP-aCC
30 DEC-OSF/1 v.4.0, cxx 6.1 G4SYSTEM: DEC-cxx
31 Linux - Linux RedHat 6.1, g++ egcs 1.1.2 G4SYSTEM: Linux-g++
34 -------------------------------------------------------------------
35 To run FLUGG, the following software must be properly installed in
36 your computing environment:
38 - C++ compiler (compiler from Unix vendor, g++ or Visual C++
40 - CLHEP library (see CLHEP reference guide http://wwwinfo.
41 cern.ch/asd/lhc++/clhep/manual/RefGuide/index.html);
42 - Native STL or ObjectSpace STL
43 (see http://www.objectspace.com/)
44 - GNU Make (note: g++ preprocessing is used to build file
45 dependencies) is also used and a UNIX shell;
50 --------------------------------------------------------------------
51 Before proceeding with the installation, you need to define some key
52 environment variables in your user environment, in order to specify
53 where all software components are placed and to set some compilation
56 FLUKA path to fluka binary files;
57 FORLIB path to the fortran library;
58 FLUPRO path to fluka program
59 FLUKAOBJ_PATH path to fluka objects;
60 FLUKAOBJ name of fluka objects (user's routines, ecc.);
62 FLUGGINSTALL path where the FLUGG toolkit tree is installed;
63 G4SYSTEM set to one of the flavors listed in the above section to
64 specify the kind of architecture and compiler used;
65 G4GEOMETRY_DEBUG if set the additional debug information is printed
66 in the log file (default = unset)
67 G4LIB_BUILD_SHARED if set shared libraries are built, static ones otherwise
70 CLHEP_BASE_DIR: path to the CLHEP installation
71 OSPACE_BASE_DIR: path to the ObjectSpace STL installation (in case
72 ObjectSpace STL implementation is used in place of the system's
76 1.4 How to make G4 libraries
77 --------------------------------------------------------------------
78 At this point, do the following to start building the compilation
79 and installation of the kernel libraries.
80 You can choose to build libraries in one of two ways, according to
81 the needs and system resources. From $FLUGGINSTALL/source:
84 This will make global libraries, one for each major category.
86 This will make one library for each "leaf" category (maximum
87 library granularity) and produce automatically a map
88 of library use and dependencies.
90 The standard build procedure assumes global libraries if they exist.
91 Advantages of using approach 2. can be noticed mainly concerning
92 library and program build speed, which in some cases can be improved
93 also of a factor 2 or 3 compared to the "global library" approach.
94 Using the "granular library" approach a fairly big number of "leaf"
95 libraries is produced, dependencies and linking list are however
96 evaluated and generated automatically on the fly. The top-level
97 GNUmakefile in $FLUGGINSTALL/source parses the dependency files of
98 FLUGG and produces libname.map in $G4LIB. libname.map is produced
99 by the tool liblist, whose source code is in $FLUGGINSTALL/config.
100 When building a binary application the script binmake.gmk in
101 $FLUGGINSTALL/config will parse the user's dependency files and use
102 libname.map to determine through liblist the required libraries
103 to add to the linking list. Only the required libraries will be
109 --------------------------------------------------------------------
110 For FLUKA libraries and FLUKA data files, pemf file, etc, you could
111 take a look at FLUKA manual.
113 At this point, you'll be ready to start building your first
117 ====================================================================
118 = 2. FluGG - Fluka + Geant4 Geometry for Simulation in HEP =
119 ====================================================================
121 2.1 How to build a FLUGG example
122 --------------------------------------------------------------------
123 You can create a FLUGG example in the directory:
124 $(FLUGGINSTALL)/examples/fluggEx/emptyEx
127 The detector definition requires the representation of its geometrical
128 elements, their materials and electronics properties, together with
129 user defined properties. FLUGG geometrical representation of
130 detector elements requires implementing the following G4 classes:
131 - Detector Construction (named "MyDetectorConstruction");
132 - Detector Parameterization (optional);
133 - Magnetic Field Construction (optional);
135 You must define these classes in include directory and their
136 implementation in src of the above directory. (see http://wwwinfo.cern.ch/
137 asd/geant4/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html/
138 index.html for details on how to write a G4 geometry).
140 As regards geometry construction, remember that replicas and
141 parameterized volumes are handled as fluka lattice-volumes, so
142 boundaries between them are not seen during tracking time.
143 Different placements of identical physical volumes, instead,
144 correspond to different fluka-regions (boundaries are seen!).
146 As regards magnetic field construction:
147 1) Fluka needs flagged region for magnetic field. So it is
148 imperative to flag logical volumes (in Detector Construction
149 file) where magnetic field is present for FLUGG simulation
150 (in GEANT4 this isn't necessary, you can define only
153 How volumes can be flagged:
154 1.a) with flag in G4LogicalVolume constructor:
155 logicBox = new G4LogicalVolume(solidBox,BoxMaterial,
157 1.b) with member function:
158 logicBigBox->SetFieldManager(fieldMgr,true);
159 *true flag implies that the field is extended to all
160 volume daughters (for field in all detector set this
161 flag for world volume!).
163 2) If field is defined with G4UniformMgnField (so it's uniform)
164 the field value is written in fluka card MGNFIELD (in flukaMat.inp
165 file). If field is defined with a user-implemented function,
166 MAGFLD wrapper gives the local value as fluka calls it run time.
169 b)FLUGG ENVIRONMENT VARIABLES
170 Define environment variables described in section 1.3.
173 In the directory: $(FLUGGINSTALL)/examples/fluggEx/emptyEx,
174 run "gmake" (or "gmake clean" and then "gmake" to recompile all files).
175 Gmake creates the executable ($(FLUGGINSTALL)/bin/Linux-g++/mainFLUGG)
176 compiling FLUGG geometry classes, linking G4 geometry libraries
177 and fluka libraries (libflukahp.a).
180 Now, to run FLUGG, you need fluka-stile input file. You can see FLUKA
181 manual for details, and input and pemf file examples in /flugg/
182 examples/fluka. Remember that GEOBEGIN-GEOEND card is dummy (you
183 have to put no lines between GEOBEGIN and GEOEND, geometry input comes
184 from G4 classes!). As regards material specification: in GEANT4
185 toolkit, materials and material-volume assignments are specified in
186 geometry input classes, in the detector constructor file. When FLUGG
187 initializes the geometry, material information is read from
188 GEANT4 detector description, and translated into FLUKA-formatted
190 So a first dummy run must be executed; the newly created file containing
191 GEANT4 material specifications and volume-material assignments
192 (flukaMat.inp) must be included into the FLUKA input file where
193 additional properties can still be defined. Other useful information,
194 like FLUGG geometry volume names and indexes (together with repetition
195 numbers for replicated or parameterized volumes!) are dump in
198 Now you are ready to run mainFLUGG (see rfluka script in /flugg/
203 --------------------------------------------------------------------
204 This module collects a set of user examples aimed to demonstrate to
205 a user how to make correct use of the FLUGG toolkit by implementing
206 those user-classes which a Geant4 user is supposed to customize
207 in order to define his/her own detector geometry setup.
208 This set of examples covers some possible general use-cases
209 for actual detector simulation for HEP.
212 - series of slab of different elements (Al, Au, Al), which total
213 thickness is of the order of the electron range;
214 - multiple scattering at boundaries (handle delicate situations such
215 as grazing angles, backscattering, deflections at boundaries);
216 Fluka input files: alaual.inp, wa_50m.pemf
219 - 500 MeV protons on a thick Cu target: the generated neutrons
220 propagate in a concrete shield;
221 - fluka biasing techniques are applied to achieve variance
223 Fluka input files: Bias.inp, wa_50m.pemf
226 - test-geometry with spheres and tubs;
227 - tracking in magnetic field;
228 Fluka input files: MagSphereNotRep.inp, t36.pemf
231 - Test-36 em-hadronic calorimeter;
232 - Full "ordinary" processes;
234 Fluka input files: T36.inp, t36.pemf
238 Appendix A. FLUKA input --> FLUGG input
239 ********************************************************
240 When transposing a fluka input in a flugg input you need
243 a) Update the following fluka cards substituting fluka
244 region indexes with G4 geometry volume indexes: (in
245 parenthesis the WHAT() with region numbers):
250 DETECT (6; contin.card:2-6)
255 GEOBEGIN/END no WHAT exept COMBINAT; throw
256 away everything between GEOBEGIN/END
264 USRBIN (4,5,6; contin.card:1,2,3,4,5,6)
270 b)integrate the following material cards with information:
271 DELTARAY, EMF-BIAS, EMF-CUT, EMF-FIX, EMF-FLUO, EVXTEST,
272 FLUKAFIX, LAM-BIAS, LANDAU, LOW-MAT, MAT-PROP, MULSOPT,
273 OPT-PROP, PAIRBREM, PHOTONUC; and in MAPA and PEMF file,
274 which contain detailed information about materials.
276 When comparing fluka and FLUGG runs, REMEMBER to:
277 1) check that coordinate system is the same in fluka geometry
278 and in GEANT4 geometry; if it is not, update position and beam
280 2) check how events are the scored!
283 Appendix B. GEANT4 example --> FLUGG example:
284 ****************************************************************
285 0) Copy /src and /include geant4 examples directories in emptyEx/
286 1) Delete all classes exept:
287 - Detector Construction;
288 - Detector Parameterization;
289 - Magnetic Field Construction;
290 2) Delete corresponding "#include ..." lines in Detector
291 Construction source file and variables definitions in the constructor,
292 and corresponding class declarations and variable declaration
293 in Detector Construction include file.
294 2b) Delete #include "G4RunManager.hh" and lines where RunManager is
296 3) Delete Detector messenger, initialization and destruction, delete
297 code lines where Sensitive Detector is set (be aware of memory leaks!).
298 4) Delete code lines where parameterization of processes for fast
299 simulation is set (and visualization of ghost volumes).
300 Delete commands for interactive definition of the calorimeter
304 Appendix C. How to update FLUGG with new Geant4 releases
305 ****************************************************************
306 For updating FLUGG with new Geant4 releases the following
307 operations are required:
309 1) from flugg/source: gmake clean_all to remove the previous
312 2) unzip and untar Geant4 release;
314 3) set environment variable for paths to Geant4 (G4INSTALL)
315 and Flugg (FLUGGINSTALL)
317 4) run update_source.sh script
319 This will replace files placed in include and src sub-directories
320 of the following directories:
321 geant4/source/geometry ---> flugg/source/geometry
322 geant4/source/graphics_reps ---> flugg/source/graphics_reps
323 geant4/source/material ---> flugg/source/material
324 geant4/source/global ---> flugg/source/global
325 geant4/source/intercoms ---> flugg/source/intercoms
326 The Geant4 makefiles are modified for Flugg; old Flugg
327 makefiles are kept and renamed to GNUmakefile.flugg and kept.
329 5) now you must add "UpdateNavigatorHistory" member function to
330 G4Navigator class; insert the following declaration in
331 "flugg/source/geometry/volumes/include/G4Navigator.hh" file:
333 // flugg member function: reinitialization of navigator history with
334 // secondary particle history banked on fluka side
335 void UpdateNavigatorHistory(const G4NavigationHistory* newNavHistory);
337 6) And append the following definition to
338 "flugg/source/geometry/volumes/src/G4Navigator.cc" file:
340 void G4Navigator::UpdateNavigatorHistory(const G4NavigationHistory* newNavHistory)
342 ResetStackAndState();
343 fHistory = *newNavHistory;
347 7) run update_config.sh
349 This will replace makefiles placed in config directory
350 with new ones from Geant4 modified for Flugg;
351 old makefiles are kept and renamed (by adding .flugg extension).
352 !!! binmake.gmk has to be updated by hands.
353 In case no major modifications were done in config
354 in new Geant4 release the old binmake.gmk may be used without