2 \section{Main Program\label{MAIN}}
4 A main program is not supplied with ISAJET. To generate events
5 and write them to disk, the user should provide a main program which
6 opens the files and then calls subroutine ISAJET. In the following
7 sample, i,j,m,n are arbitrary unit numbers.
13 C MAIN PROGRAM FOR ISAJET ON BNL VAX CLUSTER.
15 OPEN(UNIT=i,FILE='$2$DUA14:[ISAJET.ISALIBRARY]DECAY.DAT',
16 $STATUS='OLD',FORM='FORMATTED',READONLY)
17 OPEN(UNIT=j,FILE='myjob.dat',STATUS='NEW',FORM='UNFORMATTED')
18 OPEN(UNIT=m,FILE='myjob.par',STATUS='OLD',FORM='FORMATTED')
19 OPEN(UNIT=n,FILE='myjob.lis',STATUS='NEW',FORM='FORMATTED')
21 CALL ISAJET(+-i,+-j,m,n)
27 Main program for IBM (VM/CMS)
31 C MAIN PROGRAM FOR ISAJET ON IBM ASSUMING FILES HAVE BEEN
32 C OPENED WITH FILEDEF.
34 CALL ISAJET(+-i,+-j,m,n)
40 Main program for Unix:
44 C Main program for ISAJET on Unix
52 1020 FORMAT(1X,'Data file = ',A)
53 OPEN(2,FILE=FNAME,STATUS='NEW',FORM='UNFORMATTED')
56 1030 FORMAT(1X,'Parameter file = ',A)
57 OPEN(3,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
60 1040 FORMAT(1X,'Listing file = ',A)
61 OPEN(4,FILE=FNAME,STATUS='NEW',FORM='FORMATTED')
64 OPEN(1,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
73 The arguments of ISAJET are tape numbers for files, all of which
74 should be opened by the main program.
76 \verb|TAPEi|: Decay table (formatted). A positive sign prints
77 the decay table on the output listing. A negative sign suppress
78 printing of the decay table.
80 \verb|TAPEj|: Output file for events (unformatted). A positive
81 sign writes out both resonances and stable particles. A negative sign
82 writes out only stable particles.
84 \verb|TAPEm|: Commands as defined in Section 6 (formatted).
86 \verb|TAPEn|: Output listing (formatted).
88 \noindent In the sample jobs in Section 3, TAPEm is the default
89 Fortran input, and TAPEn is the default Fortran output.
91 \subsection{Interactive Interface}
93 To use the interactive interface, replace the call to ISAJET in
94 the above main program by
96 CALL ISASET(+-i,+-j,m,n)
97 CALL ISAJET(+-i,+-j,m,n)
99 ISASET calls DIALOG, which prompts the user for possible commands,
100 does a limited amount of error checking, and writes a command file on
101 TAPEm. This command file is rewound for execution by ISAJET. A main
102 program is included in patch ISARUN to open the necessary files and to
103 call ISASET and ISAJET.
105 \subsection{User Control of Event Loop}
107 If the user wishes to integrate ISAJET with another program and
108 have control over the event generation, he can call the driving
109 subroutines himself. The driving subroutines are:
111 \verb|ISAINI(+-i,+-j,m,n)|: initialize ISAJET. The arguments are
112 the same as for subroutine ISAJET.
114 \verb|ISABEG(IFL)|: begin a run. IFL is a return flag: IFL=0
115 for a good set of commands; IFL=1001 for a STOP; any other value means
118 \verb|ISAEVT(I,OK,DONE)| generate event I. Logical flag OK
119 signifies a good event (almost always .TRUE.); logical flag DONE
120 signifies the end of a run.
122 \verb|ISAEND|: end a run.
124 \noindent There are also subroutines provided to write standard ISAJET
125 records, or Zebra records if the Zebra option is selected:
127 \verb|ISAWBG| to write a begin-of-run record, should be called
128 immediately after ISABEG
130 \verb|ISAWEV| to write an event record, should be called
131 immediately after ISAEVT
133 \verb|ISAWND| to write an end-of-run record, should be called
134 immediately after ISAEND
136 The control of the event loop is somewhat complicated to
137 accomodate multiple evolution and fragmentation as described in
138 Section 11. Note in particular that after calling ISAEVT one should
139 process or write out the event only if OK=.TRUE. The check on the DONE
140 flag is essential if one is doing multiple evolution and
141 fragmentation. The following example indicates how events might be
142 generated, analyzed, and discarded (replace \verb|&| by \verb|+|
155 INTEGER JTDKY,JTEVT,JTCOM,JTLIS,IFL,ILOOP
158 C---------------------------------------------------------------------
159 C> Open files as above
160 C> Call user initialization
161 C---------------------------------------------------------------------
165 CALL ISAINI(-i,0,m,n)
175 C Generate one event - discard if .NOT.OK
176 CALL ISAEVT(ILOOP,OK,DONE)
178 C---------------------------------------------------------------------
179 C> Call user analysis for event
180 C---------------------------------------------------------------------
182 IF(.NOT.DONE) GO TO 101
184 C Calculate cross section and luminosity
187 C---------------------------------------------------------------------
189 C---------------------------------------------------------------------
194 \subsection{Multiple Event Streams}
196 It may be desirable to generate several different kinds of events
197 simultaneously to study pileup effects. While normally one would want
198 to superimpose minimum bias or low-pt jet events on a signal of
199 interest, other combinations might also be interesting. It would be
200 very inefficient to reinitialize ISAJET for each event. Therefore, a
201 pair of subroutines is provided to save and restore the context, i.e.
202 all of the initialization information, in an array. The syntax is
204 CALL CTXOUT(NC,VC,MC)
207 where VC is a real array of dimension MC and NC is the number of words
208 used, about 20000 in the standard case. If NC exceeds MC, a warning is
209 printed and the job is terminated. The use of these routines is
210 illustrated in the following example, which opens the files with names
211 read from the standard input and then superimposes on each event of
212 the signal sample three events of a pileup sample. It is assumed that
213 a large number of events is specified in the parameter file for the
214 pileup sample so that it does not terminate.
218 C Example of generating two kinds of events.
221 REAL VC1(20000),VC2(20000)
222 LOGICAL OK1,DONE1,OK2,DONE2
223 INTEGER NC1,NC2,IFL,ILOOP,I2,ILOOP2
228 OPEN(1,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
231 OPEN(3,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
233 OPEN(4,FILE=FNAME,STATUS='NEW',FORM='FORMATTED')
235 OPEN(13,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
237 OPEN(14,FILE=FNAME,STATUS='NEW',FORM='FORMATTED')
240 CALL ISAINI(-1,0,3,4)
241 CALL CTXOUT(NC1,VC1,20000)
242 CALL ISAINI(-1,0,13,14)
246 CALL CTXOUT(NC2,VC2,20000)
248 CALL user_initialization_routine
251 CALL CTXIN(NC1,VC1,20000)
253 CALL CTXOUT(NC1,VC1,20000)
254 IF(IFL.NE.0) GO TO 999
261 CALL CTXIN(NC1,VC1,20000)
262 CALL ISAEVT(ILOOP,OK1,DONE1)
263 CALL CTXOUT(NC1,VC1,20000)
264 IF(.NOT.OK1) GO TO 101
265 CALL user_analysis_routine
269 CALL CTXIN(NC2,VC2,20000)
273 CALL ISAEVT(ILOOP2,OK2,DONE2)
276 CALL user_analysis_routine
277 IF(I2.LT.3) GO TO 201
278 CALL CTXOUT(NC2,VC2,20000)
280 IF(.NOT.DONE1) GO TO 101
282 C Calculate cross section and luminosity
284 CALL CTXIN(NC1,VC1,20000)
288 999 CALL CTXIN(NC2,VC2,20000)
290 CALL user_termination_routine
294 It is possible to superimpose arbitrary combinations of events,
295 including events of the same reaction type with different parameters.
296 In general the number of events would be selected randomly based on the
297 cross sections and the luminosity.
299 At this time CTXOUT and CTXIN cannot be used with the Zebra