7
7
c Compile with makefile_rwgt
9
include "nexternal.inc"
11
include "nFKSconfigs.inc"
12
10
include "reweight_all.inc"
14
character*7 pdlabel,epa_label
11
integer i,ii,jj,kk,isave,idpdf(0:maxPDFs),itmp,lef,ifile,maxevt
12
$ ,iSorH_lhe,ifks_lhe,jfks_lhe,fksfather_lhe,ipartner_lhe
13
$ ,kwgtinfo,kexternal,jwgtnumpartn,ofile,kf,kr,n,nn
14
double precision yfactR(maxscales),yfactF(maxscales),value(20)
15
$ ,scale1_lhe,scale2_lhe,wgtcentral,wgtmumin,wgtmumax,wgtpdfmin
16
$ ,wgtpdfmax,saved_weight,xsecPDFr_acc(0:maxPDFs,maxPDFsets)
17
$ ,xsecScale_acc(maxscales,maxscales,maxdynscales)
18
logical AddInfoLHE,unweighted
20
character*10 MonteCarlo
22
character*80 event_file,fname1
28
character*7 pdlabel,epa_label
16
30
common/to_pdf/lhaid,pdlabel,epa_label
17
integer maxevt,ifile,ofile,i,jj,isave,ii
18
double precision saved_weight
31
c Les Houches Event File info:
20
32
integer IDBMUP(2),PDFGUP(2),PDFSUP(2),IDWTUP,NPRUP,LPRUP
21
33
double precision EBMUP(2),XSECUP,XERRUP,XMAXUP
23
35
PARAMETER (MAXNUP=500)
24
INTEGER NUP,IDPRUP,IDUP(MAXNUP),ISTUP(MAXNUP),
25
# MOTHUP(2,MAXNUP),ICOLUP(2,MAXNUP)
26
DOUBLE PRECISION XWGTUP,SCALUP,AQEDUP,AQCDUP,
27
# PUP(5,MAXNUP),VTIMUP(MAXNUP),SPINUP(MAXNUP)
28
integer isorh_lhe,ifks_lhe,jfks_lhe,fksfather_lhe,ipartner_lhe
29
double precision scale1_lhe,scale2_lhe,percentage
30
integer kwgtinfo,kexternal,jwgtnumpartn
31
double precision wgtcentral,wgtmumin,wgtmumax,wgtpdfmin,wgtpdfmax
32
double precision xmuR_over_ref,xmuF1_over_ref,xmuF2_over_ref,
33
# xQES_over_ref,pr_muR_over_ref,pr_muF1_over_ref,pr_muF2_over_ref,
34
# tmp,yfactR(maxscales),yfactF(maxscales),xsecPDFr(0:maxPDFs)
35
double precision xsecPDFr_acc(0:maxPDFs),xsecScale_acc(maxscales
37
double precision compute_rwgt_wgt_Sev,compute_rwgt_wgt_Sev_nbody
38
& ,compute_rwgt_wgt_Hev
39
integer kr,kf,n,nng,nps,npairs,nsets,izero,itmp,idpdf(0:maxPDFs)
42
character*80 event_file,fname1
44
character*10 MonteCarlo
47
double precision value(20)
49
external compute_rwgt_wgt_Sev,compute_rwgt_wgt_Sev_nbody
50
& ,compute_rwgt_wgt_Hev
52
common/c_i_process/i_process
36
INTEGER NUP,IDPRUP,IDUP(MAXNUP),ISTUP(MAXNUP),MOTHUP(2,MAXNUP)
38
DOUBLE PRECISION XWGTUP,SCALUP,AQEDUP,AQCDUP,PUP(5,MAXNUP)
39
$ ,VTIMUP(MAXNUP),SPINUP(MAXNUP)
54
41
call setrun !Sets up run parameters
57
43
write(*,*) 'Enter event file name'
58
44
read(*,*) event_file
61
47
write(*,*)' 0 otherwise'
50
if (store_rwgt_info)then
70
xQES_over_ref=QES_over_ref
71
xmuR_over_ref=muR_over_ref
72
xmuF1_over_ref=muF1_over_ref
73
xmuF2_over_ref=muF2_over_ref
75
write(*,*) 'QES_over_ref: ', xQES_over_ref
76
write(*,*) 'muR_over_ref: ', xmuR_over_ref
77
write(*,*) 'muF1_over_ref: ', xmuF1_over_ref
78
write(*,*) 'muF2_over_ref: ', xmuF2_over_ref
79
if (xmuF1_over_ref .ne. xmuF2_over_ref) then
80
write(*,*) "The variables muF1_over_ref and muF2_over_ref" //
81
1 " have to be set equal in the run_card.dat." //
82
1 " Run cannot continue, quitting..."
86
59
if(do_rwgt_scale)then
88
yfactR(2)=rw_Rscale_up
89
yfactR(3)=rw_Rscale_down
91
yfactF(2)=rw_Fscale_up
92
yfactF(3)=rw_Fscale_down
93
write(*,*) 'Doing scale reweight:'
94
write(*,*) rw_Fscale_down, ' < mu_F < ', rw_Fscale_up
95
write(*,*) rw_Rscale_down, ' < mu_R < ', rw_Rscale_up
61
if (lscalevar(nn)) then
62
write (*,*) "Including scale uncertainties for"/
63
$ /" dynamical_scale_choice",dyn_scale(nn)
64
write (*,*) " - renormalisation scale variation:"
65
$ ,(scalevarR(i),i=1,nint(scalevarR(0)))
66
write (*,*) " - factorisation scale variation:"
67
$ ,(scalevarF(i),i=1,nint(scalevarF(0)))
69
write (*,*) "Including central value for"/
70
$ /" dynamical_scale_choice",dyn_scale(nn)
101
c Note: when ipdf#0, the central PDF set will be used also as a reference
102
c for the scale uncertainty
103
75
if(do_rwgt_pdf)then
108
nsets=itmp-idpdf(1)+1
109
write(*,*) 'Doing PDF reweight:'
110
write(*,*) 'Central set id: ', idpdf(0)
111
write(*,*) 'Min error set id: ', idpdf(1)
112
write(*,*) 'Max error set id: ', itmp
113
if(mod(nsets,2).ne.0)then
114
write(*,*)'The number of error sets must be even',nsets
120
idpdf(i)=idpdf(1)+i-1
122
if(nsets.gt.maxPDFs)then
123
write(*,*)'Too many PDFs: increase maxPDFs in reweight0.inc'
129
call pdfset(parm,value)
78
write (*,*) "Including central PDF with "/
79
$ /"uncertainties for "//lhaPDFsetname(nn)
81
write (*,*) "Including central PDF for "
84
c Load all the PDF sets (the 1st one has already by loaded by the call
87
call initpdfsetbynamem(nn,lhaPDFsetname(nn))
89
call numberPDFm(nn,nmemPDF(nn))
94
if(nmemPDF(nn)+1.gt.maxPDFs)then
95
write(*,*)'Too many PDFs: increase maxPDFs in '/
96
$ /'reweight0.inc to ',numPDFs+1
100
c start with central member of the first set
136
c$$$ call fk88strcat(event_file,'.rwgt',fname1)
137
104
lef=index(event_file,' ')-1
138
105
fname1=event_file(1:lef)//'.rwgt'
147
114
& XSECUP,XERRUP,XMAXUP,LPRUP)
149
116
do i=1,min(10,maxevt)
150
call read_lhef_event(ifile,
151
& NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,
152
& IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
154
if(buff(1:1).ne.'#')then
155
write(*,*)'This event file cannot be reweighted [1]',i
158
read(buff,*)ch1,iSorH_lhe,ifks_lhe,jfks_lhe,
159
# fksfather_lhe,ipartner_lhe,
160
# scale1_lhe,scale2_lhe,
161
# kwgtinfo,kexternal,jwgtnumpartn,
162
# wgtcentral,wgtmumin,wgtmumax,wgtpdfmin,wgtpdfmax
163
if((kwgtinfo.lt.1.or.kwgtinfo.gt.5) .and. kwgtinfo.ne.-5)then
164
write(*,*)'This event file cannot be reweighted [2]',i
117
call read_lhef_event(ifile,
118
& NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,
119
& IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
120
if(buff(1:1).ne.'#')then
121
write (*,*) 'This event file cannot be reweighted [1]',i
124
read(buff,*)ch1,iSorH_lhe,ifks_lhe,jfks_lhe,fksfather_lhe
125
$ ,ipartner_lhe,scale1_lhe,scale2_lhe,kwgtinfo,kexternal
126
$ ,jwgtnumpartn,wgtcentral,wgtmumin,wgtmumax,wgtpdfmin
128
if(kwgtinfo.ne.-5)then
129
write (*,*) 'This event file cannot be reweighted [2]',i
169
134
saved_weight=abs(XWGTUP)
230
200
$ ,jwgtnumpartn,wgtcentral,wgtmumin,wgtmumax,wgtpdfmin
233
if (kwgtinfo.ne.-5) then
234
call reweight_fill_extra_inverse()
236
if(kwgtinfo.lt.1.or.kwgtinfo.gt.5)then
237
write(*,*)'This event file cannot be reweighted [4]',i
241
if(wgtcentral.ne.0.d0.or.wgtmumin.ne.0.d0.or.
242
# wgtmumax.ne.0.d0.or.wgtpdfmin.ne.0.d0.or.
243
# wgtpdfmax.ne.0.d0)then
244
write(*,*)'This event file was already reweighted',i
245
write(*,*)wgtcentral,wgtmumin,wgtmumax,wgtpdfmin,wgtpdfmax
249
if (kwgtinfo.eq.5) call reweight_settozero()
251
if(do_rwgt_scale)then
259
pr_muR_over_ref=xmuR_over_ref*yfactR(kr)
260
pr_muF1_over_ref=xmuF1_over_ref*yfactF(kf)
261
pr_muF2_over_ref=pr_muF1_over_ref
263
if(iSorH_lhe.eq.1)then
264
c The nbody contributions
265
if (kwgtinfo.eq.5) then
266
call fill_reweight0inc_nbody(i_process)
267
wgtxsecmu(kr,kf)=wgtxsecmu(kr,kf)
268
& +compute_rwgt_wgt_Sev_nbody(pr_muR_over_ref
269
& ,pr_muF1_over_ref, pr_muF2_over_ref
270
& ,xQES_over_ref, kwgtinfo)
271
call reweight_settozero()
273
do ii=1,nScontributions
274
nFKSprocess_used=nFKSprocess_reweight(ii)
276
& call fill_reweight0inc(nFKSprocess_used*2-1
278
wgtxsecmu(kr,kf)=wgtxsecmu(kr,kf)+
279
& compute_rwgt_wgt_Sev(pr_muR_over_ref
280
& ,pr_muF1_over_ref, pr_muF2_over_ref
281
& ,xQES_over_ref, kwgtinfo)
282
if (kwgtinfo.eq.5) call reweight_settozero()
284
elseif(iSorH_lhe.eq.2)then
286
& call fill_reweight0inc(nFKSprocess_used*2,
288
wgtxsecmu(kr,kf)=wgtxsecmu(kr,kf)+
289
& compute_rwgt_wgt_Hev(pr_muR_over_ref
290
& ,pr_muF1_over_ref, pr_muF2_over_ref
291
& ,xQES_over_ref, kwgtinfo)
292
if (kwgtinfo.eq.5) call reweight_settozero()
294
write(*,*)'Invalid value of iSorH_lhe',iSorH_lhe
299
if(tmp.lt.wgtmumin)wgtmumin=tmp
300
if(tmp.gt.wgtmumax)wgtmumax=tmp
304
if (kwgtinfo.eq.5) then
305
if (iSorH_lhe.eq.1) then
306
wgtref=wgtref_nbody_all(i_process)
307
do ii=1,nScontributions
308
wgtref=wgtref+ wgtref_all(nFKSprocess_reweight(ii)*2
312
wgtref=wgtref_all(nFKSprocess_used*2,i_process)
317
wgtcentral=wgtxsecmu(1,1)/wgtref
318
wgtmumin=wgtmumin/wgtref
319
wgtmumax=wgtmumax/wgtref
321
wgtcentral=wgtxsecmu(1,1)
333
if(iSorH_lhe.eq.1)then
334
c The nbody contributions
335
if (kwgtinfo.eq.5) then
336
call fill_reweight0inc_nbody(i_process)
337
wgtxsecPDF(n)=wgtxsecPDF(n)
338
$ +compute_rwgt_wgt_Sev_nbody(xmuR_over_ref
339
$ ,xmuF1_over_ref, xmuF2_over_ref ,xQES_over_ref,
341
call reweight_settozero()
343
do ii=1,nScontributions
344
nFKSprocess_used=nFKSprocess_reweight(ii)
346
& call fill_reweight0inc(nFKSprocess_used*2-1
348
wgtxsecPDF(n)=wgtxsecPDF(n)+
349
& compute_rwgt_wgt_Sev(xmuR_over_ref
350
& ,xmuF1_over_ref, xmuF2_over_ref ,xQES_over_ref,
352
if (kwgtinfo.eq.5) call reweight_settozero()
354
elseif(iSorH_lhe.eq.2)then
356
& call fill_reweight0inc(nFKSprocess_used*2,
358
wgtxsecPDF(n)=wgtxsecPDF(n)+
359
& compute_rwgt_wgt_Hev(xmuR_over_ref ,xmuF1_over_ref,
360
& xmuF2_over_ref ,xQES_over_ref, kwgtinfo)
361
if (kwgtinfo.eq.5) call reweight_settozero()
363
write(*,*)'Invalid value of iSorH_lhe',iSorH_lhe
367
if (kwgtinfo.eq.5) then
368
if (iSorH_lhe.eq.1) then
369
wgtref=wgtref_nbody_all(i_process)
370
do ii=1,nScontributions
371
wgtref=wgtref+wgtref_all(nFKSprocess_reweight(ii)
375
wgtref=wgtref_all(nFKSprocess_used*2,i_process)
380
xsecPDFr(n)=wgtxsecPDF(n)/wgtref
382
xsecPDFr(n)=wgtxsecPDF(n)
386
if(do_rwgt_scale)then
387
if(abs(xsecPDFr(0)/wgtcentral-1.d0).gt.1.d-6)then
388
write(*,*)'Central valued computed with mu and PDF differ'
389
write(*,*)xsecPDFr(0),wgtcentral
393
wgtcentral=xsecPDFr(0)
394
c The following serves to write on tape the reference cross section
395
c computed with the new parameters
396
wgtxsecmu(1,1)=wgtxsecPDF(0)
408
# xsecPDFr(0)-xsecPDFr(nps),
409
# xsecPDFr(0)-xsecPDFr(nng)) )**2
412
# xsecPDFr(nps)-xsecPDFr(0),
413
# xsecPDFr(nng)-xsecPDFr(0)) )**2
415
wgtpdfmin=wgtcentral-sqrt(wgtpdfmin)
416
wgtpdfmax=wgtcentral+sqrt(wgtpdfmax)
418
c Restore default PDFs
423
else ! kwgtinfo.eq.-5
425
call fill_wgt_info_from_rwgt_lines
426
if (do_rwgt_scale)call reweight_scale_ext(yfactR,yfactF)
427
if (do_rwgt_pdf) call reweight_pdf_ext
428
call fill_rwgt_arrays
432
write(buff,201)'#aMCatNLO',iSorH_lhe,ifks_lhe,jfks_lhe,
433
$ fksfather_lhe,ipartner_lhe, scale1_lhe,scale2_lhe, isave
434
$ ,izero,izero, wgtcentral,wgtmumin,wgtmumax,wgtpdfmin
203
c Do the actual reweighting.
204
call fill_wgt_info_from_rwgt_lines
205
if (do_rwgt_scale)call reweight_scale_ext
206
if (do_rwgt_pdf) call reweight_pdf_ext
207
call fill_rwgt_arrays
209
write(buff,201)'#aMCatNLO',iSorH_lhe,ifks_lhe,jfks_lhe,
210
$ fksfather_lhe,ipartner_lhe, scale1_lhe,scale2_lhe, isave
211
$ ,mexternal,izero, wgtcentral,wgtmumin,wgtmumax,wgtpdfmin
438
214
c renormalize all the scale & PDF weights to have the same normalization
440
if(do_rwgt_scale)then
443
wgtxsecmu(kr,kf)=wgtxsecmu(kr,kf)/wgtref*XWGTUP
449
wgtxsecPDF(n)=wgtxsecPDF(n)/wgtref*XWGTUP
216
if(do_rwgt_scale)then
218
if (lscalevar(kk)) then
219
do ii=1,nint(scalevarF(0))
220
do jj=1,nint(scalevarR(0))
222
& wgtxsecmu(jj,ii,kk)/wgtref*XWGTUP
226
wgtxsecmu(1,1,kk)=wgtxsecmu(1,1,kk)/wgtref*XWGTUP
230
if (do_rwgt_pdf) then
232
if (lpdfvar(nn)) then
234
wgtxsecPDF(n,nn)=wgtxsecPDF(n,nn)/wgtref*XWGTUP
237
wgtxsecPDF(0,nn)=wgtxsecPDF(0,nn)/wgtref*XWGTUP
453
242
c Keep track of the accumulated results:
454
if (numscales.gt.0) then
457
xsecScale_acc(ii,jj)=xsecScale_acc(ii,jj)+wgtxsecmu(ii
464
xsecPDFr_acc(n)=xsecPDFr_acc(n)+wgtxsecPDF(n)
243
if (do_rwgt_scale) then
245
if (lscalevar(kk)) then
246
do ii=1,nint(scalevarF(0))
247
do jj=1,nint(scalevarR(0))
248
xsecScale_acc(jj,ii,kk)=xsecScale_acc(jj,ii,kk)
249
$ +wgtxsecmu(jj,ii,kk)
254
xsecScale_acc(1,1,kk)=xsecScale_acc(1,1,kk)
259
if (do_rwgt_pdf) then
261
if (lpdfvar(nn)) then
263
xsecPDFr_acc(n,nn)=xsecPDFr_acc(n,nn)+wgtxsecPDF(n
267
xsecPDFr_acc(0,nn)=xsecPDFr_acc(0,nn)+wgtxsecPDF(0,nn)
468
271
c Write event to disk:
469
call write_lhef_event(ofile,
470
& NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,
471
& IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
272
call write_lhef_event(ofile,
273
& NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,
274
& IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
475
278
write(ofile,'(a)')'</LesHouchesEvents>'
479
282
c Write the accumulated results to a file
480
283
open (unit=34,file='scale_pdf_dependence.dat',status='unknown')
481
write (34,*) numscales**2
482
if (numscales.gt.0) then
483
write (34,*) ((xsecScale_acc(ii,jj),ii=1,numscales),jj=1
284
if (do_rwgt_scale) then
285
write (34,*) "scale variations:"
287
if (lscalevar(kk)) then
288
write (34,*) dyn_scale(kk),nint(scalevarR(0))
289
$ ,nint(scalevarF(0))
290
write (34,*) ((xsecScale_acc(jj,ii,kk),jj=1
291
$ ,nint(scalevarR(0))),ii=1,nint(scalevarF(0)))
293
write (34,*) dyn_scale(kk),1,1
294
write (34,*) xsecScale_acc(1,1,kk)
489
write (34,*) nsets + 1
490
write (34,*) (xsecPDFr_acc(n),n=0,nsets)
298
if (do_rwgt_pdf) then
299
write (34,*) "pdf variations:"
301
if (lpdfvar(nn)) then
302
write (34,*) trim(adjustl(lhaPDFsetname(nn))),
304
write (34,*) (xsecPDFr_acc(n,nn),n=0,nmemPDF(nn))
306
write(34,*) lhaPDFsetname(nn),nmemPDF(nn) + 1
307
write (34,*) xsecPDFr_acc(0,nn)
497
201 format(a9,1x,i1,4(1x,i2),2(1x,e14.8),1x,i1,2(1x,i2),5(1x,e14.8))
313
201 format(a9,1x,i1,4(1x,i2),2(1x,e14.8),1x,i2,2(1x,i2),5(1x,e14.8))
502
317
c Dummy subroutine (normally used with vegas/mint when resuming plots)
503
318
subroutine resume()
572
379
subroutine fill_wgt_info_from_rwgt_lines
574
381
include 'nexternal.inc'
575
382
include 'c_weight.inc'
576
383
include 'reweight0.inc'
577
integer i,idum,j,k,momenta_conf
384
integer i,idum,j,k,momenta_conf(2),ii
578
385
icontr=n_ctr_found
581
read(n_ctr_str(i),*)(wgt(j,i),j=1,3),idum,(pdg(j,i),j=1
582
& ,nexternal),QCDpower(i),(bjx(j,i),j=1,2),(scales2(j,i),j=1
583
& ,3),momenta_conf,itype(i),nFKS(i),wgts(1,i)
586
momenta(k,j,i)=momenta_str(k,j,momenta_conf)
388
read(n_ctr_str(i),*)(wgt(j,i),j=1,3),(wgt_ME_tree(j,i),j=1,2)
389
& ,idum,(pdg(j,i),j=1,nexternal),QCDpower(i),(bjx(j,i),j=1
390
& ,2),(scales2(j,i),j=1,3),g_strong(i),(momenta_conf(j),j=1
391
& ,2),itype(i),nFKS(i),idum,idum,idum,wgts(1,i)
395
if (momenta_conf(ii).gt.0) then
396
momenta_m(k,j,ii,i)=momenta_str(k,j
399
momenta_m(k,j,ii,i)=-99d0
592
subroutine reweight_scale_ext(yfactR,yfactF)
408
subroutine reweight_scale_ext
594
410
include 'nexternal.inc'
595
411
include 'c_weight.inc'
596
412
include 'run.inc'
597
integer i,pd,lp,iwgt_save,kr,kf
598
double precision yfactR(3),yfactF(3),mu2_f(3),mu2_r(3),xlum(3)
599
& ,pdg2pdf,mu2_q,rwgt_muR_dep_fac,g(3),alphas,pi
413
include 'reweight0.inc'
414
integer i,pd,lp,iwgt_save,kr,kf,dd
415
double precision mu2_f(maxscales),mu2_r(maxscales),xlum(maxscales)
416
$ ,pdg2pdf,mu2_q,rwgt_muR_dep_fac,g(maxscales),alphas,pi
600
418
parameter (pi=3.14159265358979323846d0)
601
419
external pdg2pdf,rwgt_muR_dep_fac,alphas
605
423
mu2_q=scales2(1,i)
607
mu2_r(kr)=scales2(2,i)*yfactR(kr)**2
425
call set_mu_central(i,dd,c_mu2_r,c_mu2_f)
426
do kr=1,nint(scalevarR(0))
427
if ((.not. lscalevar(dd)) .and. kr.ne.1) exit
428
mu2_r(kr)=c_mu2_r*scalevarR(kr)**2
608
429
c Update the strong coupling
609
g(kr)=sqrt(4d0*pi*alphas(sqrt(mu2_r(kr))))
612
mu2_f(kf)=scales2(3,i)*yfactF(kf)**2
430
g(kr)=sqrt(4d0*pi*alphas(sqrt(mu2_r(kr))))
432
do kf=1,nint(scalevarF(0))
433
if ((.not. lscalevar(dd)) .and. kf.ne.1) exit
434
mu2_f(kf)=c_mu2_f*scalevarF(kf)**2
618
xlum(kf)=xlum(kf)*PDG2PDF(ABS(LPP(1)),pd*LP,bjx(1,i)
623
xlum(kf)=xlum(kf)*PDG2PDF(ABS(LPP(2)),pd*LP,bjx(2,i)
628
iwgt=iwgt+1 ! increment the iwgt for the wgts() array
629
if (iwgt.gt.max_wgt) then
630
write (*,*) 'ERROR too many weights in reweight_scale'
440
xlum(kf)=xlum(kf)*PDG2PDF(ABS(LPP(1)),pd*LP,bjx(1,i)
445
xlum(kf)=xlum(kf)*PDG2PDF(ABS(LPP(2)),pd*LP,bjx(2,i)
448
do kf=1,nint(scalevarF(0))
449
if ((.not. lscalevar(dd)) .and. kf.ne.1) exit
450
do kr=1,nint(scalevarR(0))
451
if ((.not. lscalevar(dd)) .and. kr.ne.1) exit
452
iwgt=iwgt+1 ! increment the iwgt for the wgts() array
453
if (iwgt.gt.max_wgt) then
454
write (*,*) 'ERROR too many weights in '/
455
$ /'reweight_scale',iwgt,max_wgt
634
458
c add the weights to the array
635
wgts(iwgt,i)=xlum(kf) * (wgt(1,i)+wgt(2,i)*log(mu2_r(kr)
636
& /mu2_q)+wgt(3,i)*log(mu2_f(kf)/mu2_q))*g(kr)
638
wgts(iwgt,i)=wgts(iwgt,i)
639
& *rwgt_muR_dep_fac(sqrt(mu2_r(kr)),sqrt(mu2_r(1)))
459
wgts(iwgt,i)=xlum(kf) * (wgt(1,i)+wgt(2,i)
460
$ *log(mu2_r(kr)/mu2_q)+wgt(3,i)*log(mu2_f(kf)
461
$ /mu2_q))*g(kr)**QCDpower(i)
462
wgts(iwgt,i)=wgts(iwgt,i)*rwgt_muR_dep_fac(
463
& sqrt(mu2_r(kr)),sqrt(scales2(2,i)))
650
475
include 'c_weight.inc'
651
476
include 'run.inc'
652
477
include 'reweight0.inc'
653
integer i,pd,lp,iwgt_save,izero,n
478
integer i,pd,lp,iwgt_save,izero,n,nn,iset,imem
654
479
parameter (izero=0)
655
480
double precision mu2_f,mu2_r,pdg2pdf,mu2_q,rwgt_muR_dep_fac
656
481
& ,xlum,alphas,g,pi
657
482
parameter (pi=3.14159265358979323846d0)
658
483
external pdg2pdf,rwgt_muR_dep_fac,alphas
661
if (iwgt.gt.max_wgt) then
662
write (*,*) 'ERROR too many weights in reweight_pdf',iwgt
486
if ((.not. lpdfvar(nn)) .and. n.ne.0) exit
488
if (iwgt.gt.max_wgt) then
489
write (*,*) 'ERROR too many weights in reweight_pdf',iwgt
672
g=sqrt(4d0*pi*alphas(sqrt(mu2_r)))
499
g=sqrt(4d0*pi*alphas(sqrt(mu2_r)))
678
xlum=xlum*PDG2PDF(ABS(LPP(1)),pd*LP,bjx(1,i),DSQRT(mu2_f))
682
xlum=xlum*PDG2PDF(ABS(LPP(2)),pd*LP,bjx(2,i),DSQRT(mu2_f))
506
& PDG2PDF(ABS(LPP(1)),pd*LP,bjx(1,i),DSQRT(mu2_f))
511
& PDG2PDF(ABS(LPP(2)),pd*LP,bjx(2,i),DSQRT(mu2_f))
683
512
c add the weights to the array
684
wgts(iwgt,i)=xlum * (wgt(1,i) + wgt(2,i)*log(mu2_r/mu2_q) +
685
& wgt(3,i)*log(mu2_f/mu2_q))*g**QCDpower(i)
686
wgts(iwgt,i)=wgts(iwgt,i)
687
& *rwgt_muR_dep_fac(sqrt(mu2_r),sqrt(mu2_r))
513
wgts(iwgt,i)=xlum * (wgt(1,i) + wgt(2,i)*log(mu2_r/mu2_q)
514
& +wgt(3,i)*log(mu2_f/mu2_q))*g**QCDpower(i)
515
wgts(iwgt,i)=wgts(iwgt,i)
516
& *rwgt_muR_dep_fac(sqrt(mu2_r),sqrt(mu2_r))
520
c reset to the 0th member of the 1st set
697
528
include 'nexternal.inc'
698
529
include 'c_weight.inc'
699
530
include 'reweight0.inc'
532
integer ii,jj,kk,nn,n,iw,i
534
if (lscalevar(kk)) then
535
do ii=1,nint(scalevarF(0))
536
do jj=1,nint(scalevarR(0))
537
wgtxsecmu(jj,ii,kk)=0d0
541
wgtxsecmu(1,1,kk)=0d0
545
if (lpdfvar(nn)) then
713
wgtxsecmu(kr,kf)=wgtxsecmu(kr,kf)+wgts(iw,i)
718
wgtxsecPDF(n)=wgtxsecPDF(n)+wgts(iw,i)
555
if (do_rwgt_scale) then
557
if (lscalevar(kk)) then
558
do ii=1,nint(scalevarF(0))
559
do jj=1,nint(scalevarR(0))
560
wgtxsecmu(jj,ii,kk)=wgtxsecmu(jj,ii,kk)+wgts(iw,i)
565
wgtxsecmu(1,1,kk)=wgtxsecmu(1,1,kk)+wgts(iw,i)
570
if (do_rwgt_pdf) then
572
if (lpdfvar(nn)) then
574
wgtxsecPDF(n,nn)=wgtxsecPDF(n,nn)+wgts(iw,i)
578
wgtxsecPDF(0,nn)=wgtxsecPDF(0,nn)+wgts(iw,i)
722
if (numscales.eq.0) then
723
wgtxsecmu(1,1)=wgtxsecPDF(0)
588
subroutine set_mu_central(ic,dd,c_mu2_r,c_mu2_f)
590
include 'nexternal.inc'
591
include 'c_weight.inc'
592
include 'reweight0.inc'
595
double precision c_mu2_r,c_mu2_f,muR,muF,pp(0:3,nexternal)
597
c_mu2_r=scales2(2,ic)
598
c_mu2_f=scales2(3,ic)
600
c need to recompute the scales using the momenta
601
dynamical_scale_choice=dyn_scale(dd)
604
pp(j,i)=momenta(j,i,ic)
607
call set_ren_scale(pp,muR)
609
call set_fac_scale(pp,muF)
611
c reset the default dynamical_scale_choice
612
dynamical_scale_choice=dyn_scale(1)