-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoales_30.f
3562 lines (3202 loc) · 132 KB
/
coales_30.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
subroutine coales(ijk,neve,nnout,nap,nat,nzp,nzt,i_coal)
c A phenomenological coalescence model writen by Sa Ben-Hao on 04/06/2004
c Its input messages are in 'pyjets' ! 220822
c Its storing array is 'pyjets'
c Its output message is in 'sa1_h' (in 'pyjets' either)
c ijk: the run number
c neve: total number of runs
c nnout: a internal printing per nnout runs
c nap and nzp: atomic and charge number of projectile
c nat and nzt: atomic and charge number of target
c 250823 Lei added 'i_coal'
c221123 i_coal=1 or 0: do the real coalescence or not ( only gluon
c splitting and quark deexcitation ).
IMPLICIT DOUBLE PRECISION(A-H, O-Z)
IMPLICIT INTEGER(I-N)
INTEGER PYK,PYCHGE,PYCOMP
PARAMETER (KSZJ=80000)
PARAMETER (MPLIS=80000)
COMMON/PYDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200)
COMMON/PYDAT2/KCHG(500,4),PMAS(500,4),PARF(2000),VCKM(4,4)
COMMON/PYDAT3/MDCY(500,3),MDME(8000,2),BRAT(8000),KFDP(8000,5)
COMMON/PYJETS/N,NPAD,K(KSZJ,5),P(KSZJ,5),V(KSZJ,5)
c Those variables in above four statements are only used here and
c in subroutine 'decayh','findb' and 'thephi'.
c PYDAT1,PYDAT2,PYDAT3 and PYJETS are the subroutines in PYTHIA
common/sa1_h/nn,non1_h,kn(kszj,5),pn(kszj,5),rn(kszj,5)
common/sa4_c/kqh(80,2),kfh(80,2),proh(80,2),amash(80,2),imc
common/sa5_c/kqb(80,3),kfb(80,2),prob(80,2),amasb(80,2),ibc
common/sa6_c/ithroq,ithrob,ich,non6_c,throe(4)
common/sa6_p/ithroq_p,ithrob_p,ich_p,non6_p,throe_p(4) ! 201104 300623 Lei
common/sa18/i_deex,n_deex_step,i_pT,i_pT_max,a_FF,aPS_c,aPS_b ! 280823 Lei
common/sa24/adj1(40),nnstop,non24,zstop
common/sa28/nstr,nstra(kszj),nstrv(kszj),nstr0,
& nstr1,nstr1a(kszj),nstr1v(kszj) ! 030620
common/sa36/nglu,nongu,kglu(kszj,5),pglu(kszj,5),vglu(kszj,5) ! 220822
common/sa37/nth,npadth,kth(kszj,5),pth(kszj,5),vth(kszj,5) ! 150922
common/sbe/nbe,nonbe,kbe(kszj,5),pbe(kszj,5),vbe(kszj,5)
common/sbh/nbh,nonh,kbh(kszj,5),pbh(kszj,5),vbh(kszj,5)
common/syspar/ipden,itden,suppm,suptm,suppc,suptc,r0p,r0t,
c napp,natt,nzpp,nztt,pio
dimension numb(3)
c Do gluon splitting and energetic quark deexcitation only, without
c the real coalescence (i_coal=0).
if( i_coal.eq.0 ) goto 888 ! 250823 Lei
c-------------------------------------------------------------------------------
c------------------------- Variables initialization ------------------------
rrp = 1.16
nn = 0
nth = 0
nout = nnout
imc = INT(adj1(13))
ibc = INT(adj1(14))
iphas = INT(adj1(21))
c------------------------- Variables initialization ------------------------
c-------------------------------------------------------------------------------
c-------------------------------------------------------------------------------
c---------------------------- Junctions removing ---------------------------
if( INT(adj1(40)).eq.3 )then ! 070223
c220822 Remove junctions.
jb = 0
2010 do i1=jb+1,N,1 ! i1 loop
kf = K(i1,2)
kfab = ABS(kf)
if(kfab.ne.88)then
jb = jb + 1
goto 2020
endif
call updad_pyj(N,i1+1,1) ! 090922 'updad_pyj' in sfm_30.f
N = N - 1
goto 2010
2020 enddo ! i1 loop
endif ! 070223
c---------------------------- Junctions removing ---------------------------
c-------------------------------------------------------------------------------
c300623 g-splitting and q-deexcitation have been done before "parcas". ! 300623
c So jumps out them when do the real coalescence (i_coal=1).
888 if( INT(adj1(12)).eq.2 .AND. i_coal.eq.1 ) goto 1000 ! 250823 Lei
c-------------------------------------------------------------------------------
c----------------------------- Gluon splitting -----------------------------
c220122
n00 = N ! Original total entries in PYJETS
c Move gluons from 'pyjest' to 'sa36'.
call remo_glu
c Break-up gluon (with E_g>2E_u in 'sa36') -> qqbar string
c (filling in 'pyjets').
call break_glu
c So far, the parton list ('pyjets') is composed of q and qbar only.
adj12 = adj1(12)
i_deex_gen = INT( adj1(16) ) ! 180923 Lei
adj17 = adj1(17)
c200222 adj17=max(4.0,adj17) ! 070612, yan
c300623 Shares 4-momentum in "throe_p" among partons. ! 300623 Lei
call share_p_PYJETS ! 300623 Lei
c----------------------------- Gluon splitting -----------------------------
c-------------------------------------------------------------------------------
c-------------------------------------------------------------------------------
c--------------------------- Quark deexcitation ----------------------------
c280822 energetic q (qbar) de-excitation
i_call_deex = 0
i_daught_gen = 1 ! the #-th newly produced daughter qqbar
n_deex = 0 ! the number of successful deexcitation
jb = 0
n0 = N ! Current total entries in PYJETS
if( i_deex_gen.eq.0 ) goto 900 ! 300324 Lei
700 continue
do i1=jb+1,n0,1
kf0 = K(i1,2)
ee = P(i1,4)
iflav = 1
if( kf0.lt.0 ) iflav = -1
c iflav = 1 : if source parton is quark
c =-1 : if source parton is anti-quark
if( ee.gt.adj17 )then
if( i_deex.eq.1 ) call deexcitation_EP(i1,kf0,nstep,iflav) ! 300623 Lei
if( i_deex.eq.2 ) call deexcitation_E(i1,kf0,nstep,iflav) ! 300623 Lei
if(i_deex.eq.3) call deexcitation_EP_comp_pT(i1,kf0,nstep,iflav) ! 310723 Lei
if(i_deex.eq.4) call deexcitation_E_comp_pT(i1,kf0,nstep,iflav) ! 310723 Lei
if( nstep.gt.0 ) n_deex = n_deex + 1 ! 300623 Lei
i_call_deex = i_call_deex + 1 ! times of 'call deexcitation'
endif
c nstep : number of deexcitation steps per source q (qbar)
c300623 Lei
c Updates n0 and does deexcitation for newly produced qqbar pairs.
if( i1.eq.n0 .AND. N.gt.n0 .AND. i_daught_gen.lt.i_deex_gen)then
jb = i1
i_daught_gen = i_daught_gen + 1
n0 = N
goto 700
end if
c300623 Lei
800 enddo ! 280822 continue->enddo
900 continue
c energetic q (qbar) de-excitation, finished.
c300623 Shares the 4-momentum in 'throe_p' among partons. ! 300623 Lei
call share_p_PYJETS ! 300623 Lei
c220122
c300324 Lei
if( INT(adj1(12)).eq.3 )then
c Records the location (line numbers) of new strings (qqbar).
do i1=n00+1,N,2
nstr1 = nstr1 + 1
nstr1a( nstr1 ) = i1
nstr1v( nstr1 ) = i1 + 1
end do
nstr0 = nstr1
c Updates "sbe".
do ii=n00+1,N,1
nbe = nbe + 1
do jj=1,5,1
kbe( nbe, jj ) = K(ii,jj)
pbe( nbe, jj ) = P(ii,jj)
vbe( nbe, jj ) = V(ii,jj)
end do
end do
end if
c300324 Lei
c--------------------------- Quark deexcitation ----------------------------
c-------------------------------------------------------------------------------
c Just do the g-splitting and quark deexcitation, without real coalescence
c250324
1000 continue
if( i_coal.eq.0 ) return ! 300623 Lei For adj12 = 2
c250324
c-------------------------------------------------------------------------------
c----------------------------- Parton sorting ------------------------------
c130324 Lei
c Sorts the q & qbar according to selected quantity and order.
c Sorts out PYJETS randomly.
call PASORT( 1, N, "pyjets", "null", "random" ) ! Lower case only. In coales.f.
c Slower hadrons formed first. Assumption from Shandong model (QCM),
c which sorts quarks (antiquarks) according to rapidity from the
c minimal to maximal.
! call PASORT( 1, N, "pyjets", "|eta|", "min_to_max" )
c Usage examples:
c (Note: the CHARACTERs are accepted with the lower case only.)
! call PASORT( 5, N, "pyjets", "null", "random" )
! call PASORT( 1, N, "pyjets", "e", "max_to_min" )
! call PASORT( 1, N, "pyjets", "e", "min_to_max" )
! call PASORT( 1, N, "pyjets", "eta", "min_to_max" )
! call PASORT( 1, N, "pyjets", "|eta|", "min_to_max" )
! call PASORT( 1, N, "sbh", "|eta|", "min_to_max" )
c More details please refer to "subroutine PASORT" in coales.f.
c130324 Lei
c----------------------------- Parton sorting ------------------------------
c-------------------------------------------------------------------------------
c-------------------------------------------------------------------------------
c---------------------------- Parton coalescence ---------------------------
c Load the table of hadron (meson: pseudoscalar-spin 0 & vector-spin 1
c only, baryon: octet-spin 1/2 & decuplet-spin 3/2 only).
if( ijk.eq.1 ) call tabhb
c ijk is the event number.
c Normal coalescence process.
call hadpro(rrp,iphas)
c ithroq : the total number of quarks thrown away
c ithrob : the total number of anti-quarks thrown away
c throe : total 4-momentum of the partons thrown away
c ich : total charge of the partons thrown away
c070223 Re-coalesce failed parton after last 'call hadpro'.
c Try coalescence without phase-space constraint agian for those partons
c failed in the normal coalescence process.
if( iphas.ne.0 .AND. nth.ge.2 )then
call hadpro(rrp,0)
endif
c150922 ichth=ich ! 092600
c---------------------------- Parton coalescence ---------------------------
c-------------------------------------------------------------------------------
c-------------------------------------------------------------------------------
c------------------------------ Data dumping -------------------------------
c 'sa1_h' to 'pyjets'.
N = nn
do j2=1,5,1
do j1=1,nn,1
K(j1,j2) = kn(j1,j2)
P(j1,j2) = pn(j1,j2)
V(j1,j2) = rn(j1,j2)
enddo
enddo
c------------------------------ Data dumping -------------------------------
c-------------------------------------------------------------------------------
c Decay of unstable hadrons.
call decayh(rrp) ! 060119
return
end
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine pes(pei,il,ih,peo)
c sum up momentum and energy.
c pei : two dimension array of input momentum and energy
c il and ih : lower and higher limits of summation
c peo : one dimension array of output momentum,energy & sqrt(s)
C...Double precision and integer declarations.
IMPLICIT DOUBLE PRECISION(A-H, O-Z)
IMPLICIT INTEGER(I-N)
INTEGER PYK,PYCHGE,PYCOMP
PARAMETER (KSZJ=80000)
PARAMETER (MPLIS=80000)
dimension pei(kszj,4),peo(5)
do i=1,5
peo(i)=0.
enddo
do i=il,ih
do j=1,4
peo(j)=peo(j)+pei(i,j)
enddo
enddo
peo(5)=peo(4)*peo(4)
do i=1,3
peo(5)=peo(5)-peo(i)*peo(i)
enddo
peo5=peo(5)
if(peo5.lt.0.)then
peo5=abs(peo5)
endif
100 format(' px py pz e '//
c ' sqrt(s)')
200 format(4x,5(1x,f9.3))
return
end
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine tabhb
c Table of primary meson (pseudoscalar (spin 0) and vector (spin 1)
c only) and baryon (octet (spin 1/2) and decuplet (spin 3/2) only)
C...Double precision and integer declarations.
IMPLICIT DOUBLE PRECISION(A-H, O-Z)
IMPLICIT INTEGER(I-N)
INTEGER PYK,PYCHGE,PYCOMP
common/sa4_c/kqh(80,2),kfh(80,2),proh(80,2),amash(80,2),imc
common/sa5_c/kqb(80,3),kfb(80,2),prob(80,2),amasb(80,2),ibc
c imc (ibc): dimension of meson (baryon) table considered
c kqh(i,j): flavor code of j-th constituent q (or qbar) in i-th quark
c configuration of meson
c kfh(i,1), kfh(i,2): flavor code of pseudoscalar meson and vector meson
c with i-th quark configuration of meson
c proh(i,1), proh(i,2): proper probability of meson
c amash(i,1), amash(i,2): mass of meson
c kqb(i,j): flavor code of j-th constituent q (or qbar) in i-th quark
c configuration of baryon
c kfb(i,1), kfb(i,2): flavor code of octet baryon and decuplet baryon
c with i-th quark configuration of baryon
c prob(i,1), prob(i,2): probability of baryon
c amasb(i,1), amasb(i,2): mass of baryon
c300623 New table. ! 300623 Lei
c***********************************************************************
c imc: 26 -> 30; ibc: 18 -> 45
c Meson : 20 + 20 + 6 + 4 = 50 (meson + anti- + onium)
c Baryon : 75 + 75 = 150 (baryon + anti-)
c Total : 50 + 150 = 200
c-----------------------------------------------------------------------
c Onium (no anti-): 6 + 4
c Light mixing onium: pi0, rho0, eta, omega, eta', phi
c Heavy onium : eta_c, J/psi, eta_b, Upsilon
c***********************************************************************
c Meson table.
c-----------------------------------------------------------------------
c KF code of quark and anti-quark.
c Note that kqh1 > 0 and kqh2 < 0.
data (kqh(i,1),i=1,80)
& / 1, 1, 1, 1, 2, 1, 3, 1, 4, 1, ! 10
1 5, 2, 2, 2, 2, 3, 2, 4, 2, 5, ! 20
2 3, 3, 3, 4, 3, 5, 4, 4, 5, 5, ! 30
3 50*0 / ! 80
data (kqh(i,2),i=1,80)
& / -1, -1, -1, -2, -1, -3, -1, -4, -1, -5, ! 10
1 -1, -2, -2, -2, -3, -2, -4, -2, -5, -2, ! 20
2 -3, -3, -4, -3, -5, -3, -4, -5, -4, -5, ! 30
3 50*0 / ! 80
c-----------------------------------------------------------------------
c KF code of hadron (meson).
c Pseudoscalar meson, s = 0.
data (kfh(i,1),i=1,80)
& / 111, 221, 331, -211, 211, 311, -311, -411, 411, 511, ! 10
1 -511, 111, 221, 331, 321, -321, -421, 421, 521, -521, ! 20
2 221, 331, -431, 431, 531, -531, 441, 541, -541, 551, ! 30
3 50*0 / ! 80
c Vector meson, s = 1.
data (kfh(i,2),i=1,80)
& / 113, 223, 0, -213, 213, 313, -313, -413, 413, 513, ! 10
1 -513, 113, 223, 0, 323, -323, -423, 423, 523, -523, ! 20
2 333, 0, -433, 433, 533, -533, 443, 543, -543, 553, ! 30
3 50*0 / ! 80
c-----------------------------------------------------------------------
c Probability of hadron (meson).
data (proh(i,1),i=1,80)
& / 0.5,0.167,0.333, 1., 1., 1., 1., 1., 1., 1., ! 10
1 1., 0.5,0.167,0.333, 1., 1., 1., 1., 1., 1., ! 20
2 0.667,0.333, 1., 1., 1., 1., 1., 1., 1., 1., ! 30
3 50*0. / ! 80
data (proh(i,2),i=1,80)
& / 0.5, 0.5, 0., 1., 1., 1., 1., 1., 1., 1., ! 10
1 1., 0.5, 0.5, 0., 1., 1., 1., 1., 1., 1., ! 20
2 1., 0., 1., 1., 1., 1., 1., 1., 1., 1., ! 30
3 50*0. / ! 80
c***********************************************************************
c Baryon table.
c-----------------------------------------------------------------------
c KF code of 3-quarks.
! Note that kqb1 <= kqb2 <= kqb3.
data (kqb(i,1),i=1,80)
& / 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 10
1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 20
2 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 30
3 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, ! 40
4 3, 4, 4, 4, 5, ! 45
4 0, 0, 0, 0, 0, ! 50
5 30*0 / ! 80
data (kqb(i,2),i=1,80)
& / 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, ! 10
1 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, ! 20
2 5, 2, 2, 2, 2, 3, 3, 3, 3, 3, ! 30
3 4, 4, 4, 5, 3, 3, 3, 4, 4, 4, ! 40
4 5, 4, 4, 5, 5, ! 45
4 0, 0, 0, 0, 0, ! 50
5 30*0 / ! 80
data (kqb(i,3),i=1,80)
& / 1, 2, 3, 4, 5, 2, 3, 3, 4, 4, ! 10
1 5, 5, 3, 4, 4, 5, 5, 4, 5, 5, ! 20
2 5, 2, 3, 4, 5, 3, 4, 4, 5, 5, ! 30
3 4, 5, 5, 5, 3, 4, 5, 4, 5, 5, ! 40
4 5, 4, 5, 5, 5, ! 45
4 0, 0, 0, 0, 0, ! 50
5 30*0 / ! 80
c-----------------------------------------------------------------------
c KF code of baryon.
c Octet baryon, s = 1/2.
data (kfb(i,1),i=1,80)
& / 0, 2112, 3112, 4112, 5112, 2212, 3122, 3212, 4122, 4212, ! 10
1 5122, 5212, 3312, 4132, 4312, 5132, 5312, 4412, 5142, 5412, ! 20
2 5512, 0, 3222, 4222, 5222, 3322, 4232, 4322, 5232, 5322, ! 30
3 4422, 5242, 5422, 5522, 0, 4332, 5332, 4432, 5342, 5432, ! 40
4 5532, 0, 5442, 5542, 0, ! 45
4 0, 0, 0, 0, 0, ! 50
5 30*0 / ! 80
c Decuplet baryon, s = 3/2.
data (kfb(i,2),i=1,80)
& / 1114, 2114, 3114, 4114, 5114, 2214, 0, 3214, 0, 4214, ! 10
1 0, 5214, 3314, 0, 4314, 0, 5314, 4414, 0, 5414, ! 20
2 5514, 2224, 3224, 4224, 5224, 3324, 0, 4324, 0, 5324, ! 30
3 4424, 0, 5424, 5524, 3334, 4334, 5334, 4434, 0, 5434, ! 40
4 5534, 4444, 5444, 5544, 5554, ! 45
4 0, 0, 0, 0, 0, ! 50
5 30*0 / ! 80
c-----------------------------------------------------------------------
c Probability of baryon.
data (prob(i,1),i=1,80)
& / 0., 1., 1., 1., 1., 1., 0.5, 0.5, 0.5, 0.5, ! 10
1 0.5, 0.5, 1., 0.5, 0.5, 0.5, 0.5, 1., 0.5, 0.5, ! 20
2 1., 0., 1., 1., 1., 1., 0.5, 0.5, 0.5, 0.5, ! 30
3 1., 0.5, 0.5, 1., 0., 1., 1., 1., 0.5, 0.5, ! 40
4 1., 0., 1., 1., 0., ! 45
4 0., 0., 0., 0., 0., ! 50
5 30*0. / ! 80
data (prob(i,2),i=1,80)
& / 1., 1., 1., 1., 1., 1., 0., 1., 0., 1., ! 10
1 0., 1., 1., 0., 1., 0., 1., 1., 0., 1., ! 20
2 1., 1., 1., 1., 1., 1., 0., 1., 0., 1., ! 30
3 1., 0., 1., 1., 1., 1., 1., 1., 0., 1., ! 40
4 1., 1., 1., 1., 1., ! 45
4 0., 0., 0., 0., 0., ! 50
5 30*0. / ! 80
c***********************************************************************
c300623 New table. ! 300623 Lei
do i1=1,imc
kf1=kfh(i1,1)
kf2=kfh(i1,2)
amash(i1,1)=pymass(kf1)
amash(i1,2)=pymass(kf2)
enddo
do i1=1,ibc
kf1=kfb(i1,1)
kf2=kfb(i1,2)
amasb(i1,1)=pymass(kf1)
amasb(i1,2)=pymass(kf2)
enddo
return
end
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine eord(ni,nc)
c Order particle set (ni to nc) according to energy
C...Double precision and integer declarations.
IMPLICIT DOUBLE PRECISION(A-H, O-Z)
IMPLICIT INTEGER(I-N)
INTEGER PYK,PYCHGE,PYCOMP
PARAMETER (KSZJ=80000,MPLIS=80000) ! 280822
COMMON/PYJETS/N,NPAD,K(KSZJ,5),P(KSZJ,5),V(KSZJ,5) ! 280822
dimension rr(4),p1(4)
do 100 i1=ni,nc
ii=i1
if(i1.eq.nc)goto 100
j=ii ! 280224 Lei
alar=P(ii,4)
do 200 i2=i1+1,nc
c280822 communication between i1 and i2 of which the energy is lagest
c among i1+1, i1+2, ..., nc
ee=P(i2,4)
if(ee.gt.alar)then ! 280822 .ge. -> .gt.
j=i2
alar=ee
endif
200 enddo ! continue-> enddo 280822
c280822 now, j: order number of particle with largest energy
kii2=K(ii,2)
do jj=1,4
p1(jj)=P(ii,jj)
rr(jj)=V(ii,jj)
enddo
pii5=P(ii,5)
K(ii,2)=K(j,2)
do jj=1,4
P(ii,jj)=P(j,jj)
V(ii,jj)=V(j,jj)
enddo
P(ii,5)=P(j,5)
K(j,2)=kii2
do jj=1,4
P(j,jj)=p1(jj)
V(j,jj)=rr(jj)
enddo
P(j,5)=pii5
100 enddo
return
end
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine hadpro(rrp,iphas) ! 080324
c Parton coalescence (hadronization)
c iphas: = 1, complete phase space constraint ! 300623 Lei
c = 2, position constraint only
c = 3, momentum constraint only
c ithroq : total number of quarks thrown away
c ithrob : total number of anti-quarks thrown away
c throe : total four momentum of the partons thrown away ! 090922
c ich : total charge of the partons thrown away
C...Double precision and integer declarations.
IMPLICIT DOUBLE PRECISION(A-H, O-Z)
IMPLICIT INTEGER(I-N)
INTEGER PYK,PYCHGE,PYCOMP
PARAMETER (KSZJ=80000,MPLIS=80000)
COMMON/PYDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200)
COMMON/PYDAT2/KCHG(500,4),PMAS(500,4),PARF(2000),VCKM(4,4)
COMMON/PYJETS/N,NPAD,K(KSZJ,5),P(KSZJ,5),V(KSZJ,5)
common/sa1_h/nn,non1_h,kn(kszj,5),pn(kszj,5),rn(kszj,5)
common/sa4_c/kqh(80,2),kfh(80,2),proh(80,2),amash(80,2),imc
common/sa5_c/kqb(80,3),kfb(80,2),prob(80,2),amasb(80,2),ibc
common/sa6_c/ithroq,ithrob,ich,non6_c,throe(4)
common/sa6_p/ithroq_p,ithrob_p,ich_p,non6_p,throe_p(4) ! 201104 300623 Lei
common/sa24/adj1(40),nnstop,non24,zstop
common/sa37/nth,npadth,kth(kszj,5),pth(kszj,5),vth(kszj,5) ! 150922
common/coal1/bmrat,i_mm ! ratio of baryon to meson
dimension pc(4),rc(3),iar(3),rcp(3)
dimension psu(3),peo(5),pnn(kszj,5)
dimension numb(3) ! 110905
c-------------------------------------------------------------------------------
c------------------------- Variables initialization ------------------------
c300623 Moved from 'coales' to here. ! 300623 Lei
ithroq = 0
ithrob = 0
ich = 0
throe = 0D0
c110324 Lei
c Appends the last failed quarks to list, i.e. PYJETS + sa37.
if( nth.gt.0 )then
do i=1,nth,1
N = N + 1
do j=1,5,1
K(N,j) = kth(i,j)
P(N,j) = pth(i,j)
V(N,j) = vth(i,j)
end do
end do
nth = 0
end if
c110324 Lei
c------------------------- Variables initialization ------------------------
c-------------------------------------------------------------------------------
c-------------------------------------------------------------------------------
c------------------------------- Coalescence -------------------------------
ibarp = 0 ! Numer of baryon generated. (baryon plus)
ibarm = 0 ! Number of anti-baryon generated. (baryon minus)
imes = 0 ! Number of meson generated.
nme = 0 ! 110324 Lei
nba = 0 ! 110324 Lei
i_fail_iteration = 0 ! 110324 Lei
i_normal_coal = 0 ! 110324 Lei
390 continue
c110324 Lei
c Re-coalesces the failed q & qbar. No more than 50 times.
if( i_normal_coal.eq.1 ) i_fail_iteration = i_fail_iteration + 1 ! 110324 Lei
c110324 Lei
do 400 i1=1,N-2 ! 110324 Lei N -> N-2
kf1=K(i1,2)
do 500 i2=i1+1,N-1
kf2=K(i2,2)
c----------------------------- Meson Producing -----------------------------
c Tries to produce a meason.
if( (kf1.gt.0.and.kf2.lt.0) .or. (kf1.lt.0.and.kf2.gt.0) )then ! if 1
sume = P(i1,4) + P(i2,4)
sump1 = P(i1,1) + P(i2,1)
sump2 = P(i1,2) + P(i2,2)
sump3 = P(i1,3) + P(i2,3)
cm = sume*sume - sump1*sump1 - sump2*sump2 - sump3*sump3
if( cm.gt.1D20 ) cm = 1D20
if( cm.le.0D0 ) goto 500 ! (meson) fail
cm = SQRT(cm)
c110324 Lei
KF_in_1 = kf1
KF_in_2 = kf2
c Exchanges KFs of qbar and q to ensure the first one is q.
if( kf1.lt.0 )then
KF_in_1 = kf2
KF_in_2 = kf1
end if
call findm( KF_in_1, KF_in_2, cm, kfii, amasi, isucc, 1 )
c110324 Lei
if(isucc.eq.0) goto 500
c Phase space adjudgment.
if( iphas.ne.0 )then
call phas(i1,i2,0,isucc,2,iphas)
if( isucc.eq.0 ) goto 500 ! fail
endif
c Proceed for success
imes = imes + 1
nme = nme + 1
c Give proper variables to the primary meson.
nnol = nn
nn = nn+1
kn(nn,1) = 1
kn(nn,2) = kfii
kn(nn,3) = 0
kn(nn,4) = 0
kn(nn,5) = 0
pn(nn,5) = amasi
pn(nn,1) = sump1
pn(nn,2) = sump2
pn(nn,3) = sump3
pnnm = sump1*sump1 + sump2*sump2 + sump3*sump3
pnnmm = amasi*amasi + pnnm
if( pnnmm.gt.1D20 ) pnnmm = 1D20
if( pnnmm.le.0D0 ) pnnmm = 1D-20
pnnn = SQRT(pnnmm)
pn(nn,4) = pnnn
! dele = sume - pnnn
throe_p(4) = throe_p(4) + sume-pnnn ! 300623 Lei
c Produced hadron is set in between contituent partons randomly.
pyrx = PYR(1)
pyry = PYR(1)
rn(nn,1) = pyrx*V(i1,1) + pyry*V(i2,1)
rn(nn,2) = pyrx*V(i1,2) + pyry*V(i2,2)
rn(nn,3) = pyrx*V(i1,3) + pyry*V(i2,3)
c Move parton list ('pyjets') one step downward since i2+1.
call updad_pyj(N,i2+1,1) ! this subroutine is in 'sfm_30.f'
N = N - 1
c Move parton list ('pyjets') one step downward since i1+1.
call updad_pyj(N,i1+1,1)
N = N - 1
c300623 Lei
c Share the surplus 4-momentum in throe_p.
! call share_p_PYJETS
call share_p_PYJETS_sa1h
c300623 Lei
goto 390 ! to construct three cycle again
endif
c----------------------------- Meson Producing -----------------------------
c---------------------------- Baryon Producing -----------------------------
c Tries to produce a baryon.
if(kf1.gt.0.and.kf2.gt.0)then !
rand=pyr(1)
if(rand.gt.bmrat) goto 500 ! bmrat: ratio of baryon to meson
do 600 i3=i2+1,N ! 110324 Lei N-2 -> N
kf3=K(i3,2)
if(kf3.lt.0) goto 600
sume = P(i1,4) + P(i2,4) + P(i3,4)
sump1 = P(i1,1) + P(i2,1) + P(i3,1)
sump2 = P(i1,2) + P(i2,2) + P(i3,2)
sump3 = P(i1,3) + P(i2,3) + P(i3,3)
cm = sume*sume - sump1*sump1 - sump2*sump2 - sump3*sump3
if( cm.gt.1D20 ) cm = 1D20
if( cm.le.0D0 ) goto 600 ! (baryon) fail
cm = SQRT(cm)
c Find out the baryon from hadron table.
call findb(kf1,kf2,kf3,cm,kfii,amasi,isucc,1)
if(isucc.eq.0) goto 600
c Phase space adjudgment.
if( iphas.ne.0 )then
call phas(i1,i2,i3,isucc,3,iphas)
if( isucc.eq.0 ) goto 600 ! fail
endif
c Proceed for success.
ibarp = ibarp + 1
nba = nba + 1
c Give proper variables to the baryon.
nnol = nn
nn = nn+1
kn(nn,1) = 1
kn(nn,2) = kfii
kn(nn,3) = 0
kn(nn,4) = 0
kn(nn,5) = 0
pn(nn,5) = amasi
pn(nn,1) = sump1
pn(nn,2) = sump2
pn(nn,3) = sump3
pnnm = sump1*sump1 + sump2*sump2 + sump3*sump3
pnnmm = amasi*amasi + pnnm
if( pnnmm.gt.1D20 ) pnnmm = 1D20
if( pnnmm.le.0D0 ) pnnmm = 1D-20
pnnn = SQRT(pnnmm)
pn(nn,4) = pnnn
! dele = sume - pnnn
throe_p(4) = throe_p(4) + sume-pnnn ! 300623 Lei
c Produced hadron is arranged among constituent partons randomly.
pyrx = PYR(1)
pyry = PYR(1)
pyrz = PYR(1)
rn(nn,1) = pyrx*V(i1,1) + pyry*V(i2,1) + pyrz*V(i3,1)
rn(nn,2) = pyrx*V(i1,2) + pyry*V(i2,2) + pyrz*V(i3,2)
rn(nn,3) = pyrx*V(i1,3) + pyry*V(i2,3) + pyrz*V(i3,3)
c Move parton list one step downward from i3+1 to n1.
call updad_pyj(N,i3+1,1)
N = N - 1
c Move parton list one step downward from i2+1 to n1.
call updad_pyj(N,i2+1,1)
N = N - 1
c Move parton list one step downward from i1+1 to n1.
call updad_pyj(N,i1+1,1)
N = N - 1
c300623 Lei
c Share the surplus 4-momentum in throe_p.
! call share_p_PYJETS
call share_p_PYJETS_sa1h
c300623 Lei
goto 390 ! to construct three cycle again
c110324 600 enddo ! 110324 Lei
600 continue ! 110324 Lei
endif !
c---------------------------- Baryon Producing -----------------------------
c-------------------------- Anti-Baryon Producing --------------------------
c Tries to produce an anti-baryon.
if(kf1.lt.0.and.kf2.lt.0)then !!
rand=pyr(1)
if(rand.gt.bmrat) goto 500
do 700 i3=i2+1,N ! 110324 Lei N02 -> N
kf3=K(i3,2)
if(kf3.gt.0) goto 700
sume = P(i1,4) + P(i2,4) + P(i3,4)
sump1 = P(i1,1) + P(i2,1) + P(i3,1)
sump2 = P(i1,2) + P(i2,2) + P(i3,2)
sump3 = P(i1,3) + P(i2,3) + P(i3,3)
cm = sume*sume - sump1*sump1 - sump2*sump2 - sump3*sump3
if( cm.gt.1D20 ) cm = 1D20
if( cm.le.0D0 ) goto 700 ! fail
cm = SQRT(cm)
c Find out the anti-baryon from hadron table.
call findb(-kf1,-kf2,-kf3,cm,kfii,amasi,isucc,-1)
if(isucc.eq.0) goto 700 ! 110324 Lei
c Phase space adjudgment.
if( iphas.ne.0 )then
call phas(i1,i2,i3,isucc,3,iphas)
if( isucc.eq.0 ) goto 700 ! fail
endif
ibarm = ibarm + 1
nba = nba + 1
c Give proper variables to the anti-baryon.
nnol = nn
nn = nn + 1
kn(nn,1) = 1
kn(nn,2) = kfii
kn(nn,3) = 0
kn(nn,4) = 0
kn(nn,5) = 0
pn(nn,5) = amasi
pn(nn,1) = sump1
pn(nn,2) = sump2
pn(nn,3) = sump3
pnnm = sump1*sump1 + sump2*sump2 + sump3*sump3
pnnmm = amasi*amasi + pnnm
if( pnnmm.gt.1D20 ) pnnmm = 1D20
if( pnnmm.le.0D0 ) pnnmm = 1D-20
pnnn = SQRT(pnnmm)
pn(nn,4) = pnnn
! dele = sume - pnnn
throe_p(4) = throe_p(4) + sume-pnnn ! 300623 Lei
c Produced hadron is arranged among contituent partons randomly.
pyrx = PYR(1)
pyry = PYR(1)
pyrz = PYR(1)
rn(nn,1) = pyrx*V(i1,1) + pyry*V(i2,1) + pyrz*V(i3,1)
rn(nn,2) = pyrx*V(i1,2) + pyry*V(i2,2) + pyrz*V(i3,2)
rn(nn,3) = pyrx*V(i1,3) + pyry*V(i2,3) + pyrz*V(i3,3)
c Move parton list one step downward from i3+1 to n1.
call updad_pyj(N,i3+1,1)
N = N - 1
c Move parton list one step downward from i2+1 to n1.
call updad_pyj(N,i2+1,1)
N = N - 1
c Move parton list one step downward from i1+1 to n1.
call updad_pyj(N,i1+1,1)
N = N - 1
c300623 Lei
c Share the surplus 4-momentum in throe_p.
! call share_p_PYJETS
call share_p_PYJETS_sa1h
c300623 Lei
goto 390 ! to construct three cycle again
c110324 700 enddo ! 110324 Lei
700 continue ! 110324 Lei
endif !!
c-------------------------- Anti-Baryon Producing --------------------------
c110324 Lei
c Do not use " do xxx --- xxx enddo ". This syntax was too old and
c has be deprecated in the modern Fortran.
c Use " do xxx --- xxx continue" or " do --- enddo " directly.
c110324 500 enddo
c110324 400 enddo
500 continue
400 continue
c Re-coalesces the failed q & qbar. No more than 50 times.
if( N.ge.2 ) i_normal_coal = 1
if( N.ge.2 .AND. i_fail_iteration.lt.50 )then
! if( i_normal_coal.eq.1 .AND. i_fail_iteration.lt.10 )then
goto 390
end if
c110324 Lei
c------------------------------- Coalescence -------------------------------
c-------------------------------------------------------------------------------
c-------------------------------------------------------------------------------
c----------------------- Failed Particle Collecting ------------------------
c300623 Lei
c Collects failed quarks that may fail, i.e. PYJETS -> sa37.
c 'PYJETS' -> 'sa37'
if( N.gt.0 )then
do i=1,N,1
do j=1,5,1
kth(i,j) = K(i,j)
pth(i,j) = P(i,j)
vth(i,j) = V(i,j)
end do
if( K(i,2).gt.0 )then
ithroq = ithroq + 1
ich = ich + PYCHGE(K(i,2))
throe = throe + P(i,4)
elseif( K(i,2).lt.0 )then
ithrob = ithrob + 1
ich = ich + PYCHGE(K(i,2))
throe = throe + P(i,4)
end if
end do
nth = N
N = 0
else
nth = 0
N = 0
end if
c300623 Lei
c----------------------- Failed Particle Collecting ------------------------
c-------------------------------------------------------------------------------
return ! 241212
end
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine findm(kf1,kf2,cm,kfii,amasi,isucc,iflav)
c Find out the primary meson from mesonic table according to kf1 & kf2
c cm : invariant mass of kf1 & kf2
c kfii : flavor code of the primary meson
c amasi : mass of the primary meson
c isucc = 1 : success
c = 0 : fail
c iflav = 1 : kf1>0,do not need to permute kf1 & kf2
c = -1 : kf1<0,need to permute kf1 & kf2 (never used now, 241022)
C...Double precision and integer declarations.
IMPLICIT DOUBLE PRECISION(A-H, O-Z)
IMPLICIT INTEGER(I-N)
INTEGER PYK,PYCHGE,PYCOMP
common/sa4_c/kqh(80,2),kfh(80,2),proh(80,2),amash(80,2),imc
common/sa5_c/kqb(80,3),kfb(80,2),prob(80,2),amasb(80,2),ibc
dimension ikf(2)
if(iflav.eq.1)then ! 1
if1=kf1
if2=kf2
do 500 i4=1,imc
kfi=kqh(i4,1)
kfj=kqh(i4,2)
amas1=amash(i4,1)
c amas1=abs(cm-amas1)
amas2=amash(i4,2)
c amas2=abs(cm-amas2)
xpseud=amas2/(amas1+amas2) ! probability for pseudoscalar
xvector=1-xpseud ! probability for vector
c110324 Lei
rand=PYR(1)
if(kfi.eq.if1 .AND. kfj.eq.if2)then ! 2 success
if( ABS(proh(i4,1)).le.1D-5 .AND.
& ABS(proh(i4,2)).le.1D-5 )
& goto 500
if( ABS(proh(i4,1)).le.1D-5 .and.
& ABS(proh(i4,2)).gt.1D-5 )
& goto 506
if( ( ABS(proh(i4,1)).gt.1D-5 .AND.
& ABS(proh(i4,2)).gt.1D-5 ) .AND. rand.gt.xpseud )
& goto 506 ! vector
c110324 Lei
c Proceed for pseudoscalar
kfii=kfh(i4,1)
amasi=amash(i4,1)
proi=proh(i4,1)
ran1=pyr(1)
if(ran1.gt.proi)goto 500
goto 504 ! success
506 kfii=kfh(i4,2) ! vector
amasi=amash(i4,2)
proi=proh(i4,2)
ran1=pyr(1)
if(ran1.gt.proi)goto 500
goto 504 ! success
endif ! 2
500 continue
isucc=0 ! fail
return
endif ! 1
ikf(1)=kf1
ikf(2)=kf2
c Two body permutation = arrangement (2,2)
do 501 i1=1,2
if1=ikf(i1)
do 502 i2=1,2
if(i2.eq.i1)goto 502
if2=ikf(i2)
do 503 i4=1,imc
kfi=kqh(i4,1)
kfj=kqh(i4,2)
amas1=amash(i4,1)
amas1=abs(cm-amas1)
amas2=amash(i4,2)
amas2=abs(cm-amas2)
c110324 Lei
if(kfi.eq.if1 .and. kfj.eq.if2)then ! success
if( ABS(proh(i4,1)).le.1D-5 .and.
& ABS(proh(i4,2)).le.1D-5 )
& goto 503 ! 280224 Lei ABS
if( ABS(proh(i4,1)).le.1D-5 .and.
& ABS(proh(i4,2)).gt.1D-5 )
& goto 505 ! vector 280224 Lei ABS
if(( ABS(proh(i4,1)).gt.1D-5 .and.
& ABS(proh(i4,2)).gt.1D-5) .and. amas2.le.amas1 ) ! 280224 Lei ABS
& goto 505 ! vector
c110324 Lei
c Proceed for pseudoscalar
kfii=kfh(i4,1)
amasi=amash(i4,1)
proi=proh(i4,1)
ran1=pyr(1)
if(ran1.gt.proi)goto 503
goto 504 ! success
505 kfii=kfh(i4,2) ! vector
amasi=amash(i4,2)
proi=proh(i4,2)
ran1=pyr(1)
if(ran1.gt.proi)goto 503
goto 504
endif
503 continue
502 continue
501 continue
isucc=0 ! fail
return
504 isucc=1 ! success