Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyrset.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyrset.f
1 
2 C*********************************************************************
3 
4 C...PYRSET
5 C...Reads a state of the random number generator from a file
6 C...for subsequent generation from this state onwards.
7 
8  SUBROUTINE pyrset(LFN,MOVE)
9 
10 C...Double precision and integer declarations.
11  IMPLICIT DOUBLE PRECISION(a-h, o-z)
12  IMPLICIT INTEGER(i-n)
13  INTEGER pyk,pychge,pycomp
14 C...Commonblocks.
15  common/pydatr/mrpy(6),rrpy(100)
16  SAVE /pydatr/
17 C...Local character variable.
18  CHARACTER cherr*8
19 
20 C...Backspace required number of records (or as many as there are).
21  IF(move.LT.0) THEN
22  nbck=min(mrpy(6),-move)
23  DO 100 ibck=1,nbck
24  backspace(lfn,err=120,iostat=ierr)
25  100 CONTINUE
26  mrpy(6)=mrpy(6)-nbck
27  ENDIF
28 
29 C...Unformatted read from unit LFN.
30  nfor=1+max(0,move)
31  DO 110 ifor=1,nfor
32  READ(lfn,err=120,iostat=ierr) (mrpy(i1),i1=1,5),
33  & (rrpy(i2),i2=1,100)
34  110 CONTINUE
35  mrpy(6)=mrpy(6)+nfor
36  RETURN
37 
38 C...Write error.
39  120 WRITE(cherr,'(I8)') ierr
40  CALL pyerrm(18,'(PYRSET:) error when accessing file, IOSTAT ='//
41  &cherr)
42 
43  RETURN
44  END