1
double precision function pdg2pdf(ih,ipdg,x,xmu)
2
c***************************************************************************
3
c Based on pdf.f, wrapper for calling the pdf of MCFM
4
c***************************************************************************
16
integer i,j,ihlast(20),ipart,iporg,ireuse,imemlast(20),iset,imem
17
& ,i_replace,ii,ipartlast(20)
18
double precision xlast(20),xmulast(20),pdflast(20)
19
save ihlast,xlast,xmulast,pdflast,imemlast,ipartlast
21
data ipartlast/20*-99/
23
data xmulast/20*-99d9/
24
data pdflast/20*-99d9/
28
c Make sure we have a reasonable Bjorken x. Note that even though
29
c x=0 is not reasonable, we prefer to simply return pdg2pdf=0
30
c instead of stopping the code, as this might accidentally happen.
34
elseif (x.lt.0d0 .or. x.gt.1d0) then
35
write (*,*) 'PDF not supported for Bjorken x ', x
36
open(unit=26,file='../../../error',status='unknown')
37
write(26,*) 'Error: PDF not supported for Bjorken x ',x
42
if(iabs(ipart).eq.21) ipart=0
43
if(iabs(ipart).eq.22) ipart=7
46
c This will be called for any PDG code, but we only support up to 7
47
if(iabs(ipart).gt.7)then
48
write(*,*) 'PDF not supported for pdg ',ipdg
49
write(*,*) 'For lepton colliders, please set the lpp* '//
50
$ 'variables to 0 in the run_card'
51
open(unit=26,file='../../../error',status='unknown')
52
write(26,*) 'Error: PDF not supported for pdg ',ipdg
56
c Determine the iset used in lhapdf
59
write (*,*) 'PDF not supported for Bjorken x ', x
60
open(unit=26,file='../../../error',status='unknown')
61
write(26,*) 'Error: PDF not supported for Bjorken x ',x
65
c Determine the member of the set (function of lhapdf)
66
call getnmem(iset,imem)
71
c Check if result can be reused since any of last twenty
72
c calls. Start checking with the last call and move back in time
73
if (ih.eq.ihlast(ii)) then
74
if (ipart.eq.ipartlast(ii)) then
75
if (x.eq.xlast(ii)) then
76
if (xmu.eq.xmulast(ii)) then
77
if (imem.eq.imemlast(ii)) then
89
c Reuse previous result, if possible
91
if (pdflast(ireuse).ne.-99d9) then
92
pdg2pdf=pdflast(ireuse)
97
c Calculated a new value: replace the value computed longest ago
98
i_replace=mod(i_replace,20)+1
100
c Call lhapdf and give the current values to the arrays that should
102
call evolvepart(ipart,x,xmu,pdg2pdf)
104
pdflast(i_replace)=pdg2pdf
106
xmulast(i_replace)=xmu
108
imemlast(i_replace)=imem