]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGenModels/continuum.F
minor coverity defect: adding self-assignment protection
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenModels / continuum.F
1 C--------------------------------------------------------------------------
2 C
3 C Environment:
4 C      This software is part of the EvtGen package developed jointly
5 C      for the BaBar and CLEO collaborations.  If you use all or part
6 C      of it, please give an appropriate acknowledgement.
7 C
8 C Copyright Information: See EvtGen/COPYRIGHT
9 C      Copyright (C) 1998      Caltech, UCSB
10 C
11 C Module: continuum.F
12 C
13 C Description:
14 C
15 C Modification history:
16 C
17 C    DJL/RYD     August 11, 1998         Module created
18 C
19 C------------------------------------------------------------------------
20       subroutine continuum(energy,flavor,ndaug,kf,px,py,pz,e)
21
22       implicit none
23
24       common/lujets/n,k(4000,5),p(4000,5),v(4000,5)
25
26       integer n,k
27       real p,v
28
29       real*8 pxsum,pysum,pzsum
30
31       real*8 energy
32
33       real senergy
34
35       integer lucomp
36       external lucomp
37
38       integer flavor,kf(100),i,ndaug,istart
39       real*8  px(100),py(100),pz(100),e(100)
40
41       senergy=energy
42
43 C      if(flavor.ne.0) kf_user=flavor
44 C      flavor = kf_user
45
46
47 C     call lueevt(kf_user,senergy)  ! e+e- --> qq shower parton model
48  4    call lueevt(flavor,senergy) ! e+e- --> qq shower parton model
49
50 C      call lulist(1)
51
52       ndaug=0
53
54 C--- Save the primary quarks 
55
56       do 1,i=1,n
57         if(abs(k(i,2)).gt.6) goto 1
58         if(k(i,2).eq.0)      goto 1
59         if(k(i,3).ne.0)      goto 1
60         ndaug=ndaug+1
61         kf(ndaug)=k(i,2)
62         px(ndaug)=p(i,1)
63         py(ndaug)=p(i,2)
64         pz(ndaug)=p(i,3)
65         e(ndaug) =p(i,4)
66 1     continue
67
68 C     sum to check that we preserve momentum
69       pxsum=0.0
70       pysum=0.0
71       pzsum=0.0
72
73       istart=0
74
75       do 2, i=1,n
76          if(k(i,3).le.0.and.k(i,2).ne.22) goto 2
77 c        if particle is jet or cluster
78
79          if (k(i,2).eq.22.and.istart.eq.0) goto 22
80          if ( k(i,3).le.0) goto 2
81
82          if(k(k(i,3),2).eq.92.or.k(k(i,3),2).eq.91) goto 22
83
84          goto 2
85          
86  22      continue
87 C     Copy particle. If parent is cluster or string or photon if
88 C     before first cluster or string. Uggly...
89          if (k(i,2).ne.22) istart=1
90          ndaug = ndaug + 1
91          kf(ndaug)=k(i,2)
92          px(ndaug)=p(i,1)
93          py(ndaug)=p(i,2)
94          pz(ndaug)=p(i,3)
95          pxsum=pxsum+px(ndaug)
96          pysum=pysum+py(ndaug)
97          pzsum=pzsum+pz(ndaug)
98          e(ndaug) =p(i,4)
99  2    continue
100
101
102       if (abs(pxsum).gt.0.001.or.
103      +       abs(pysum).gt.0.001.or.
104      +       abs(pzsum).gt.0.001) then
105
106
107          print *, 'Momentum not conserved in jetset fragmentation:'
108          print *,'dPx:',pxsum,' dPy:',pysum,' dPz:',pzsum
109
110          call lulist(1)
111
112          goto 4
113
114       endif
115
116       return
117       end
118
119
120
121
122
123