]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ISAJET/doc/main.doc
First commit.
[u/mrichter/AliRoot.git] / ISAJET / doc / main.doc
CommitLineData
0795afa3 1\newpage
2\section{Main Program\label{MAIN}}
3
4 A main program is not supplied with ISAJET. To generate events
5and write them to disk, the user should provide a main program which
6opens the files and then calls subroutine ISAJET. In the following
7sample, i,j,m,n are arbitrary unit numbers.
8
9 Main program for VMS:
10\begin{verbatim}
11 PROGRAM RUNJET
12C
13C MAIN PROGRAM FOR ISAJET ON BNL VAX CLUSTER.
14C
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')
20C
21 CALL ISAJET(+-i,+-j,m,n)
22C
23 STOP
24 END
25\end{verbatim}
26
27 Main program for IBM (VM/CMS)
28\begin{verbatim}
29 PROGRAM RUNJET
30C
31C MAIN PROGRAM FOR ISAJET ON IBM ASSUMING FILES HAVE BEEN
32C OPENED WITH FILEDEF.
33C
34 CALL ISAJET(+-i,+-j,m,n)
35C
36 STOP
37 END
38\end{verbatim}
39
40 Main program for Unix:
41\begin{verbatim}
42 PROGRAM RUNJET
43C
44C Main program for ISAJET on Unix
45C
46 CHARACTER*60 FNAME
47C
48C Open user files
49 READ 1000, FNAME
501000 FORMAT(A)
51 PRINT 1020, FNAME
521020 FORMAT(1X,'Data file = ',A)
53 OPEN(2,FILE=FNAME,STATUS='NEW',FORM='UNFORMATTED')
54 READ 1000, FNAME
55 PRINT 1030, FNAME
561030 FORMAT(1X,'Parameter file = ',A)
57 OPEN(3,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
58 READ 1000, FNAME
59 PRINT 1040, FNAME
601040 FORMAT(1X,'Listing file = ',A)
61 OPEN(4,FILE=FNAME,STATUS='NEW',FORM='FORMATTED')
62C Open decay table
63 READ 1000, FNAME
64 OPEN(1,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
65C
66C Run ISAJET
67 CALL ISAJET(-1,2,3,4)
68C
69 STOP
70 END
71\end{verbatim}
72
73 The arguments of ISAJET are tape numbers for files, all of which
74should be opened by the main program.
75
76 \verb|TAPEi|: Decay table (formatted). A positive sign prints
77the decay table on the output listing. A negative sign suppress
78printing of the decay table.
79
80 \verb|TAPEj|: Output file for events (unformatted). A positive
81sign writes out both resonances and stable particles. A negative sign
82writes out only stable particles.
83
84 \verb|TAPEm|: Commands as defined in Section 6 (formatted).
85
86 \verb|TAPEn|: Output listing (formatted).
87
88\noindent In the sample jobs in Section 3, TAPEm is the default
89Fortran input, and TAPEn is the default Fortran output.
90
91\subsection{Interactive Interface}
92
93 To use the interactive interface, replace the call to ISAJET in
94the above main program by
95\begin{verbatim}
96 CALL ISASET(+-i,+-j,m,n)
97 CALL ISAJET(+-i,+-j,m,n)
98\end{verbatim}
99ISASET calls DIALOG, which prompts the user for possible commands,
100does a limited amount of error checking, and writes a command file on
101TAPEm. This command file is rewound for execution by ISAJET. A main
102program is included in patch ISARUN to open the necessary files and to
103call ISASET and ISAJET.
104
105\subsection{User Control of Event Loop}
106
107 If the user wishes to integrate ISAJET with another program and
108have control over the event generation, he can call the driving
109subroutines himself. The driving subroutines are:
110
111 \verb|ISAINI(+-i,+-j,m,n)|: initialize ISAJET. The arguments are
112the same as for subroutine ISAJET.
113
114 \verb|ISABEG(IFL)|: begin a run. IFL is a return flag: IFL=0
115for a good set of commands; IFL=1001 for a STOP; any other value means
116an error.
117
118 \verb|ISAEVT(I,OK,DONE)| generate event I. Logical flag OK
119signifies a good event (almost always .TRUE.); logical flag DONE
120signifies the end of a run.
121
122 \verb|ISAEND|: end a run.
123
124\noindent There are also subroutines provided to write standard ISAJET
125records, or Zebra records if the Zebra option is selected:
126
127 \verb|ISAWBG| to write a begin-of-run record, should be called
128immediately after ISABEG
129
130 \verb|ISAWEV| to write an event record, should be called
131immediately after ISAEVT
132
133 \verb|ISAWND| to write an end-of-run record, should be called
134immediately after ISAEND
135
136 The control of the event loop is somewhat complicated to
137accomodate multiple evolution and fragmentation as described in
138Section 11. Note in particular that after calling ISAEVT one should
139process or write out the event only if OK=.TRUE. The check on the DONE
140flag is essential if one is doing multiple evolution and
141fragmentation. The following example indicates how events might be
142generated, analyzed, and discarded (replace \verb|&| by \verb|+|
143everywhere):
144\begin{verbatim}
145 PROGRAM SAMPLE
146C
147&SELF,IF=IMPNONE
148 IMPLICIT NONE
149&SELF
150&CDE,ITAPES
151&CDE,IDRUN
152&CDE,PRIMAR
153&CDE,ISLOOP
154C
155 INTEGER JTDKY,JTEVT,JTCOM,JTLIS,IFL,ILOOP
156 LOGICAL OK,DONE
157 SAVE ILOOP
158C---------------------------------------------------------------------
159C> Open files as above
160C> Call user initialization
161C---------------------------------------------------------------------
162C
163C Initialize ISAJET
164C
165 CALL ISAINI(-i,0,m,n)
166 1 IFL=0
167 CALL ISABEG(IFL)
168 IF(IFL.NE.0) STOP
169C
170C Event loop
171C
172 ILOOP=0
173 101 CONTINUE
174 ILOOP=ILOOP+1
175C Generate one event - discard if .NOT.OK
176 CALL ISAEVT(ILOOP,OK,DONE)
177 IF(OK) THEN
178C---------------------------------------------------------------------
179C> Call user analysis for event
180C---------------------------------------------------------------------
181 ENDIF
182 IF(.NOT.DONE) GO TO 101
183C
184C Calculate cross section and luminosity
185C
186 CALL ISAEND
187C---------------------------------------------------------------------
188C> Call user summary
189C---------------------------------------------------------------------
190 GO TO 1
191 END
192\end{verbatim}
193
194\subsection{Multiple Event Streams}
195
196 It may be desirable to generate several different kinds of events
197simultaneously to study pileup effects. While normally one would want
198to superimpose minimum bias or low-pt jet events on a signal of
199interest, other combinations might also be interesting. It would be
200very inefficient to reinitialize ISAJET for each event. Therefore, a
201pair of subroutines is provided to save and restore the context, i.e.
202all of the initialization information, in an array. The syntax is
203\begin{verbatim}
204 CALL CTXOUT(NC,VC,MC)
205 CALL CTXIN(NC,VC,MC)
206\end{verbatim}
207where VC is a real array of dimension MC and NC is the number of words
208used, about 20000 in the standard case. If NC exceeds MC, a warning is
209printed and the job is terminated. The use of these routines is
210illustrated in the following example, which opens the files with names
211read from the standard input and then superimposes on each event of
212the signal sample three events of a pileup sample. It is assumed that
213a large number of events is specified in the parameter file for the
214pileup sample so that it does not terminate.
215\begin{verbatim}
216 PROGRAM SAMPLE
217C
218C Example of generating two kinds of events.
219C
220 CHARACTER*60 FNAME
221 REAL VC1(20000),VC2(20000)
222 LOGICAL OK1,DONE1,OK2,DONE2
223 INTEGER NC1,NC2,IFL,ILOOP,I2,ILOOP2
224C
225C Open decay table
226 READ 1000, FNAME
2271000 FORMAT(A)
228 OPEN(1,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
229C Open user files
230 READ 1000, FNAME
231 OPEN(3,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
232 READ 1000, FNAME
233 OPEN(4,FILE=FNAME,STATUS='NEW',FORM='FORMATTED')
234 READ 1000,FNAME
235 OPEN(13,FILE=FNAME,STATUS='OLD',FORM='FORMATTED')
236 READ 1000,FNAME
237 OPEN(14,FILE=FNAME,STATUS='NEW',FORM='FORMATTED')
238C
239C Initialize ISAJET
240 CALL ISAINI(-1,0,3,4)
241 CALL CTXOUT(NC1,VC1,20000)
242 CALL ISAINI(-1,0,13,14)
243 IFL=0
244 CALL ISABEG(IFL)
245 IF(IFL.NE.0) STOP1
246 CALL CTXOUT(NC2,VC2,20000)
247 ILOOP2=0
248 CALL user_initialization_routine
249C
2501 IFL=0
251 CALL CTXIN(NC1,VC1,20000)
252 CALL ISABEG(IFL)
253 CALL CTXOUT(NC1,VC1,20000)
254 IF(IFL.NE.0) GO TO 999
255 ILOOP=0
256C
257C Main event
258C
259101 CONTINUE
260 ILOOP=ILOOP+1
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
266C
267C Pileup
268C
269 CALL CTXIN(NC2,VC2,20000)
270 I2=0
271201 CONTINUE
272 ILOOP2=ILOOP2+1
273 CALL ISAEVT(ILOOP2,OK2,DONE2)
274 IF(OK2) I2=I2+1
275 IF(DONE2) STOP2
276 CALL user_analysis_routine
277 IF(I2.LT.3) GO TO 201
278 CALL CTXOUT(NC2,VC2,20000)
279C
280 IF(.NOT.DONE1) GO TO 101
281C
282C Calculate cross section and luminosity
283C
284 CALL CTXIN(NC1,VC1,20000)
285 CALL ISAEND
286 GO TO 1
287C
288999 CALL CTXIN(NC2,VC2,20000)
289 CALL ISAEND
290 CALL user_termination_routine
291 STOP
292 END
293\end{verbatim}
294It is possible to superimpose arbitrary combinations of events,
295including events of the same reaction type with different parameters.
296In general the number of events would be selected randomly based on the
297cross sections and the luminosity.
298
299 At this time CTXOUT and CTXIN cannot be used with the Zebra
300output routines.