4 c----------------------------------------------------------------------
5 subroutine paramini(imod)
6 c----------------------------------------------------------------------
7 c Set parameters of the parametrisation of the eikonals.
9 c xDfit=Sum(i=0,1)(alpD(i)*xp**betDp(i)*xm**betDpp(i)*s**betD(i)
10 c *xs**(gamD(i)*b2)*exp(-b2/delD(i))
12 c Parameters stored in /Dparam/ (epos.inc)
13 c if imod=0, do settings only for iclpro, if imod=1, do settings
14 c for iclpro=2 and iclpro
15 c----------------------------------------------------------------------
21 double precision PhiExact,y
22 call utpri('parini',ish,ishini,3)
24 c Initialisation of the variables
26 call Class('paramini ')
28 c Variables used for xparg (only graphical application)
30 spmin=4.*q2min !Definition of spmin in psvin (epos-sha)
31 sfshlim=5.*spmin !transition energy for soft->hard
32 emaxDf=engy !energy for fit subroutines
33 smaxDf=emaxDf**2 !energy squared for fit subroutines
35 nptf=10 !number of point for the fit
36 xmaxDf=1.d0 !maximum limit for the fit
37 xminDf=1.d0/dble(smaxDf) !minimum limit
38 xshmin=3.d-2 !minimum limit for sh variance fit
39 if(smaxDf.lt.sfshlim) xshmin=1.d0
40 xfitmin=0.1d0 !sh fitted between f(1) and f(1)*xfitmin
41 if(smaxDf.lt.sfshlim) xfitmin=1.d0
43 bmaxDf=2. !maximum b for variance fit
45 idxDmin=idxD0 !minimum indice for parameters
46 ntymin=ntymi !minimum indice for diagram type
48 ucfpro=utgam1(1.+alplea(iclpro))
49 ucftar=utgam1(1.+alplea(icltar))
55 c for pi or K - p crosse section calculation, we need alpD, ... for
56 c iclpro=1 or 3 and iclpro=2
63 if(iiiclpro1.lt.iiiclpro2)iiidirec=-1
67 do iiipro=iiiclpro2,iiiclpro1,iiidirec
71 if(ish.ge.4)write(ifch,*)'gamini'
72 & ,iscreen,iclpro,icltar,iclegy,engy,sfshlim
74 if(isetcs.le.1)then !if set mode, do fit
76 c First try for fit parameters
78 c linear fit of the 2 components of G as a function of x
79 call pompar(alpsf,betsf,0) !soft (taking into account hard)
80 call pompar(alpsh,betsh,1) !sh
81 c Gaussian fit of the 2 components of G as a function of x and b
82 call variance(delsf,gamsf,0)
83 call variance(delsh,gamsh,1)
92 numminDf=3 !minimum indice
93 numparDf=4 !maximum indice
94 betac=100. !temperature for chi2
95 betae=1. !temperature for error
96 fparDf=0.8 !variation amplitude for range
98 nmcxDf=20000 !number of try for x fit
107 if(smaxDf.ge.3.*sfshlim)then
108 call paramx !alpD and betD
110 call pompar(alpsf,betsf,-1) !soft (taking into account hard)
112 parDf(2,3)=max(-0.95+alppar,betsf)
122 else !else parameters from table (inirj)
125 al=1.+(log(engy)-log(egylow))/log(egyfac) !energy class
126 i2=min(iiiclegy+1,iclegy2)
135 !linear interpolation
136 alpsf=alpDs(nbpsf,i2,iclpro,icltar)*dl
137 & +alpDs(nbpsf,i1,iclpro,icltar)*dl1
138 alpsh=alpDs(1,i2,iclpro,icltar)*dl
139 & +alpDs(1,i1,iclpro,icltar)*dl1
140 betsf=betDs(nbpsf,i2,iclpro,icltar)*dl
141 & +betDs(nbpsf,i1,iclpro,icltar)*dl1
142 betsh=betDs(1,i2,iclpro,icltar)*dl
143 & +betDs(1,i1,iclpro,icltar)*dl1
144 gamsf=gamDs(nbpsf,i2,iclpro,icltar)*dl
145 & +gamDs(nbpsf,i1,iclpro,icltar)*dl1
146 gamsh=gamDs(1,i2,iclpro,icltar)*dl
147 & +gamDs(1,i1,iclpro,icltar)*dl1
148 delsf=delDs(nbpsf,i2,iclpro,icltar)*dl
149 & +delDs(nbpsf,i1,iclpro,icltar)*dl1
150 delsh=delDs(1,i2,iclpro,icltar)*dl
151 & +delDs(1,i1,iclpro,icltar)*dl1
162 c if energy too small to have semi-hard interaction -> only soft diagram
164 if(smaxDf.lt.sfshlim.and.idxD0.eq.0)then !no hard: soft+hard=soft
177 write(ifch,*)"parameters for iclpro:",iclpro
178 write(ifch,*)"alp,bet,gam,del sf:",alpsf,betsf,gamsf,delsf
179 write(ifch,*)"alp,bet,gam,del sh:",alpsh,betsh,gamsh,delsh
186 alpD(idxD0,iclpro,icltar)=alpsf
187 alpDp(idxD0,iclpro,icltar)=0.
188 alpDpp(idxD0,iclpro,icltar)=0.
189 betD(idxD0,iclpro,icltar)=betsf
190 betDp(idxD0,iclpro,icltar)=betsf
191 betDpp(idxD0,iclpro,icltar)=betsf
192 gamD(idxD0,iclpro,icltar)=gamsf
193 delD(idxD0,iclpro,icltar)=delsf
195 alpD(1,iclpro,icltar)=alpsh
196 alpDp(1,iclpro,icltar)=0.
197 alpDpp(1,iclpro,icltar)=0.
198 betD(1,iclpro,icltar)=betsh
199 betDp(1,iclpro,icltar)=betsh
200 betDpp(1,iclpro,icltar)=betsh
201 gamD(1,iclpro,icltar)=gamsh
202 delD(1,iclpro,icltar)=delsh
204 if(iomega.lt.2.and.alpdif.ne.1.)then
205 alpDp(2,iclpro,icltar)=0.
206 alpDpp(2,iclpro,icltar)=0.
207 betD(2,iclpro,icltar)=0. !max(0.,betsf)
210 betDp(2,iclpro,icltar)=-alpdif+alppar
211 betDpp(2,iclpro,icltar)=-alpdif+alppar
212 c alpD(2,iclpro,icltar)=(alpsf+alpsh)*wdiff(iclpro)*wdiff(icltar)
213 alpD(2,iclpro,icltar)=wdiff(iclpro)*wdiff(icltar)
214 & /utgam1(1.-alpdif)**2
215 & *utgam1(2.-alpdif+alplea(iclpro))
216 & *utgam1(2.-alpdif+alplea(icltar))
217 & /chad(iclpro)/chad(icltar)
219 gamD(2,iclpro,icltar)=0.
220 delD(2,iclpro,icltar)=4.*.0389*(gwidth*(r2had(iclpro)
221 & +r2had(icltar))+slopoms*log(smaxDf))
223 alpD(2,iclpro,icltar)=0.
224 alpDp(2,iclpro,icltar)=0.
225 alpDpp(2,iclpro,icltar)=0.
226 betD(2,iclpro,icltar)=0.
227 betDp(2,iclpro,icltar)=0.
228 betDpp(2,iclpro,icltar)=0.
229 gamD(2,iclpro,icltar)=0.
230 delD(2,iclpro,icltar)=1.
232 if(ish.ge.4)write(ifch,*)"alp,bet,betp,del dif:"
233 & ,alpD(2,iclpro,icltar),betD(2,iclpro,icltar)
234 & ,betDp(2,iclpro,icltar),delD(2,iclpro,icltar)
237 bmxdif(iclpro,icltar)=conbmxdif() !important to do it before kfit, because it's used in.
238 c call Kfit(-1) !xkappafit not used : if arg=-1, set xkappafit to 1
241 call Kfit(-1) !xkappafit not used : if arg=-1, set xkappafit to 1)
243 c call Kfit(-1) !xkappafit not used : if arg=-1, set xkappafit to 1)
246 c for plots record alpDs, betDs, etc ...
247 alpDs(idxD0,iclegy,iclpro,icltar)=alpsf
248 alpDps(idxD0,iclegy,iclpro,icltar)=0.
249 alpDpps(idxD0,iclegy,iclpro,icltar)=0.
250 betDs(idxD0,iclegy,iclpro,icltar)=betsf
251 betDps(idxD0,iclegy,iclpro,icltar)=betsf
252 betDpps(idxD0,iclegy,iclpro,icltar)=betsf
253 gamDs(idxD0,iclegy,iclpro,icltar)=gamsf
254 delDs(idxD0,iclegy,iclpro,icltar)=delsf
256 alpDs(1,iclegy,iclpro,icltar)=alpsh
257 alpDps(1,iclegy,iclpro,icltar)=0.
258 alpDpps(1,iclegy,iclpro,icltar)=0.
259 betDs(1,iclegy,iclpro,icltar)=betsh
260 betDps(1,iclegy,iclpro,icltar)=betsh
261 betDpps(1,iclegy,iclpro,icltar)=betsh
262 gamDs(1,iclegy,iclpro,icltar)=gamsh
263 delDs(1,iclegy,iclpro,icltar)=delsh
268 if(iclpro.ne.iclprosave)stop'problem in parini with iclpro'
270 if(ish.ge.4)then !check PhiExact value for x=1
271 y=PhiExact(1.,1.d0,1.d0,smaxDf,0.)
272 write(ifch,*)'PhiExact=',y
275 call utprix('parini',ish,ishini,3)
280 c----------------------------------------------------------------------
281 subroutine Class(text)
282 c----------------------------------------------------------------------
284 include 'epos.incpar'
285 parameter (eps=1.e-5) !to correct for precision problem)
287 if(iclegy1.eq.iclegy2)then
290 iclegy=1+int( (log(engy)-log(egylow))/log(egyfac) + eps ) !energy class
291 if(iclegy.gt.iclegy2)then
292 write(ifch,*)'***********************************************'
293 write(ifch,*)'Warning in ',text
294 write(ifch,*)'Energy above the range used for the fit of D:'
295 write(ifch,*)egylow*egyfac**(iclegy1-1),egylow*egyfac**iclegy2
296 write(ifch,*)'***********************************************'
299 if(iclegy.lt.iclegy1)then
300 write(ifch,*)'***********************************************'
301 write(ifch,*)'Warning in ',text
302 write(ifch,*)'Energy below the range used for the fit of D:'
303 write(ifch,*)egylow*egyfac**(iclegy1-1),egylow*egyfac**iclegy2
304 write(ifch,*)'***********************************************'
310 c----------------------------------------------------------------------
312 c----------------------------------------------------------------------
313 c Set the parameter of the parametrisation of the eikonale.
314 c We group the parameters into 4 array with a dimension of idxD1(=1)
315 c to define xDfit (see below).
317 c xDfit=Sum(i,0,1)(alpD(i)*xp**betDp(i)*xm**betDpp(i)*s**betD(i)
318 c *xs**(gamD(i)*b2)*exp(-b2/delD(i))
320 c subroutine used for tabulation.
321 c----------------------------------------------------------------------
323 include 'epos.incsem'
324 include 'epos.incpar'
326 c Initialisation of the variables
328 emaxDf=egyfac**(iclegy-1)*egylow
331 spmin=4.*q2min !Definition of spmin in psvin (epos-sha)
335 xminDf=1d0/dble(smaxDf)
336 xshmin=3.d-2 !minimum limit for sh variance fit
337 if(smaxDf.lt.sfshlim) xshmin=1.d0
338 xfitmin=0.1d0 !sh fitted between f(1) and f(1)*xfitmin
339 if(smaxDf.lt.sfshlim) xfitmin=1.d0
343 if(idxD0.ne.0.and.idxD1.ne.1) stop "* idxD0/1 are not good! *"
348 c Initialisation of the parameters
356 c.......Calculations of the parameters
358 c First try for fit parameters
360 c linear fit of the 2 components of G as a function of x
361 call pompar(alpsf,betsf,0) !soft
362 call pompar(alpsh,betsh,1) !sh
363 c Gaussian fit of the 2 components of G as a function of x and b
364 call variance(delsf,gamsf,0)
365 call variance(delsh,gamsh,1)
372 numminDf=3 !minimum indice
373 numparDf=4 !maximum indice
374 betac=100. !temperature for chi2
375 betae=1. !temperature for error
376 fparDf=0.8 !variation amplitude for range
378 nmcxDf=20000 !number of try for x fit
387 if(smaxDf.ge.3.*sfshlim)then
388 call paramx !alpD and betD
390 call pompar(alpsf,betsf,-1) !soft (taking into account hard)
392 parDf(2,3)=max(-0.95+alppar,betsf)
402 write(ifch,*)"param: fit parameters :",iscreen,iclpro,icltar
404 write(ifch,*)"alp,bet,gam,del sf:",alpsf,betsf,gamsf,delsf
405 write(ifch,*)"alp,bet,gam,del sh:",alpsh,betsh,gamsh,delsh
408 alpDs(idxD0,iclegy,iclpro,icltar)=alpsf
409 alpDps(idxD0,iclegy,iclpro,icltar)=betsf
410 alpDpps(idxD0,iclegy,iclpro,icltar)=0.
411 betDs(idxD0,iclegy,iclpro,icltar)=betsf
412 betDps(idxD0,iclegy,iclpro,icltar)=betsf
413 betDpps(idxD0,iclegy,iclpro,icltar)=betsf
414 gamDs(idxD0,iclegy,iclpro,icltar)=gamsf
415 delDs(idxD0,iclegy,iclpro,icltar)=delsf
417 alpDs(1,iclegy,iclpro,icltar)=alpsh
418 alpDps(1,iclegy,iclpro,icltar)=betsh
419 alpDpps(1,iclegy,iclpro,icltar)=0.
420 betDs(1,iclegy,iclpro,icltar)=betsh
421 betDps(1,iclegy,iclpro,icltar)=betsh
422 betDpps(1,iclegy,iclpro,icltar)=betsh
423 gamDs(1,iclegy,iclpro,icltar)=gamsh
424 delDs(1,iclegy,iclpro,icltar)=delsh
432 c----------------------------------------------------------------------
434 subroutine pompar(alpha,beta,iqq)
436 c----------------------------------------------------------------------
437 c Return the power beta and the factor alpha of the fit of the eikonal
438 c of a pomeron of type iqq : D(X)=alpha*(X)**beta
439 c----------------------------------------------------------------------
442 include 'epos.incsem'
443 include 'epos.incpar'
444 double precision X,D1,D0,X0,D,droot
445 double precision Dsoftshval,xmax
446 dimension xlnXs(maxdataDf),xlnD(maxdataDf),sigma(maxdataDf)
455 xmax=min(0.1d0,10.d0*xminDf)
457 if(ish.ge.4)write (ifch,*) 'pompar (0) x0,xmax=',X0,xmax
461 if (i.ne.0) X=X*(xmax/X0)**(dble(i)/dble(nptf-1))
462 D=max(1.d-10,Dsoftshval(real(X)*smaxDf,X,0.d0,0.,iscr))
465 & "Warning in pompar ! Dsoftshval(0) could be negative"
468 xlnXs(i+1)=real(dlog(X*dble(smaxDf)))
469 xlnD(i+1)=real(dlog(D))
473 c Fit of D(X) between X0 and xmax
475 call fit(xlnXs,xlnD,nptf,sigma,0,a,beta)
476 if(beta.gt.10.)beta=10.
478 alpha=real(Dsoftshval(real(X0)*smaxDf,X0,0.d0,0.,iscr))
479 & *(real(X0)*smaxDf)**(-beta)
482 elseif(iqq.eq.1.and.xfitmin.ne.1.d0) then
487 c Definition of D0=D(X0)
489 D1=Dsoftshval(real(xmax)*smaxDf,xmax,0.d0,0.,iscr)
493 c Calculation of X0 and D(X)
495 X0=droot(D0,D1,xmax,iscr)
496 if(ish.ge.4)write (ifch,*) 'pompar (1) x0,xmax=',X0,xmax
500 if (i.ne.0) X=X*(xmax/X0)**(dble(i)/dble(nptf-1))
501 D=max(1.d-10,Dsoftshval(real(X)*smaxDf,X,0.d0,0.,iscr))
504 & "Warning in pompar ! Dsoftshval(1) could be negative"
507 xlnXs(i+1)=real(dlog(X*dble(smaxDf)))
508 xlnD(i+1)=real(dlog(D))
512 c Fit of D(X) between X0 and xmax
514 call fit(xlnXs,xlnD,nptf,sigma,0,a,beta)
515 if(beta.gt.10.)beta=10.
517 alpha=real(Dsoftshval(real(xmax)*smaxDf,xmax,0.d0,0.,iscr))
518 & *(real(xmax)*smaxDf)**(-beta)
521 elseif(iqq.eq.10.and.xfitmin.ne.1.d0) then ! iqq=10
524 xmax=1.d0 !2.d0/max(2.d0,dlog(dble(smaxDf)/1.d3))
526 c Definition of D0=D(X0)
528 D1=Dsoftshval(real(xmax)*smaxDf,xmax,0.d0,0.,iscr)
532 c Calculation of X0 and D(X)
534 X0=droot(D0,D1,xmax,iscr)
535 if(ish.ge.4)write (ifch,*) 'pompar (1) x0,xmax=',X0,xmax
539 if (i.ne.0) X=X*(xmax/X0)**(dble(i)/dble(nptf-1))
540 D=max(1.d-10,Dsoftshval(real(X)*smaxDf,X,0.d0,0.,iscr))
543 & "Warning in pompar ! Dsoftshval(10) could be negative"
546 xlnXs(i+1)=real(dlog(X*dble(smaxDf)))
547 xlnD(i+1)=real(dlog(D))
551 c Fit of D(X) between X0 and xmax
553 call fit(xlnXs,xlnD,nptf,sigma,0,a,beta)
554 if(beta.gt.10.)beta=10.
556 alpha=real(Dsoftshval(real(xmax)*smaxDf,xmax,0.d0,0.,iscr))
557 & *(real(xmax)*smaxDf)**(-beta)
561 else !iqq=-1 or iqq=1 and xfitmin=1
563 c Calculation of X0 and D(X)
567 xmax=max(2.d0/dble(smaxDf),
568 & min(max(0.03d0,dble(smaxDf)/2.d5),0.1d0))
570 if(ish.ge.4)write (ifch,*) 'pompar (-1) x0,xmax=',X0,xmax
574 if (i.ne.0) X=X*(xmax/X0)**(dble(i)/dble(nptf-1))
575 D=max(1.d-10,Dsoftshval(real(X)*smaxDf,X,0.d0,0.,iscr))
578 & "Warning in pompar ! Dsoftshval(-1) could be negative"
581 xlnXs(i+1)=real(dlog(X*dble(smaxDf)))
582 xlnD(i+1)=real(dlog(D))
585 c Fit of D(X) between X0 and xmax
587 call fit(xlnXs,xlnD,nptf,sigma,0,a,beta)
588 if(beta.gt.10.)beta=10.
591 alpha=real(Dsoftshval(real(xmax)*smaxDf,xmax,0.d0,0.,iscr))
592 & *(real(xmax)*smaxDf)**(-beta)
595 if(ish.ge.4)write(ifch,*) '%%%%%%%%%%%%% pompar %%%%%%%%%%%%%'
596 if(ish.ge.4)write(ifch,*) 'alpD ini =',alpha,' betD ini=',beta
601 c----------------------------------------------------------------------
603 double precision function droot(d0,d1,xmax,iscr)
605 c----------------------------------------------------------------------
606 c Find x0 which gives f(x0)=D(x0*S)-d0=0
608 c iqq=1 semi-hard pomeron
609 c----------------------------------------------------------------------
611 include 'epos.incsem'
612 include 'epos.incpar'
613 double precision Dsoftshval,d0,d1,d2,x0,x1,x2,f0,f1,f2,xmax
614 parameter (kmax=1000)
618 x0=min(xfitmin,100.d0*xminDf)
620 5 d2=dabs(Dsoftshval(real(x0)*smaxDf,x0,0.d0,0.,iscr))
621 if(d2.lt.1.d-10.and.x0.lt.x1)then
623 c write(ifch,*)"droot",x0,x1,d0,d1,d2
626 droot=max(x0,xfitmin)
627 c write(ifch,*)"droot",x0,x1,d0,d1,d2
632 if(f0*f1.lt.0.d0)then
636 d2=dabs(Dsoftshval(real(x2)*smaxDf,x2,0.d0,0.,iscr))
639 c write (ifch,*) '******************* droot **************'
640 c write (ifch,*) x0,x1,x2,f0,f1,f2
642 if (f0*f2.lt.0.D0) then
650 if (dabs((x1-x0)/x1).gt.(1.D-5).and.k.le.kmax.and.x1.ne.x0) then
654 write(ifch,*)'??? Warning in Droot: Delta=',dabs((x1-x0)/x1)
655 c.........stop 'Error in Droot, too many steps'
667 c----------------------------------------------------------------------
669 double precision function drootom(d0,dmax,bmax,eps)
671 c----------------------------------------------------------------------
672 c Find b0 which gives f(b0)=(1-exp(-om(b0,iqq)))/dmax-d0=0
674 include 'epos.incsem'
675 include 'epos.incpar'
676 double precision om1intbc,d0,d1,d2,f0,f1,f2,dmax
677 parameter (kmax=1000)
683 d2=(1.d0-exp(-om1intbc(b1)))/dmax
686 c write(*,*)"drootom exit (1)",b0,b1,d0,d1,d2
689 d1=(1.d0-exp(-om1intbc(b0)))/dmax
692 if(f0*f1.lt.0.d0)then
696 d2=(1.d0-dexp(-om1intbc(b2)))/dmax
699 c write (*,*) '******************* drootom **************'
700 c write (*,*) b0,b1,b2,f0,f1,f2
702 if (f1*f2.lt.0.D0) then
710 if (abs(f2).gt.eps.and.k.le.kmax.and.b1.ne.b0) then
714 write(ifch,*)'??? Warning in Drootom: Delta=',abs((b1-b0)/b1)
715 c.........stop 'Error in Droot, too many steps'
721 c write(*,*)"drootom exit (2)",b0,b1,d0,d1,d2
728 c----------------------------------------------------------------------
729 subroutine variance(r2,alp,iqq)
730 c----------------------------------------------------------------------
731 c fit sigma2 into : 1/sigma2(x)=1/r2-alp*log(x*s)
732 c iqq=0 -> soft pomeron
733 c iqq=1 -> semi-hard pomeron
735 c----------------------------------------------------------------------
737 include 'epos.incsem'
738 include 'epos.incpar'
739 dimension Xs(maxdataDf),vari(maxdataDf),sigma(maxdataDf)
740 double precision X,X0,xmax
746 if(iqq.eq.0.or.xshmin.gt.0.95d0)then
753 X0=.1d0/dlog(max(dexp(2.d0),dble(smaxDf)/1.d3))
754 if(smaxDf.lt.100.*q2min)X0=.95d0
757 if(iqq.ne.3.and.iqq.ne.4)then
761 if (i.ne.0) X=X*(xmax/X0)**(dble(i)/dble(nptf-1))
762 Xs(i+1)=log(real(X)*smaxDf)
764 if(sig2.le.0.) call utstop
765 & ('In variance, initial(1) sigma2 not def!&')
769 c Fit of the variance of D(X,b) between X0 and xmaxDf
771 call fit(Xs,vari,nptf,sigma,0,tr2,talp)
774 c in principle, the formula to convert 1/(del+eps*log(sy)) into
775 c 1/del*(1-eps/del*log(sy)) is valid only if eps/del*log(sy)=alp*r2*log(sy)
776 c is small. In practice, since the fit of G(x) being an approximation, each
777 c component of the fit should not be taken separatly but we should consider
778 c G as one function. Then it works even with large alp (gamD).
779 c ttt=alp*r2*log(smaxDf)
781 c & write(ifmt,*)'Warning, G(b) parametrization not optimal : ',
782 c & 'gamD too large compared to delD !',ttt
784 if(iqq.eq.3)r2=sigma2(xmaxDf,3)
785 if(iqq.eq.4)r2=sigma2(xshmin,3)
786 if(r2.le.0.) call utstop
787 &('In variance, initial(2) sigma2 not def!&')
792 write(ifch,*) '%%%%%%%%%% variance ini %%%%%%%%%%%%'
793 write(ifch,*) 'X0=',X0
794 write(ifch,*) 'delD ini=',r2
795 write(ifch,*) 'gamD ini=',alp
803 c----------------------------------------------------------------------
805 function sigma2(x,iqq)
807 c----------------------------------------------------------------------
808 c Return the variance for a given x of :
810 c iqq=0 the soft pomeron
811 c iqq=1 the semi-hard and valence quark pomeron
813 c----------------------------------------------------------------------
816 include 'epos.incpar'
817 double precision x,Dsoftshval,sfsh,om51p,eps,range,sig2!,omNpuncut
819 double precision varifit,Db(maxdataDf),bf(maxdataDf)
829 sfsh=om51p(real(x)*smaxDf,x,0.d0,0.,0)
830 if (dabs(sfsh).gt.eps) then
832 bf(i+1)=dble(bmin+real(i)*(bmax-bmin)/real(nptf-1))
833 Db(i+1)=om51p(real(x)*smaxDf,x,0.d0,real(bf(i+1)),0)/sfsh
838 elseif(iqq.eq.1.and.xshmin.lt..95d0)then
842 sfsh=sfsh+om51p(real(x)*smaxDf,x,0.d0,0.,j)
844 if (dabs(sfsh).gt.eps) then
846 bf(i+1)=dble(bmin+real(i)*(bmax-bmin)/real(nptf-1))
849 Db(i+1)=Db(i+1)+om51p(real(x)*smaxDf,x,0.d0,real(bf(i+1)),j)
860 sfsh=Dsoftshval(real(x)*smaxDf,x,0.d0,0.,iscr)
861 if (dabs(sfsh).gt.eps) then
863 bf(i+1)=dble(bmin+real(i)*(bmax-bmin)/real(nptf-1))
864 Db(i+1)=Dsoftshval(real(x)*smaxDf,x,0.d0,real(bf(i+1)),iscr)
872 c Fit of D(X,b) between -bmaxDf and bmaxDf
876 call minfit(varifit,bf,Db,nptft,sig2,range)
885 c----------------------------------------------------------------------
889 c----------------------------------------------------------------------
890 c updates the 4 parameters alpsf,betsf,alpsh,betsh by fitting GFF
891 c parDf(1,3) parDf(2,3) ... alp, bet soft
892 c parDf(3,3) parDf(4,3) ... alp, bet semihard
893 c----------------------------------------------------------------------
896 include 'epos.incpar'
898 double precision Dsoftshpar
902 dimension range(nbpf)
906 !determine parameter range
907 do i=numminDf,numparDf
908 range(i)=fparDf*parDf(i,3)
909 parDf(i,1)=parDf(i,3)-range(i)
910 parDf(i,2)=parDf(i,3)+range(i)
914 ! write(ifch,*) '%%%%%%%%%%%%%%%%%%% fitx %%%%%%%%%%%%%%%%%%%%%%%'
916 call fitx(Dsoftshpar,nmcxDf,chi2,err)
918 ! write(ifch,*) 'chi2=',chi2
919 ! write(ifch,*) 'err=',err
920 ! write(ifch,*) 'alpD(1)=',parDf(1,3),' betD(1)=',parDf(2,3)
921 ! write(ifch,*) 'alpD(2)=',parDf(3,3),' betD(2)=',parDf(4,3)
927 c----------------------------------------------------------------------
929 c----------------------------------------------------------------------
932 include 'epos.incsem'
933 include 'epos.incpar'
934 double precision X,X0,X1,Dsoftshval,Xseuil
938 X0=max(xminDf,dble(sfshlim/smaxDf))
942 c Fit of G(X) between X0 and X1
945 if (i.ne.0) X=X*(X1/X0)**(dble(i)/dble(nptf-1))
946 datafitD(i+1,2)=max(1.e-10,
947 & real(Dsoftshval(real(X)*smaxDf,X,0.d0,0.,1)))
948 datafitD(i+1,1)=real(X)
950 if (X.gt.Xseuil) datafitD(i+1,3)=exp((Xseuil/X)-1.)
960 c----------------------------------------------------------------------
964 c----------------------------------------------------------------------
965 c Return the variance of the sum of the soft pomeron and the semi-hard
966 c pomeron for a given x.
967 c----------------------------------------------------------------------
970 include 'epos.incpar'
971 double precision x,Dsoftshval,Dint
975 Dint=Dsoftshval(real(x)*smaxDf,x,0.d0,0.,iscr)
979 &sigma1i=real(-1.d0/dlog(Dsoftshval(real(x)*smaxDf,x,0.d0,1.,iscr)
987 c----------------------------------------------------------------------
989 SUBROUTINE minfit(func,x,y,ndata,a,range)
991 c----------------------------------------------------------------------
992 c Given a set of data points x(1:ndata),y(1:ndata), and the range of
993 c the parameter a, fit it on function func by minimizing chi2.
994 c In input a define the expected value of a, and on output they
995 c correspond to the fited value.
996 c ---------------------------------------------------------------------
998 double precision x(ndata),y(ndata),func,a,range,Smin,Som,a1,a2,eps
1000 parameter (eps=1.d-5)
1017 10 if(a.lt.0.d0.and.k.lt.100) then
1023 if(k.ge.100) call utstop
1024 &('Always negative variance in minfit ...&')
1028 yp=min(1.d10,func(x(k),a)) !proposal function
1029 Som=Som+(yp-y(k))**2.d0
1043 if(Smin.lt.eps)goto 20
1054 c----------------------------------------------------------------------
1055 subroutine fitx(func,nmc,chi2,err)
1056 c----------------------------------------------------------------------
1057 c Determines parameters of the funcion func
1058 c representing the best fit of the data.
1059 c At the end of the run, the "best" parameters are stored in parDf(n,3).
1060 c The function func has to be defined via "function" using the parameters
1061 c parDf(n,3), n=1,numparDf .
1062 c Parameters as well as data are stored on /fitpar/:
1063 c numparDf: number of parameters (input)
1064 c parDf: array containing parameters:
1065 c parDf(n,1): lower limit (input)
1066 c parDf(n,2): upper limit (input)
1067 c parDf(n,3): current parameter (internal and output = final result)
1068 c parDf(n,4): previous parameter (internal)
1069 c numdataDf: number of data points (input)
1070 c datafitD: array containing data:
1071 c datafitD(i,1): x value (input)
1072 c datafitD(i,2): y value (input)
1073 c datafitD(i,3): error (input)
1074 c----------------------------------------------------------------------
1077 include 'epos.incpar'
1078 double precision func,x
1081 ! write (ifch,*) 'numparDf,numminDf',numparDf,numminDf
1084 c initial configuration (better if one start directly with initial one)
1086 c do n=numminDf,numparDf
1087 c parDf(n,3)=parDf(n,1)+rangen()*(parDf(n,2)-parDf(n,1))
1093 x=dble(datafitD(i,1))
1095 chi2=chi2+(log(fx)-log(datafitD(i,2)))**2/datafitD(i,3)**2
1096 err=err+(log(fx)-log(datafitD(i,2)))/datafitD(i,3)**2
1098 err=abs(err)/real(numdataDf)
1100 c metropolis iteration
1103 c if(mod(i,int(real(nmc)/1000.)).eq.0)then
1104 betac=betac*(1.+1./real(nmc))!1.05
1105 betae=betae*(1.+1./real(nmc))!1.05
1107 c if(mod(i,int(real(nmc)/20.)).eq.0)write(ifch,*)i,chi2,err
1109 do n=numminDf,numparDf
1110 parDf(n,4)=parDf(n,3)
1115 n=numminDf+int(rangen()*(numparDf-numminDf+1))
1118 c if(mod(i,int(real(nmc)/20.)).eq.0)write(ifch,*)n
1120 10 parDf(n,3)=parDf(n,1)+rangen()*(parDf(n,2)-parDf(n,1))
1124 x=dble(datafitD(j,1))
1126 chi2=chi2+(log(fx)-log(datafitD(j,2)))**2/datafitD(j,3)**2
1127 err=err+(log(fx)-log(datafitD(j,2)))/datafitD(j,3)**2
1129 err=abs(err)/real(numdataDf)
1131 if(chi2.gt.chi2x.and.rangen()
1132 $ .gt.exp(-min(50.,max(-50.,betac*(chi2-chi2x))))
1133 & .or.err.gt.errx.and.rangen()
1134 $ .gt.exp(-min(50.,max(-50.,betae*(err-errx))))
1136 do n=numminDf,numparDf
1137 parDf(n,3)=parDf(n,4)
1149 c----------------------------------------------------------------------
1151 SUBROUTINE fit(x,y,ndata,sig,mwt,a,b)
1153 c----------------------------------------------------------------------
1154 c Given a set of data points x(1:ndata),y(1:ndata) with individual standard
1155 c deviations sig(1:ndata), fit them to a straight line y = a + bx by
1157 c Returned are a,b and their respective probable uncertainties siga and sigb,
1158 c the chiÂsquare chi2, and the goodness-of-fit probability q (that the fit
1159 c would have chi2 this large or larger). If mwt=0 on input, then the standard
1160 c deviations are assumed to be unavailable: q is returned as 1.0 and the
1161 c normalization of chi2 is to unit standard deviation on all points.
1162 c ---------------------------------------------------------------------
1166 REAL sig(ndata),x(ndata),y(ndata)
1167 REAL a,b,siga,sigb,chi2 !,q
1169 REAL sigdat,ss,st2,sx,sxoss,sy,t,wt
1172 sx=0. !Initialize sums to zero.
1176 if(mwt.ne.0) then ! Accumulate sums ...
1178 do i=1,ndata !...with weights
1185 do i=1,ndata !...or without weights.
1194 t=(x(i)-sxoss)/sig(i)
1205 b=b/st2 !Solve for a, b, oe a , and oe b .
1207 siga=sqrt((1.+sx*sx/(ss*st2))/ss)
1209 chi2=0. !Calculate chi2 .
1213 chi2=chi2+(y(i)-a-b*x(i))**2
1216 c For unweighted data evaluate typical sig using chi2, and adjust
1217 c the standard deviations.
1219 sigdat=sqrt(chi2/(ndata-2))
1224 chi2=chi2+((y(i)-a-b*x(i))/sig(i))**2
1229 b=(y(ndata)-y(1))/(x(ndata)-x(1))
1230 a=y(ndata)-b*x(ndata)
1234 c write(ifch,*) '$$$$$$$$$$ fit : a,b,siga,sigb,chi2,q $$$$$$$$$$$'
1235 c write(ifch,*) a,b,siga,sigb,chi2!???????????????
1243 c----------------------------------------------------------------------
1245 double precision function varifit(x,var)
1247 c----------------------------------------------------------------------
1248 double precision x,var
1250 varifit=dexp(-min(50.d0,x**2.d0/var))
1257 c----------------------------------------------------------------------
1259 double precision function Dsoftshval(sy,x,y,b,iscr)
1261 c----------------------------------------------------------------------
1262 c iscr=-1 sum of om5p (i), i from 0 to 4 - fit of hard
1263 c iscr=0 sum of om5p (i), i from 0 to 4
1264 c iscr=1 sum of om5p (i), i from 0 to 4 * F * F
1265 c iscr=2 sum of om5p (i), i from 1 to 4 (semihard + valence quark)
1266 c----------------------------------------------------------------------
1267 double precision x,om51p,y,xp,xm
1269 include 'epos.incsem'
1270 include 'epos.incpar'
1276 Dsoftshval=Dsoftshval+om51p(sy,x,y,b,i)
1280 elseif(iscr.eq.1)then
1282 if(dabs(xp).ge.1.d-15)then
1286 write(ifch,*)'Warning in Dsoftshval in epos-par'
1289 Dsoftshval=Dsoftshval+om51p(sy,x,y,b,i)
1291 Dsoftshval=Dsoftshval*(1.d0-xm)**dble(alplea(icltar))
1292 & *(1.d0-xp)**dble(alplea(iclpro))
1293 elseif(iscr.eq.2)then
1295 Dsoftshval=Dsoftshval+om51p(sy,x,y,b,i)
1300 Dsoftshval=2.d0*Dsoftshval
1301 & /(x**dble(-alppar)*dble(chad(iclpro)*chad(icltar)))
1303 if(iscr.eq.-1.and.parDf(3,3).lt.parDf(1,3))Dsoftshval=Dsoftshval
1304 & -dble(parDf(3,3)*sy**parDf(4,3))
1309 c----------------------------------------------------------------------
1311 double precision function Dsoftshpar(x)
1313 c----------------------------------------------------------------------
1314 double precision x,xp,xm
1316 include 'epos.incpar'
1319 & parDf(1,3)*(real(x)*smaxDf)**parDf(2,3)
1320 & +parDf(3,3)*(real(x)*smaxDf)**parDf(4,3) )
1323 Dsoftshpar=Dsoftshpar*(1.d0-xm)**dble(alplea(icltar))
1324 & *(1.d0-xp)**dble(alplea(iclpro))
1325 Dsoftshpar=min(max(1.d-15,Dsoftshpar),1.d15)