]> git.uio.no Git - u/mrichter/AliRoot.git/blob - LHAPDF/lhapdf5.3.1/LHpdflib.f
Reference run number is added
[u/mrichter/AliRoot.git] / LHAPDF / lhapdf5.3.1 / LHpdflib.f
1 c     Automatically determine the path to the system's PDF set
2 c     collection using the lhapdf-config utility (which must be
3 c     in the user's execution path
4 c     ---------------------------------------------------------
5       subroutine InitPDFsetByCodes(code1, code2, code3)
6       write(*,*) "Not implemented yet: this will move the 'glue' interf
7      +ace to LHAPDF proper and use the InitPDFsetByName function to get
8      +the path automatically."
9       return
10       end
11 c     ---------------------------------------------------------
12
13
14 c     Automatically determine the path to the system's PDF set
15 c     collection using the lhapdf-config utility (which must be
16 c     in the user's execution path
17 c     --------------------------------------------------------
18       subroutine InitPDFsetByName(setname)
19       implicit none
20       character setname*(*)
21       integer nset
22       nset = 1
23       call InitPDFsetByNameM(nset,setname)
24       return
25       end
26
27       
28       subroutine InitPDFsetByNameM(nset,setname)
29       implicit none
30       include 'parmsetup.inc'
31       include 'pathsetup.inc'
32       integer LNBLNK
33       common/LHAPDFC/lhapath
34       character*20 lhaparm(20)
35       real*8 lhavalue(20)
36       common/LHACONTROL/lhaparm,lhavalue
37       character setname*(*)
38       integer nset
39 c      integer :: ierror
40       integer n, dirpathlength, setnamelength
41       character*512 dirpath, homepath, dotlhapath, cachepath, setpath
42 c pr      
43       INTEGER LNROOT
44       CHARACTER*1000 CHROOT
45       CHROOT=' '
46                  
47 c check enviromental variable LHAPATH
48       call getenv('LHAPATH',dirpath)
49       if (dirpath.eq.'') then
50 C     Take the data from $ALICE_ROOT/LHAPDF/PDFsets
51          CALL GETENV('ALICE_ROOT',CHROOT)
52          LNROOT = LNBLNK(CHROOT)
53          IF(LNROOT.LE.0) THEN
54             dirpath='PDFsets'   ! Default value
55          ELSE
56             dirpath=CHROOT(1:LNROOT)//'/LHAPDF/PDFsets'
57          ENDIF
58       endif
59
60 c     Now build the path to the PDF set
61       setpath = dirpath(:LEN_TRIM(dirpath)) // "/" //
62      +setname(:LEN_TRIM(setname))
63
64 c     Initialize using the detected PDF set
65       call InitPDFsetM(nset, setpath(:LEN_TRIM(setpath)))
66       return
67       end
68 c     ---------------------------------------------------------
69
70       subroutine InitPDFset(setpath)
71       implicit none
72       integer nset
73       character setpath*(*)
74       nset = 1
75       call InitPDFsetM(nset,setpath)
76       return
77       end      
78 c
79       subroutine InitPDFsetM(nset,setpath)
80       implicit none
81       include 'parmsetup.inc'
82       character setpath*(*)
83       character*64 string
84       character*16 s1,s2
85       integer id,token,Ctoken
86       integer lhasilent
87       common/lhasilent/lhasilent
88       integer nset,imem
89 c
90       call setnset(nset)
91 c      
92       open(unit=1,file=setpath,status='old')
93       read(1,*) s1,s2
94       if ((index(s2,'1.0').ne.1)
95      +.and.(index(s2,'1.1').ne.1)
96      +.and.(index(s2,'2.0').ne.1)
97      +.and.(index(s2,'2.1').ne.1)
98      +.and.(index(s2,'3.0').ne.1) 
99      +.and.(index(s2,'3.1').ne.1)
100      +.and.(index(s2,'4.0').ne.1)
101      +.and.(index(s2,'5.0').ne.1)
102      +.and.(index(s2,'5.3').ne.1))then
103          write(*,*) 
104      .        'Version ',s2,' not supported by this version of LHAPDF'
105          stop
106       else  
107        if(lhasilent.eq.0) then
108          write(*,*) '*************************************'
109          write(*,*) '*       LHAPDF Version 5.3.0          *'
110          write(*,*) '*************************************'
111          write(*,*)
112        endif
113       endif
114       id=Ctoken()
115  1    read(1,*) string
116       id=token(string)
117 c      print *,'id = ',id,string
118       if (id.eq.0) then
119          write(*,*) 'File description error:'
120          write(*,*) 'Command not understood: ',string
121          stop
122       endif
123       if (id.eq.1) call descriptionPDF(nset,id)
124 c      print *,'1/2'
125       if (id.eq.2) call initEvolve(nset)
126 c      print *,'2/3'
127       if (id.eq.3) call initAlphasPDF(nset)
128 c      print *,'3/4'
129       if (id.eq.4) call initInputPDF(nset)
130 c      print *,'4/5'
131       if (id.eq.5) call initListPDF(nset)
132 c      print *,'5/6'
133       if (id.eq.6) call initQCDparams(nset)
134 c      print *,'6/7'
135       if (id.eq.7) call initMinMax(nset)
136 c      print *,'7/8'
137       if (id.ne.8) goto 1
138       close(1)
139 c      print *,'calling InitEvolveCode',nset
140       call InitEvolveCode(nset)
141 *
142       return
143       end
144 *     
145       integer function token(s)
146       implicit none
147       character*16 s
148       integer not,i,Ctoken
149       parameter(not=8)
150       character*16 t(not)
151       data t/'Description:','Evolution:','Alphas:',
152      .                    'Parametrization:','Parameterlist:',
153      .                    'QCDparams:','MinMax:',
154      .                    'End:'/
155       integer count(not)
156       save count
157 *
158       token=0
159       do i=1,not
160          if (s.eq.t(i)) token=i
161       enddo
162       if (token.ne.0) then
163          count(token)=count(token)+1
164          if (count(token).eq.2) then
165             write(*,*) 'File description error:'
166             write(*,*) 'Second definition of entry: ',s
167             stop
168          endif
169       endif
170       return
171 *
172       entry Ctoken()
173       do i=1,not
174          count(i)=0
175       enddo
176       Ctoken=0
177       return
178 *     
179       end
180 c
181       subroutine LHAprint(iprint)
182       implicit none
183       integer lhasilent,iprint
184       common/lhasilent/lhasilent
185       lhasilent=iprint
186 c      print *,'lhasilent',lhasilent
187       return
188       end