~maddevelopers/mg5amcnlo/3.0.2-alpha0

« back to all changes in this revision

Viewing changes to Template/Source/PDF/Ctq6Pdf.f

Added Template and HELAS into bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
C============================================================================
 
2
C                CTEQ Parton Distribution Functions: Version 6
 
3
C                             January 24, 2002, v6.0
 
4
C                             April 10, 2002, v6.1
 
5
C
 
6
C   Ref: "New Generation of Parton Distributions with
 
7
C         Uncertainties from Global QCD Analysis"
 
8
C   By: J. Pumplin, D.R. Stump, J.Huston, H.L. Lai, P. Nadolsky, W.K. Tung
 
9
C       hep-ph/0201195
 
10
C
 
11
C   This package contains 3 standard sets of CTEQ6 PDF's and 40 up/down sets
 
12
C   with respect to CTEQ6M PDF's. Details are:
 
13
C ---------------------------------------------------------------------------
 
14
C  Iset   PDF        Description       Alpha_s(Mz)**Lam4  Lam5   Table_File
 
15
C ---------------------------------------------------------------------------
 
16
C   1    CTEQ6M   Standard MSbar scheme   0.118     326   226    cteq6m.tbl
 
17
C   2    CTEQ6D   Standard DIS scheme     0.118     326   226    cteq6d.tbl
 
18
C   3    CTEQ6L   Leading Order           0.118**   326** 226    cteq6l.tbl
 
19
C   4    CTEQ6L1  Leading Order           0.130     215   165    cteq6l1.tbl
 
20
C     ------------------------------
 
21
C   1xx  CTEQ6M1xx  +/- w.r.t. CTEQ6M     0.118     326   226    cteq6m1xx.tbl
 
22
C    (where xx=01--40)
 
23
C ---------------------------------------------------------------------------
 
24
C   ** ALL fits are obtained by using the same coupling strength 
 
25
C   \alpha_s(Mz)=0.118 and the NLO running \alpha_s formula, except CTEQ6L1 
 
26
C   which uses the LO running \alpha_s and its value determined from the fit.
 
27
C   For the LO fits, the evolution of the PDF and the hard cross sections are
 
28
C   calculated at LO.  More detailed discussions are given in hep-ph/0201195.
 
29
C
 
30
C   The table grids are generated for 10^-6 < x < 1 and 1.3 < Q < 10,000 (GeV).
 
31
C   PDF values outside of the above range are returned using extrapolation.
 
32
C   Lam5 (Lam4) represents Lambda value (in MeV) for 5 (4) flavors.
 
33
C   The matching alpha_s between 4 and 5 flavors takes place at Q=4.5 GeV,
 
34
C   which is defined as the bottom quark mass, whenever it can be applied.
 
35
C
 
36
C   The Table_Files are assumed to be in the working directory.
 
37
C
 
38
C   Before using the PDF, it is necessary to do the initialization by
 
39
C       Call SetCtq6(Iset)
 
40
C   where Iset is the desired PDF specified in the above table.
 
41
C
 
42
C   The function Ctq6Pdf (Iparton, X, Q)
 
43
C   returns the parton distribution inside the proton for parton [Iparton]
 
44
C   at [X] Bjorken_X and scale [Q] (GeV) in PDF set [Iset].
 
45
C   Iparton  is the parton label (5, 4, 3, 2, 1, 0, -1, ......, -5)
 
46
C                            for (b, c, s, d, u, g, u_bar, ..., b_bar),
 
47
C
 
48
C   For detailed information on the parameters used, e.q. quark masses,
 
49
C   QCD Lambda, ... etc.,  see info lines at the beginning of the
 
50
C   Table_Files.
 
51
C
 
52
C   These programs, as provided, are in double precision.  By removing the
 
53
C   "Implicit Double Precision" lines, they can also be run in single
 
54
C   precision.
 
55
C
 
56
C   If you have detailed questions concerning these CTEQ6 distributions,
 
57
C   or if you find problems/bugs using this package, direct inquires to
 
58
C   Pumplin@pa.msu.edu or Tung@pa.msu.edu.
 
59
C
 
60
C===========================================================================
 
61
 
 
62
      Function Ctq6Pdf (Iparton, X, Q)
 
63
      Implicit Double Precision (A-H,O-Z)
 
64
      Logical Warn
 
65
      Common
 
66
     > / CtqPar2 / Nx, Nt, NfMx
 
67
     > / QCDtable /  Alambda, Nfl, Iorder
 
68
 
 
69
      Data Warn /.true./
 
70
      save Warn
 
71
 
 
72
      If (X .lt. 0D0 .or. X .gt. 1D0) Then
 
73
        Print *, 'X out of range in Ctq6Pdf: ', X
 
74
        Stop
 
75
      Endif
 
76
      If (Q .lt. Alambda) Then
 
77
        Print *, 'Q out of range in Ctq6Pdf: ', Q
 
78
        Stop
 
79
      Endif
 
80
      If ((Iparton .lt. -NfMx .or. Iparton .gt. NfMx)) Then
 
81
         If (Warn) Then
 
82
C        put a warning for calling extra flavor.
 
83
             Warn = .false.
 
84
             Print *, 'Warning: Iparton out of range in Ctq6Pdf: '
 
85
     >              , Iparton
 
86
         Endif
 
87
         Ctq6Pdf = 0D0
 
88
         Return
 
89
      Endif
 
90
 
 
91
      Ctq6Pdf = PartonX6 (Iparton, X, Q)
 
92
      if(Ctq6Pdf.lt.0.D0)  Ctq6Pdf = 0.D0
 
93
 
 
94
      Return
 
95
 
 
96
C                             ********************
 
97
      End
 
98
 
 
99
      Subroutine SetCtq6 (Iset)
 
100
      Implicit Double Precision (A-H,O-Z)
 
101
      Parameter (Isetmax0=4)
 
102
      Character Flnm(Isetmax0)*6, nn*3, Tablefile*40
 
103
      Data (Flnm(I), I=1,Isetmax0)
 
104
     > / 'cteq6m', 'cteq6d', 'cteq6l', 'cteq6l'/
 
105
      Data Isetold, Isetmin0, Isetmin1, Isetmax1 /-987,1,101,140/
 
106
      save
 
107
 
 
108
C             If data file not initialized, do so.
 
109
      If(Iset.ne.Isetold) then
 
110
         IU= NextUn6()
 
111
         If (Iset.ge.Isetmin0 .and. Iset.le.3) Then
 
112
            Tablefile=Flnm(Iset)//'.tbl'
 
113
         Elseif (Iset.eq.Isetmax0) Then
 
114
            Tablefile=Flnm(Iset)//'1.tbl'
 
115
         Elseif (Iset.ge.Isetmin1 .and. Iset.le.Isetmax1) Then
 
116
            write(nn,'(I3)') Iset
 
117
            Tablefile=Flnm(1)//nn//'.tbl'
 
118
         Else
 
119
            Print *, 'Invalid Iset number in SetCtq6 :', Iset
 
120
            Stop
 
121
         Endif
 
122
c     Open(IU, File='Pdfdata/'//Tablefile, Status='OLD', Err=100)
 
123
            call OpenData(TableFile)
 
124
 21      Call ReadTbl6 (IU)
 
125
         Close (IU)
 
126
         Isetold=Iset
 
127
      Endif
 
128
      Return
 
129
 
 
130
 100  Print *, ' Data file ', Tablefile, ' cannot be opened '
 
131
     >//'in SetCtq6!!'
 
132
      Stop
 
133
C                             ********************
 
134
      End
 
135
 
 
136
      Subroutine ReadTbl6 (Nu)
 
137
      Implicit Double Precision (A-H,O-Z)
 
138
      Character Line*80
 
139
      PARAMETER (MXX = 96, MXQ = 20, MXF = 5)
 
140
      PARAMETER (MXPQX = (MXF + 3) * MXQ * MXX)
 
141
      Common
 
142
     > / CtqPar1 / Al, XV(0:MXX), TV(0:MXQ), UPD(MXPQX)
 
143
     > / CtqPar2 / Nx, Nt, NfMx
 
144
     > / XQrange / Qini, Qmax, Xmin
 
145
     > / QCDtable /  Alambda, Nfl, Iorder
 
146
     > / Masstbl / Amass(6)
 
147
 
 
148
      Read  (Nu, '(A)') Line
 
149
      Read  (Nu, '(A)') Line
 
150
      Read  (Nu, *) Dr, Fl, Al, (Amass(I),I=1,6)
 
151
      Iorder = Nint(Dr)
 
152
      Nfl = Nint(Fl)
 
153
      Alambda = Al
 
154
 
 
155
      Read  (Nu, '(A)') Line
 
156
      Read  (Nu, *) NX,  NT, NfMx
 
157
 
 
158
      Read  (Nu, '(A)') Line
 
159
      Read  (Nu, *) QINI, QMAX, (TV(I), I =0, NT)
 
160
 
 
161
      Read  (Nu, '(A)') Line
 
162
      Read  (Nu, *) XMIN, (XV(I), I =0, NX)
 
163
 
 
164
      Do 11 Iq = 0, NT
 
165
         TV(Iq) = Log(Log (TV(Iq) /Al))
 
166
   11 Continue
 
167
C
 
168
C                  Since quark = anti-quark for nfl>2 at this stage,
 
169
C                  we Read  out only the non-redundent data points
 
170
C     No of flavors = NfMx (sea) + 1 (gluon) + 2 (valence)
 
171
 
 
172
      Nblk = (NX+1) * (NT+1)
 
173
      Npts =  Nblk  * (NfMx+3)
 
174
      Read  (Nu, '(A)') Line
 
175
      Read  (Nu, *, IOSTAT=IRET) (UPD(I), I=1,Npts)
 
176
 
 
177
      Return
 
178
C                        ****************************
 
179
      End
 
180
 
 
181
      Function NextUn6()
 
182
C                                 Returns an unallocated FORTRAN i/o unit.
 
183
      Logical EX
 
184
C
 
185
      Do 10 N = 10, 300
 
186
         INQUIRE (UNIT=N, OPENED=EX)
 
187
         If (.NOT. EX) then
 
188
            NextUn6 = N
 
189
            Return
 
190
         Endif
 
191
 10   Continue
 
192
      Stop ' There is no available I/O unit. '
 
193
C               *************************
 
194
      End
 
195
C
 
196
 
 
197
      SUBROUTINE POLINT6 (XA,YA,N,X,Y,DY)
 
198
 
 
199
      IMPLICIT DOUBLE PRECISION (A-H, O-Z)
 
200
C                                        Adapted from "Numerical Recipes"
 
201
      PARAMETER (NMAX=10)
 
202
      DIMENSION XA(N),YA(N),C(NMAX),D(NMAX)
 
203
      NS=1
 
204
      DIF=ABS(X-XA(1))
 
205
      DO 11 I=1,N
 
206
        DIFT=ABS(X-XA(I))
 
207
        IF (DIFT.LT.DIF) THEN
 
208
          NS=I
 
209
          DIF=DIFT
 
210
        ENDIF
 
211
        C(I)=YA(I)
 
212
        D(I)=YA(I)
 
213
11    CONTINUE
 
214
      Y=YA(NS)
 
215
      NS=NS-1
 
216
      DO 13 M=1,N-1
 
217
        DO 12 I=1,N-M
 
218
          HO=XA(I)-X
 
219
          HP=XA(I+M)-X
 
220
          W=C(I+1)-D(I)
 
221
          DEN=HO-HP
 
222
          IF(DEN.EQ.0.) stop
 
223
          DEN=W/DEN
 
224
          D(I)=HP*DEN
 
225
          C(I)=HO*DEN
 
226
12      CONTINUE
 
227
        IF (2*NS.LT.N-M)THEN
 
228
          DY=C(NS+1)
 
229
        ELSE
 
230
          DY=D(NS)
 
231
          NS=NS-1
 
232
        ENDIF
 
233
        Y=Y+DY
 
234
13    CONTINUE
 
235
      RETURN
 
236
      END
 
237
 
 
238
      Function PartonX6 (IPRTN, XX, QQ)
 
239
 
 
240
c  Given the parton distribution function in the array U in
 
241
c  COMMON / PEVLDT / , this routine interpolates to find
 
242
c  the parton distribution at an arbitray point in x and q.
 
243
c
 
244
      Implicit Double Precision (A-H,O-Z)
 
245
 
 
246
      Parameter (MXX = 96, MXQ = 20, MXF = 5)
 
247
      Parameter (MXQX= MXQ * MXX,   MXPQX = MXQX * (MXF+3))
 
248
 
 
249
      Common
 
250
     > / CtqPar1 / Al, XV(0:MXX), TV(0:MXQ), UPD(MXPQX)
 
251
     > / CtqPar2 / Nx, Nt, NfMx
 
252
     > / XQrange / Qini, Qmax, Xmin
 
253
 
 
254
      Dimension fvec(4), fij(4)
 
255
      Dimension xvpow(0:mxx)
 
256
      Data OneP / 1.00001 /
 
257
      Data xpow / 0.3d0 /       !**** choice of interpolation variable
 
258
      Data nqvec / 4 /
 
259
      Data ientry / 0 /
 
260
      Save ientry,xvpow
 
261
 
 
262
c store the powers used for interpolation on first call...
 
263
      if(ientry .eq. 0) then
 
264
         ientry = 1
 
265
 
 
266
         xvpow(0) = 0D0
 
267
         do i = 1, nx
 
268
            xvpow(i) = xv(i)**xpow
 
269
         enddo
 
270
      endif
 
271
 
 
272
      X = XX
 
273
      Q = QQ
 
274
      tt = log(log(Q/Al))
 
275
 
 
276
c      -------------    find lower end of interval containing x, i.e.,
 
277
c                       get jx such that xv(jx) .le. x .le. xv(jx+1)...
 
278
      JLx = -1
 
279
      JU = Nx+1
 
280
 11   If (JU-JLx .GT. 1) Then
 
281
         JM = (JU+JLx) / 2
 
282
         If (X .Ge. XV(JM)) Then
 
283
            JLx = JM
 
284
         Else
 
285
            JU = JM
 
286
         Endif
 
287
         Goto 11
 
288
      Endif
 
289
C                     Ix    0   1   2      Jx  JLx         Nx-2     Nx
 
290
C                           |---|---|---|...|---|-x-|---|...|---|---|
 
291
C                     x     0  Xmin               x                 1
 
292
C
 
293
      If     (JLx .LE. -1) Then
 
294
        Print '(A,1pE12.4)', 'Severe error: x <= 0 in PartonX6! x = ', x
 
295
        Stop
 
296
      ElseIf (JLx .Eq. 0) Then
 
297
         Jx = 0
 
298
      Elseif (JLx .LE. Nx-2) Then
 
299
 
 
300
C                For interrior points, keep x in the middle, as shown above
 
301
         Jx = JLx - 1
 
302
      Elseif (JLx.Eq.Nx-1 .or. x.LT.OneP) Then
 
303
 
 
304
C                  We tolerate a slight over-shoot of one (OneP=1.00001),
 
305
C              perhaps due to roundoff or whatever, but not more than that.
 
306
C                                      Keep at least 4 points >= Jx
 
307
         Jx = JLx - 2
 
308
      Else
 
309
        Print '(A,1pE12.4)', 'Severe error: x > 1 in PartonX6! x = ', x
 
310
        Stop
 
311
      Endif
 
312
C          ---------- Note: JLx uniquely identifies the x-bin; Jx does not.
 
313
 
 
314
C                       This is the variable to be interpolated in
 
315
      ss = x**xpow
 
316
 
 
317
      If (JLx.Ge.2 .and. JLx.Le.Nx-2) Then
 
318
 
 
319
c     initiation work for "interior bins": store the lattice points in s...
 
320
      svec1 = xvpow(jx)
 
321
      svec2 = xvpow(jx+1)
 
322
      svec3 = xvpow(jx+2)
 
323
      svec4 = xvpow(jx+3)
 
324
 
 
325
      s12 = svec1 - svec2
 
326
      s13 = svec1 - svec3
 
327
      s23 = svec2 - svec3
 
328
      s24 = svec2 - svec4
 
329
      s34 = svec3 - svec4
 
330
 
 
331
      sy2 = ss - svec2
 
332
      sy3 = ss - svec3
 
333
 
 
334
c constants needed for interpolating in s at fixed t lattice points...
 
335
      const1 = s13/s23
 
336
      const2 = s12/s23
 
337
      const3 = s34/s23
 
338
      const4 = s24/s23
 
339
      s1213 = s12 + s13
 
340
      s2434 = s24 + s34
 
341
      sdet = s12*s34 - s1213*s2434
 
342
      tmp = sy2*sy3/sdet
 
343
      const5 = (s34*sy2-s2434*sy3)*tmp/s12
 
344
      const6 = (s1213*sy2-s12*sy3)*tmp/s34
 
345
 
 
346
      EndIf
 
347
 
 
348
c         --------------Now find lower end of interval containing Q, i.e.,
 
349
c                          get jq such that qv(jq) .le. q .le. qv(jq+1)...
 
350
      JLq = -1
 
351
      JU = NT+1
 
352
 12   If (JU-JLq .GT. 1) Then
 
353
         JM = (JU+JLq) / 2
 
354
         If (tt .GE. TV(JM)) Then
 
355
            JLq = JM
 
356
         Else
 
357
            JU = JM
 
358
         Endif
 
359
         Goto 12
 
360
       Endif
 
361
 
 
362
      If     (JLq .LE. 0) Then
 
363
         Jq = 0
 
364
      Elseif (JLq .LE. Nt-2) Then
 
365
C                                  keep q in the middle, as shown above
 
366
         Jq = JLq - 1
 
367
      Else
 
368
C                         JLq .GE. Nt-1 case:  Keep at least 4 points >= Jq.
 
369
        Jq = Nt - 3
 
370
 
 
371
      Endif
 
372
C                                   This is the interpolation variable in Q
 
373
 
 
374
      If (JLq.GE.1 .and. JLq.LE.Nt-2) Then
 
375
c                                        store the lattice points in t...
 
376
      tvec1 = Tv(jq)
 
377
      tvec2 = Tv(jq+1)
 
378
      tvec3 = Tv(jq+2)
 
379
      tvec4 = Tv(jq+3)
 
380
 
 
381
      t12 = tvec1 - tvec2
 
382
      t13 = tvec1 - tvec3
 
383
      t23 = tvec2 - tvec3
 
384
      t24 = tvec2 - tvec4
 
385
      t34 = tvec3 - tvec4
 
386
 
 
387
      ty2 = tt - tvec2
 
388
      ty3 = tt - tvec3
 
389
 
 
390
      tmp1 = t12 + t13
 
391
      tmp2 = t24 + t34
 
392
 
 
393
      tdet = t12*t34 - tmp1*tmp2
 
394
 
 
395
      EndIf
 
396
 
 
397
 
 
398
c get the pdf function values at the lattice points...
 
399
 
 
400
      If (Iprtn .GE. 3) Then
 
401
         Ip = - Iprtn
 
402
      Else
 
403
         Ip = Iprtn
 
404
      EndIf
 
405
      jtmp = ((Ip + NfMx)*(NT+1)+(jq-1))*(NX+1)+jx+1
 
406
 
 
407
      Do it = 1, nqvec
 
408
 
 
409
         J1  = jtmp + it*(NX+1)
 
410
 
 
411
       If (Jx .Eq. 0) Then
 
412
C                          For the first 4 x points, interpolate x^2*f(x,Q)
 
413
C                           This applies to the two lowest bins JLx = 0, 1
 
414
C            We can not put the JLx.eq.1 bin into the "interrior" section
 
415
C                           (as we do for q), since Upd(J1) is undefined.
 
416
         fij(1) = 0
 
417
         fij(2) = Upd(J1+1) * XV(1)**2
 
418
         fij(3) = Upd(J1+2) * XV(2)**2
 
419
         fij(4) = Upd(J1+3) * XV(3)**2
 
420
C
 
421
C                 Use Polint6 which allows x to be anywhere w.r.t. the grid
 
422
 
 
423
         Call Polint6 (XVpow(0), Fij(1), 4, ss, Fx, Dfx)
 
424
 
 
425
         If (x .GT. 0D0)  Fvec(it) =  Fx / x**2
 
426
C                                              Pdf is undefined for x.eq.0
 
427
       ElseIf  (JLx .Eq. Nx-1) Then
 
428
C                                                This is the highest x bin:
 
429
 
 
430
        Call Polint6 (XVpow(Nx-3), Upd(J1), 4, ss, Fx, Dfx)
 
431
 
 
432
        Fvec(it) = Fx
 
433
 
 
434
       Else
 
435
C                       for all interior points, use Jon's in-line function
 
436
C                              This applied to (JLx.Ge.2 .and. JLx.Le.Nx-2)
 
437
         sf2 = Upd(J1+1)
 
438
         sf3 = Upd(J1+2)
 
439
 
 
440
         g1 =  sf2*const1 - sf3*const2
 
441
         g4 = -sf2*const3 + sf3*const4
 
442
 
 
443
         Fvec(it) = (const5*(Upd(J1)-g1)
 
444
     &               + const6*(Upd(J1+3)-g4)
 
445
     &               + sf2*sy3 - sf3*sy2) / s23
 
446
 
 
447
       Endif
 
448
 
 
449
      enddo
 
450
C                                   We now have the four values Fvec(1:4)
 
451
c     interpolate in t...
 
452
 
 
453
      If (JLq .LE. 0) Then
 
454
C                         1st Q-bin, as well as extrapolation to lower Q
 
455
        Call Polint6 (TV(0), Fvec(1), 4, tt, ff, Dfq)
 
456
 
 
457
      ElseIf (JLq .GE. Nt-1) Then
 
458
C                         Last Q-bin, as well as extrapolation to higher Q
 
459
        Call Polint6 (TV(Nt-3), Fvec(1), 4, tt, ff, Dfq)
 
460
      Else
 
461
C                         Interrior bins : (JLq.GE.1 .and. JLq.LE.Nt-2)
 
462
C       which include JLq.Eq.1 and JLq.Eq.Nt-2, since Upd is defined for
 
463
C                         the full range QV(0:Nt)  (in contrast to XV)
 
464
        tf2 = fvec(2)
 
465
        tf3 = fvec(3)
 
466
 
 
467
        g1 = ( tf2*t13 - tf3*t12) / t23
 
468
        g4 = (-tf2*t34 + tf3*t24) / t23
 
469
 
 
470
        h00 = ((t34*ty2-tmp2*ty3)*(fvec(1)-g1)/t12
 
471
     &    +  (tmp1*ty2-t12*ty3)*(fvec(4)-g4)/t34)
 
472
 
 
473
        ff = (h00*ty2*ty3/tdet + tf2*ty3 - tf3*ty2) / t23
 
474
      EndIf
 
475
 
 
476
      PartonX6 = ff
 
477
 
 
478
      Return
 
479
C                                       ********************
 
480
      End