1033
1039
double precision p1_cnt(0:3,nexternal,-2:2),wgt_cnt(-2:2)
1034
1040
$ ,pswgt_cnt(-2:2),jac_cnt(-2:2)
1035
1041
common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
1042
double precision fkssymmetryfactor,fkssymmetryfactorBorn,
1043
& fkssymmetryfactorDeg
1044
integer ngluons,nquarks(-6:6)
1045
common/numberofparticles/fkssymmetryfactor,fkssymmetryfactorBorn,
1046
& fkssymmetryfactorDeg,ngluons,nquarks
1047
double precision wgt_ME_born,wgt_ME_real
1048
common /c_wgt_ME_tree/ wgt_ME_born,wgt_ME_real
1049
double precision iden_comp
1050
common /c_iden_comp/ iden_comp
1036
1051
if (wgt1.eq.0d0 .and. wgt2.eq.0d0 .and. wgt3.eq.0d0) return
1037
1052
c Check for NaN's and INF's. Simply skip the contribution
1038
1053
if (wgt1.ne.wgt1) return
1064
1079
c Anything else
1065
1080
QCDpower(icontr)=nint(2*wgtbpower+2)
1082
c Compensate for the fact that in the Born matrix elements, we use the
1083
c identical particle symmetry factor of the corresponding real emission
1085
c IDEN_COMP STUFF NEEDS TO BE UPDATED WHEN MERGING WITH 'FKS_EW' STUFF
1086
wgt_ME_tree(1,icontr)=wgt_me_born
1087
wgt_ME_tree(2,icontr)=wgt_me_real
1090
if (p1_cnt(0,1,0).gt.0d0) then
1091
momenta_m(j,i,1,icontr)=p1_cnt(j,i,0)
1092
elseif (p1_cnt(0,1,1).gt.0d0) then
1093
momenta_m(j,i,1,icontr)=p1_cnt(j,i,1)
1094
elseif (p1_cnt(0,1,2).gt.0d0) then
1095
momenta_m(j,i,1,icontr)=p1_cnt(j,i,2)
1097
if (i.lt.fks_i_d(nFKSprocess)) then
1098
momenta_m(j,i,1,icontr)=p_born(j,i)
1099
elseif(i.eq.fks_i_d(nFKSprocess)) then
1100
momenta_m(j,i,1,icontr)=0d0
1102
momenta_m(j,i,1,icontr)=p_born(j,i-1)
1105
momenta_m(j,i,2,icontr)=p_ev(j,i)
1067
1108
if(type.eq.1 .or. type.eq. 8 .or. type.eq.9 .or. type.eq.10 .or.
1068
1109
& type.eq.13) then
1069
1110
c real emission and n+1-body kin. contributions to counter terms and MC
1071
1112
do i=1,nexternal
1073
c 'momenta' is the momentum configuration for this contribution;
1074
c 'momenta_m' is the momentum configuration that was used in the
1075
c matrix elements of this contribution.
1076
momenta(j,i,icontr)=p_ev(j,i)
1078
momenta_m(j,i,icontr)=momenta(j,i,icontr)
1080
if (p1_cnt(0,1,0).gt.0d0) then
1081
momenta_m(j,i,icontr)=p1_cnt(j,i,0)
1082
elseif (p1_cnt(0,1,1).gt.0d0) then
1083
momenta_m(j,i,icontr)=p1_cnt(j,i,1)
1084
elseif (p1_cnt(0,1,2).gt.0d0) then
1085
momenta_m(j,i,icontr)=p1_cnt(j,i,2)
1087
write (*,*) 'ERROR in add_wgt: no valid momenta'
1114
momenta(j,i,icontr)=momenta_m(j,i,2,icontr)
1093
1117
H_event(icontr)=.true.
1094
1118
elseif(type.ge.2 .and. type.le.7 .or. type.eq.11 .or. type.eq.12
1095
$ .or. type.eq.14)then
1119
$ .or. type.eq.14 .or. type.eq.15)then
1096
1120
c Born, counter term, soft-virtual, or n-body kin. contributions to real
1097
1121
c and MC subtraction terms.
1098
1122
do i=1,nexternal
1100
c 'momenta' is the momentum configuration for this contribution;
1101
c 'momenta_m' is the momentum configuration that was used in the
1102
c matrix elements of this contribution.
1103
if (p1_cnt(0,1,0).gt.0d0) then
1104
momenta(j,i,icontr)=p1_cnt(j,i,0)
1105
elseif (p1_cnt(0,1,1).gt.0d0) then
1106
momenta(j,i,icontr)=p1_cnt(j,i,1)
1107
elseif (p1_cnt(0,1,2).gt.0d0) then
1108
momenta(j,i,icontr)=p1_cnt(j,i,2)
1110
write (*,*) 'ERROR in add_wgt: no valid momenta'
1113
if (type.eq.11) then
1114
momenta_m(j,i,icontr)=p_ev(j,i)
1116
momenta_m(j,i,icontr)=momenta(j,i,icontr)
1124
momenta(j,i,icontr)=momenta_m(j,i,1,icontr)
1120
1127
H_event(icontr)=.false.
1276
1283
include 'reweight.inc'
1277
1284
include 'reweightNLO.inc'
1278
1285
include 'timing_variables.inc'
1279
integer i,kr,kf,iwgt_save
1280
double precision xlum(maxscales),dlum,pi,mu2_r(maxscales)
1281
& ,mu2_f(maxscales),mu2_q,alphas,g(maxscales),rwgt_muR_dep_fac
1286
integer i,kr,kf,iwgt_save,dd
1287
double precision xlum(maxscales),dlum,pi,mu2_r(maxscales),c_mu2_r
1288
$ ,c_mu2_f,mu2_f(maxscales),mu2_q,alphas,g(maxscales)
1282
1290
external rwgt_muR_dep_fac
1283
1291
parameter (pi=3.1415926535897932385d0)
1284
1292
external dlum,alphas
1297
1305
xbk(1) = bjx(1,i)
1298
1306
xbk(2) = bjx(2,i)
1299
1307
mu2_q=scales2(1,i)
1308
c Loop over the dynamical_scale_choices
1309
do dd=1,dyn_scale(0)
1300
1310
c renormalisation scale variation (requires recomputation of the strong
1303
mu2_r(kr)=scales2(2,i)*yfactR(kr)**2
1304
g(kr)=sqrt(4d0*pi*alphas(sqrt(mu2_r(kr))))
1312
call set_mu_central(i,dd,c_mu2_r,c_mu2_f)
1313
do kr=1,nint(scalevarR(0))
1314
if ((.not. lscalevar(dd)) .and. kr.ne.1) exit
1315
mu2_r(kr)=c_mu2_r*scalevarR(kr)**2
1316
g(kr)=sqrt(4d0*pi*alphas(sqrt(mu2_r(kr))))
1306
1318
c factorisation scale variation (require recomputation of the PDFs)
1308
mu2_f(kf)=scales2(3,i)*yfactF(kf)**2
1315
iwgt=iwgt+1 ! increment the iwgt for the wgts() array
1316
if (iwgt.gt.max_wgt) then
1317
write (*,*) 'ERROR too many weights in reweight_scale'
1319
do kf=1,nint(scalevarF(0))
1320
if ((.not. lscalevar(dd)) .and. kf.ne.1) exit
1321
mu2_f(kf)=c_mu2_f*scalevarF(kf)**2
1326
do kf=1,nint(scalevarF(0))
1327
if ((.not. lscalevar(dd)) .and. kf.ne.1) exit
1328
do kr=1,nint(scalevarR(0))
1329
if ((.not. lscalevar(dd)) .and. kr.ne.1) exit
1330
iwgt=iwgt+1 ! increment the iwgt for the wgts() array
1331
if (iwgt.gt.max_wgt) then
1332
write (*,*) 'ERROR too many weights in '/
1333
$ /'reweight_scale',iwgt,max_wgt
1321
1336
c add the weights to the array
1322
wgts(iwgt,i)=xlum(kf) * (wgt(1,i)+wgt(2,i)*log(mu2_r(kr)
1323
& /mu2_q)+wgt(3,i)*log(mu2_f(kf)/mu2_q))*g(kr)
1325
wgts(iwgt,i)=wgts(iwgt,i)
1326
& *rwgt_muR_dep_fac(sqrt(mu2_r(kr)),sqrt(mu2_r(1)))
1337
wgts(iwgt,i)=xlum(kf) * (wgt(1,i)+wgt(2,i)
1338
$ *log(mu2_r(kr)/mu2_q)+wgt(3,i)*log(mu2_f(kf)
1339
$ /mu2_q))*g(kr)**QCDpower(i)
1340
wgts(iwgt,i)=wgts(iwgt,i)*rwgt_muR_dep_fac(
1341
& sqrt(mu2_r(kr)),sqrt(scales2(2,i)))
1355
1371
common/c_nFKSprocess/nFKSprocess
1356
1372
call cpu_time(tBefore)
1357
1373
if (icontr.eq.0) return
1374
if (dyn_scale(0).gt.1) then
1375
write (*,*) "When doing NNLL+NLO veto, "/
1376
$ /"can only do one dynamical_scale_choice",dyn_scale(0)
1358
1380
c currently we have 'iwgt' weights in the wgts() array.
1360
1382
c compute the new veto multiplier factor
1383
do ks=1,nint(scalevarR(0))
1384
if ((.not. lscalevar(1)) .and. ks.ne.1) exit
1385
do kh=1,nint(scalevarF(0))
1386
if ((.not. lscalevar(1)) .and. kh.ne.1) exit
1363
1387
if (H1_factor_virt.ne.0d0) then
1364
call compute_veto_multiplier(H1_factor_virt,yfactR(ks)
1365
& ,yfactF(kh),veto_multiplier_new(ks,kh))
1388
call compute_veto_multiplier(H1_factor_virt,scalevarR(ks)
1389
$ ,scalevarF(kh),veto_multiplier_new(ks,kh))
1366
1390
veto_multiplier_new(ks,kh)=veto_multiplier_new(ks,kh)
1367
1391
& /veto_multiplier
1377
1401
xbk(1) = bjx(1,i)
1378
1402
xbk(2) = bjx(2,i)
1379
1403
mu2_q=scales2(1,i)
1404
c Hard scale variation
1405
do kh=1,nint(scalevarF(0))
1406
if ((.not. lscalevar(1)) .and. kh.ne.1) exit
1380
1407
c soft scale variation
1382
mu2_r(ks)=scales2(2,i)*yfactR(ks)**2
1383
g(ks)=sqrt(4d0*pi*alphas(sqrt(mu2_r(ks))))
1384
mu2_f(ks)=scales2(2,i)*yfactR(ks)**2
1388
c Hard scale variation
1390
iwgt=iwgt+1 ! increment the iwgt for the wgts() array
1408
do ks=1,nint(scalevarR(0))
1409
if ((.not. lscalevar(1)) .and. ks.ne.1) exit
1410
mu2_r(ks)=scales2(2,i)*scalevarR(ks)**2
1411
g(ks)=sqrt(4d0*pi*alphas(sqrt(mu2_r(ks))))
1412
mu2_f(ks)=scales2(2,i)*scalevarR(ks)**2
1416
iwgt=iwgt+1 ! increment the iwgt for the wgts() array
1391
1417
if (iwgt.gt.max_wgt) then
1392
1418
write (*,*) 'ERROR too many weights in reweight_scale'
1393
1419
& ,iwgt,max_wgt
1402
1428
c special for the itype=7 (i.e, the veto-compensating factor)
1403
1429
call compute_veto_compensating_factor(H1_factor_virt
1404
& ,born_wgt_veto,yfactR(ks),yfactF(kh)
1430
& ,born_wgt_veto,scalevarR(ks),scalevarF(kh)
1405
1431
& ,veto_compensating_factor_new)
1406
1432
wgts(iwgt,i)=xlum(ks) * wgt(1,i)*g(ks)**QCDpower(i)
1407
1433
& /veto_compensating_factor
1408
1434
& *veto_compensating_factor_new
1410
wgts(iwgt,i)=wgts(iwgt,i)
1411
& *rwgt_muR_dep_fac(sqrt(mu2_r(ks)),sqrt(mu2_r(1)))
1436
wgts(iwgt,i)=wgts(iwgt,i)*rwgt_muR_dep_fac(
1437
& sqrt(mu2_r(ks)),sqrt(scales2(2,i)))
1412
1438
wgts(iwgt,i)=wgts(iwgt,i)*veto_multiplier_new(ks,kh)
1438
1464
common/c_nFKSprocess/nFKSprocess
1439
1465
call cpu_time(tBefore)
1440
1466
if (icontr.eq.0) return
1441
1468
c Use as external loop the one over the PDF sets and as internal the one
1442
1469
c over the icontr. This reduces the number of calls to InitPDF and
1443
1470
c allows for better caching of the PDFs
1446
if (iwgt.gt.max_wgt) then
1447
write (*,*) 'ERROR too many weights in reweight_pdf',iwgt
1473
if (iwgt.gt.max_wgt) then
1474
write (*,*) 'ERROR too many weights in reweight_pdf',iwgt
1488
c Compute the luminosity
1490
c Recompute the strong coupling: alpha_s in the PDF might change
1491
g=sqrt(4d0*pi*alphas(sqrt(mu2_r)))
1462
1492
c add the weights to the array
1463
wgts(iwgt,i)=xlum * (wgt(1,i) + wgt(2,i)*log(mu2_r/mu2_q) +
1464
& wgt(3,i)*log(mu2_f/mu2_q))*g_strong(i)**QCDpower(i)
1465
wgts(iwgt,i)=wgts(iwgt,i)*
1466
& rwgt_muR_dep_fac(sqrt(mu2_r),sqrt(mu2_r))
1493
wgts(iwgt,i)=xlum * (wgt(1,i) + wgt(2,i)*log(mu2_r/mu2_q)
1494
$ +wgt(3,i)*log(mu2_f/mu2_q))*g**QCDpower(i)
1495
wgts(iwgt,i)=wgts(iwgt,i)*
1496
& rwgt_muR_dep_fac(sqrt(mu2_r),sqrt(mu2_r))
1470
1501
call cpu_time(tAfter)
1471
1502
tr_pdf=tr_pdf+(tAfter-tBefore)
2179
2212
c Check if the current set of momenta are already available in the
2180
2213
c momenta_str_l array. If not, add it.
2183
if (momenta_equal(momenta_str_l(0,1,j),momenta_m(0,1,ict)))
2217
if (momenta_m(0,1,k,ict).le.0d0) then
2221
if (momenta_equal(momenta_str_l(0,1,j),
2222
& momenta_m(0,1,k,ict))) then
2228
if (.not. found) then
2229
n_mom_conf=n_mom_conf+1
2232
momenta_str(jj,ii,n_mom_conf)=
2233
& momenta_m(jj,ii,k,ict)
2234
momenta_str_l(jj,ii,n_mom_conf)=
2235
& momenta_m(jj,ii,k,ict)
2238
momenta_conf(k)=n_mom_conf
2190
if (.not. found) then
2191
n_mom_conf=n_mom_conf+1
2194
momenta_str(jj,ii,n_mom_conf)=momenta_m(jj,ii,ict)
2195
momenta_str_l(jj,ii,n_mom_conf)=momenta_m(jj,ii,ict)
2198
momenta_conf=n_mom_conf
2200
2241
if (.not. Hevents) then
2201
2242
c For S-events, be careful to take all the IPROC that contribute to the
2202
2243
c iproc_picked:
2204
2245
do ii=1,iproc_save(nFKS(ict))
2205
2246
if (eto(ii,nFKS(ict)).ne.ipr) cycle
2206
2247
n_ctr_found=n_ctr_found+1
2207
2249
if (nincoming.eq.2) then
2208
write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
2209
& (wgt(j,ict)*conv,j=1,3),
2250
write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
2251
& (wgt(j,ict)*conv,j=1,3),(wgt_me_tree(j,ict),j=1,2),
2212
write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
2213
& (wgt(j,ict),j=1,3),
2254
write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
2255
& (wgt(j,ict),j=1,3),(wgt_me_tree(j,ict),j=1,2),
2217
2260
do j=1,nexternal
2218
2261
write (str_temp,*) parton_pdg(j,ii,ict)
2222
2265
n_ctr_str(n_ctr_found) =
2223
2266
& trim(adjustl(n_ctr_str(n_ctr_found)))//' '
2224
2267
& //trim(adjustl(procid))
2225
write (str_temp,'(i2,5(1x,d14.8),3(1x,i2),1x,d18.12)')
2269
write (str_temp,'(i2,6(1x,d14.8),6(1x,i2),1x,i8,1x,d18.12)')
2226
2270
& QCDpower(ict),
2227
2271
& (bjx(j,ict),j=1,2),
2228
2272
& (scales2(j,ict),j=1,3),
2274
& (momenta_conf(j),j=1,2),
2277
& fks_i_d(nFKS(ict)),
2278
& fks_j_d(nFKS(ict)),
2279
& parton_pdg_uborn(fks_j_d(nFKS(ict)),ii,ict),
2232
2280
& parton_iproc(ii,ict)
2233
2281
n_ctr_str(n_ctr_found) =
2234
2282
& trim(adjustl(n_ctr_str(n_ctr_found)))//' '
2239
2287
ipr=iproc_picked
2240
2288
n_ctr_found=n_ctr_found+1
2241
2290
if (nincoming.eq.2) then
2242
write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
2243
& (wgt(j,ict)*conv,j=1,3),
2291
write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
2292
& (wgt(j,ict)*conv,j=1,3),(wgt_me_tree(j,ict),j=1,2),
2246
write (n_ctr_str(n_ctr_found),'(3(1x,d18.12),1x,i2)')
2247
& (wgt(j,ict),j=1,3),
2295
write (n_ctr_str(n_ctr_found),'(5(1x,d18.12),1x,i2)')
2296
& (wgt(j,ict),j=1,3),(wgt_me_tree(j,ict),j=1,2),
2251
2301
do j=1,nexternal
2252
2302
write (str_temp,*) parton_pdg(j,ipr,ict)
2256
2306
n_ctr_str(n_ctr_found) =
2257
2307
& trim(adjustl(n_ctr_str(n_ctr_found)))//' '
2258
2308
& //trim(adjustl(procid))
2259
write (str_temp,'(i2,5(1x,d14.8),3(1x,i2),1x,d18.12)')
2310
write (str_temp,'(i2,6(1x,d14.8),6(1x,i2),1x,i8,1x,d18.12)')
2260
2311
& QCDpower(ict),
2261
2312
& (bjx(j,ict),j=1,2),
2262
2313
& (scales2(j,ict),j=1,3),
2315
& (momenta_conf(j),j=1,2),
2318
& fks_i_d(nFKS(ict)),
2319
& fks_j_d(nFKS(ict)),
2320
& parton_pdg_uborn(fks_j_d(nFKS(ict)),ipr,ict),
2266
2321
& parton_iproc(ipr,ict)
2267
2322
n_ctr_str(n_ctr_found) =
2268
2323
& trim(adjustl(n_ctr_str(n_ctr_found)))//' '
2269
2324
& //trim(adjustl(str_temp))
2271
2328
if (n_ctr_found.ge.max_n_ctr) then
2272
2329
write (*,*) 'ERROR: too many contributions in <rwgt>'
5412
5483
character*1 integrate
5413
5484
integer i_fks,j_fks
5414
5485
common/fks_indices/i_fks,j_fks
5415
integer fac_i,fac_j,i_fks_pdg,j_fks_pdg
5486
integer fac_i,fac_j,i_fks_pdg,j_fks_pdg,iden(nexternal)
5417
5488
integer fac_i_FKS(fks_configs),fac_j_FKS(fks_configs)
5418
$ ,i_type_FKS(fks_configs),j_type_FKS(fks_configs)
5419
$ ,m_type_FKS(fks_configs),ngluons_FKS(fks_configs)
5489
& ,i_type_FKS(fks_configs),j_type_FKS(fks_configs)
5490
& ,m_type_FKS(fks_configs),ngluons_FKS(fks_configs)
5491
& ,iden_real_FKS(fks_configs),iden_born_FKS(fks_configs)
5420
5492
save fac_i_FKS,fac_j_FKS,i_type_FKS,j_type_FKS,m_type_FKS
5493
$ ,ngluons_FKS,iden_real_FKS,iden_born_FKS
5423
5495
character*13 filename
5594
5666
i_type_FKS(nFKSprocess)=i_type
5595
5667
j_type_FKS(nFKSprocess)=j_type
5596
5668
m_type_FKS(nFKSprocess)=m_type
5671
c Compute the identical particle symmetry factor that is in the
5672
c real-emission matrix elements.
5673
iden_real_FKS(nFKSprocess)=1
5677
do i=nincoming+2,nexternal
5678
do j=nincoming+1,i-1
5679
if (pdg_type(j).eq.pdg_type(i)) then
5681
iden_real_FKS(nFKSprocess)=
5682
& iden_real_FKS(nFKSprocess)*iden(j)
5687
c Compute the identical particle symmetry factor that is in the
5688
c Born matrix elements.
5689
iden_born_FKS(nFKSprocess)=1
5690
call set_pdg(0,nFKSprocess)
5694
do i=nincoming+2,nexternal-1
5695
do j=nincoming+1,i-1
5696
if (pdg_uborn(j,0).eq.pdg_uborn(i,0)) then
5698
iden_born_FKS(nFKSprocess)=
5699
& iden_born_FKS(nFKSprocess)*iden(j)
5599
5706
i_type=i_type_FKS(nFKSprocess)
5600
5707
j_type=j_type_FKS(nFKSprocess)
5601
5708
m_type=m_type_FKS(nFKSprocess)
5710
c Difference in identical particle factor in the Born and real emission
5711
c matrix elements. To define wgt_ME_tree for the Born, we need to
5712
c include this factor, because in the current Born the symmetry factor
5713
c for the real is used. THIS NEEDS TO BE CHANGED WHEN MERGING WITH THE
5715
iden_comp=dble(iden_born_FKS(nFKSprocess))/
5716
& dble(iden_real_FKS(nFKSprocess))
5603
5719
c Set matrices used by MC counterterms
5604
5720
if (match_to_shower) call set_mc_matrices