This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / gbase / grun.F
1 *CMZ :          03/11/94  15.43.38  by  John Apostolakis CERN GP-MIMD 2
2 *-- Author :
3       SUBROUTINE GRUN
4 *.
5 *.    ******************************************************************
6 *.    *                                                                *
7 *.    *       Steering routine to process all the events               *
8 *.    *                                                                *
9 *.    *    ==>Called by : <USER>, main program                         *
10 *.    *       Author    R.Brun  *********                              *
11 *.    *                                                                *
12 *.    ******************************************************************
13 *.
14 #include "geant321/gcbank.inc"
15 #include "geant321/gcflag.inc"
16 #include "geant321/gcunit.inc"
17 #include "geant321/gctime.inc"
18
19 #if defined(CERNLIB_PARA)
20 #include "geant321/multiprox.inc"
21 #endif
22
23       SAVE IFIRST
24       DATA IFIRST/0/
25 *.
26 *.    ------------------------------------------------------------------
27 *.
28 *             Keep starting time
29 *
30       IF(IFIRST.EQ.0)THEN
31          IFIRST=1
32          CALL TIMEL(TIMINT)
33       ENDIF
34 #if defined(CERNLIB_PARA)
35 *      Parallel : Does not change nevent on nodes - using it as maximum
36 *                   number that one node can process and regulating
37 *                   end by end of input file ...
38 *                 For programs that have no input file, gprun should
39 *                   divide the total number of events evenly between tasks.
40 *
41       call gprun
42 *
43 #endif
44    10 IF(IEVENT.LT.NEVENT) THEN
45          IEVENT=IEVENT+1
46 *
47 *             Initialises event partition
48 *
49          CALL GTRIGI
50 *
51 *             Process one event (trigger)
52 *
53          CALL GTRIG
54 *
55 *             Clear event partition
56 *
57          CALL GTRIGC
58 *
59          IF(IEORUN.EQ.0) THEN
60 *
61 *             Check time left
62 *
63             IF(ITIME.LE.0)GO TO 10
64             IF(MOD(IEVENT,ITIME).NE.0)GO TO 10
65             CALL TIMEL(TIMNOW)
66             IF(TIMNOW.GT.TIMEND)GO TO 10
67             WRITE(CHMAIL,10000)TIMEND
68             CALL GMAIL(0,2)
69             IEORUN = 1
70          ENDIF
71       ENDIF
72 *
73 10000 FORMAT(5X,'***** THE JOB STOPS NOW BECAUSE THE TIME LEFT IS LESS',
74      +' THAN     ',F8.3,' SECONDS *****')
75       END