EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lkinem.F
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file lkinem.F
1 
2 C **********************************************************************
3 
4  FUNCTION lkinem(L)
5 
6  IMPLICIT NONE
7 
8 C...Calculate kinematical variables and reject (optionally) if outside
9 C...required limits.
10 
11  COMMON /lintrl/ psave(3,4,5),ksave(4),xmin,xmax,ymin,ymax,
12  &q2min,q2max,w2min,w2max,ilep,inu,ig,iz
13  REAL psave,xmin,xmax,ymin,ymax,q2min,q2max,w2min,w2max
14  INTEGER ksave,ilep,inu,ig,iz
15  SAVE /lintrl/
16 
17  INTEGER nlupdm,nplbuf
18  parameter(nlupdm=4000,nplbuf=5)
19  common/lujets/n,k(nlupdm,5),p(nlupdm,nplbuf),v(nlupdm,5)
20  INTEGER n,k
21  REAL p,v
22  SAVE /lujets/
23 
24  common/ludat1/mstu(200),paru(200),mstj(200),parj(200)
25  INTEGER mstu,mstj
26  REAL paru,parj
27  SAVE /ludat1/
28 
29 *
30 * to avoid variable conflictions, a second keep element is necessary
31 * with the same common block name (see LPTOU2)
32 *
33  COMMON /leptou/ cut(14),lst(40),parl(30),
34  & x,y,w2,q2,u
35  REAL cut,parl,x,y,w2,q2,u
36  INTEGER lst
37  SAVE /leptou/
38 
39  COMMON /linter/ pari(50),ewqc(2,2,8),qc(8),zl(2,4),zq(2,8),pq(17)
40  REAL pari,ewqc,qc,zl,zq,pq
41  SAVE /linter/
42 
43  COMMON /lboost/ dbeta(2,3),stheta(2),sphi(2),pb(5),phir
44  DOUBLE PRECISION dbeta
45  REAL stheta,sphi,pb,phir
46  SAVE /lboost/
47 
48 
49  INTEGER lkinem,l,j
50  REAL thetal,plu
51  REAL ulmass
52  DOUBLE PRECISION de,dpz,dpt
53 
54  lkinem=1
55  IF(l.EQ.-3) THEN
56 C...x,W known from LWEITS, no cuts applied.
57  u=(w2-p(2,5)**2)/(2.*p(2,5)*(1.-x))
58  q2=2.*p(2,5)*u*x
59  y=q2/(parl(21)*x)
60  goto 200
61  ENDIF
62 C...x,y given.
63  parl(22)=y*parl(21)
64  q2=x*parl(22)
65  u=parl(22)/(2.*p(2,5))
66  w2=parl(22)*(1.-x)+p(2,5)**2
67  p(4,5)=ulmass(k(4,2))
68  IF(p(4,5)/sqrt(parl(21)).LT.0.001) THEN
69 C...Simpler formulae for effectively massless scattered lepton.
70  de=dble(p(1,4))*(1.-dble(y))+dble(x)*dble(y)*dble(abs(p(2,3)))
71  dpz=de-dble(x)*dble(y)*(dble(p(2,4))+dble(abs(p(2,3))))
72  ELSE
73 C...Formulae for massive scattered lepton.
74  de=dble(p(1,4))+(dble(abs(p(2,3)))*(dble(q2)+dble(p(1,5))**2+
75  & dble(p(4,5))**2)/(2.d0*dble(p(1,4)))-dble(parl(22))/2.d0)/
76  & (dble(p(2,4))+dble(abs(p(2,3))))
77  dpz=dble(p(1,4))-(dble(p(2,4))*(dble(q2)+dble(p(1,5))**2+
78  & dble(p(4,5))**2)/(2.d0*dble(p(1,4)))+dble(parl(22))/2.d0)/
79  & (dble(p(2,4))+dble(abs(p(2,3))))
80  ENDIF
81  dpt=de**2-dpz**2-dble(p(4,5))**2
82  IF(dpt.LT.0.d0) RETURN
83  dpt=sqrt(dpt)
84  p(4,1)=dpt
85  p(4,2)=0.
86  p(4,3)=dpz
87  p(4,4)=de
88  p(3,1)=-dpt
89  p(3,2)=0.
90  p(3,3)=dble(p(1,3))-dpz
91  p(3,4)=dble(p(1,4))-de
92  p(3,5)=-sqrt(q2)
93  k(3,3)=1
94  k(4,3)=1
95  n=4
96  IF(l.EQ.3) goto 200
97 
98  IF(x.LT.xmin.OR.x.GT.xmax) RETURN
99  IF(y.LT.ymin.OR.y.GT.ymax) RETURN
100  IF(q2.LT.q2min.OR.q2.GT.q2max) RETURN
101  IF(w2.LT.w2min.OR.w2.GT.w2max) RETURN
102 C-check: CUT(9),CUT(10) --> UMIN,UMAX needs change in /LINTRL/ --> next update
103  IF(u.LT.cut(9).OR.u.GT.cut(10)) RETURN
104  IF(lst(17).EQ.0) THEN
105  IF(p(4,4).LT.cut(11).OR.p(4,4).GT.cut(12)) RETURN
106  thetal=plu(4,13)
107 C THETAL=ACOS((P(1,1)*P(4,1)+P(1,2)*P(4,2)+P(1,3)*P(4,3))
108 C & /SQRT(P(1,1)**2+P(1,2)**2+P(1,3)**2)/
109 C & SQRT(P(4,1)**2+P(4,2)**2+P(4,3)**2))
110  ELSE
111 C...No cuts on energy, angle for initialisation of varying energy mode
112  IF(lst(32).NE.0) goto 200
113 C...Transform scattered lepton back to lab system to make cut
114 C...in energy and angle (defined as space angle to incoming lepton).
115  DO 110 j=1,5
116  k(6,j)=k(4,j)
117  110 p(6,j)=p(4,j)
118  CALL ludbrb(6,6,stheta(1),sphi(1),0.d0,0.d0,0.d0)
119  CALL ludbrb(6,6,0.,0.,dbeta(1,1),dbeta(1,2),dbeta(1,3))
120  IF(p(6,4).LT.cut(11).OR.p(6,4).GT.cut(12)) RETURN
121  thetal=acos((psave(3,1,1)*p(6,1)+psave(3,1,2)*p(6,2)+
122  & psave(3,1,3)*p(6,3))
123  & /sqrt(psave(3,1,1)**2+psave(3,1,2)**2+psave(3,1,3)**2)/
124  & sqrt(p(6,1)**2+p(6,2)**2+p(6,3)**2))
125  ENDIF
126  IF(thetal.LT.cut(13).OR.thetal.GT.cut(14)) RETURN
127  200 lkinem=0
128  RETURN
129  END