In order to compile and run the code for AGATA, the CLHEP libraries (up to version 1.8.2, which can be found here) and the Geant4 libraries (version 4.5.X and above, which can be found here) should be properly installed on your computer. Obviously, a C++ compiler is needed. Geant versions 4.5.X to 4.7.X are compatible with gcc v. 3.2.3 (which is the recommended choice according to the Geant4 manual). Geant versions 4.7.X can be compiled with gcc v. 3.4.3, although problems have been reported (see below).
Fixing known bugs with Geant4 and extending its capabilities
Patches are provided to fix some bugs with the standard Geant4 distribution and extend its capabilities (which are used by the main Agata code) with the G4LECS package.
Description of the bugs
The following files in the standard Geant4 distribution have bugs which compromise severely the possibility to run the code for Agata:
G4VAssemblyVolume.cc (bug fixed from version 4.6.1 above), prevents from numbering the detectors in the proper way.
G4IntersectionSolid.cc (fixed from version 4.7.1), produces results depending on the order of the intersection.
In addition, there is a known problem with the neutron data files affecting the interaction of neutrons with Germanium.
Fixing the bugs
The bug with the neutron data files can be easily solved by removing the following files:
where ($neutron) is the directory where the neutron data files are installed.
The bugs with the Geant4 distribution can be fixed by applying the proper patch and recompiling the Geant4 libraries (which is strongly recommended if one wants to obtain sensible results!). The patch-sources-XX.tgz archive should be decompressed from the directory where the Geant4 source files are using the following command:
tar xvfmz patch-sources-XX.tgz
After that, recompile the Geant4 libraries referring to the Geant4 documentation. The data files contained in patch-data-XX.tgz should instead be decompressed from the directory containing the data files for the low-energy set of interactions.
If, for any reason, the user does not want to recompile the Geant4 libraries, the Agata code will compile anyway (producing unreliable results) by placing some files from the patches in the Agata subdirectories:
G4LECSCompData.cc, G4LECSRaylData.cc, G4LECSCompton.cc, G4LECSRayleigh.cc should be placed in the src subdirectory;
G4Boost.hh, G4LECSCompData.hh, G4LECSRaylData.hh, G4LECSCompton.hh, G4LECSRayleigh.hh should be placed in the include subdirectory.
Obviously, the patch corresponding to the installed version of Geant4 should be chosen.
Installing the Agata code
After decompressing the distribution package for Agata, move to the Agata main directory and modify the GNUmakefile according to the version of Geant4 installed on your computer:
for version 4.5.X, the line CPPFLAGS += -DG4V46 should be commented and the line CPPFLAGS += -DG4V45 should be uncommented;
version 4.6.X or 4.7.X, the line CPPFLAGS += -DG4V45 should be
commented and the line CPPFLAGS += -DG4V46 should be uncommented. Note
that for version 4.7.1 and above also the line CPPFLAGS += -DG4V47
should be uncommented.
Other compilation options are:
uncomment the line CPPFLAGS += -DGRETA to generate the cryostat geometry according to the GRETINA style;
uncomment the line CPPFLAGS += -DANCIL to generate more materials, in case a “realistic” ancillary detector is included in the simulation.
After that, make
sure that the Geant4 environment variables have been
set and compile with make or gmake. Forgive the warnings and good
luck! In case gcc v. 3.4.X is being used, the linking stage will
apparently end with a number of errors concerning the neutron
libraries, however the program is typically linked successfully and
will run without major problems (check whether the executable exists!).