| 1 | 
mocchiut | 
3.3 | 
Emiliano Mocchiutti: | 
| 2 | 
  | 
  | 
UNDER SL6: | 
| 3 | 
  | 
  | 
A) install compat-gcc-34-g77 and related compatibility packages | 
| 4 | 
  | 
  | 
B) use  | 
| 5 | 
  | 
  | 
# CERNLIB SETTINGS | 
| 6 | 
  | 
  | 
export CERN=/afs/cern.ch/sw/lcg/external/cernlib | 
| 7 | 
  | 
  | 
export CERN_LEVEL=2006b/i686-slc5-gcc34-opt/ | 
| 8 | 
  | 
  | 
export CERN_ROOT=$CERN/$CERN_LEVEL | 
| 9 | 
  | 
  | 
export PATH=$CERN_ROOT/bin:$PATH | 
| 10 | 
  | 
  | 
 | 
| 11 | 
cafagna | 
3.1 | 
 | 
| 12 | 
  | 
  | 
     Quick and dirty instruction list to build GPAMELA executable | 
| 13 | 
  | 
  | 
     ------------------------------------------------------------ | 
| 14 | 
  | 
  | 
 | 
| 15 | 
  | 
  | 
                   (F. Cafagna, Bari 11 July 2002) | 
| 16 | 
  | 
  | 
 | 
| 17 | 
  | 
  | 
 | 
| 18 | 
  | 
  | 
1. INTRODUCTION | 
| 19 | 
  | 
  | 
 | 
| 20 | 
  | 
  | 
  In this directory you will find all the sources and auxiliary files needed  | 
| 21 | 
  | 
  | 
  to build GPAMELA. | 
| 22 | 
  | 
  | 
 | 
| 23 | 
  | 
  | 
  GPAMELA sources are distributed in several subdirectories along with  | 
| 24 | 
  | 
  | 
  the GARFIELD car files needed to build the GARFIELD library.  | 
| 25 | 
  | 
  | 
 | 
| 26 | 
  | 
  | 
  To build GPAMELA you need the Makefile in the top directory along with  | 
| 27 | 
  | 
  | 
  the file: makefile_linux, stored in the garfield/src directory. | 
| 28 | 
  | 
  | 
 | 
| 29 | 
  | 
  | 
2. BUILD GPAMELA EXECUTABLE FOR INPATIENTS | 
| 30 | 
  | 
  | 
 | 
| 31 | 
  | 
  | 
Here is the list of action for the inpatients: | 
| 32 | 
  | 
  | 
 | 
| 33 | 
  | 
  | 
- Create the directory you want to store executables and run the program,  | 
| 34 | 
  | 
  | 
  in this example I wil create my_gpamela in my home directory: | 
| 35 | 
  | 
  | 
 | 
| 36 | 
  | 
  | 
  > mkdir  $HOME/my_gpamela | 
| 37 | 
  | 
  | 
 | 
| 38 | 
  | 
  | 
- Define the environment variable GPAMELA_BIN pointing the the created directory: | 
| 39 | 
  | 
  | 
 | 
| 40 | 
  | 
  | 
  > GPAMELA_BIN = $HOME/my_gpamela; export GPAMELA_BIN (for [ba]sh ) | 
| 41 | 
  | 
  | 
  > setenv GPAMELA_BIN $HOME/my_gpamela (for [t]csh) | 
| 42 | 
  | 
  | 
 | 
| 43 | 
  | 
  | 
- Make it:  | 
| 44 | 
  | 
  | 
 | 
| 45 | 
  | 
  | 
  > make distclean; make gpamelax11.exe; make gpamela.exe | 
| 46 | 
  | 
  | 
  > make gpamelax11_deb.exe; make gpamela_deb.exe | 
| 47 | 
  | 
  | 
   | 
| 48 | 
  | 
  | 
- Install it: | 
| 49 | 
  | 
  | 
 | 
| 50 | 
  | 
  | 
  > make install | 
| 51 | 
  | 
  | 
 | 
| 52 | 
  | 
  | 
3. DIRECTORY TREE | 
| 53 | 
  | 
  | 
 | 
| 54 | 
  | 
  | 
Here follows the gpamela directory tree: | 
| 55 | 
  | 
  | 
. | 
| 56 | 
  | 
  | 
|-- Makefile | 
| 57 | 
  | 
  | 
|-- aux | 
| 58 | 
  | 
  | 
|   |-- Auxiliary files needed by GPAMELA, i.e. field map, data cards,  | 
| 59 | 
  | 
  | 
|       garfield definitions etc. etc.  | 
| 60 | 
  | 
  | 
|-- cmz | 
| 61 | 
  | 
  | 
|   `-- Versions | 
| 62 | 
  | 
  | 
|       |-- History of the previous CMZ releases | 
| 63 | 
  | 
  | 
|-- garfield | 
| 64 | 
  | 
  | 
|   `-- src | 
| 65 | 
  | 
  | 
|       |-- GARFIELD sources and makefile | 
| 66 | 
  | 
  | 
|-- gcdes | 
| 67 | 
  | 
  | 
|   |-- GEANT 3.21 include files | 
| 68 | 
  | 
  | 
|-- gpamela | 
| 69 | 
  | 
  | 
|   |-- general purpose routine, for example GUSTEP, GPDAT etc. etc.  | 
| 70 | 
  | 
  | 
|-- gpcal | 
| 71 | 
  | 
  | 
|   |-- CALorimeter related routines  | 
| 72 | 
cafagna | 
3.2 | 
|-- gpcalor | 
| 73 | 
  | 
  | 
|   |-- GCALOR interface between GEANT and MICAP | 
| 74 | 
  | 
  | 
|-- gpcalordes | 
| 75 | 
  | 
  | 
|   |-- GCALOR include files | 
| 76 | 
cafagna | 
3.1 | 
|-- gpcas | 
| 77 | 
  | 
  | 
|   |-- CAS related soubroutine | 
| 78 | 
  | 
  | 
|-- gpcat | 
| 79 | 
  | 
  | 
|   |-- CAT related soubroutine | 
| 80 | 
  | 
  | 
|-- gpcdes | 
| 81 | 
  | 
  | 
|   |-- GPAMELA include files | 
| 82 | 
  | 
  | 
|-- gpfield | 
| 83 | 
  | 
  | 
|   |-- magnetic field related subroutines | 
| 84 | 
  | 
  | 
|-- gpgar | 
| 85 | 
  | 
  | 
|   |-- GPAMELA- GARFIELD interface related subroutines | 
| 86 | 
  | 
  | 
|-- gphys | 
| 87 | 
  | 
  | 
|   |-- obsolete routines to integrate dE/dx fluctuations  | 
| 88 | 
  | 
  | 
|        in the GEANT physics bank | 
| 89 | 
  | 
  | 
|-- gpmain | 
| 90 | 
  | 
  | 
|   `-- GPAMELA main routine | 
| 91 | 
cafagna | 
3.2 | 
|-- gpnd | 
| 92 | 
  | 
  | 
+   |-- neutron detector related routines | 
| 93 | 
cafagna | 
3.1 | 
|-- gpobsolete | 
| 94 | 
  | 
  | 
|   |-- obsolete code for tracker digitization | 
| 95 | 
  | 
  | 
|-- gpspe | 
| 96 | 
  | 
  | 
|   |-- SPEctrometer related subroutine | 
| 97 | 
  | 
  | 
|-- gptof | 
| 98 | 
  | 
  | 
|   |-- TOF related subroutine | 
| 99 | 
  | 
  | 
|-- gptrd | 
| 100 | 
  | 
  | 
|   |-- TOF related subroutine  | 
| 101 | 
  | 
  | 
|-- gpxint | 
| 102 | 
  | 
  | 
|   |-- GPAMELA main routine for the interactive version | 
| 103 | 
  | 
  | 
|-- history | 
| 104 | 
  | 
  | 
|   `-- history file (GPAMELA logbook) | 
| 105 | 
  | 
  | 
`-- inform | 
| 106 | 
  | 
  | 
    `-- list and usage of GPAMELA data cards | 
| 107 | 
  | 
  | 
 | 
| 108 | 
  | 
  | 
Please note that no lib and bin directories are presents in the distribution.  | 
| 109 | 
  | 
  | 
They will be created by make.  | 
| 110 | 
  | 
  | 
 | 
| 111 | 
  | 
  | 
Please note that all the source files have the .F extensions, they must be preprocessed.  | 
| 112 | 
  | 
  | 
 | 
| 113 | 
  | 
  | 
4. BUILD GPAMELA EXECUTABLE, LONG VERSION | 
| 114 | 
  | 
  | 
 | 
| 115 | 
  | 
  | 
You can create GPAMELA executables using gmake. For sake of simplicity I am  | 
| 116 | 
  | 
  | 
using just one Makefile located in the top directory: gpamela.  | 
| 117 | 
  | 
  | 
 | 
| 118 | 
  | 
  | 
The Makefile will create the executables locally in the bin directory | 
| 119 | 
  | 
  | 
of the top directory gpamela and will install them into the any user | 
| 120 | 
  | 
  | 
created directory along with the auxiliaries files need. You can pass | 
| 121 | 
  | 
  | 
the used directory via the GPAMELA_BIN environment variable. | 
| 122 | 
  | 
  | 
 | 
| 123 | 
  | 
  | 
Please note that the Makefile does use GNUmake: gmake, | 
| 124 | 
  | 
  | 
extension. Usually in the RedHat Linux distributions make points to | 
| 125 | 
  | 
  | 
gmake so the usage is equivalent. | 
| 126 | 
  | 
  | 
 | 
| 127 | 
  | 
  | 
The Makefile contains the following targets: | 
| 128 | 
  | 
  | 
 | 
| 129 | 
  | 
  | 
-gpamelax11.exe     : builds the interactive version of GPAMELA | 
| 130 | 
  | 
  | 
-gpamela.exe        : builds the batch version of GPAMELA | 
| 131 | 
  | 
  | 
-gpamelax11_deb.exe : builds the interactive version of GPAMELA with debug flags | 
| 132 | 
  | 
  | 
-gpamela_deb.exe    : builds the batch version of GPAMELA with debug flags | 
| 133 | 
  | 
  | 
-depend             : creates dependency files for each source file | 
| 134 | 
  | 
  | 
-install            : install GPAMELA executables and auxiliary files in GPAMELA_BIN | 
| 135 | 
  | 
  | 
-${GPLIBDIR}/libgarfield-7.a: builds the GARFIELD library in garfield/src directory | 
| 136 | 
  | 
  | 
-createdir          : creates the ./bin directory in the top directory | 
| 137 | 
  | 
  | 
-distclean          : deletes all the objects, dependency files, executables,  | 
| 138 | 
  | 
  | 
                      GARFIELD library, bin and lib directories | 
| 139 | 
  | 
  | 
-clean              : deletes all the objects and dependency files | 
| 140 | 
  | 
  | 
 | 
| 141 | 
  | 
  | 
The Makefile contains the following implicit rule: | 
| 142 | 
  | 
  | 
 | 
| 143 | 
  | 
  | 
%.d: %.F  : builds dependency files from the .F files | 
| 144 | 
  | 
  | 
 | 
| 145 | 
  | 
  | 
Please note that no rule has been included to build dependencies for .f files.  | 
| 146 | 
  | 
  | 
To avoid confusion all the GPAMELA fortran sources must have the .F extension.  | 
| 147 | 
  | 
  | 
 | 
| 148 | 
  | 
  | 
The Makefiles does use the g77 capability of creating dependencies suitable for | 
| 149 | 
  | 
  | 
usage in makefile. Once the dependency files have been created Makefiles does include | 
| 150 | 
  | 
  | 
them and use them as targets to build the objects from the sources.  | 
| 151 | 
  | 
  | 
Because I am using a single Makefile in the top directory the rule does create the  | 
| 152 | 
  | 
  | 
dependency files in the subdirectories.  | 
| 153 | 
  | 
  | 
 | 
| 154 | 
  | 
  | 
Please note tha gmake scans the Makefile before executing it. If no | 
| 155 | 
  | 
  | 
files are available for the include directive gmake will try to build | 
| 156 | 
  | 
  | 
them. For this reason you will get the "Creating dependency files" | 
| 157 | 
  | 
  | 
message also when you try to delete them ....... | 
| 158 | 
  | 
  | 
 | 
| 159 | 
  | 
  | 
Please note that all the object files are deleted after executable | 
| 160 | 
  | 
  | 
creation. Because the GPAMELA code relies on the preprocessor | 
| 161 | 
  | 
  | 
directives codes must be preprocessed for each case, i.e. interactive | 
| 162 | 
  | 
  | 
or not interactive version. Deleting them in each executable target | 
| 163 | 
  | 
  | 
will force the object creation next time you build any target.  To be | 
| 164 | 
  | 
  | 
sure you are using the right objects you should issue a "make clean" | 
| 165 | 
  | 
  | 
command before any executable creation. | 
| 166 | 
  | 
  | 
 | 
| 167 | 
  | 
  | 
Please note that the dependency files are note recreated. This means | 
| 168 | 
  | 
  | 
that they should not depend on preprocessor directives, i.e. #if | 
| 169 | 
  | 
  | 
#define etc. etc.  | 
| 170 | 
  | 
  | 
 | 
| 171 | 
  | 
  | 
GPAMELA depends on GARFIELD libraries. In case libgarfield-7.a is not | 
| 172 | 
  | 
  | 
present in the lib subdirectory it will be created from scratch. This | 
| 173 | 
  | 
  | 
is a long procedure that may take several minutes. | 
| 174 | 
  | 
  | 
 | 
| 175 | 
  | 
  | 
Here is the list of action to build GPAMELA executables: | 
| 176 | 
  | 
  | 
 | 
| 177 | 
  | 
  | 
- Create the directory you want to store executables and run the program,  | 
| 178 | 
  | 
  | 
  in this example I wil create my_gpamela in my home directory: | 
| 179 | 
  | 
  | 
 | 
| 180 | 
  | 
  | 
  > mkdir  $HOME/my_gpamela | 
| 181 | 
  | 
  | 
 | 
| 182 | 
  | 
  | 
- Define the environment variable GPAMELA_BIN pointing the the created directory: | 
| 183 | 
  | 
  | 
 | 
| 184 | 
  | 
  | 
  > GPAMELA_BIN = $HOME/my_gpamela; export GPAMELA_BIN (for [ba]sh ) | 
| 185 | 
  | 
  | 
  > setenv GPAMELA_BIN $HOME/my_gpamela (for [t]csh) | 
| 186 | 
  | 
  | 
 | 
| 187 | 
  | 
  | 
- Delete all the objects, dependency files and GARFIELD library (you never know):  | 
| 188 | 
  | 
  | 
  > make distclean  | 
| 189 | 
  | 
  | 
 | 
| 190 | 
  | 
  | 
- Create interactive executable (it will create the libgarfield-7.a also): | 
| 191 | 
  | 
  | 
  > make gpamelax11.exe;  | 
| 192 | 
  | 
  | 
 | 
| 193 | 
  | 
  | 
- Create batch executable:  | 
| 194 | 
  | 
  | 
  > make gpamela.exe | 
| 195 | 
  | 
  | 
 | 
| 196 | 
  | 
  | 
- Create debug versions | 
| 197 | 
  | 
  | 
  > make gpamelax11_deb.exe; make gpamela_deb.exe | 
| 198 | 
  | 
  | 
   | 
| 199 | 
  | 
  | 
- Install all executables, along with GPAMELA.FFR, gpfield.rz, | 
| 200 | 
  | 
  | 
  TRD_ATT.DAT, PROVA.GAR, in GPAMELA_BIN directory: | 
| 201 | 
  | 
  | 
  > make install | 
| 202 | 
  | 
  | 
 | 
| 203 | 
  | 
  | 
5. OUTPUT MESSAGES | 
| 204 | 
  | 
  | 
 | 
| 205 | 
  | 
  | 
To maintain backward compatibility with the previous g77 version, I am | 
| 206 | 
  | 
  | 
still using the debug-kludge flag to access fortran COMMONs in | 
| 207 | 
  | 
  | 
debug. This is obsolete in the new release: 2.96. For this reason if | 
| 208 | 
  | 
  | 
you are running a RedHat 7.x you will receive the message: | 
| 209 | 
  | 
  | 
 | 
| 210 | 
  | 
  | 
f771:warning: -fdebug-kludge disabled, use normal debugging flags | 
| 211 | 
  | 
  | 
 | 
| 212 | 
  | 
  | 
During gpamelax11(_deb).exe building you will get the message: | 
| 213 | 
  | 
  | 
 | 
| 214 | 
  | 
  | 
/cern/pro/lib/libpawlib.a(bugrep.o): In function `br_create_template': | 
| 215 | 
  | 
  | 
bugrep.o(.text+0x113): the use of `tmpnam' is dangerous, better use `mkstemp' | 
| 216 | 
  | 
  | 
 | 
| 217 | 
  | 
  | 
It is a warning related to the pawlib in the cern release that is still not RH7.x certified.  |