Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:21:21

0001 
0002 C...Old example: handles a simple Pythia 6.4 initialization file.
0003  
0004 c      SUBROUTINE UPINIT
0005  
0006 C...Double precision and integer declarations.
0007 c      IMPLICIT DOUBLE PRECISION(A-H, O-Z)
0008 c      IMPLICIT INTEGER(I-N)
0009  
0010 C...Commonblocks.
0011 c      COMMON/PYDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200)
0012 c      COMMON/PYPARS/MSTP(200),PARP(200),MSTI(200),PARI(200)
0013 c      SAVE /PYDAT1/,/PYPARS/
0014  
0015 C...User process initialization commonblock.
0016 c      INTEGER MAXPUP
0017 c      PARAMETER (MAXPUP=100)
0018 c      INTEGER IDBMUP,PDFGUP,PDFSUP,IDWTUP,NPRUP,LPRUP
0019 c      DOUBLE PRECISION EBMUP,XSECUP,XERRUP,XMAXUP
0020 c      COMMON/HEPRUP/IDBMUP(2),EBMUP(2),PDFGUP(2),PDFSUP(2),
0021 c     &IDWTUP,NPRUP,XSECUP(MAXPUP),XERRUP(MAXPUP),XMAXUP(MAXPUP),
0022 c     &LPRUP(MAXPUP)
0023 c      SAVE /HEPRUP/
0024  
0025 C...Read info from file.
0026 c      IF(MSTP(161).GT.0) THEN
0027 c        READ(MSTP(161),*,END=110,ERR=110) IDBMUP(1),IDBMUP(2),EBMUP(1),
0028 c     &  EBMUP(2),PDFGUP(1),PDFGUP(2),PDFSUP(1),PDFSUP(2),IDWTUP,NPRUP
0029 c        DO 100 IPR=1,NPRUP
0030 c          READ(MSTP(161),*,END=110,ERR=110) XSECUP(IPR),XERRUP(IPR),
0031 c     &    XMAXUP(IPR),LPRUP(IPR)
0032 c  100   CONTINUE
0033 c        RETURN
0034 C...Error or prematurely reached end of file.
0035 c  110   WRITE(MSTU(11),5000)
0036 c        STOP
0037  
0038 C...Else not implemented.
0039 c      ELSE
0040 c        WRITE(MSTU(11),5100)
0041 c        STOP
0042 c      ENDIF
0043  
0044 C...Format for error printout.
0045 c 5000 FORMAT(1X,'Error: UPINIT routine failed to read information'/
0046 c     &1X,'Execution stopped!')
0047 c 5100 FORMAT(1X,'Error: You have not implemented UPINIT routine'/
0048 c     &1X,'Dummy routine in PYTHIA file called instead.'/
0049 c     &1X,'Execution stopped!')
0050  
0051 c      RETURN
0052 c      END
0053  
0054 C*********************************************************************
0055  
0056 C...UPEVNT
0057 C...Dummy routine, to be replaced by a user implementing external
0058 C...processes. Depending on cross section model chosen, it either has
0059 C...to generate a process of the type IDPRUP requested, or pick a type
0060 C...itself and generate this event. The event is to be stored in the
0061 C...HEPEUP commonblock, including (often) an event weight.
0062 
0063 C...New example: handles a standard Les Houches Events File.
0064 
0065       SUBROUTINE UPEVNT
0066  
0067 C...Double precision and integer declarations.
0068       IMPLICIT DOUBLE PRECISION(A-H, O-Z)
0069       IMPLICIT INTEGER(I-N)
0070  
0071 C...PYTHIA commonblock: only used to provide read unit MSTP(162).
0072       COMMON/PYPARS/MSTP(200),PARP(200),MSTI(200),PARI(200)
0073       SAVE /PYPARS/
0074  
0075 C...User process event common block.
0076       INTEGER MAXNUP
0077       PARAMETER (MAXNUP=500)
0078       INTEGER NUP,IDPRUP,IDUP,ISTUP,MOTHUP,ICOLUP
0079       DOUBLE PRECISION XWGTUP,SCALUP,AQEDUP,AQCDUP,PUP,VTIMUP,SPINUP
0080       COMMON/HEPEUP/NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,IDUP(MAXNUP),
0081      &ISTUP(MAXNUP),MOTHUP(2,MAXNUP),ICOLUP(2,MAXNUP),PUP(5,MAXNUP),
0082      &VTIMUP(MAXNUP),SPINUP(MAXNUP)
0083       SAVE /HEPEUP/
0084 
0085 C...Lines to read in assumed never longer than 200 characters. 
0086       PARAMETER (MAXLEN=200)
0087       CHARACTER*(MAXLEN) STRING
0088 
0089 C...Format for reading lines.
0090       CHARACTER*6 STRFMT
0091       STRFMT='(A000)'
0092       WRITE(STRFMT(3:5),'(I3)') MAXLEN
0093 
0094 C...Loop until finds line beginning with "<event>" or "<event ". 
0095   100 READ(MSTP(162),STRFMT,END=130,ERR=130) STRING
0096       IBEG=0
0097   110 IBEG=IBEG+1
0098 C...Allow indentation.
0099       IF(STRING(IBEG:IBEG).EQ.' '.AND.IBEG.LT.MAXLEN-6) GOTO 110 
0100       IF(STRING(IBEG:IBEG+6).NE.'<event>'.AND.
0101      &STRING(IBEG:IBEG+6).NE.'<event ') GOTO 100
0102 
0103 C...Read first line of event info.
0104       READ(MSTP(162),*,END=130,ERR=130) NUP,IDPRUP,XWGTUP,SCALUP,
0105      &AQEDUP,AQCDUP
0106 
0107 C...Read NUP subsequent lines with information on each particle.
0108       DO 120 I=1,NUP
0109         READ(MSTP(162),*,END=130,ERR=130) IDUP(I),ISTUP(I),
0110      &  MOTHUP(1,I),MOTHUP(2,I),ICOLUP(1,I),ICOLUP(2,I),
0111      &  (PUP(J,I),J=1,5),VTIMUP(I),SPINUP(I)
0112   120 CONTINUE
0113       RETURN
0114 
0115 C...Error exit, typically when no more events.
0116   130 WRITE(*,*) ' Failed to read LHEF event information.'
0117       WRITE(*,*) ' Will assume end of file has been reached.'
0118       NUP=0
0119       MSTI(51)=1
0120  
0121       RETURN
0122       END