5 changed files with 219 additions and 2 deletions
@ -0,0 +1,199 @@ |
|||||
|
! |
||||
|
! SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
! Copyright (C) 2019-2022, respective authors of MCFM. |
||||
|
! |
||||
|
|
||||
|
module nplotter_ktopanom |
||||
|
use types |
||||
|
use MCFMPlotting |
||||
|
|
||||
|
implicit none |
||||
|
|
||||
|
public :: setup, book |
||||
|
private |
||||
|
|
||||
|
integer, save, allocatable :: histos(:) |
||||
|
|
||||
|
contains |
||||
|
|
||||
|
subroutine setup() |
||||
|
use types |
||||
|
use parseinput |
||||
|
implicit none |
||||
|
include 'mpicommon.f' |
||||
|
|
||||
|
allocate(histos(1)) |
||||
|
|
||||
|
histos(1) = plot_setup_uniform(0.0_dp, 200.0_dp, 5.0_dp, 'mbl') |
||||
|
|
||||
|
end subroutine |
||||
|
|
||||
|
subroutine book(p,wt,ids,vals,wts) |
||||
|
use types |
||||
|
use ResummationTransition |
||||
|
use ieee_arithmetic |
||||
|
use jettagging |
||||
|
use bbfrac_m, only: bbpart |
||||
|
use qsort_m |
||||
|
use mathfun |
||||
|
use SCET, only: currentNd |
||||
|
implicit none |
||||
|
include 'mxpart.f' |
||||
|
include 'kpart.f' |
||||
|
include 'jetlabel.f' |
||||
|
include 'plabel.f' |
||||
|
|
||||
|
real(dp), intent(in) :: p(mxpart,4) |
||||
|
real(dp), intent(in) :: wt |
||||
|
|
||||
|
integer, allocatable, intent(out) :: ids(:) |
||||
|
real(dp), allocatable, intent(out) :: vals(:) |
||||
|
real(dp), allocatable, intent(out) :: wts(:) |
||||
|
|
||||
|
integer :: jetindices(3) |
||||
|
|
||||
|
integer :: bjetindices(3) |
||||
|
integer :: nonbjetindices(3) |
||||
|
|
||||
|
integer :: bjetindices_bbfrac(3) |
||||
|
integer :: nonbjetindices_bbfrac(3) |
||||
|
|
||||
|
real(dp) :: plep(4), pnu(4) |
||||
|
|
||||
|
integer :: i,n |
||||
|
|
||||
|
integer :: imax, imaxb |
||||
|
|
||||
|
real(dp) :: puremass |
||||
|
real(dp) :: mbl |
||||
|
|
||||
|
jetindices(:) = [5,6,7] |
||||
|
|
||||
|
! the 'bbpart' variable (logical, true or false) designates whether we |
||||
|
! have two b-quarks in the final state or not |
||||
|
|
||||
|
bjetindices = 0 |
||||
|
nonbjetindices = 0 |
||||
|
|
||||
|
! for main part with at most one b |
||||
|
if (bbpart .eqv. .false.) then |
||||
|
imax = 1 |
||||
|
imaxb = 1 |
||||
|
do i=1,jets |
||||
|
if (iand(bitflag(5),jetcontent(jetindices(i),currentNd)) > 0) then |
||||
|
bjetindices(imaxb) = jetindices(i) |
||||
|
imaxb = imaxb + 1 |
||||
|
else |
||||
|
nonbjetindices(imax) = jetindices(i) |
||||
|
imax = imax + 1 |
||||
|
endif |
||||
|
enddo |
||||
|
else |
||||
|
imax = 1 |
||||
|
imaxb = 1 |
||||
|
do i=1,jets |
||||
|
if ((iand(bitflag(5),jetcontent(jetindices(i),currentNd)) > 0) .or. & |
||||
|
(iand(bitflag(7),jetcontent(jetindices(i),currentNd)) > 0)) then |
||||
|
bjetindices(imaxb) = jetindices(i) |
||||
|
imaxb = imaxb + 1 |
||||
|
else |
||||
|
nonbjetindices(imax) = jetindices(i) |
||||
|
imax = imax + 1 |
||||
|
endif |
||||
|
enddo |
||||
|
|
||||
|
endif |
||||
|
|
||||
|
! require at least one b-jet and one light jet |
||||
|
if ( bjetindices(1) == 0 .or. nonbjetindices(1) == 0 ) then |
||||
|
ids = histos |
||||
|
vals = [0._dp] |
||||
|
wts = [0._dp] |
||||
|
return |
||||
|
endif |
||||
|
|
||||
|
if (plabel(3) == 'el') then |
||||
|
plep(:) = p(3,:) |
||||
|
pnu(:) = p(4,:) |
||||
|
else |
||||
|
plep(:) = p(4,:) |
||||
|
pnu(:) = p(3,:) |
||||
|
endif |
||||
|
|
||||
|
mbl = puremass(p(bjetindices(1),:) + plep(:)) |
||||
|
|
||||
|
ids = histos |
||||
|
vals = [mbl] |
||||
|
wts = [wt] |
||||
|
|
||||
|
end subroutine book |
||||
|
|
||||
|
|
||||
|
subroutine wrecons(pl_in, pnu_in, pnu_out) |
||||
|
use types |
||||
|
implicit none |
||||
|
include 'masses.f' |
||||
|
|
||||
|
real(dp), intent(in) :: pl_in(4) |
||||
|
real(dp), intent(in) :: pnu_in(4) |
||||
|
real(dp), intent(out) :: pnu_out(4) |
||||
|
|
||||
|
integer, parameter :: ielectron = 1 |
||||
|
integer, parameter :: ineutrino = 2 |
||||
|
|
||||
|
real(dp) :: ps(0:3, 2) |
||||
|
real(dp) :: pn(0:3) |
||||
|
|
||||
|
real(dp) :: a,b,c,d, fix |
||||
|
logical :: good |
||||
|
|
||||
|
integer :: i,j |
||||
|
|
||||
|
ps(0:3,1) = [pl_in(4), pl_in(1), pl_in(2), pl_in(3)] |
||||
|
ps(0:3,2) = [pnu_in(4), pnu_in(1), pnu_in(2), pnu_in(3)] |
||||
|
|
||||
|
pn(:) = ps(:,2) |
||||
|
|
||||
|
|
||||
|
! from MG 1 |
||||
|
|
||||
|
i = ielectron |
||||
|
j = ineutrino |
||||
|
a=wmass*wmass*.5d0+ps(1,i)*ps(1,j)+ps(2,i)*ps(2,j) |
||||
|
b = ps(0,i) |
||||
|
c = sqrt(ps(1,j)**2+ps(2,j)**2) |
||||
|
d = ps(3,i) |
||||
|
good =(a**2 - b**2*c**2 + c**2*d**2 > 0d0) |
||||
|
fix=1d0 |
||||
|
do while (.not. good) |
||||
|
fix=fix*0.9d0 |
||||
|
ps(1,j)=ps(1,j)*.9d0 |
||||
|
ps(2,j)=ps(2,j)*.9d0 |
||||
|
a = wmass*wmass*.5d0+ps(1,i)*ps(1,j)+ps(2,i)*ps(2,j) |
||||
|
b = ps(0,i) |
||||
|
c = sqrt(ps(1,j)**2+ps(2,j)**2) |
||||
|
d = ps(3,i) |
||||
|
good =(a**2 - b**2*c**2 + c**2*d**2 > 0d0) |
||||
|
enddo |
||||
|
ps(3,j) = (2d0*a*d/(b**2 - d**2) + & |
||||
|
2d0*b*Sqrt(max(a**2 - b**2*c**2 + c**2*d**2,0d0))/ & |
||||
|
((b - d)*(b + d)))/2d0 |
||||
|
|
||||
|
pn(3) = (2d0*a*d/(b**2 - d**2) - & |
||||
|
2d0*b*Sqrt(max(a**2 - b**2*c**2 + c**2*d**2,0d0))/ & |
||||
|
((b - d)*(b + d)))/2d0 |
||||
|
if (abs(ps(3,j)) > abs(pn(3))) then |
||||
|
a=ps(3,j) |
||||
|
ps(3,j)=pn(3) |
||||
|
pn(3)=a |
||||
|
endif |
||||
|
ps(0,j) = sqrt(ps(1,j)**2+ps(2,j)**2+ps(3,j)**2) |
||||
|
pn(0) = sqrt(pn(1)**2+pn(2)**2+pn(3)**2) |
||||
|
|
||||
|
pnu_out(4) = ps(0,j) |
||||
|
pnu_out(1:3) = ps(1:3,j) |
||||
|
|
||||
|
|
||||
|
end subroutine |
||||
|
|
||||
|
end module |
||||
Loading…
Reference in new issue