9
9
DOUBLE PRECISION x,xmu
16
double precision Ctq3df,Ctq4Fn,Ctq5Pdf,Ctq6Pdf,Ctq5L
17
integer mode,Irt,ihlast
18
double precision xlast,xmulast,pdflast(-7:7)
19
save ihlast,xlast,xmulast,pdflast
16
integer i,j,ihlast(2),ipart,iporg,ireuse,imemlast(2),iset,imem
17
double precision xlast(2),xmulast(2),pdflast(-7:7,2)
18
save ihlast,xlast,xmulast,pdflast,imemlast
22
data pdflast/30*-99d9/
25
c Make sure we have a reasonable Bjorken x. Note that even though
26
c x=0 is not reasonable, we prefer to simply return pdg2pdf=0
27
c instead of stopping the code, as this might accidentally happen.
31
elseif (x.lt.0d0 .or. x.gt.1d0) then
32
write (*,*) 'PDF not supported for Bjorken x ', x
33
open(unit=26,file='../../../error',status='unknown')
34
write(26,*) 'Error: PDF not supported for Bjorken x ',x
22
39
if(ipart.eq.21) ipart=0
23
40
if(iabs(ipart).eq.22) ipart=7
25
43
c This will be called for any PDG code, but we only support up to 7
26
44
if(iabs(ipart).gt.7)then
45
write(*,*) 'PDF not supported for pdg ',ipdg
46
open(unit=26,file='../../../error',status='unknown')
47
write(26,*) 'Error: PDF not supported for pdg ',ipdg
51
c Determine the iset used in lhapdf
54
write (*,*) 'PDF not supported for Bjorken x ', x
55
open(unit=26,file='../../../error',status='unknown')
56
write(26,*) 'Error: PDF not supported for Bjorken x ',x
60
c Determine the member of the set (function of lhapdf)
61
call getnmem(iset,imem)
65
c Check if result can be reused since any of last two calls
66
if (x.eq.xlast(i) .and. xmu.eq.xmulast(i) .and.
67
$ imem.eq.imemlast(i) .and. ih.eq.ihlast(i)) then
72
c Reuse previous result, if possible
73
if (ireuse.gt.0.and.pdflast(iporg,ireuse).ne.-99d9) then
74
pdg2pdf=pdflast(iporg,ireuse)
31
if(ih.eq.ihlast.and.x.eq.xlast.and.xmu.eq.xmulast)then
32
pdg2pdf=pdflast(ipart);
34
call pftopdglha(ih,x,xmu,pdflast)
38
pdg2pdf=pdflast(ipart);
78
c Bjorken x and/or facrorization scale and/or PDF set are not
79
c identical to the saved values: this means a new event and we
80
c should reset everything to compute new PDF values. Also, determine
81
c if we should fill ireuse=1 or ireuse=2.
82
if (ireuse.eq.0.and.xlast(1).ne.-99d9.and.xlast(2).ne.-99d9)then
92
c everything has been reset. Now set ireuse=1 to fill the first
93
c arrays of saved values below
95
else if(ireuse.eq.0.and.xlast(1).ne.-99d9)then
96
c This is first call after everything has been reset, so the first
97
c arrays are already filled with the saved values (hence
98
c xlast(1).ne.-99d9). Fill the second arrays of saved values (done
99
c below) by setting ireuse=2
101
else if(ireuse.eq.0)then
102
c Special: only used for the very first call to this function:
103
c xlast(i) are initialized as data statements to be equal to -99d9
107
c Call lhapdf and give the current values to the arrays that should
109
call pftopdglha(ih,x,xmu,pdflast(-7,ireuse))
113
imemlast(ireuse)=imem
115
pdg2pdf=pdflast(ipart,ireuse);