-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlhefread.f
96 lines (92 loc) · 2.58 KB
/
lhefread.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
c...lhefheader(nlf)
c...reads initialization information from a les houches events file on unit nlf.
subroutine lhefreadhdr(nlf)
implicit none
integer nlf
character * 100 string
integer ipr
include 'LesHouches.h'
1 read(nlf,fmt='(a)',err=998,end=998) string
if(string(1:5).eq.'<init') then
read(nlf,*) idbmup(1),idbmup(2),ebmup(1),ebmup(2),
& pdfgup(1),pdfgup(2),pdfsup(1),pdfsup(2),idwtup,nprup
do ipr=1,nprup
read(nlf,*) xsecup(ipr),xerrup(ipr),xmaxup(ipr),
& lprup(ipr)
enddo
goto 999
else
goto 1
endif
998 write(*,*) 'lhefreadhdr: could not find <init> data'
call exit(1)
999 end
c...reads event information from a les houches events file on unit nlf.
subroutine lhefreadev(nlf)
implicit none
integer nlf
character * 100 string
include 'LesHouches.h'
integer i,j
1 continue
string=' '
read(nlf,fmt='(a)',err=777,end=666) string
if(string.eq.'</LesHouchesEvents>') then
goto 998
endif
if(string(1:6).eq.'<event') then
c on error try next event. The error may be cause by merging
c truncated event files. On EOF return with no event found
read(nlf,*,end=998,err=1)nup,idprup,xwgtup,scalup,aqedup,aqcdup
do i=1,nup
read(nlf,*,end=998,err=1) idup(i),istup(i),mothup(1,i),
& mothup(2,i),icolup(1,i),icolup(2,i),(pup(j,i),j=1,5),
& vtimup(i),spinup(i)
enddo
call lhefreadextra(nlf)
goto 999
else
goto 1
endif
c no event found:
777 continue
print *,"Error in reading"
print *,string
stop
666 continue
print *,"reached EOF"
print *,string
stop
998 continue
print *,"read </LesHouchesEvents>"
nup=0
999 end
subroutine lhefreadextra(nlf)
implicit none
include 'LesHouches.h'
include 'nlegborn.h'
include 'pwhg_flst.h'
include 'pwhg_rad.h'
include 'pwhg_st.h'
include 'pwhg_kn.h'
include 'pwhg_flg.h'
character * 100 string
integer nlf
1 continue
read(unit=nlf,fmt='(a)',end=998) string
if(string.eq.'<event>') then
backspace nlf
return
endif
if(string.eq.'# Start extra-info-previous-event') then
read(nlf,'(a)') string
read(string(3:),*) rad_kinreg
read(nlf,'(a)') string
read(string(3:),*) rad_type
return
else
goto 1
endif
return
998 continue
end