next up previous
Next: Examples module Up: FLUGG - FLUKA + Previous: FLUGG - FLUKA +

How to build a FLUGG application

To create a FLUGG application, first create a directory, not necessarily in the FLUGG path. You can also create it directly in $FLUGGINSTALL/examples/fluggEx/emptyEx

Copy in your application directory the file:
$FLUGGINSTALL/examples/fluggEx/emptyEx/mainFLUGG.cc
This will be your application main routine, and the executable will have the same name. You can change the name , ex mainMyApp.cc

Copy in your application directory the file:
$FLUGGINSTALL/examples/fluggEx/emptyEx/GNUmakefile If you changed the main name, edit GNUmakefile and substitute the new name in the name := mainFLUGG line.

If you need to simulate ion interactions, edit the makefile and substitute binmake_ion.gmk to binmake.gmk

Create three subdirectories

     src/
     include/
     for/ (optional)
Now you can start building your application
a)
GEOMETRY

The detector definition requires the representation of its geometrical elements, their materials and electronics properties, together with user defined properties. FLUGG geometrical representation of detector elements requires implementing the following G4 classes:

-
Detector Construction (named ``MyDetectorConstruction");
-
Detector Parameterization (optional);
-
Magnetic Field Construction (optional);
You must define these classes in include directory and their implementation in src of the above directory[1].

As far as geometry construction is concerned, remember that replicas and parameterized volumes are handled as fluka lattice-volumes, so boundaries between two identical replicas are not seen during tracking time. Different placements of identical physical volumes, instead, correspond to different fluka-regions (boundaries are seen!).

As far as magnetic field construction are regarded:

  1. Fluka needs flagged region for magnetic field. So it is imperative to flag logical volumes (in Detector Construction file) where magnetic field is present for FLUGG simulation (in GEANT4 this isn't necessary)

    How volumes can be flagged:

    1.a)
    with flag in G4LogicalVolume constructor:
    logicBox = new G4LogicalVolume(solidBox,BoxMaterial, ``Box",fieldMgr,0,0);
    1.b)
    with member function:
    logicBigBox-$>$SetFieldManager(fieldMgr,true); *true flag implies that the field is extended to all volume daughters (for field in all detector set this flag for world volume!).
  2. If field is defined with G4UniformMgnField (so it's uniform) the field value is written in fluka card MGNFIELD (in flukaMat.inp file). If field is defined with a user-implemented function, the FLUKA user routine magfld.f should be modified to include a call to the FLDWR wrapper, that gives the local B value.
b)
FLUKA user routines if modified FLUKA user routines are needed ( i.e. source.f, magfld.f..) they must be put in a subdirectory for/ of the directory where the application is built.

c)
FLUGG ENVIRONMENT VARIABLES Define environment variables . ./configure.sh or source ./configure.sh depending on your shell

d)
FLUGG EXECUTABLE In your application directory, run ``gmake" (or ``gmake clean" and then ``gmake" to recompile all files). Gmake creates the executable:
 
${FLUGGINSTALL}/bin/Linux-g++/mainFLUGG
compiling FLUGG geometry classes, fortran optional routines and linking G4 geometry libraries and fluka libraries (libflukahp.a).

e)
FLUKA INPUT Now, to run FLUGG, you need fluka-stile input file. You can see FLUKA manual for details, and input examples in
$FLUGGINSTALL/flugg/examples/fluka.
Put a GEOBEGIN card with sdum = FLUGG immediately followed by a GEOEND card. (you have to put no lines between GEOBEGIN and GEOEND, geometry input comes from G4 classes!). The sdum=FLUGG card is mandatory only when Flair is used.
As concerns material specification: in GEANT4 toolkit, materials and material-volume assignments are specified in geometry input classes, in the detector constructor file. When FLUGG initializes the geometry, material information is read from GEANT4 detector description, and translated into FLUKA-formatted input cards. So a first dummy run must be executed; the newly created file containing GEANT4 material specifications and volume-material assignments (flukaMat.inp) must be included into the FLUKA input file where additional properties can still be defined. Other useful information, like FLUGG geometry volume names and indexes (together with repetition numbers for replicated or parameterized volumes!) are dump in Volumes_index.inp.
As concerns region names: the volume names from tthe GEANT4 detector description are transalated into FLUKA-compatible names: they are truncated to 8 characters, and numbers are appended at the end of the name in case of ambiguities. The user chan choose to stay with the old number-based description by setting the NO_NAMES environmmental variable before the creation of the FluGG libraries.
Now you are ready to run mainFLUGG through the FLUKA rfluka script ( it is in the flutil directory of your FLUKA installation ) specifying the executable name: From the directory where you have the input file:
 $FLUPRO/flutil/rfluka -e \${FLUGGINSTALL}/bin/Linux-g++/mainFLUGG   \
           -M<end run> -N<start run-1>  myinput

next up previous
Next: Examples module Up: FLUGG - FLUKA + Previous: FLUGG - FLUKA +
Giuseppe Battistoni 2003-01-24