-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpdfcalls.f
More file actions
130 lines (127 loc) · 3.73 KB
/
pdfcalls.f
File metadata and controls
130 lines (127 loc) · 3.73 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
subroutine pdfcall(ih,x,pdf)
implicit none
include 'pwhg_pdf.h'
integer ih
real * 8 x,pdf(-pdf_nparton:pdf_nparton)
include 'pwhg_st.h'
integer npdf
if(ih == 1 .and. pdf_ndns1 == -100) then
pdf = 1
return
elseif(ih == 2 .and. pdf_ndns2 == -100) then
pdf = 1
return
endif
if(x .ge. 1) then
if(x-1 .gt. 1d-4) then
write(*,*) 'pdfcall: warning, x=',x
write(*,*) 'returning pdf=0'
endif
pdf = 0
return
endif
if(ih.eq.1) then
call genericpdf0(pdf_ndns1,pdf_ih1,st_mufact2,x,pdf)
elseif(ih.eq.2) then
call genericpdf0(pdf_ndns2,pdf_ih2,st_mufact2,x,pdf)
else
write(*,*) ' pdfcall: invalid call, ih=',ih
stop
endif
end
c Front end to genericpdf; it stores the arguments and return values of
c the nrec most recent calls to genericpdf. When invoked it looks in the
c stored calls; if a match its found, its return value is used.
c In this framework it is found that nrec=8 would be enough.
c This provides a remarkable increase in spead (better than a factor of 3)
c when cteq6 pdf are used.
subroutine genericpdf0(ns,ih,xmu2,x,fx)
implicit none
include 'pwhg_pdf.h'
integer maxparton
parameter (maxparton=22)
integer ns,ih
real * 8 xmu2,x,fx(-pdf_nparton:pdf_nparton)
integer nrec
parameter (nrec=10)
real * 8 oxmu2(nrec),ox(nrec),ofx(-maxparton:maxparton,nrec)
integer ons(nrec),oih(nrec)
integer irec
save oxmu2,ox,ofx,ons,oih,irec
c set to impossible values to begin with
data ox/nrec*-1d0/
data irec/0/
integer j,k
real * 8 charmthr2,bottomthr2
logical ini
data ini/.true./
save ini,charmthr2,bottomthr2
real * 8 powheginput
external powheginput
real * 8 tmp
if(ini) then
charmthr2=powheginput('#charmthrpdf')
bottomthr2=powheginput('#bottomthrpdf')
if(charmthr2.lt.0) charmthr2=1.5
if(bottomthr2.lt.0) bottomthr2=5
charmthr2=charmthr2**2
bottomthr2=bottomthr2**2
ini=.false.
endif
do j=irec,1,-1
if(x.eq.ox(j)) then
if(xmu2.eq.oxmu2(j)) then
if(ns.eq.ons(j).and.ih.eq.oih(j)) then
fx=ofx(-pdf_nparton:pdf_nparton,j)
return
endif
endif
endif
enddo
do j=nrec,irec+1,-1
if(x.eq.ox(j)) then
if(xmu2.eq.oxmu2(j)) then
if(ns.eq.ons(j).and.ih.eq.oih(j)) then
fx=ofx(-pdf_nparton:pdf_nparton,j)
return
endif
endif
endif
enddo
irec=irec+1
if(irec.gt.nrec) irec=1
ons(irec)=ns
oih(irec)=ih
oxmu2(irec)=xmu2
ox(irec)=x
if(abs(ih) == 2) then
c Do the neutron or antineutron
call genericpdf(ns,ih/abs(ih),xmu2,x,
1 ofx(-pdf_nparton:pdf_nparton,irec))
tmp = ofx(1,irec)
ofx(1,irec)=ofx(2,irec)
ofx(2,irec)=tmp
tmp = ofx(-1,irec)
ofx(-1,irec)=ofx(-2,irec)
ofx(-2,irec)=tmp
else
call genericpdf(ns,ih,xmu2,x,
1 ofx(-pdf_nparton:pdf_nparton,irec))
endif
c Flavour thresholds:
if(xmu2.lt.bottomthr2) then
ofx(5,irec)=0
ofx(-5,irec)=0
endif
if(xmu2.lt.charmthr2) then
ofx(4,irec)=0
ofx(-4,irec)=0
endif
do k=-pdf_nparton,pdf_nparton
if (ofx(k,irec).lt.0) then
call increasecnt("negative pdf values");
ofx(k,irec)=0
endif
enddo
fx=ofx(-pdf_nparton:pdf_nparton,irec)
end