]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GEANT321/gbase/gbase.doc
Patch from Piergiorgio, concerning Dead andoes and the like.
[u/mrichter/AliRoot.git] / GEANT321 / gbase / gbase.doc
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:06  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 #if defined(CERNLIB_DOC)
11 *CMZ :  3.21/02 29/03/94  15.41.19  by  S.Giani
12 *-- Author :
13 *
14 ************************************************************************
15 *                                                                      *
16 *                                                                      *
17 *                         Introduction to GEANT3                       *
18 *                         ----------------------                       *
19 *                                                                      *
20 *                                                                      *
21 *    GEANT3 APPLICATIONS                                               *
22 *                                                                      *
23 *  The principal applications of GEANT3 are:                           *
24 *                                                                      *
25 *  - The  tracking of  particles  through an  experimental setup  for  *
26 *    acceptance studies or simulation of detector response, and        *
27 *  - the graphical  representation of the  setup and of  the particle  *
28 *    trajectories.                                                     *
29 *                                                                      *
30 *  It is of course desirable and  very instructive to combine the two  *
31 *  interactively since the observation of  what happens to a particle  *
32 *  during the tracking may underline  the weaknesses of the setup and  *
33 *  makes  the debugging  easier. In view  of these  applications, the  *
34 *  GEANT3 system allows:                                               *
35 *                                                                      *
36 *  - to  describe an  experimental setup  in a  rather efficient  and  *
37 *    simple  way.   The  setup  is  represented  by  a  structure  of  *
38 *    geometrical VOLUMEs.  Each volume is  given a 'MEDIUM' number by  *
39 *    the user.   Different volumes  may have  the same  medium number  *
40 *    [GEOM].   A  medium is  defined  by  a  set of  parameters,  the  *
41 *    so-called TRACKING MEDIUM parameters, which include reference to  *
42 *    the MATERIAL filling the volume [CONS].                           *
43 *  - to  generate   simulated  events   from  standard   Monte  Carlo  *
44 *    generators [KINE].                                                *
45 *  - to  control  the  transport  of particles  through  the  various  *
46 *    regions of the setup, taking into account the geometrical volume  *
47 *    boundaries and  all physical  effects due to  the nature  of the  *
48 *    particles themselves, to their  interactions with the matter and  *
49 *    to the magnetic field [TRAK, PHYS].                               *
50 *  - to  record the  elements of  the particle  trajectories and  the  *
51 *    response from the sensitive detectors [HITS],                     *
52 *  - to visualize either interactively  or in batch the detectors and  *
53 *    the particle trajectories [DRAW, XINT].                           *
54 *                                                                      *
55 *   Part of the  subroutines available in GEANT3  are integrated into  *
56 *  program segments which perform these tasks.                         *
57 *   The  program  segments may  contain  'dummy'  and 'default'  user  *
58 *  subroutines  called  whenever  application dependent  actions  are  *
59 *  expected.                                                           *
60 *   Other  subroutines   provide  tools  either  to   perform  simple  *
61 *  functions (control  print, debug, I/O,  etc.) or to  implement the  *
62 *  operations required  for most of the  applications (description of  *
63 *  the geometrical setup, handling of detector responses,etc.).        *
64 *   It is the responsibility of  the user to assemble the appropriate  *
65 *  program segments and tools into an executable program, to code the  *
66 *  relevant  user subroutines,  to  provide the  data describing  the  *
67 *  experimental environment and to  submit the appropriate data cards  *
68 *  which control the  execution of the program.  The  section BASE of  *
69 *  the User's Guide gives the information necessary to understand how  *
70 *  to do this job.                                                     *
71 *                                                                      *
72 *  Note: as a  general convention the  names of the dummy  or default  *
73 *        user subroutines have GU or UG  as first two letters and are  *
74 *        printed in bold characters.                                   *
75 *                                                                      *
76 *  EVENT SIMULATION FRAMEWORK                                          *
77 *                                                                      *
78 *  The framework for  event simulation is described  in the following  *
79 *  paragraphs to  familiarize the  reader with  the areas  where user  *
80 *  interventions are expected.                                         *
81 *   At  the same  time, the  GEANT3 data  structures are  introduced.  *
82 *  This last point  is important as the coding to  be provided by the  *
83 *  user  often consists  of  filling data  structures, or  extracting  *
84 *  information from  them, or  saving them on  output, making  use of  *
85 *  standard routines available in the system.                          *
86 *   A main  program has to  be provided by  the user [BASE  100].  It  *
87 *  allocates the dynamic memory for ZEBRA and HBOOK and gives control  *
88 *  to the three phases of the run:                                     *
89 *                                                                      *
90 *  - Initialisation                                                    *
91 *  - Event processing                                                  *
92 *  - Termination.                                                      *
93 *                                                                      *
94 *  INITIALISATION                                                      *
95 *                                                                      *
96 *  The initialisation  phase is under  the control of the  user [BASE  *
97 *  100].  It consists of the  following steps, most of them performed  *
98 *  via calls to standard GEANT3 subroutines:                           *
99 *                                                                      *
100 *  - GINIT,  to  initialize the  GEANT3  common  blocks with  default  *
101 *    values which the user should be aware of [BASE 030, 110].         *
102 *  - GFFGO to read  'free format' data cards which  can override some  *
103 *    of the  values defined in  GINIT the default options  [BASE 040,  *
104 *    110].                                                             *
105 *  - GZINIT to initialize the dynamic  core divisions, the link areas  *
106 *    and the data structure JRUNG [BASE 110].                          *
107 *  - GDINIT  to initialize the drawing package [DRAW].                 *
108 *  - GPART  and auxiliaries,  to  generate the  data structure  JPART  *
109 *    describing the standard particle properties [CONS].               *
110 *  - GMATE  and auxiliaries,  to  generate the  data structure  JMATE  *
111 *    describing  the  characteristics  of   the  most  commonly  used  *
112 *    MATERIALs [CONS].                                                 *
113 *  - <USER> to define the geometry of the different components of the  *
114 *    experimental  setup [GEOM]  and the  tracking medium  parameters  *
115 *    [CONS,TRAK], and  to generate the corresponding  data structures  *
116 *    JROTM, JVOLUM and JTMED.                                          *
117 *  - <USER> to specify which elements of the geometrical setup should  *
118 *    be considered as 'sensitive detectors', giving a 'response' when  *
119 *    hit by a particle [HITS].                                         *
120 *  - GGCLOS to close the Geometry package (mandatory).                 *
121 *  - GBHSTA to  book standard  GEANT3 histograms  as required  by the  *
122 *    user with the data card HSTA [BASE 040, 110].                     *
123 *  - GPHYSI to  compute energy loss  and cross section tables  and to  *
124 *    store them in the data structure JMATE [CONS,PHYS].               *
125 *                                                                      *
126 *  EVENT PROCESSING                                                    *
127 *                                                                      *
128 *  The processing phase is triggered by  a call to the subroutine GRUN *
129 *  which,  for each  event to  be  processed,  gives  control to  the  *
130 *  subroutines:                                                        *
131 *                                                                      *
132 *  - GTRIGI, to  initialize the  event processing  and to  create the  *
133 *    Header bank JHEAD.                                                *
134 *  - GTRIG to process the event.                                       *
135 *  - GTRIGC to clean up the event division                             *
136 *                                                                      *
137 *  and checks that enough time is left for the next event [BASE 200].  *
138 *  The main  steps of GTRIG  consist of  calls to the  following user  *
139 *  routines:                                                           *
140 *                                                                      *
141 *  - GUKINE generates the data structures JVERTX and JKINE describing  *
142 *    the kinematics  of the current  event on input [KINE],  or reads  *
143 *    them [IOPA].                                                      *
144 *  - GUTREV (calls GTREVE) controls the  tracking for the whole event  *
145 *    [TRAK].  Each particle  is tracked in turn and  when a sensitive  *
146 *    detector is  hit, the user  may store any useful  information in  *
147 *    the  data  structure JHITS  [HITS].   Before  tracking the  next  *
148 *    particle, any  secondary products generated by  the current one,  *
149 *    and stored  by the user  in the temporary data  structure JSTAK,  *
150 *    are processed in the same way.                                    *
151 *    Simultaneously,   the  data   structure  JXYZ,   containing  the  *
152 *    coordinates  of space  points  along the  tracks  for the  whole  *
153 *    event, can be filled by the user [TRAK].                          *
154 *  - GUDIGI  simulates the  detector responses  for the  whole event,  *
155 *    making use  of the information  previously recorded in  the data  *
156 *    structure JHITS,  and stores the  results in the  data structure  *
157 *    JDIGI [HITS].                                                     *
158 *  - GUOUT outputs the relevant data structures for the current event  *
159 *    [IOPA].                                                           *
160 *                                                                      *
161 *  Other user routines called during  the tracking phase triggered by  *
162 *  GTREVE should be mentioned for completeness:                        *
163 *                                                                      *
164 *  - The hadronic processes activated by  default for the tracking of  *
165 *    hadrons in  GEANT3 are  described by  the program  GHEISHA (file  *
166 *    GEANH).  In  the subroutines GUPHAD  and GUHADR [TRAK]  the user  *
167 *    may select, instead of GHEISHA,  the program FLUKA (file GEANF).  *
168 *  - After each  tracking step of  a given  track in a  given medium,  *
169 *    control is given to the subroutine GUSTEP.  From the information  *
170 *    available  in  common  blocks  the  user is  able  to  take  the  *
171 *    appropriate  action, such  as  storing a  hit or transferring  a  *
172 *    secondary product  either in  the stack JSTAK  or in  the events  *
173 *    structure JVERTX/JKINE.                                           *
174 *  - The subroutine GUSWIM is called  by various tracking routines to  *
175 *    select the appropriate  code for transport of  the particle over  *
176 *    the given tracking  step.  A default version is  provided in the  *
177 *    library for  this routine which in  normal cases need not  to be  *
178 *    provided by the user.                                             *
179 *  - The magnetic field,  unless constant with no  X- or Y-component,  *
180 *    has to be returned by the user subroutine GUFLD.                  *
181 *                                                                      *
182 *  TERMINATION                                                         *
183 *                                                                      *
184 *   The  termination phase  is under  the control  of the  user [BASE  *
185 *  300].  For trivial applications it may simply consist of a call to  *
186 *  the subroutine  GLAST which  computes and prints  some statistical  *
187 *  information (time per event, use of dynamic memory, etc.).          *
188 *                                                                      *
189 *                                                                      *
190 ************************************************************************
191 *                                                                      *
192 *                                                                      *
193 *                  Simplified Program Flow Chart                       *
194 *                  -----------------------------                       *
195 *                                                                      *
196 *  MAIN(user)                                                          *
197 *  |                                                                   *
198 *  |-GZEBRA  initialisation   of   ZEBRA  system, dynamic core         *
199 *  |         allocation                                                *
200 *  |-UGINIT  (user)                                                    *
201 *  ||                                                                  *
202 *  ||- GINIT    initialisation of GEANT3 variables                     *
203 *  ||- GFFGO    interpretation of data cards                           *
204 *  ||- GZINIT   initialisation  of ZEBRA  core  divisions and  link    *
205 *  ||           areas                                                  *
206 *  ||- GPART    creation of the 'particle' data structure JPART        *
207 *  ||- GMATE    creation of the 'material' data structure JMATE        *
208 *  ||- <USER>   description  of the geometrical setup,   of the        *
209 *  ||           sensitive detectors and creation of data structures    *
210 *  ||           JVOLUM, JTMED, JROTM, JSETS                            *
211 *  ||- GGCLOS   close Geometry package                                 *
212 *  ||- GPHYSI   preparation of cross-sections and energy loss tables   *
213 *  |            for all used materials                                 *
214 *  |                                                                   *
215 *  |-GRUN (loop over events)                                           *
216 *  ||                                                                  *
217 *  ||- GTRIGI   initialisation for event processing                    *
218 *  ||- GTRIG    event processing                                       *
219 *  ||  |                                                               *
220 *  ||  |- GUKINE (user)  generation (or input)  of  event initial      *
221 *  ||  |                 kinematics                                    *
222 *  ||  |- GUTREV (user)                                                *
223 *  ||  |   |- GTREVE   (simplified flow for sequential tracking)       *
224 *  ||  |      |- GSSTAK   store primary tracks in stack                *
225 *  ||  |      |- Loop over tracks                                      *
226 *  ||  |        |- GLTRAC   prepare commons for tracking               *
227 *  ||  |            |- GMEDIA  find current volume /tracking medium    *
228 *  ||  |        |- GUTRAK (user)                                       *
229 *  ||  |          |- GTRACK                                            *
230 *  ||  |            |- GTGAMA/GTELEC/...  tracking   of  particle      *
231 *  ||  |                                  according to type            *
232 *  ||  |                 |-   compute physical step size               *
233 *  ||  |                 |- GTNEXT compute geometrical step size       *
234 *  ||  |                 |-   propagate (GUSWIM..)                     *
235 *  ||  |                 |-   test change of volume (GINVOL)           *
236 *  ||  |            |- GUSTEP (user) recording of hits in data         *
237 *  ||  |                      structure JHITS and of space points      *
238 *  ||  |                      in structure JXYZ                        *
239 *  ||  |- GUDIGI computation  of  digitisations  and recording  in     *
240 *  ||  |         structure JDIGI                                       *
241 *  ||  |- GUOUT  output of current event                               *
242 *  ||                                                                  *
243 *  ||- GTRIGC   clearing of memory for next event                      *
244 *  |                                                                   *
245 *  |-UGLAST (user)                                                     *
246 *  ||                                                                  *
247 *  ||- GLAST    standard GEANT3 termination.                           *
248 *  |                                                                   *
249 *  |                                                                   *
250 *  STOP                                                                *
251 *                                                                      *
252 *                                                                      *
253 ************************************************************************
254 ************************************************************************
255 *                                                                      *
256 *                    Overview of COMMON Blocks                         *
257 *                    -------------------------                         *
258 *                                                                      *
259 *                                                                      *
260 *  INTRODUCTION                                                        *
261 *                                                                      *
262 *  The communication between program segments of the GEANT3 system is  *
263 *  ensured by data structures and by 'long range' variables in common  *
264 *  blocks.  In addition,within the  program segments, the subroutines  *
265 *  communicate with each other  via  explicit arguments  and via  the  *
266 *  common block variables.                                             *
267 *   The data structures are described in separate sections. Here, the  *
268 *  main features of the common  blocks used in GEANT3 are summarized,  *
269 *  with special mention of the  variables initialized in GINIT and of  *
270 *  the possibility to override them via data cards [BASE040].          *
271 *   The  labelled   common  blocks  are  accessible   via  Patchy/CMZ  *
272 *  sequences identified by the name  of the COMMON.  They are defined  *
273 *  in the Patch GCDES.                                                 *
274 *                                                                      *
275 *  Note: Unless  otherwise specified  the  long  range variables  are  *
276 *        initialized  in GINIT.   When not  zero, default  values are  *
277 *        quoted between brackets.  If the value may be modified via a  *
278 *        standard data  card the  card  keyword is also given between  *
279 *        brackets.                                                     *
280 *                                                                      *
281 *  DYNAMIC CORE                                                        *
282 *                                                                      *
283 *  The  GEANT3 data  structures  are stored  in  the common  /GCBANK/  *
284 *  accessible via the following Patchy sequence.                       *
285 *                                                                      *
286 *+KEEP,GCBANK                                                          *
287 *     PARAMETER (KWBANK=69000,KWWORK=5200)                             *
288 *     COMMON/GCBANK/NZEBRA,GVERSN,ZVERSN,IXSTOR,IXDIV,IXCONS,FENDQ(16) *
289 *    +             ,LMAIN,LR1,WS(KWBANK)                               *
290 *     DIMENSION IQ(2),Q(2),LQ(8000),IWS(2)                             *
291 *     EQUIVALENCE (Q(1),IQ(1),LQ(9)),(LQ(1),LMAIN),(IWS(1),WS(1))      *
292 *     EQUIVALENCE (JCG,JGSTAT)                                         *
293 *     COMMON/GCLINK/JDIGI ,JDRAW ,JHEAD ,JHITS ,JKINE ,JMATE ,JPART    *
294 *    +      ,JROTM ,JRUNG ,JSET  ,JSTAK ,JGSTAT,JTMED ,JTRACK,JVERTX   *
295 *    +      ,JVOLUM,JXYZ  ,JGPAR ,JGPAR2,JSKLT                         *
296 *                                                                      *
297 *  The /GCLINK/ variables are pointers to the GEANT3 data structures.  *
298 *  They belong  to a permanent  area declared in GZINIT.   The common  *
299 *  /GCLINK/ alone may be accessed through the sequence GCLINK.         *
300 *                                                                      *
301 *  OTHER LABELLED COMMON BLOCKS                                        *
302 *                                                                      *
303 *        COMMON/GCCUTS/CUTGAM,CUTELE,CUTNEU,CUTHAD,CUTMUO,BCUTE,BCUTM) *
304 *       +             ,DCUTE ,DCUTM ,PPCUTM,TOFMAX,GCUTS(5)            *
305 *  C                                                                   *
306 *  CUTGAM   Kinetic energy cut for gammas              (0.001, CUTS)   *
307 *  CUTELE   Kinetic energy cut for electrons           (0.001, CUTS)   *
308 *  CUTHAD   Kinetic energy cut for hadrons             (0.01, CUTS)    *
309 *  CUTNEU   Kinetic energy cut for neutral hadrons     (0.01, CUTS)    *
310 *  CUTMUO   Kinetic energy cut for muons               (0.01, CUTS)    *
311 *  BCUTE    Kinetic energy cut for electron Brems.     (CUTGAM, CUTS)  *
312 *  BCUTM    Kinetic energy cut for muon Brems.         (CUTGAM, CUTS)  *
313 *  DCUTE    Kinetic energy cut for electron delta-rays (CUTELE, CUTS)  *
314 *  DCUTM    Kinetic energy cut for muon delta-rays     (CUTELE, CUTS)  *
315 *  PPCUTM   Kinetic energy cut for e+e- pair production by muons       *
316 *                                                      (.01, CUTS)     *
317 *  TOFMAX   Tracking cut on time of flight integrated from  primary    *
318 *           interaction time                           (1.E+10, CUTS)  *
319 *  GCUTS    For user applications                      (CUTS)          *
320 *                                                                      *
321 *  Note: The cuts BCUTE, BCUTM and DCUTE, DCUTM are given, in GPHYSI,  *
322 *        the  respective  default  values CUTGAM  and  CUTELE.   Only  *
323 *        experienced users should make use of the facility offered by  *
324 *        the data card CUTS to  change BCUTE, DCUTE, BCUTM and DCUTM.  *
325 *                                                                      *
326 *     COMMON /GCDRAW/ .....                                            *
327 *                     see GEANG Pam file                               *
328 *                                                                      *
329 *        COMMON/GCFLAG/IDEBUG,IDEMIN,IDEMAX,ITEST,IDRUN,IDEVT,IEORUN   *
330 *       +        ,IEOTRI,IEVENT,ISWIT(10),IFINIT(20),NEVENT,NRNDM(2)   *
331 *        COMMON/GCFLAX/BATCH, NOLOG                                    *
332 *        LOGICAL BATCH, NOLOG                                          *
333 *  C                                                                   *
334 *  IDEBUG   Flag set equal to 1 to activate debug if IEVENT (below)    *
335 *  IDEMIN            is greater or equal to IDEMIN                     *
336 *  IDEMAX            and less or equal to IDEMAX             (DEBU)    *
337 *  ITEST    Flag to request printing of IEVENT, IDEVT and NRNDM        *
338 *           (below) every ITEST events                       (DEBU)    *
339 *  IDRUN    Current user run number                        (1, RUN)    *
340 *  IDEVT    Current user event number                         (RUN)    *
341 *  IEORUN   Flag to terminate current run if non zero                  *
342 *  IEOTRI   Flag to abort current event if non zero                    *
343 *  IEVENT   Current event sequence number                       (1)    *
344 *  ISWIT    Flags reserved for user in relation to debug     (SWIT)    *
345 *  IFINIT   System flags to check initialisation of GEANT routines     *
346 *  NEVENT   Number of events to be processed        (10000000,TRIG)    *
347 *  NRNDM    Initial value of random number seeds NRNDM(1),             *
348 *           NRNDM(2). If NRNDM(2) is 0, the independent sequence       *
349 *           NRNDM(1) is used. If NRNDM(1) is 0, the default sequence   *
350 *           is used. (9876, 54321, RNDM)                               *
351 *  BATCH    Flag set to .TRUE. if the program is running in            *
352 *           batch.                                                     *
353 *  NOLOG    Flag set to .TRUE. if the no logon file has been           *
354 *           requested.                                                 *
355 *                                                                      *
356 *        COMMON/GCJLOC/NJLOC(2),JTM,JMA,JLOSS,JPROB,JMIXT,JPHOT,JANNI  *
357 *       +                  ,JCOMP,JBREM,JPAIR,JDRAY,JPFIS,JMUNU,JRAYL  *
358 *       +                  ,JMULOF,JCOEF,JRANG                         *
359 *  C                                                                   *
360 *   For relocation of local pointers. Self-explanatory [CONS 199].     *
361 *                                                                      *
362 *        COMMON/GCKINE/IKINE,PKINE(10),ITRA,ISTAK,IVERT,IPART,ITRTYP   *
363 *       +      ,NAPART(5),AMASS,CHARGE,TLIFE,VERT(3),PVERT(4),IPAOLD   *
364 *  C                                                                   *
365 *  IKINE    User flag(0, KINE)                                         *
366 *  PKINE    User array(1E10, KINE)                                     *
367 *  ITRA     Current track number                                       *
368 *  ISTAK    Current stack-track number                                 *
369 *  IVERT    Current vertex number                                      *
370 *  IPART    Current particle number                                    *
371 *  ITRTYP   Tracking type of current particle                          *
372 *  NAPART   Name of current particle                                   *
373 *  AMASS    Mass of current particle                                   *
374 *  CHARGE   Charge of current particle                                 *
375 *  TLIFE    Life-time of current particle                              *
376 *  VERT     Coordinates of origin vertex for current track             *
377 *  PVERT    Track kinematics at origin vertex (PVERT(4) no longer      *
378 *           used)                                                      *
379 *  IPAOLD   Particle number of the previous track.                     *
380 *                                                                      *
381 *        INTEGER MXGKIN                                                *
382 *        PARAMETER (MXGKIN=100)                                        *
383 *        COMMON/GCKING/KCASE,NGKINE,GKIN(5,MXGKIN),                    *
384 *       +                           TOFD(MXGKIN),IFLGK(MXGKIN)         *
385 *  KCASE     Mechanism having generated the secondary particles        *
386 *  NGKINE    Number of generated secondaries                           *
387 *  GKIN(1,I) Px      of I-th secondary                                 *
388 *  GKIN(2,I) Py               " "                                      *
389 *  GKIN(3,I) Pz               " "                                      *
390 *  GKIN(4,I) E                " "                                      *
391 *  GKIN(5,I) Particle number  " "                                      *
392 *  TOFD(I)   Time delay introduced by the interaction.                 *
393 *                                                                      *
394 *     COMMON/GCLIST/NHSTA,NGET ,NSAVE,NSETS,NPRIN,NGEOM,NVIEW,NPLOT    *
395 *    +       ,NSTAT,LHSTA(20),LGET (20),LSAVE(20),LSETS(20),LPRIN(20)  *
396 *    +             ,LGEOM(20),LVIEW(20),LPLOT(20),LSTAT(20)            *
397 *C                                                                     *
398 *  NHSTA    Number of histograms declared on data card HSTA            *
399 *  NGET     Number of data structures declared on data card GET        *
400 *  NSAVE    Number of data structures declared on data card SAVE       *
401 *  NSETS    Number of items described on data card SETS                *
402 *  NPRIN    Number of items described on data card PRIN                *
403 *  NGEOM    Number of items described on data card GEOM                *
404 *  NVIEW    Number of items described on data card VIEW                *
405 *  NPLOT    Number of items described on data card PLOT                *
406 *  NSTAT    Number of items described on data card STAT                *
407 *  LHSTA,...,LSTAT Corresponding user lists of items (HSTA,...,STAT)   *
408 *                                                                      *
409 *   See examples of utilisation of  the user lists in GEANT3 examples  *
410 *  in  GEANX file.   LSTAT(1) is  reserved by  the system  for volume  *
411 *  statistics.                                                         *
412 *                                                                      *
413 *        COMMON/GCMATE/NMAT,NAMATE(5),A,Z,DENS,RADL,ABSL               *
414 *  C                                                                   *
415 *  NMAT      Current material number                                   *
416 *  NAMATE    Name of current material                                  *
417 *  A         Atomic weight of current material                         *
418 *  Z         Atomic number of current material                         *
419 *  DENS      Density of current material                               *
420 *  RADL      Radiation length of current material                      *
421 *  ABSL      Absorption length of current material                     *
422 *                                                                      *
423 *     COMMON/GCMULO/SINMUL(101),COSMUL(101),SQRMUL(101),OMCMOL,CHCMOL  *
424 *    +  ,EKMIN,EKMAX,NEKBIN,NEK1,EKINV,GEKA,GEKB,EKBIN(200),ELOW(200)  *
425 *                                                                      *
426 *   Pre-computed  quantities  for   multiple  scattering  and  energy  *
427 *  binning [CONS 199]                                                  *
428 *  SINMUL   Not used                                                   *
429 *  COSMUL   Not used                                                   *
430 *  SQRMUL   Not used                                                   *
431 *  OMCMOL   Constant Omega for Moliere scattering                      *
432 *  CHCMOL   Constant for Moliere scattering                            *
433 *  EKMIN    Lower edge for the energy range           (1E-5, ERAN)     *
434 *  EKMAX    Upper edge for the energy range           (1E+4, ERAN)     *
435 *  NEKBIN   Number of energy bins to be used          (90, ERAN)       *
436 *  NEK1     Number of energy bins to be used + 1                       *
437 *  EKINV    \                                                          *
438 *  GEKA      >Constants for the energy binning                         *
439 *  GEKB     /                                                          *
440 *  EKBIN    Lower edges of energy bins                                 *
441 *  ELOW     Lower edges of logarithm of energy bins                    *
442 *                                                                      *
443 *        COMMON/GCNUM/NMATE ,NVOLUM,NROTM,NTMED,NTMULT,NTRACK,NPART    *
444 *       +            ,NSTMAX,NVERTX,NHEAD,NBIT                         *
445 *        COMMON /GCNUMX/ NALIVE,NTMSTO                                 *
446 *  C                                                                   *
447 *  NMATE    Number of Materials                                        *
448 *  NVOLUM   Number of Volumes                                          *
449 *  NROTM    Number of Rotation matrices                                *
450 *  NTMED    Number of Tracking media                                   *
451 *  NTMULT   Number of  tracks processed  in current  event (including  *
452 *           secondaries), reset to 0 for each event                    *
453 *  NTRACK   Number of tracks in JKINE banks for current event          *
454 *  NPART    Number of Particle banks                                   *
455 *  NSTMAX   Maximum  number of  tracks  in  stack JSTAK  for  current  *
456 *           event, reset to 0 for each event                           *
457 *  NVERTX   Number of Vertices in JVERTX banks for current event       *
458 *  NHEAD    Number of data words in the JHEAD bank       (10)          *
459 *  NBIT     Number of bits per word (initialized in GINIT via FFINIT   *
460 *  NALIVE   Internal counter used for parallel tracking                *
461 *  NTMSTO   Internal counter used for parallel tracking                *
462 *                                                                      *
463 **KEEP,GCONSP                                                          *
464 *      DOUBLE PRECISION PI,TWOPI,PIBY2,DEGRAD,RADDEG,CLIGHT,BIG,EMASS  *
465 *      DOUBLE PRECISION EMMU,PMASS,AVO                                 *
466 *C                                                                     *
467 *      PARAMETER (PI=3.14159265358979324)                              *
468 *      PARAMETER (TWOPI=6.28318530717958648)                           *
469 *      PARAMETER (PIBY2=1.57079632679489662)                           *
470 *      PARAMETER (DEGRAD=0.0174532925199432958)                        *
471 *      PARAMETER (RADDEG=57.2957795130823209)                          *
472 *      PARAMETER (CLIGHT=29979245800.)                                 *
473 *      PARAMETER (BIG=10000000000.)                                    *
474 *      PARAMETER (EMASS=0.0005109990615)                               *
475 *      PARAMETER (EMMU=0.105658387)                                    *
476 *      PARAMETER (PMASS=0.9382723128)                                  *
477 *      PARAMETER (AVO=0.60221367)                                      *
478 *                                                                      *
479 *  PI       Number PI                                                  *
480 *  TWOPI    (2.*PI)                                                    *
481 *  PIBY2    (PI/2.)                                                    *
482 *  DEGRAD   Degree to radian conversion factor  (PI/180.)              *
483 *  RADDEG   Radian to degree conversion factor  (180./PI)              *
484 *  CLIGHT   Light velocity                                             *
485 *  BIG      Arbitrary large number                                     *
486 *  EMASS    Electron mass                                              *
487 *  EMMU     Muon mass                                                  *
488 *  PMASS    Proton mass                                                *
489 *  AVO      Avogadro Number * 1E-24                                    *
490 *                                                                      *
491 *  Control of Geometry optimisation                                    *
492 *     COMMON/GCOPTI/IOPTIM                                             *
493 *  IOPTIM  -1 = No optimisation at all. GSORD calls disabled           *
494 *           0 = No optimisation. Only user calls to GSORD kept         *
495 *           1 = All non-ordered volumes are ordered along the best axis*
496 *           2 = All volumes are ordered along the best axis            *
497 *                                                                      *
498 *   Control of physics processes.                                      *
499 *        COMMON/GCPHYS/IPAIR,SPAIR,SLPAIR,ZINTPA,STEPPA                *
500 *       +             ,ICOMP,SCOMP,SLCOMP,ZINTCO,STEPCO                *
501 *       +             ,IPHOT,SPHOT,SLPHOT,ZINTPH,STEPPH                *
502 *       +             ,IPFIS,SPFIS,SLPFIS,ZINTPF,STEPPF                *
503 *       +             ,IDRAY,SDRAY,SLDRAY,ZINTDR,STEPDR                *
504 *       +             ,IANNI,SANNI,SLANNI,ZINTAN,STEPAN                *
505 *       +             ,IBREM,SBREM,SLBREM,ZINTBR,STEPBR                *
506 *       +             ,IHADR,SHADR,SLHADR,ZINTHA,STEPHA                *
507 *       +             ,IMUNU,SMUNU,SLMUNU,ZINTMU,STEPMU                *
508 *       +             ,IDCAY,SDCAY,SLIFE ,SUMLIF,DPHYS1                *
509 *       +             ,ILOSS,SLOSS,SOLOSS,STLOSS,DPHYS2                *
510 *       +             ,IMULS,SMULS,SOMULS,STMULS,DPHYS3                *
511 *       +             ,IRAYL,SRAYL,SLRAYL,ZINTRA,STEPRA                *
512 *  *                                                                   *
513 *  IPAIR    Controls pair production process               (1,PAIR)    *
514 *           0 = no pair production                                     *
515 *           1 = pair production with generation of secondaries         *
516 *           2 = same without generation of secondaries                 *
517 *  ICOMP    Controls Compton scattering process            (1,COMP)    *
518 *           0 = no Compton scattering                                  *
519 *           1 = Compton scattering with generation of secondaries      *
520 *           2 = same without generation of secondaries                 *
521 *  IPHOT    Controls photo-electric effect process         (1,PHOT)    *
522 *           0 = no photo-electric effect                               *
523 *           1 = photo-electric effect with generation of secondaries   *
524 *           2 = same without generation of secondaries                 *
525 *  IPFIS    Controls photofission process                  (0,PFIS)    *
526 *           0 = no photofission                                        *
527 *           1 = photofission with generation of secondaries            *
528 *           2 = same without generation of secondaries                 *
529 *  IDRAY    Controls delta rays process                    (1,DRAY)    *
530 *           0 = no delta rays effect                                   *
531 *           1 = delta rays with generation of secondaries              *
532 *           2 = same without generation of secondaries                 *
533 *  IANNI    Controls positron annihilation process         (1,ANNI)    *
534 *           0 = no positron annihilation effect                        *
535 *           1 = positron annihilation with generation of secondaries   *
536 *           2 = same without generation of secondaries                 *
537 *  IBREM    Controls Bremsstrahlung process                (1,BREM)    *
538 *           0 = no Bremsstrahlung effect                               *
539 *           1 = Bremsstrahlung with generation of secondaries          *
540 *           2 = same without generation of secondaries                 *
541 *  IHADR    Controls hadron interactions process           (1,HADR)    *
542 *           0 = no hadron interactions effect                          *
543 *           1 = hadron interactions with generation of secondaries     *
544 *           2 = same without generation of secondaries                 *
545 *  IMUNU    Controls muon nuclear interaction process       (0,MUNU)   *
546 *           0 = no muon nuclear interaction effect                     *
547 *           1 = muon nuclear interaction with generation of secondaries*
548 *           2 = same without generation of secondaries                 *
549 *  IDCAY    Controls decay process                          (1,DCAY)   *
550 *           0 = no decay effect                                        *
551 *           1 = decay with generation of secondaries                   *
552 *           2 = same without generation of secondaries                 *
553 *  ILOSS    Controls energy loss process                    (2,LOSS)   *
554 *           0 = no energy loss effect                                  *
555 *           1 = delta ray and reduced Landau fluctuations              *
556 *           2 = full Landau fluctuations and no delta rays             *
557 *           3 = same as 1                                              *
558 *           4 = average Energy loss and no fluctuations                *
559 *  IMULS    Controls multiple scattering                   (1,MULS)    *
560 *           1 = Moliere or Coulomb scattering                          *
561 *           2 = Moliere or Coulomb scattering                          *
562 *           3 = Gaussian scattering                                    *
563 *  IRAYL    0 = No Rayleigh scattering                                 *
564 *           1 = Rayleigh scattering                                    *
565 *                                                                      *
566 *        COMMON/GCPOLY/IZSEC,IPSEC                                     *
567 *  C                                                                   *
568 *  Internal flags for polygon and polycone shapes. See GEANG file.     *
569 *                                                                      *
570 *        COMMON/GCPUSH/NCVERT,NCKINE,NCJXYZ,NPVERT,NPKINE,NPJXYZ       *
571 *  C                                                                   *
572 *  NCVERT   Initial size of mother bank JVERTX              (5)        *
573 *  NCKINE   Initial size of mother bank JKINE              (50)        *
574 *  NCJXYZ   Initial size of mother bank JXYZ               (50)        *
575 *  NPVERT   Increment for size of mother bank JVERTX        (5)        *
576 *  NPKINE   Increment for size of mother bank JKINE        (10)        *
577 *  NPJXYZ   Increment for size of mother bank JXYZ         (10)        *
578 *                                                                      *
579 *        COMMON/GCSETS/IHSET,IHDET,ISET,IDET,IDTYPE,NVNAME,NUMBV(20)   *
580 *  C                                                                   *
581 *  IHSET    Set identifier                                             *
582 *  IHDET    Detector identifier                                        *
583 *  ISET     Position of set in bank JSET                               *
584 *  IDET     Position of detector in bank JS=IB(JSET-IDET)              *
585 *  IDTYPE   User defined detector type                                 *
586 *  NVNAME   Number of elements in NUMBV                                *
587 *  NUMBV    List of volume numbers to identify the detector            *
588 *                                                                      *
589 *      PARAMETER (NWSTAK=12,NWINT=11,NWREAL=12,NWTRAC=NWINT+NWREAL+5)  *
590 *      COMMON /GCSTAK/ NJTMAX, NJTMIN, NTSTKP, NTSTKS, NDBOOK, NDPUSH, *
591 *     +                NJFREE, NJGARB, NJINVO, LINSAV(15), LMXSAV(15)  *
592 *C                                                                     *
593 *  NTKSTP   Primary allocation for stack JSTAK                         *
594 *  NTKSTS   Secondary allocation for stack JSTAK                       *
595 *  NDBOOK   local variable for control of stack size                   *
596 *  NDPUSH   local variable for control of stack size                   *
597 *  (other variables used in parallel tracking only)                    *
598 *                                                                      *
599 *        COMMON/GCTIME/TIMINT,TIMEND,ITIME,IGDATE,IGTIME               *
600 *        INTEGER ITIME,IGDATE,IGTIME                                   *
601 *        REAL TIMINT,TIMEND                                            *
602 *  C                                                                   *
603 *  TIMINT   Total time left after initialization  (System, TIME)       *
604 *  TIMEND   Time required for program termination phase (1., TIME)     *
605 *  ITIME    Test on time left done every ITIME events (1, ITIME)       *
606 *  IGDATE   Date of the day  YYMMDD  integer (e.g. 920407)             *
607 *  IGTIME   Time of the day  HHMM    integer (e.g. 1425)               *
608 *                                                                      *
609 *      COMMON/GCTMED/NUMED,NATMED(5),ISVOL,IFIELD,FIELDM,TMAXFD,STEMAX *
610 *     +      ,DEEMAX,EPSIL,STMIN,CFIELD,PREC,IUPD,ISTPAR,NUMOLD        *
611 *  NUMED    Current tracking medium number                             *
612 *  NATMED   Name of current tracking medium                            *
613 *  ISVOL    Sensitive volume flag (if non zero)                        *
614 *  IFIELD   Field map type (0 if no field)                             *
615 *  FIELDM   Maximum field                                              *
616 *  TMAXFD   Maximum field turning angle in one step                    *
617 *  STEMAX   Maximum step allowed                                       *
618 *  DEEMAX   Maximum energy loss gradient in one step                   *
619 *  EPSIL    Boundary crossing accuracy                                 *
620 *  STMIN    Minimum step size by energy loss, multiple scattering      *
621 *           or field                                                   *
622 *  CFIELD   Constant for field step evaluation                         *
623 *  PREC     Initial step for boundary crossing (0.1*EPSIL)             *
624 *  IUDP     0 If medium change, (1 otherwise)                          *
625 *  ISTPAR   0 If standard tracking parameters                          *
626 *  NUMOLD   Numed of the last medium.                                  *
627 *                                                                      *
628 *        PARAMETER (MAXMEC=30)                                         *
629 *        COMMON/GCTRAK/VECT(7),GETOT,GEKIN,VOUT(7),NMEC,LMEC(MAXMEC)   *
630 *       + ,NAMEC(MAXMEC),NSTEP ,MAXNST,DESTEP,DESTEL,SAFETY,SLENG      *
631 *       + ,STEP  ,SNEXT ,SFIELD,TOFG  ,GEKRAT,UPWGHT,IGNEXT,INWVOL     *
632 *       + ,ISTOP ,IGAUTO,IEKBIN, ILOSL, IMULL,INGOTO,NLDOWN,NLEVIN     *
633 *       + ,NLVSAV,ISTORY                                               *
634 *  VECT     Current track parameters (X,Y,Z,Px/P,Py/P,Pz/P,P)          *
635 *  GETOT    Current track total energy                                 *
636 *  GEKIN    Current track kinetic energy                               *
637 *  VOUT     Local use                                                  *
638 *  NMEC     Number of mechanisms for current step                      *
639 *  LMEC     List of mechanism indices for current step                 *
640 *  NAMEC    Mechanism names (See below)                                *
641 *  NSTEP    Number of steps so far                                     *
642 *  MAXNST   Maximum number of steps allowed (default = 10000)          *
643 *  DESTEP   Total energy lost in current step                          *
644 *  DESTEL   Continuous energy loss in current step                     *
645 *  SAFETY   Overestimated distance to closest medium boundary          *
646 *  SLENG    Track length at current point                              *
647 *  STEP     Size of current tracking step                              *
648 *  SNEXT    Straight distance to next current medium boundary          *
649 *  SFIELD   Field turning angle step size evaluation                   *
650 *  TOFG     Time of flight                                             *
651 *  GEKRAT   Interpolation factor in table ELOW                         *
652 *  UPWGHT   User particle weight                                       *
653 *  IGNEXT   Flag set to 1 when SNEXT has been recomputed               *
654 *  INWVOL   Flag set to 1 when entering a new volume,                  *
655 *                       2 when leaving a volume and                    *
656 *                       3 when leaving the experimental setup.         *
657 *                       0 otherwise 0                                  *
658 *  ISTOP    Flag set to 1 when track looses its identity               *
659 *                       2 when energy below cut                        *
660 *  IGAUTO   Automatic computation of DEEMAX,STMIN,TMAXFD,STEMAX        *
661 *  IEKBIN   Current kinetic energy bin in table ELOW                   *
662 *  ILOSL    Local value of ILOSS for current tracking medium           *
663 *  IMULL    Local value of IMULS for current tracking medium           *
664 *  INGOTO   Content number of limiting content when computing SNEXT    *
665 *  NLDOWN   Lowest level reached down the tree (parallel tracking only)*
666 *  NLEVIN   Number of levels currently filled and valid in /GCVOLU/    *
667 *  NLVSAV   Current level (parallel tracking only)                     *
668 *  ISTORY   User flag for current track history (reset to 0 in GLTRAC) *
669 *  --------                                                            *
670 *  NAMEC    List  of possible  mechanisms  for  step size  limitation  *
671 *           filled in GINIT :                                          *
672 *     DATA MEC/'NEXT','MULS','LOSS','FIEL','DCAY','PAIR','COMP','PHOT' *
673 *    +        ,'BREM','DRAY','ANNI','HADR','ECOH','EVAP','FISS','ABSO' *
674 *    +        ,'ANNH','CAPT','EINC','INHE','MUNU','TOFM','PFIS','SCUT' *
675 *    +        ,'RAYL','PARA','PRED','LOOP','NULL','STOP'/              *
676 *  *                                                                   *
677 *                                                                      *
678 *        COMMON/GCUNIT/LIN,LOUT,NUNITS,LUNITS(5)                       *
679 *        INTEGER LIN,LOUT,NUNITS,LUNITS                                *
680 *        COMMON/GCMAIL/CHMAIL                                          *
681 *        CHARACTER*132 CHMAIL                                          *
682 *  C                                                                   *
683 *  LIN      Input unit to read data cards                              *
684 *  LOUT     Line printer output unit                                   *
685 *  NUNITS   Number of additional units                                 *
686 *  LUNITS   List of additional units.                                  *
687 *  CHMAIL   Internal string used for error messages                    *
688 *   LIN and  LOUT are defined in  GINIT through calls to  the routine  *
689 *  FFGET from  the standard  FFREAD package.   NUNITS and  LUNITS are  *
690 *  reserved for user applications.                                     *
691 *                                                                      *
692 *     COMMON /GCVOLU/   ......                                         *
693 *                     see GEANG Pam file                               *
694 *                                                                      *
695 *                                                                      *
696 *                                                                      *
697 ************************************************************************
698 *                                                                      *
699 *                      Summary of Data Cards                           *
700 *                      ---------------------                           *
701 *                                                                      *
702 *                                                                      *
703 *  INTRODUCTION                                                        *
704 *                                                                      *
705 *  GEANT3 uses the standard FFREAD package to read 'free format' data  *
706 *  cards in  the routine GFFGO.   The cards currently  interpreted by  *
707 *  GFFGO can be classified into four categories:                       *
708 *                                                                      *
709 *  - General control of the run.                                       *
710 *  - Control of the physics processes.                                 *
711 *  - Debug and I/O operations.                                         *
712 *  - User applications.                                                *
713 *                                                                      *
714 *  The data  cards are  listed below by  category with  the following  *
715 *  information:                                                        *
716 *                                                                      *
717 *  - KEY, card  keyword, any  number of  characters truncated  to the  *
718 *    first 4                                                           *
719 *  - N, maximum expected number of variables NVAR,                     *
720 *  - T,  TYPE of these variables (I=INTEGER,  R=REAL or M=MIXED)       *
721 *                                                                      *
722 *  for each variable in turn:                                          *
723 *                                                                      *
724 *      - VAR.., FORTRAN name                                           *
725 *      - Short description (more detail in BASE 030)                   *
726 *      - COMMON where it is stored, and                                *
727 *      - Default value from GINIT.                                     *
728 *                                                                      *
729 *  When a  card is decoded,  the values  entered by the  user without  *
730 *  explicit assignment are  assigned to the variables  in order.  The  *
731 *  number of values can  be less than NVAR.  In case  of a MIXED type  *
732 *  the values entered have to be in agreement with the default of the  *
733 *  corresponding FORTRAN variable names.                               *
734 *                                                                      *
735 *  Example of data card:     RUN   5   201                             *
736 *                                                                      *
737 *  to  preset  the  current  run  and  event  number  to  5  and  201  *
738 *  respectively.                                                       *
739 *   In batch jobs  there is no need for any  special termination card  *
740 *  and none of the cards mentioned below is mandatory.                 *
741 *                                                                      *
742 *  USER DEFINED DATA CARDS                                             *
743 *                                                                      *
744 *  Before  calling  GFFGO the  user  may  define private  data  cards  *
745 *  through calls to FFKEY as follows:                                  *
746 *      CALL FFKEY('KEY',VAR(1),NVAR,'TYPE')                            *
747 *   They will be interpreted by GFFGO in the same way as the standard  *
748 *  cards.                                                              *
749 *                                                                      *
750 *  SUMMARY OF THE MOST IMPORTANT GEANT3 DATA CARDS                     *
751 *                                                                      *
752 *  KEY   N  T  VAR..  Short description                COMMON  GINIT   *
753 *  General control of the run:                                         *
754 *  HSTA 20  M LHSTA   Names of required histograms     GCLIST    0     *
755 *  PATR  4  I NJTMAX  Max number of tracks in parallel GCSTAK    0     *
756 *                     tracking stack                                   *
757 *             NJTMIN  Number of tracks above which        "      0     *
758 *                     parallel tracking can be                         *
759 *                     reactivated when frozen earlier                  *
760 *             NTSTKP  Primary allocation for stack JSTAK  "    500     *
761 *             NTSTKS  Secondary  ... (when parallel       "    100     *
762 *                     tracking used)                                   *
763 *  RNDM  2  I NRNDM   Initial random number seeds                      *
764 *             NRNDM(1)                                 GCFLAG  9876    *
765 *             NRNDM(2)                                 GCFLAG 54321    *
766 *  RNDM  2  I NRNDM   Initial random number seeds      GCFLAG    0     *
767 *  RUNG  2  I IDRUN   User run number                  GCFLAG    1     *
768 *             IDEVT   User event number                GCFLAG    1     *
769 *  TIME  3  M TIMINT  Time left after initialisation   GCTIME System   *
770 *             TIMEND  Time required for termination    GCTIME   1.     *
771 *             ITIME   Test every ITIME events          GCTIME   1      *
772 *  TRIG  1  I NEVENT  Number of events to process      GCFLAG  1E7     *
773 *  Geometry optimization:                                              *
774 *  OPTI  1  I IOPTIM  Optimization level               GCOPTI   1      *
775 *  SCAN process control:                                               *
776 *  SCAN  8  M         SCAN granularity and mode                        *
777 *           SCANFL    Scan processing flag (Logical)   GCSCAN  FALSE   *
778 *           NPHI      Number of divisions in PHI       GCSCAN   90     *
779 *           PHIMIN    Minimum value of PHI             GCSCAN   0.     *
780 *           PHIMAX    Maximum value of PHI             GCSCAN 360.     *
781 *           NTETA     Number of divisions in TETA      GCSCAN  90      *
782 *           TETMIN    Minimum value of TETA            GCSCAN  0.      *
783 *           TETMAX    Maximum value of TETA            GCSCAN 180.     *
784 *           MODTET    Type of TETA division            GCSCAN   1      *
785 *  SCAL 32  M SLIST   List of scanned volumes          GCSCAN  'XXXX'  *
786 *  SCAP  6  R         SCAN parameters                                  *
787 *           VX      SCAN vertex X coordinate           GCSCAN  0.0     *
788 *           VY      SCAN vertex Y coordinate           GCSCAN  0.0     *
789 *           VZ      SCAN vertex Z coordinate           GCSCAN  0.0     *
790 *           FACTX0  Scale factor for SX0               GCSCAN  100.    *
791 *           FACTL   Scale factor for SL                GCSCAN  1000.   *
792 *           FACTR   Scale factor for R                 GCSCAN  100.    *
793 *  Control of physics processes:                                       *
794 *  AUTO  1  I IGAUTO  Automatic computation of STMIN   GCTRAK   1      *
795 *                     STEMAX,DEEMAX,TMAXFD                             *
796 *                     0 = Tracking media parameters                    *
797 *                         taken from the argument list                 *
798 *                         of GSTMED                                    *
799 *                     1 = Tracking media parameters                    *
800 *                         calculated by GEANT                          *
801 *  ANNI  1  I IANNI   Annihilation flag                GCPHYS   1      *
802 *  BREM  1  I IBREM   Bremsstrahlung flag              GCPHYS   1      *
803 *  COMP  1  I ICOMP   Compton scattering flag          GCPHYS   1      *
804 *  CUTS 15  R         Kinetic energy cuts :                            *
805 *           CUTGAM    " "   for gammas                 GCCUTS   0.001  *
806 *           CUTELE    " "   for electrons              GCCUTS   0.001  *
807 *           CUTHAD    " "   for charged hadrons        GCCUTS   0.01   *
808 *           CUTNEU    " "   for neutral hadrons        GCCUTS   0.01   *
809 *           CUTMUO    " "   for muons                  GCCUTS   0.01   *
810 *           BCUTE     " "   for electron brems.        GCCUTS   CUTGAM *
811 *           BCUTM     " "   for muon Brems.            GCCUTS   CUTGAM *
812 *           DCUTE     " "   for electron delta-rays    GCCUTS   CUTELE *
813 *           DCUTM     " "   for muon delta-rays        CCUTS    CUTELE *
814 *           PPCUTM    " "   for e+e- pairs by muons    CCUTS    10 MeV *
815 *           TOFMAX  Time of flight cut                 GCCUTS   1.E+10 *
816 *           GCUTS   5 user words                       GCCUTS   0.     *
817 *  DCAY  1  I IDCAY   Decay flag                       GCPHYS   1      *
818 *  DRAY  1  I IDRAY   delta-rays flag                  GCPHYS   1      *
819 *  ERAN  3  M Cross section tables                                     *
820 *           R EKMIN   Minimum energy for the tables    GCMULO  1E-5    *
821 *           R EKMAX   Maximum energy for the tables    GCMULO  1E+4    *
822 *           I NEKBIN  Number of bins in the table      GCMULO   90     *
823 *  HADR  1  I IHADR   Hadronic process flag            GCPHYS   1      *
824 *  LOSS  1  I ILOSS   Energy loss flag                 CGPHYS   2      *
825 *  MULS  1  I IMULS   Multiple scattering flag         GCPHYS   1      *
826 *  MUNU  1  I IMUNU   Muon nuclear interactions flag   GCPHYS   0      *
827 *  PAIR  1  I IPAIR   Pair production flag             GCPHYS   1      *
828 *  PFIS  1  I IPFIS   Photofission flag                GCPHYS   0      *
829 *  PHOT  1  I IPHOT   Photo-electric effect flag       GCPHYS   1      *
830 *  RAYL  1  I IRAYL   Rayleigh scattering flag         GCPHYS   0      *
831 *                                                                      *
832 *  Debug and I/O operations:                                           *
833 *  DEBU 3  M IDEMIN  First event to debug              GCFLAG   0      *
834 *            IDEMAX  Last event to debug               GCFLAG   0      *
835 *            ITEST   Print control frequency           GCFLAG   0      *
836 *  GET  20 M LGET    Names of data structure to get    GCLIST   ' '    *
837 *  PRIN 20 M LPRIN   User keywords to print data       GCLIST   ' '    *
838 *                   structures                                         *
839 *  SAVE 20 M LSAVE   Names of data struct. to save     GCLIST   ' '    *
840 *  SWIT 10 I ISWIT   User flags for debug or else      GCFLAG   0      *
841 *                   User applications:                                 *
842 *  KINE 11 M IKINE   User flag                         GCKINE   0      *
843 *            PKINE   10 user words                     GCKINE 1.E+10   *
844 *  SETS 20 M LSETS   User words for detector sets      GCLIST   ' '    *
845 *  STAT 20 M LSTAT   1 system + 19 user words          GCLIST   ' '    *
846 *  PLOT 20 M LPLOT   User words to control plots       GCLIST   ' '    *
847 *  GEOM 20 M LGEOM   User words to control geometry    GCLIST   ' '    *
848 *  VIEW 20 M LVIEW   User words to control View banks  GCLIST ' '      *
849 *                                                                      *
850 *                                                                      *
851 *                                                                      *
852 *                                                                      *
853 *                                                                      *
854 *                                                                      *
855 ************************************************************************
856 *                                                                      *
857 *               The Reference Systems and dimensional Units            *
858 *               -------------------------------------------            *
859 *                                                                      *
860 *                                                                      *
861 *  THE MASTER REFERENCE SYSTEM  (MARS)                                 *
862 *                                                                      *
863 *   The Master Reference  System (MARS) is determined by  the way the  *
864 *  user  represents  the kinematical  quantities.   If  the axes  are  *
865 *  labelled (X,Y,Z), then the point P(A,B,C) is represented by         *
866 *                                                                      *
867 *           Y |                                                        *
868 *             |         * P(A,B,C)                                     *
869 *             |                    * X                  A on axis X    *
870 *             |                  *                      B on axis Y    *
871 *             |                *                        C on axis Z    *
872 *             |              *                                         *
873 *             |            *                                           *
874 *             |          *                                             *
875 *             |        *                                               *
876 *             |      *                                                 *
877 *             |                                                        *
878 *             |                                                        *
879 *             ............................>                            *
880 *                                         Z                            *
881 *    The tracking is performed in  the MAster Reference System.  This  *
882 *  implies that  the arguments  of the  user magnetic  field routine,  *
883 *  space point  coordinates and field  components, are given  in this  *
884 *  system.                                                             *
885 *                                                                      *
886 *  THE LOCAL REFERENCE SYSTEMS (MRS AND DRS)                           *
887 *                                                                      *
888 *   As explained in GEOM 001, the experimental set-up is described by  *
889 *  the  definition  of  an   'initial  MOTHER'  volume  inside  which  *
890 *  'DAUGHTER' volumes are positioned.   Other daughter volumes can be  *
891 *  positioned  inside  these volumes  which  are  promoted as  mother  *
892 *  volumes and so on, as russian dolls.                                *
893 *   This  requires the  definition  of local  reference systems,  the  *
894 *  Mother  Reference  Systems  (MRS,  Origin  O.)  and  the  Daughter  *
895 *  Reference Systems (DRS, Origin O.).                                 *
896 *   The  local  reference  system  of  the  'initial  mother'  volume  *
897 *  coincides with the MAster Reference System.                         *
898 *   The full description of a given  detector is usually given in the  *
899 *  local reference system of the associated volume.                    *
900 *   The transformation of a point from  the MRS (V.) to the DRS (V.),  *
901 *  at any level, requires the knowledge  of a rotation matrix R and a  *
902 *  translation vector T defined through the relation :                 *
903 *              ( V. ) = [ R ] ( V. - T )                               *
904 *   The components of  T are the projections of the  vector O.O. onto  *
905 *  the MRS axes.                                                       *
906 *   The rotation matrices  are computed from the  spherical angles of  *
907 *  each of  the axes of  the daughter  reference system (I,  II, III)  *
908 *  with respect to the mother reference system (1,2,3).                *
909 *   The spherical angles  THETA and PHI of a direction  D are defined  *
910 *  as follows :                                                        *
911 *                                                                      *
912 *  THETA     is the angle formed by the axis 3 and D (range : 0 to 180 *
913 *            degrees)                                                  *
914 *  PHI       is the angle formed by the axis 1 and the projection of D *
915 *            onto the plane defined by the axes 1 and 2 (range : 0 to  *
916 *            360 degrees)                                              *
917 *  Examples are given in GEOM 200.                                     *
918 *   The various rotation matrices required for a given set-up must be  *
919 *  defined  during  the initialisation  stage,  usually  in the  user  *
920 *  routine UGEOM.                                                      *
921 *   A serial number is assigned to each matrix [GEOM 200].             *
922 *   The translation parameters and the  serial number of the rotation  *
923 *  matrix are specified  by the user when the  volumes are positioned  *
924 *  inside the set-up [GEOM 110].                                       *
925 *                                                                      *
926 *  THE DIMENSIONAL UNITS                                               *
927 *                                                                      *
928 *  Unless  otherwise   specified,  the   following  units   are  used  *
929 *  throughout the program :                                            *
930 *                                                                      *
931 *      -  CENTIMETER, SECOND, KILOGAUSS, GEV, GEV/C, DEGREE            *
932 *                                                                      *
933 ************************************************************************
934 *                                                                      *
935 *        Examples of MAIN Program and User Initialisation              *
936 *        ------------------------------------------------              *
937 *                                                                      *
938 *      PROGRAM MAIN                                                    *
939 *  C                                                                   *
940 *      PARAMETER (NG=100000,NH=10000)                                  *
941 *      COMMON/PAWC/H(NH)                                               *
942 *      COMMON/GCBANK/Q(NG)                                             *
943 *  C                                                                   *
944 *  C       Allocate memory for ZEBRA and HBOOK                         *
945 *      CALL GZEBRA(NG)                                                 *
946 *      CALL HLIMIT(-NH)                                                *
947 *  C                                                                   *
948 *  C       Initialize Graphics package                                 *
949 *      CALL IGINIT(0)                                                  *
950 *  C       Open metafile and define workstation type                   *
951 *  C         (computer dependent)                                      *
952 *                  ....                                                *
953 *  C                                                                   *
954 *  C       Initialisation phase                                        *
955 *      CALL UGINIT                                                     *
956 *  C                                                                   *
957 *  C       Processing phase                                            *
958 *      CALL GRUN                                                       *
959 *  C                                                                   *
960 *  C       Termination phase                                           *
961 *      CALL UGLAST                                                     *
962 *  C                                                                   *
963 *      END                                                             *
964 *      SUBROUTINE UGINIT                                               *
965 *  C                                                                   *
966 *  +SEQ,GCLIST                                                         *
967 *  C                                                                   *
968 *  C       Initialize GEANT variables                                  *
969 *      CALL GINIT                                                      *
970 *  C                                                                   *
971 *  C       Read data cards                                             *
972 *      CALL GFFGO                                                      *
973 *  C                                                                   *
974 *  C       Initialize data structures                                  *
975 *      CALL GZINIT                                                     *
976 *  C                                                                   *
977 *  C       Initialize drawing package                                  *
978 *      CALL GDINIT                                                     *
979 *  C                                                                   *
980 *  C       Open I/O buffers                                            *
981 *      IF(NGET .GT.0)CALL GOPEN(1,'I',0,IER)                           *
982 *      IF(NSAVE.GT.0)CALL GOPEN(2,'O',0,IER)                           *
983 *  C                                                                   *
984 *  C       Fetch permanent data structures (if any)                    *
985 *      CALL GFIN(1,'INIT',1,IDENT,' ',IER)                             *
986 *      IF(IER.LT.0) THEN                                               *
987 *  C                                                                   *
988 *  C       Define standard Particle and Material data                  *
989 *         CALL GPART                                                   *
990 *         CALL GMATE                                                   *
991 *  C                                                                   *
992 *  C       Define the geometrical set-up                               *
993 *         CALL 'user code'                                             *
994 *         CALL GGCLOS                                                  *
995 *  C                                                                   *
996 *  C       Compute cross-section and energy loss tables                *
997 *         CALL GPHYSI                                                  *
998 *       ENDIF                                                          *
999 *  C                                                                   *
1000 *  C       Initialize standard histograms                              *
1001 *       CALL GBHSTA                                                    *
1002 *  C                                                                   *
1003 *       END                                                            *
1004 *                                                                      *
1005 *                                                                      *
1006 *                                                                      *
1007 ************************************************************************
1008 *                                                                      *
1009 *               The System Initialisation routines                     *
1010 *               ----------------------------------                     *
1011 *                                                                      *
1012 *  Presets COMMON  block variables to default  values.  Preprocessing  *
1013 *  of  various  COMMON  block  variables.  See  'Overview  of  COMMON  *
1014 *  blocks' [BASE  030].  Reads a  set of  data cards with  the FFREAD  *
1015 *  package.  See 'Summary  of data cards' [BASE 040]  GFFGO should be  *
1016 *  called  after  GINIT.   Allocates   the  dynamic  core  divisions.  *
1017 *  Initialize the link areas and the data structure JRUNG [BASE 299].  *
1018 *  Initialize  exotic bank  formats.  GZINIT  should be  called after  *
1019 *  GFFGO.  To be called before the  user geometry routine if the user  *
1020 *  wants  to  open  VIEW   banks  there.   Initializes  any  standard  *
1021 *  histogram required by the user with the data record HSTA.           *
1022 *   The following histogram keywords may be used :                     *
1023 *  TIME     Time per event                                             *
1024 *  SIZE     Size of division LXDIV per event                           *
1025 *  MULT     Total number of tracks per event                           *
1026 *  NTRA     Number of 'long life' tracks per event                     *
1027 *  STAK     Maximum stack size per event                               *
1028 *                                                                      *
1029 *   GBHSTA should be called after GFFGO.                               *
1030 *                                                                      *
1031 *             Steering routines for Event Processing                   *
1032 *             --------------------------------------                   *
1033 *                                                                      *
1034 *   The following flow chart is  only valid for the 'batch' execution  *
1035 *  mode.   For  interactive  applications, see  section  XINT.   Main  *
1036 *  routine to control a run of events                                  *
1037 *                     .........                                        *
1038 *                 ...>|  TIMEX|                                        *
1039 *                 |   .........                                        *
1040 *                 |      Get    time   left    (TIMINT)    after       *
1041 *   initialisation                                                     *
1042 *                 |                                                    *
1043 *                 .............................                        *
1044 *                 |    ...........            |                        *
1045 *                 ... >| GTRIGI  |            |                        *
1046 *                 |    ...........            |                        *
1047 *                 |    ...........            |                        *
1048 *   ........ .    |.. >| GTRIG   |       ......... .                   *
1049 *   |        |    |    ......... .       |loop on  |                   *
1050 *   | GRUN   |... |    |                 |         |                   *
1051 *   ........ .    |    ......... .       | events  |                   *
1052 *                 |.. >| GTRIGC  |       ......... .                   *
1053 *                 |    ......... .            .                        *
1054 *                 |    ...................    |                        *
1055 *                 ... >| check time left |    |                        *
1056 *                 |    ...................    |                        *
1057 *                 .............................                        *
1058 *                                                                      *
1059 *   Resets to 0  the flag IEOTRI in /GCFLAG/ and  the counters NTRACK  *
1060 *  and NVERTX in /GCNUM/.  Sets the  debug flag IDEBUG in /GCFLAG/ to  *
1061 *  the value required for the current event.                           *
1062 *   Creates the Header bank for current event.                         *
1063 *   Prints  the sequence  number,  the event  number  and the  number  *
1064 *  random  generators, under  control of  the flag  ITEST (data  card  *
1065 *  DEBU).                                                              *
1066 *   Steering routine to process one event (trigger)                    *
1067 *                                                                      *
1068 *                      ..........................                      *
1069 *                      | Generates kinematics,  |                      *
1070 *                 ... >| or read event GUKINE   |                      *
1071 *                 |    ..........................                      *
1072 *                 |    ................                                *
1073 *                 |    | Tracking/hits|                                *
1074 *   ........ .    |.. >| GUTREV       |                                *
1075 *   | GTRIG  |.. >|    .............. .                                *
1076 *   ........ .    |    .............. .                                *
1077 *                 |.. >|                                               *
1078 *   Digitisations |                                                    *
1079 *                 |    | GUDIGI       |                                *
1080 *                 |    ................                                *
1081 *                 |    ................                                *
1082 *                 |    | Output event |                                *
1083 *                 ... >| GUOUT        |                                *
1084 *                      ................                                *
1085 *   The partition initialized  in GTRIGI is cleared.   The space used  *
1086 *  by the current event may be used by the next one.                   *
1087 *                                                                      *
1088 *                    The banks JRUNG and JHEAD                         *
1089 *                    -------------------------                         *
1090 *                                                                      *
1091 *  Run bank JRUNG:  1 user link, 30 data words                         *
1092 *  LQ(JRUNG-1)   user link                                             *
1093 *   IQ(JRUNG+1) IDRUN     Run number                                   *
1094 *    ""  +2/10)           Reserved for user applications               *
1095 *          +11) creation date for 'INIT' data structures               *
1096 *          +12) creation time for 'INIT' data structures               *
1097 *          +13) creation data for 'KINE'                               *
1098 *          +14) creation time for 'KINE'                               *
1099 *          +15) creation data for 'HITS'                               *
1100 *          +16) creation time for 'HITS'                               *
1101 *          +17) creation data for 'DIGI'                               *
1102 *          +18) creation time for 'DIGI'                               *
1103 *          +19) Random number seed 1                                   *
1104 *          +20) Random number seed 2                                   *
1105 *          +21) GEANT version number when 'INIT' created               *
1106 *          +22) ZEBRA version number when 'INIT' created               *
1107 *          +23) GEANT version number when 'KINE' created               *
1108 *          +24) ZEBRA version number when 'KINE' created               *
1109 *          +25) GEANT version number when 'HITS' created               *
1110 *          +26) ZEBRA version number when 'HITS' created               *
1111 *          +27) GEANT version number when 'DIGI' created               *
1112 *          +28) ZEBRA version number when 'DIGI' created               *
1113 *  Header bank JHEAD: 1 user link, NHEAD(=10) data words               *
1114 *   IQ(JHEAD+1) IDRUN     Run number                                   *
1115 *       ""  +2) IDEVT     Event number                                 *
1116 *       ""  +3) NRNDM(1)  Random number seed 1 at beginning of event   *
1117 *       ""  +4) NRNDM(2)          "     "                              *
1118 *     "" +5/10)           Reserved for user applications               *
1119 *                                                                      *
1120 ************************************************************************
1121 *                                                                      *
1122 *                                                                      *
1123 *        Example of User Termination and related routines              *
1124 *        ------------------------------------------------              *
1125 *                                                                      *
1126 *     SUBROUTINE UGLAST                                                *
1127 *  C                                                                   *
1128 *  +SEQ,GCLIST                                                         *
1129 *  C                                                                   *
1130 *  C      Call standard GEANT termination routine                      *
1131 *     CALL GLAST                                                       *
1132 *  C                                                                   *
1133 *  C      Close HIGZ files                                             *
1134 *     CALL IGEND                                                       *
1135 *  C                                                                   *
1136 *  C      Close I/O buffers                                            *
1137 *     IF(NGET.EQ.0.AND.NSAVE.EQ.0) GO TO 5                             *
1138 *     CALL GCLOSE(0,IER)                                               *
1139 *  C                                                                   *
1140 *  C      Print histograms                                             *
1141 *   5 CALL HISTDO                                                      *
1142 *  C                                                                   *
1143 *     END                                                              *
1144 *                                                                      *
1145 *                                                                      *
1146 ************************************************************************
1147 #endif