EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lsigmx.F
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file lsigmx.F
1 C **********************************************************************
2 
3  SUBROUTINE lsigmx(NPAR,DERIV,DIFSIG,XF,IFLAG)
4 
5  IMPLICIT NONE
6 
7 C...Calculates the negative of the differential cross-section.
8 C...In the generation procedure the maximum of the differential cross-
9 C...section is needed for weighting purposes. This maximum is found by
10 C...minimizing the negative differential cross-section using the MINUIT
11 C...routines which are then calling this routine.
12 C...More precisly, only the part of the cross-section formula which is
13 C...needed for the weighting procedure is included here.
14 *
15 * to avoid variable conflictions, a second keep element is necessary
16 * with the same common block name (see LPTOU2)
17 *
18  COMMON /leptou/ cut(14),lst(40),parl(30),
19  & x,y,w2,q2,u
20  REAL cut,parl,x,y,w2,q2,u
21  INTEGER lst
22  SAVE /leptou/
23 
24  COMMON /linter/ pari(50),ewqc(2,2,8),qc(8),zl(2,4),zq(2,8),pq(17)
25  REAL pari,ewqc,qc,zl,zq,pq
26  SAVE /linter/
27 
28  COMMON /lintrl/ psave(3,4,5),ksave(4),xmin,xmax,ymin,ymax,
29  &q2min,q2max,w2min,w2max,ilep,inu,ig,iz
30  REAL psave,xmin,xmax,ymin,ymax,q2min,q2max,w2min,w2max
31  INTEGER ksave,ilep,inu,ig,iz
32  SAVE /lintrl/
33 
34  COMMON /loptim/ optx(4),opty(4),optq2(4),optw2(4),comfac
35  REAL optx,opty,optq2,optw2,comfac
36  SAVE /loptim/
37 
38  INTEGER nlupdm,nplbuf
39  parameter(nlupdm=4000,nplbuf=5)
40  common/lujets/n,k(nlupdm,5),p(nlupdm,nplbuf),v(nlupdm,5)
41  INTEGER n,k
42  REAL p,v
43  SAVE /lujets/
44 
45  common/ludat1/mstu(200),paru(200),mstj(200),parj(200)
46  INTEGER mstu,mstj
47  REAL paru,parj
48  SAVE /ludat1/
49 
50  common/ludat2/kchg(500,3),pmas(500,4),parf(2000),vckm(4,4)
51  INTEGER kchg
52  REAL pmas,parf,vckm
53  SAVE /ludat2/
54 
55 
56  INTEGER npar,iflag,ncalls,lst2
57  REAL deriv,difsig,xf,dummy,s,pm2,q2low,q2upp,ylow,yupp,w2low,
58  +w2upp
59 
60  dimension deriv(30),xf(30)
61  DATA ncalls/0/
62 
63  dummy=npar+deriv(1)
64  IF(iflag.EQ.1) ncalls=0
65  IF(iflag.EQ.2) WRITE(6,1000)
66 
67  difsig=1.e+12
68  ncalls=ncalls+1
69  x=xf(1)
70  IF(x.LT.xmin) THEN
71  difsig=(xmin-x)**2*1.e+11
72  RETURN
73  ELSEIF(x.GT.xmax) THEN
74  difsig=(x-xmax)**2*1.e+11
75  RETURN
76  ENDIF
77  s=parl(21)
78  pm2=psave(3,2,5)**2
79  q2low=max(q2min,x*ymin*s,(w2min-pm2)*x/(1.-x))
80  q2upp=min(q2max,x*ymax*s,(w2max-pm2)*x/(1.-x))
81  ylow=max(ymin,q2min/(s*x),(w2min-pm2)/(s*(1.-x)))
82  yupp=min(ymax,q2max/(s*x),(w2max-pm2)/(s*(1.-x)))
83  w2low=max(w2min,(1.-x)*ymin*s+pm2,q2min*(1.-x)/x+pm2)
84  w2upp=min(w2max,(1.-x)*ymax*s+pm2,q2max*(1.-x)/x+pm2)
85  IF(lst(31).EQ.1) THEN
86  q2=xf(2)
87  IF(q2.LT.q2low) THEN
88  difsig=(q2low-q2)**2*1.e+11
89  RETURN
90  ELSEIF(q2.GT.q2upp) THEN
91  difsig=(q2-q2upp)**2*1.e+11
92  RETURN
93  ENDIF
94  y=q2/(parl(21)*x)
95  w2=(1.-x)*y*parl(21)+pm2
96  ELSEIF(lst(31).EQ.2) THEN
97  y=xf(2)
98  IF(y.LT.ylow) THEN
99  difsig=(ylow-y)**2*1.e+11
100  RETURN
101  ELSEIF(y.GT.yupp) THEN
102  difsig=(y-yupp)**2*1.e+11
103  RETURN
104  ENDIF
105  q2=y*x*parl(21)
106  w2=(1.-x)*y*parl(21)+pm2
107  ELSEIF(lst(31).EQ.3) THEN
108  w2=xf(2)
109  IF(w2.LT.w2low) THEN
110  difsig=(w2low-w2)**2*1.e+11
111  RETURN
112  ELSEIF(w2.GT.w2upp) THEN
113  difsig=(w2-w2upp)**2*1.e+11
114  RETURN
115  ENDIF
116  y=(w2-pm2)/((1.-x)*parl(21))
117  q2=x*y*parl(21)
118  ENDIF
119  IF(q2.LT.q2low) THEN
120  difsig=(q2low-q2)**2*1.e+11
121  RETURN
122  ELSEIF(q2.GT.q2upp) THEN
123  difsig=(q2-q2upp)**2*1.e+11
124  RETURN
125  ENDIF
126  IF(y.LT.ylow) THEN
127  difsig=(ylow-y)**2*1.e+11
128  RETURN
129  ELSEIF(y.GT.yupp) THEN
130  difsig=(y-yupp)**2*1.e+11
131  RETURN
132  ENDIF
133  IF(w2.LT.w2low) THEN
134  difsig=(w2low-w2)**2*1.e+11
135  RETURN
136  ELSEIF(w2.GT.w2upp) THEN
137  difsig=(w2-w2upp)**2*1.e+11
138  RETURN
139  ENDIF
140  lst2=lst(2)
141  lst(2)=-1
142  CALL lepto
143  lst(2)=lst2
144  difsig=0.
145  IF(lst(21).NE.0) RETURN
146  difsig=-pq(17)*comfac
147 
148  IF(lst(3).GE.4.AND.iflag.EQ.3)
149  &WRITE(6,1100) ncalls,difsig,x,y,q2,w2
150  RETURN
151 
152  1000 FORMAT(' Warning: IFLAG = 2 in call to LSIGMX, which does not '
153  &,'calculate derivatives.')
154  1100 FORMAT(/,5x,'Terminating entry in LSIGMX after ',i5,' calls.',/,
155  &5x,'Best estimate of minimum found to be ',e12.4,/,
156  &5x,'located at x, y, Q**2, W**2 = ',4g10.3,/)
157 
158  END