Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
upinit.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file upinit.f
1 
2 C*********************************************************************
3 
4 C...UPINIT
5 C...Dummy routine, to be replaced by a user implementing external
6 C...processes. Is supposed to fill the HEPRUP commonblock with info
7 C...on incoming beams and allowed processes.
8 
9 C...New example: handles a standard Les Houches Events File.
10 
11  SUBROUTINE upinit
12 
13 C...Double precision and integer declarations.
14  IMPLICIT DOUBLE PRECISION(a-h, o-z)
15  IMPLICIT INTEGER(i-n)
16 
17 C...PYTHIA commonblock: only used to provide read unit MSTP(161).
18  common/pypars/mstp(200),parp(200),msti(200),pari(200)
19  SAVE /pypars/
20 
21 C...User process initialization commonblock.
22  INTEGER maxpup
23  parameter(maxpup=100)
24  INTEGER idbmup,pdfgup,pdfsup,idwtup,nprup,lprup
25  DOUBLE PRECISION ebmup,xsecup,xerrup,xmaxup
26  common/heprup/idbmup(2),ebmup(2),pdfgup(2),pdfsup(2),
27  &idwtup,nprup,xsecup(maxpup),xerrup(maxpup),xmaxup(maxpup),
28  &lprup(maxpup)
29  SAVE /heprup/
30 
31 C...Lines to read in assumed never longer than 200 characters.
32  parameter(maxlen=200)
33  CHARACTER*(MAXLEN) string
34 
35 C...Format for reading lines.
36  CHARACTER*6 strfmt
37  strfmt='(A000)'
38  WRITE(strfmt(3:5),'(I3)') maxlen
39 
40 C...Loop until finds line beginning with "<init>" or "<init ".
41  100 READ(mstp(161),strfmt,end=130,err=130) string
42  ibeg=0
43  110 ibeg=ibeg+1
44 C...Allow indentation.
45  IF(string(ibeg:ibeg).EQ.' '.AND.ibeg.LT.maxlen-5) goto 110
46  IF(string(ibeg:ibeg+5).NE.'<init>'.AND.
47  &string(ibeg:ibeg+5).NE.'<init ') goto 100
48 
49 C...Read first line of initialization info.
50  READ(mstp(161),*,end=130,err=130) idbmup(1),idbmup(2),ebmup(1),
51  &ebmup(2),pdfgup(1),pdfgup(2),pdfsup(1),pdfsup(2),idwtup,nprup
52 
53 C...Read NPRUP subsequent lines with information on each process.
54  DO 120 ipr=1,nprup
55  READ(mstp(161),*,end=130,err=130) xsecup(ipr),xerrup(ipr),
56  & xmaxup(ipr),lprup(ipr)
57  120 CONTINUE
58  RETURN
59 
60 C...Error exit: give up if initalization does not work.
61  130 WRITE(*,*) ' Failed to read LHEF initialization information.'
62  WRITE(*,*) ' Event generation will be stopped.'
63  CALL pystop(12)
64 
65  RETURN
66  END