2
2
c NLO and aMC@NLO results, for the computation of scale
3
3
c and PDF uncertainties
5
subroutine reweight_fillkin(pp,itype)
6
c Fills four-momenta common blocks, according to itype
9
include "nexternal.inc"
10
include "reweight.inc"
12
double precision pp(0:3,nexternal)
15
double precision p1_cnt(0:3,nexternal,-2:2)
16
double precision wgt_cnt(-2:2)
17
double precision pswgt_cnt(-2:2)
18
double precision jac_cnt(-2:2)
19
common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
27
wgtkin(j,i,ione)=pp(j,i)
30
elseif(itype.ge.2.and.itype.le.4)then
34
wgtkin(j,i,itype)=p1_cnt(j,i,icnt)
38
write(*,*)'Error in reweight_fillkin: itype=',itype
45
subroutine reweight_fillkin_all(pp,itype,iFKS)
46
c Fills four-momenta common blocks, according to itype
49
include "nexternal.inc"
50
include "nFKSconfigs.inc"
51
include "reweight_all.inc"
53
double precision pp(0:3,nexternal)
56
double precision p1_cnt(0:3,nexternal,-2:2)
57
double precision wgt_cnt(-2:2)
58
double precision pswgt_cnt(-2:2)
59
double precision jac_cnt(-2:2)
60
common/counterevnts/p1_cnt,wgt_cnt,pswgt_cnt,jac_cnt
68
wgtkin_all(j,i,ione,iFKS)=pp(j,i)
71
elseif(itype.ge.2.and.itype.le.4)then
75
wgtkin_all(j,i,itype,iFKS)=p1_cnt(j,i,icnt)
79
write(*,*)'Error in reweight_fillkin: itype=',itype
86
subroutine reweight_replkin_cnt()
87
c Fills wgtkin(*,*,2) with the content of wgtkin(*,*,3) or wgtkin(*,*,4).
88
c This is needed since only wgtkin(*,*,0) is used in the computations of
89
c cross sections through weights, and counterterms may be non zero
90
c only for collinear or soft-collinear configurations (eg because of
91
c choices of xicut and delta's). This is fine so long as the counterevent
92
c kinematic configurations are identical for the computations performed
96
include "nexternal.inc"
97
include "reweight.inc"
102
if (wgtkin(0,1,2).gt.0.d0 .or.
103
# (wgtkin(0,1,3).lt.0.d0.and.wgtkin(0,1,4).lt.0.d0) )then
104
write(*,*)'Error in reweight_replkin_cnt'
105
write(*,*)wgtkin(0,1,2),wgtkin(0,1,3),wgtkin(0,1,4)
109
if(wgtkin(0,1,4).gt.0.d0)then
117
wgtkin(j,i,itwo)=wgtkin(j,i,icnt)
125
subroutine reweight_fill_extra()
126
c Fills arrays with dimensions maxparticles, equating them with their
127
c counterparts with dimensions nexternal. Needed before calling routines
128
c that only include reweight0.inc, such as read_lhef_event() and
132
include "nexternal.inc"
133
include "reweight.inc"
139
wgtkinE(j,i,k)=wgtkin(j,i,k)
145
wgtwmcxsecE(k)=wgtwmcxsec(k)
146
wgtmcxbjE(1,k)=wgtmcxbj(1,k)
147
wgtmcxbjE(2,k)=wgtmcxbj(2,k)
154
6
subroutine reweight_fill_extra_inverse()
155
7
c Fills arrays with dimensions nexternal, equating them with their
156
8
c counterparts with dimensions maxparticles; this is thus the inverse
468
subroutine sum_reweight(iFKS_s,iFKS,iproc)
469
c Set all reweight variables equal to zero
472
include "nexternal.inc"
473
include "nFKSconfigs.inc"
474
include "reweight_all.inc"
475
integer i,j,k,iFKS_s,iFKS,iproc
477
parameter (debug=.false.)
479
if (debug) write (*,*) 'wgtref',iFKS_s,iFKS,wgtref_all(iFKS_s
480
$ ,iproc),wgtref_all(iFKS,iproc)
481
call reweight_sum(wgtref_all(iFKS_s,iproc),wgtref_all(iFKS,iproc))
482
if (debug) write (*,*) 'wgtref_nbody',iFKS_s,iFKS
483
$ ,wgtref_nbody_all(iproc),wgtref_nbody_all(iproc)
484
call reweight_sum(wgtref_nbody_all(iproc),wgtref_nbody_all(iproc))
486
if (debug) write (*,*) 'wgtqes2',k,iFKS_s,iFKS,wgtqes2_all(k
487
& ,iFKS_s),wgtqes2_all(k,iFKS)
488
call reweight_check_equal(wgtqes2_all(k,iFKS_s),wgtqes2_all(k
490
if (debug) write (*,*) 'wgtxbj1',k,iFKS_s,iFKS,wgtxbj_all(1,k
491
& ,iFKS_s),wgtxbj_all(1,k,iFKS)
492
if (k.eq.1.or.k.eq.2) then
493
call reweight_check_equal(wgtxbj_all(1,k,iFKS_s)
494
& ,wgtxbj_all(1,k,iFKS))
496
call reweight_overwrite(wgtxbj_all(1,k,iFKS_s)
497
& ,wgtxbj_all(1,k,iFKS),2)
499
if (debug) write (*,*) 'wgtxbj2',k,iFKS_s,iFKS,wgtxbj_all(2,k
500
& ,iFKS_s),wgtxbj_all(2,k,iFKS)
501
if (k.eq.1.or.k.eq.2) then
502
call reweight_check_equal(wgtxbj_all(2,k,iFKS_s)
503
& ,wgtxbj_all(2,k,iFKS))
505
call reweight_overwrite(wgtxbj_all(2,k,iFKS_s)
506
& ,wgtxbj_all(2,k,iFKS),2)
510
if (debug) write (*,*) 'wgtkin',j,i,k,iFKS_s,iFKS
511
& ,wgtkin_all(j,i,k,iFKS_s),wgtkin_all(j,i,k,iFKS)
512
if (k.eq.1.or.k.eq.2) then
513
call reweight_check_equal(wgtkin_all(j,i,k,iFKS_s)
514
& ,wgtkin_all(j,i,k,iFKS))
516
call reweight_overwrite(wgtkin_all(j,i,k,iFKS_s)
517
& ,wgtkin_all(j,i,k,iFKS),2)
521
if (debug) write (*,*) 'wgtmuR2',k,iFKS_s,iFKS,wgtmuR2_all(k
522
& ,iFKS_s),wgtmuR2_all(k,iFKS)
523
call reweight_check_equal(wgtmuR2_all(k,iFKS_s),wgtmuR2_all(k
525
if (debug) write (*,*) 'wgtmuF12',k,iFKS_s,iFKS,wgtmuF12_all(k
526
& ,iFKS_s),wgtmuF12_all(k,iFKS)
527
call reweight_check_equal(wgtmuF12_all(k,iFKS_s),wgtmuF12_all(k
529
if (debug) write (*,*) 'wgtmuF22',k,iFKS_s,iFKS,wgtmuF22_all(k
530
& ,iFKS_s),wgtmuF22_all(k,iFKS)
531
call reweight_check_equal(wgtmuF22_all(k,iFKS_s),wgtmuF22_all(k
533
if (debug) write (*,*) 'wgtwreal',k,iFKS_s,iFKS,wgtwreal_all(k
534
& ,iFKS_s),wgtwreal_all(k,iFKS)
535
call reweight_sum(wgtwreal_all(k,iFKS_s),wgtwreal_all(k,iFKS))
536
if (debug) write (*,*) 'wgtwdeg',k,iFKS_s,iFKS,wgtwdeg_all(k
537
& ,iFKS_s),wgtwdeg_all(k,iFKS)
538
call reweight_sum(wgtwdeg_all(k,iFKS),wgtwdeg_all(k,iFKS))
539
if (debug) write (*,*) 'wgtwdegmuF',k,iFKS_s,iFKS
540
& ,wgtwdegmuf_all(k,iFKS_s),wgtwdegmuf_all(k,iFKS)
541
call reweight_sum(wgtwdegmuf_all(k,iFKS),wgtwdegmuf_all(k,iFKS))
543
c$$$ if (debug) write (*,*) 'wgtwborn',k,wgtwborn(k),wgtwborn_all
544
c$$$ call reweight_overwrite(wgtwborn(k),wgtwborn_all,0)
545
c$$$ if (debug) write (*,*) 'wgtwns',k,wgtwns(k),wgtwns_all
546
c$$$ call reweight_overwrite(wgtwns(k),wgtwns_all,0)
547
c$$$ if (debug) write (*,*) 'wgtwnsmuf',k,wgtwnsmuf(k)
548
c$$$ & ,wgtwnsmuf_all
549
c$$$ call reweight_overwrite(wgtwnsmuf(k),wgtwnsmuf_all,0)
550
c$$$ if (debug) write (*,*) 'wgtwnsmur',k,wgtwnsmur(k)
551
c$$$ & ,wgtwnsmur_all
552
c$$$ call reweight_overwrite(wgtwnsmur(k),wgtwnsmur_all,0)
556
if (debug) write (*,*) 'wgtwmcxsec',k,iFKS_s,iFKS
557
& ,wgtwmcxsec_all(k,iFKS_s),wgtwmcxsec_all(k,iFKS)
558
call reweight_sum(wgtwmcxsec_all(k,iFKS_s),wgtwmcxsec_all(k
560
if (debug) write (*,*) 'wgtwmcxbj1',k,iFKS_s,iFKS
561
& ,wgtmcxbj_all(1,k,iFKS_s),wgtmcxbj_all(1,k,iFKS)
562
call reweight_check_equal(wgtmcxbj_all(1,k,iFKS_s)
563
& ,wgtmcxbj_all(1,k,iFKS))
564
if (debug) write (*,*) 'wgtwmcxbj2',k,iFKS_s,iFKS
565
& ,wgtmcxbj_all(2,k,iFKS_s),wgtmcxbj_all(2,k,iFKS)
566
call reweight_check_equal(wgtmcxbj_all(2,k,iFKS_s)
567
& ,wgtmcxbj_all(2,k,iFKS))
569
if (debug) write (*,*) 'iwgtnumpartn',iFKS
570
& ,iwgtnumpartn_all(iFKS_s),iwgtnumpartn_all(iFKS)
571
call reweight_check_equal_int(iwgtnumpartn_all(iFKS_s)
572
& ,iwgtnumpartn_all(iFKS))
576
subroutine reweight_check_equal_int(a,b)
580
write (*,*) 'Error #1 in reweight_check_equal_int',a,b
586
subroutine reweight_check_equal(a,b)
589
double precision vtiny
590
parameter (vtiny=1d-10)
592
if (abs(a-b)/abs(a).gt.vtiny) then
593
write (*,*) 'Error #1 in reweight_check_equal',a,b
597
if (abs(a-b)/abs(b).gt.vtiny) then
598
write (*,*) 'Error #2 in reweight_check_equal',a,b
605
subroutine reweight_sum(a,b)
613
function compute_rwgt_wgt_NLO(xmuR_over_ref,xmuF1_over_ref,
614
# xmuF2_over_ref,xQES_over_ref,
616
c Recomputes the NLO cross section using the weights saved, and compares
617
c with the reference weight
620
include "nexternal.inc"
624
include "reweight.inc"
625
include "appl_common.inc"
626
include "nFKSconfigs.inc"
628
double precision compute_rwgt_wgt_NLO
629
double precision xmuR_over_ref,xmuF1_over_ref,
630
# xmuF2_over_ref,xQES_over_ref
632
double precision rwgt,xsec,xlum,dlum,xlgmuf,xlgmur,alphas
633
double precision xsec11,xsec12,xsec20
634
double precision QES2_local
635
double precision save_murrat,save_muf1rat,save_muf2rat,save_qesrat
636
double precision tiny,pi
637
parameter (tiny=1.d-2)
638
parameter (pi=3.14159265358979323846d0)
640
integer k,izero,mohdr
642
parameter (mohdr=-100)
644
COMMON/C_NFKSPROCESS/NFKSPROCESS
645
integer save_nFKSprocess
647
logical rewgt_mohdr_calculated,rewgt_izero_calculated
648
double precision rewgt_mohdr,rewgt_izero,rewgt_exp_mohdr
651
double precision rewgt
652
external setclscales,rewgt
653
double precision rwgt_muR_dep_fac
656
common /for_applgrid/ iappl
657
double precision vegas_weight
658
common/cvegas_weight/vegas_weight
659
integer flavour_map(fks_configs)
660
common/c_flavour_map/flavour_map
661
double precision final_state_rescaling
662
integer iproc_save(fks_configs),eto(maxproc,fks_configs),
663
1 etoi(maxproc,fks_configs),maxproc_found
664
common/cproc_combination/iproc_save,eto,etoi,maxproc_found
666
save_murrat=muR_over_ref
667
save_muf1rat=muF1_over_ref
668
save_muf2rat=muF2_over_ref
669
save_qesrat=QES_over_ref
670
save_nFKSprocess=nFKSprocess
672
muR_over_ref=xmuR_over_ref
673
muF1_over_ref=xmuF1_over_ref
674
muF2_over_ref=xmuF2_over_ref
675
QES_over_ref=xQES_over_ref
677
if(kwgtinfo.ne.4.and.kwgtinfo.ne.5) wgtbpower=rwgtbpower
684
if (wgtwreal(1).eq.0d0) goto 541
686
call set_cms_stuff(mohdr)
687
if( (kwgtinfo.eq.1.and.wgtmuR2(1).ne.0.d0) .or.
688
$ ((kwgtinfo.ge.3.or.kwgtinfo.le.5).and.wgtkin(0,1,1).gt.0.d0)
690
if(kwgtinfo.eq.1)then
691
scale=muR_over_ref*sqrt(wgtmuR2(1))
692
g=sqrt(4d0*pi*alphas(scale))
693
q2fact(1)=wgtmuF12(1) * muF1_over_ref**2
694
q2fact(2)=wgtmuF22(1) * muF2_over_ref**2
695
c Should cause the code to crash if used
697
elseif(kwgtinfo.ge.3.or.kwgtinfo.le.5)then
698
call set_cms_stuff(mohdr)
700
mu_r=sqrt(wgtmuR2(1))*muR_over_ref
702
g=sqrt(4d0*pi*alphas(scale))
703
call update_as_param()
704
q2fact(1)=muF1_over_ref**2*wgtmuF12(1)
705
q2fact(2)=muF2_over_ref**2*wgtmuF22(1)
707
call set_alphaS(wgtkin(0,1,1))
710
write(*,*)'Error #0a in compute_rwgt_wgt_NLO',kwgtinfo
715
if(xbk(1).le.0.d0.or.xbk(2).le.0.d0.or.
716
# xbk(1).gt.1.d0.or.xbk(2).gt.1.d0)then
717
if(wgtwreal(1).ne.0.d0)then
718
write(*,*)'Error #1 in compute_rwgt_wgt_NLO'
719
write(*,*)xbk(1),xbk(2),wgtwreal(1)
723
nFKSprocess=nFKSprocess_used
725
xsec11=xsec11+xlum*wgtwreal(1)*g**(2*wgtbpower+2.d0)
726
f * rwgt_muR_dep_fac(scale)
727
com-- muR-dependent fac is reweighted here
732
if ( wgtwreal(2).eq.0d0 .and.
733
$ wgtwreal(3).eq.0d0 .and. wgtwreal(4).eq.0d0 .and.
734
$ wgtwdeg(2).eq.0d0 .and.
735
$ wgtwdeg(3).eq.0d0 .and. wgtwdeg(4).eq.0d0 .and.
736
$ wgtwdegmuf(2).eq.0d0 .and.
737
$ wgtwdegmuf(3).eq.0d0 .and. wgtwdegmuf(4).eq.0d0 .and.
738
$ wgtwborn(2).eq.0d0 .and. wgtwns(2).eq.0d0 .and.
739
$ wgtwnsmuf(2).eq.0d0 .and. wgtwnsmur(2).eq.0d0) goto 542
741
call set_cms_stuff(izero)
742
if( (kwgtinfo.eq.1.and.wgtmuR2(2).ne.0.d0) .or.
743
$ ((kwgtinfo.ge.3.or.kwgtinfo.le.5).and.wgtkin(0,1,2).gt.0.d0)
745
if(kwgtinfo.eq.1)then
746
scale=muR_over_ref*sqrt(wgtmuR2(2))
747
g=sqrt(4d0*pi*alphas(scale))
748
q2fact(1)=wgtmuF12(2) * muF1_over_ref**2
749
q2fact(2)=wgtmuF22(2) * muF2_over_ref**2
750
c Should cause the code to crash if used
752
elseif(kwgtinfo.ge.3.or.kwgtinfo.le.5)then
754
mu_r=sqrt(wgtmuR2(2))*muR_over_ref
756
g=sqrt(4d0*pi*alphas(scale))
757
call update_as_param()
758
q2fact(1)=muF1_over_ref**2*wgtmuF12(2)
759
q2fact(2)=muF2_over_ref**2*wgtmuF22(2)
761
call set_alphaS(wgtkin(0,1,2))
764
write(*,*)'Error #0b in compute_rwgt_wgt_NLO',kwgtinfo
767
QES2_local=wgtqes2(2)
768
if(QES2_local.eq.0.d0)then
769
if(wgtwdegmuf(3).ne.0.d0.or.
770
# wgtwdegmuf(4).ne.0.d0.or.
771
# wgtwnsmuf(2).ne.0.d0.or.
772
# wgtwnsmur(2).ne.0.d0)then
773
write(*,*)'Error in compute_rwgt_wgt_NLO'
774
write(*,*)' Ellis-Sexton scale was not set'
775
write(*,*)wgtwdegmuf(3),wgtwdegmuf(4),
776
# wgtwnsmuf(2),wgtwnsmur(2)
782
if(abs(QES2/QES2_local-1.d0).gt.tiny.and.
783
& (kwgtinfo.ge.3.or.kwgtinfo.le.5))then
784
write(*,*)'Error in compute_rwgt_wgt_NLO'
785
write(*,*)' Mismatch in ES scale',QES2,QES2_local
788
xlgmuf=log(q2fact(1)/QES2_local)
789
xlgmur=log(scale**2/QES2_local)
794
if(xbk(1).le.0.d0.or.xbk(2).le.0.d0.or.
795
# xbk(1).gt.1.d0.or.xbk(2).gt.1.d0)then
796
if(wgtwreal(k).ne.0.d0.or.
797
# wgtwdeg(k).ne.0.d0.or.
798
# wgtwdegmuf(k).ne.0.d0.or.
799
# (k.eq.2.and.(wgtwborn(2).ne.0.d0.or.
800
# wgtwns(2).ne.0.d0.or.
801
# wgtwnsmuf(2).ne.0.d0.or.
802
# wgtwnsmur(2).ne.0.d0)))then
803
write(*,*)'Error #2 in compute_rwgt_wgt_NLO'
804
write(*,*)k,xbk(1),xbk(2)
805
write(*,*)wgtwreal(k),wgtwdeg(k),wgtwdegmuf(k)
806
if(k.eq.2)write(*,*)wgtwborn(k),wgtwns(k),
807
# wgtwnsmuf(k),wgtwnsmur(k)
811
nFKSprocess=nFKSprocess_used
813
xsec12=xsec12+xlum*( wgtwreal(k)+wgtwdeg(k)+
814
# wgtwdegmuf(k)*xlgmuf )*
815
# g**(2*wgtbpower+2.d0) * rwgt_muR_dep_fac(scale)
816
com-- muR-dependent fac is reweighted here
818
nFKSprocess=nFKSprocess_used_born
820
if(wgtbpower.gt.0)then
821
xsec20=xsec20+xlum*wgtwborn(k)*g**(2*wgtbpower)
822
f * rwgt_muR_dep_fac(scale)
823
com-- muR-dependent fac is reweighted here
825
xsec20=xsec20+xlum*wgtwborn(k) * rwgt_muR_dep_fac(scale)
826
com-- muR-dependent fac is reweighted here
829
xsec12=xsec12+xlum*( wgtwns(k)+
830
# wgtwnsmuf(k)*xlgmuf+
831
# wgtwnsmur(k)*xlgmur )*
832
# g**(2*wgtbpower+2.d0) * rwgt_muR_dep_fac(scale)
833
com-- muR-dependent fac is reweighted here
842
muR_over_ref=save_murrat
843
muF1_over_ref=save_muf1rat
844
muF2_over_ref=save_muf2rat
845
QES_over_ref=save_qesrat
846
nFKSprocess=save_nFKSprocess
849
wgtNLO12=xsec12-xsec20
852
compute_rwgt_wgt_NLO=xsec
855
************************************************************************
856
* APPLgrid (Refer to arXiv:1110.4738).
857
************************************************************************
861
appl_x1(k) = wgtxbj(1,k)
862
appl_x2(k) = wgtxbj(2,k)
865
appl_muF2(k) = wgtmuF12(1) * muF1_over_ref**2
866
appl_muR2(k) = wgtmuR2(1) * muR_over_ref**2
867
appl_QES2(k) = wgtqes2(2)
868
elseif(k.ge.2.and.k.le.4)then
869
appl_muF2(k) = wgtmuF12(2) * muF1_over_ref**2
870
appl_muR2(k) = wgtmuR2(2) * muR_over_ref**2
871
appl_QES2(k) = wgtqes2(2)
878
c Fill weights (Same notation as in Eq. (2.17) of the paper above).
879
c Flavor map: integer from 1 to nproc, with nproc the number of the
880
c parton luminosities, defined at generation in
881
c initial_states_map.dat.
883
c Events (only W0 is non-zero)
884
if(wgtwreal(k).ne.0d0)then
886
appl_w0(k) = wgtwreal(k)
888
appl_flavmap(k) = flavour_map(nFKSprocess_used)
891
if ( wgtwreal(2).ne.0d0 .or. wgtwreal(3).ne.0d0 .or.
892
$ wgtwreal(4).ne.0d0 .or. wgtwdeg(2).ne.0d0 .or.
893
$ wgtwdeg(3).ne.0d0 .or. wgtwdeg(4).ne.0d0 .or.
894
$ wgtwdegmuf(2).ne.0d0 .or. wgtwdegmuf(3).ne.0d0 .or.
895
$ wgtwdegmuf(4).ne.0d0 .or. wgtwborn(2).ne.0d0 .or.
896
$ wgtwns(2).ne.0d0 .or. wgtwnsmuf(2).ne.0d0 .or.
897
$ wgtwnsmur(2).ne.0d0) then
899
c Note that for k=2 it is the Born flavour map that is always used.
900
c So there is a unique set of weights for k=2, all of which uses
901
c flavour_map(nFKSprocess_used_Born)
904
appl_w0(k) = wgtwreal(k) + wgtwdeg(k) + wgtwns(k)
905
appl_wR(k) = wgtwnsmur(k)
906
appl_wF(k) = wgtwdegmuf(k) + wgtwnsmuf(k)
907
appl_wB(k) = wgtwborn(k)
909
appl_flavmap(k)=flavour_map(nFKSprocess_used_Born)
910
c Collinear and sof-collinear events
911
elseif(k.eq.3.or.k.eq.4)then
913
appl_w0(k) = wgtwreal(k) + wgtwdeg(k)
914
appl_wF(k) = wgtwdegmuf(k)
916
appl_flavmap(k) = flavour_map(nFKSprocess_used)
920
c Multiply the weights by the number of equivalent final states that
921
c share both the same matrix element and the same initial luminosity
922
final_state_rescaling = dble(iproc_save(nFKSprocess_used))
923
1 / dble(appl_nproc(flavour_map(nFKSprocess_used)))
924
c Multiply by Vegas weight before filling the APPLgrid histograms,
925
c as done for the NLO plots in the reweighting routine, and by the
926
c final rescaling factor.
927
appl_w0(k) = appl_w0(k) * final_state_rescaling * vegas_weight
928
appl_wR(k) = appl_wR(k) * final_state_rescaling * vegas_weight
929
appl_wF(k) = appl_wF(k) * final_state_rescaling * vegas_weight
930
appl_wB(k) = appl_wB(k) * final_state_rescaling * vegas_weight
932
c Save the value of the event weight (hadronic differential cross section).
933
c Computed with the reference PDF sets for checks of the amcatnlo interface.
934
appl_event_weight = compute_rwgt_wgt_NLO
935
c Save also the vegas weight
936
appl_vegaswgt = vegas_weight
942
320
function compute_rwgt_wgt_Hev(xmuR_over_ref,xmuF1_over_ref,
943
321
# xmuF2_over_ref,xQES_over_ref,