forked from alisw/POWHEG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecidemerging.f
322 lines (315 loc) · 10.5 KB
/
decidemerging.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
subroutine getbornfac(nlegs,flav,pin,bornfac)
c this is a remodelled setlocalscales0 routine, that only
c returns the Born factor.
implicit none
include 'pwhg_st.h'
include 'pwhg_math.h'
integer nlegs
integer flav(nlegs)
real * 8 pin(0:3,nlegs),bornfac,nlofac
integer onem
parameter (onem=1000000)
real * 8 scales(nlegs),p(0:3,nlegs),ptot(0:3),
1 lscalej,lscalek
integer j,k,l,lflav(nlegs),jmerge,kmerge,inlofac
integer mergedfl
real * 8 q2merge,q2merge0,renfac2,facfact2,alphas,mu2,muf2
real * 8 sudakov,expsudakov_mrg,pwhg_alphas,b0,powheginput
external sudakov,expsudakov_mrg,pwhg_alphas,powheginput
real * 8 q2mergeMAX
logical raisingscales,ini
save raisingscales,ini
data ini/.true./
if(ini) then
if(powheginput("#raisingscales").eq.1) then
raisingscales = .true.
else
raisingscales = .false.
endif
ini = .false.
endif
lflav=flav
p=pin
scales=0
q2mergeMAX=-1d10
do l=1,nlegs
call findNearestNeighbours(nlegs,p,lflav,jmerge,kmerge,
$ mergedfl,q2merge)
if(q2merge.lt.1d10) then
c perform the merging
if(q2merge.gt.q2mergeMAX) q2mergeMAX=q2merge
lscalej=scales(jmerge)
lscalek=scales(kmerge)
scales(jmerge)=q2merge
if(lscalej.eq.0) then
c This is the first merge; it sets the low scale for
c all partons; no Sudakov factor or reweighting is introduced
do j=1,nlegs
scales(j)=q2merge
enddo
c save this scale; it is the Q_0 scale that appears in all Sudakovs
q2merge0=q2merge
bornfac=0
c Provide alpha_S reweighting for the first merge
alphas=pwhg_alphas(max(q2merge,1d0),
1 st_lambda5MSB,st_nlight)
nlofac=alphas
inlofac=1
else
bornfac=bornfac+
1 expsudakov_mrg(q2merge0,q2merge,lscalej,lflav(jmerge))
bornfac=bornfac+
1 expsudakov_mrg(q2merge0,q2merge,lscalek,lflav(kmerge))
c provide alpha_S reweighting
alphas=pwhg_alphas(max(q2merge,1d0),
1 st_lambda5MSB,st_nlight)
nlofac=nlofac+alphas
inlofac=inlofac+1
endif
if(jmerge.gt.2) then
p(:,jmerge)=p(:,jmerge)+p(:,kmerge)
else
p(3,jmerge)=p(3,jmerge)-p(3,kmerge)
p(0,jmerge)=abs(p(3,jmerge))
endif
lflav(kmerge)=onem
lflav(jmerge)=mergedfl
else
goto 99
endif
enddo
99 continue
c No more merging is possible. Define the initial scale as
c the invariant mass of the remaining system
ptot=0
do j=3,nlegs
if(lflav(j).ne.onem) then
ptot=ptot+p(:,j)
endif
enddo
if(raisingscales) then
q2merge=max(q2mergeMAX,
$ ptot(0)**2-ptot(1)**2-ptot(2)**2-ptot(3)**2)
else
q2merge=ptot(0)**2-ptot(1)**2-ptot(2)**2-ptot(3)**2
endif
if(scales(1).gt.0) then
do j=1,nlegs
if(abs(lflav(j)).le.st_nlight) then
bornfac=bornfac+
1 expsudakov_mrg(q2merge0,q2merge,scales(j),lflav(j))
endif
enddo
else
c If scales(1)=0 no merge has taken place: no sudakovs.
inlofac=0
bornfac=0
nlofac=0
endif
if(st_bornorder.gt.inlofac) then
alphas=pwhg_alphas(max(q2merge,1d0),
1 st_lambda5MSB,st_nlight)
nlofac=nlofac+alphas*(st_bornorder-inlofac)
inlofac=st_bornorder
endif
if (inlofac /= 0) nlofac=nlofac/inlofac
bornfac=1+nlofac*bornfac
end
subroutine getbornfac_1(iflag,nlegs,flav,pin,bornfac)
c this is a remodelled setlocalscales0 routine, that only
c returns the Born factor.
implicit none
include 'pwhg_st.h'
include 'pwhg_math.h'
integer iflag,nlegs
integer flav(nlegs)
real * 8 pin(0:3,nlegs),bornfac,nlofac
integer onem
parameter (onem=1000000)
real * 8 scales(nlegs),p(0:3,nlegs),ptot(0:3),
1 lscalej,lscalek
integer j,k,l,lflav(nlegs),jmerge,kmerge,inlofac
integer mergedfl
real * 8 q2merge,q2merge0,renfac2,facfact2,alphas,mu2,muf2
real * 8 sudakov,expsudakov_mrg,pwhg_alphas,b0,powheginput
external sudakov,expsudakov_mrg,pwhg_alphas,powheginput
real * 8 q2mergeMAX
logical raisingscales,ini
save raisingscales,ini
data ini/.true./
if(ini) then
if(powheginput("#raisingscales").eq.1) then
raisingscales = .true.
else
raisingscales = .false.
endif
ini = .false.
endif
lflav=flav
p=pin
scales=0
q2mergeMAX=-1d10
do l=1,nlegs
call findNearestNeighbours(nlegs,p,lflav,jmerge,kmerge,
$ mergedfl,q2merge)
if(q2merge.lt.1d10) then
c if iflag=1 and l=1, perform the first merging and cycle
if(l.le.iflag) then
if(jmerge.gt.2) then
p(:,jmerge)=p(:,jmerge)+p(:,kmerge)
else
p(3,jmerge)=p(3,jmerge)-p(3,kmerge)
p(0,jmerge)=abs(p(3,jmerge))
endif
lflav(kmerge)=onem
lflav(jmerge)=mergedfl
cycle
endif
c perform the merging
if(q2merge.gt.q2mergeMAX) q2mergeMAX=q2merge
lscalej=scales(jmerge)
lscalek=scales(kmerge)
scales(jmerge)=q2merge
if(lscalej.eq.0) then
c This is the first merge; it sets the low scale for
c all partons; no Sudakov factor or reweighting is introduced
do j=1,nlegs
scales(j)=q2merge
enddo
c save this scale; it is the Q_0 scale that appears in all Sudakovs
q2merge0=q2merge
bornfac=0
c Provide alpha_S reweighting for the first merge
alphas=pwhg_alphas(max(q2merge,1d0),
1 st_lambda5MSB,st_nlight)
nlofac=alphas
inlofac=1
else
bornfac=bornfac+
1 expsudakov_mrg(q2merge0,q2merge,lscalej,lflav(jmerge))
bornfac=bornfac+
1 expsudakov_mrg(q2merge0,q2merge,lscalek,lflav(kmerge))
c provide alpha_S reweighting
alphas=pwhg_alphas(max(q2merge,1d0),
1 st_lambda5MSB,st_nlight)
nlofac=nlofac+alphas
inlofac=inlofac+1
bornfac=1 + bornfac*nlofac/inlofac
return
endif
if(jmerge.gt.2) then
p(:,jmerge)=p(:,jmerge)+p(:,kmerge)
else
p(3,jmerge)=p(3,jmerge)-p(3,kmerge)
p(0,jmerge)=abs(p(3,jmerge))
endif
lflav(kmerge)=onem
lflav(jmerge)=mergedfl
else
goto 99
endif
enddo
99 continue
c No more merging is possible. Define the initial scale as
c the invariant mass of the remaining system
ptot=0
do j=3,nlegs
if(lflav(j).ne.onem) then
ptot=ptot+p(:,j)
endif
enddo
if(raisingscales) then
q2merge=max(q2mergeMAX,
$ ptot(0)**2-ptot(1)**2-ptot(2)**2-ptot(3)**2)
else
q2merge=ptot(0)**2-ptot(1)**2-ptot(2)**2-ptot(3)**2
endif
if(scales(1).gt.0) then
do j=1,nlegs
if(abs(lflav(j)).le.st_nlight) then
bornfac=bornfac+
1 expsudakov_mrg(q2merge0,q2merge,scales(j),lflav(j))
endif
enddo
else
c If scales(1)=0 no merge has taken place: no sudakovs.
write(*,*) ' WARNING: getbornfac_1, no merging', iflag
write(*,*) 'lflav',lflav
write(*,*) 'flav',flav
write(*,*) 'q2merge',q2merge
inlofac=0
bornfac=1
nlofac=0
endif
if (inlofac /= 0) nlofac=nlofac/inlofac
bornfac=1+nlofac*bornfac
end
C ------------------------------------------------ C
C - Inputs: - C
C - ******* - C
C - q2h - Upper node scale / bound on Sudakov - C
C - q2l - Lower node scale / bound on Sudakov - C
C - flav - flavour index for the evolving parton - C
C - - C
C - Outputs: - C
C - ******** - C
C - expsudakov - The Sudakov form factor's expon - C
C - -ent MODULO a factor of minus - C
C - alphaS, integrated with alphaS - C
C - fixed. Summed over with the - C
C - relevant alphaS factors this is - C
C - used in compensating the NLO - C
C - correction induced when the - C
C - Sudakov multiplies the Born. - C
C - - C
C ------------------------------------------------ C
function expsudakov_mrg(q20,q2h,q2l,flav)
implicit none
real * 8 expsudakov_mrg,q2h,q2l,q20
integer flav
include 'pwhg_st.h'
include 'pwhg_math.h'
include 'pwhg_flg.h'
real * 8 b0,c,b,lam2
real * 8 powheginput
logical flagllsudmerg,ini
save flagllsudmerg,ini
data ini/.true./
if(ini) then
if(powheginput("#flagllsudmerg").eq.1) then
flagllsudmerg = .true.
write(*,*) ' Using only LL sudakov for merging'
else
write(*,*) ' Using NLL sudakov for merging'
flagllsudmerg = .false.
endif
ini = .false.
endif
lam2=st_lambda5MSB**2
if(q20.le.lam2.or.q2l.lt.lam2.or.q2h.lt.lam2) then
c in this case everything is zero, irrelevant
expsudakov_mrg=0
return
endif
if(q2l.ge.q2h.or.q2h.le.q20.or.flg_bornonly) then
expsudakov_mrg=0
return
endif
b0=(33-2*st_nlight)/12d0
if(flav.eq.0) then
c=3
b=b0/3
else
c=4d0/3
b=3d0/4
endif
if(flagllsudmerg) b = 0d0
if(q2l.le.q20) then
expsudakov_mrg=
1 c/pi*(0.25d0*log(q2h/q20)**2 - b*log(q2h/q20))
else
expsudakov_mrg=
1 c/pi*(0.25d0*log(q2h/q20)**2 - b*log(q2h/q20))
2 - c/pi*(0.25d0*log(q2l/q20)**2 - b*log(q2l/q20))
endif
end