Writing raw event data during FO integration
Hi,
I'd like to write raw event data to a text file during a MadGraph NLO FO run (4-vectors, ibody values, and weights). My goal is to read these values into root and construct my own histograms from them. Currently, I'm doing this in the analysis_fill subroutine of the analysis_root_xxx.f (where "xxx" is a user-defined name). This is a file that the user can use to define custom histogram filling. This generates four text files (one for each subprocess) which I then parse and combine in root to create histograms. The histograms I've generated are similar but not the same as those generated by the analysis_root_xxx.f file.
One issue I noticed is that the first chunk of events I was writing to my text files had weights of 0 for weights(i) where i=2:9. These events were not being used to fill the fortran-generated histograms. I corrected for this, but I'm still getting slightly different results.
My question is: do you know where, in the code, should I place a subroutine for writing the raw event data into a text file so that I can build my own histograms in root from that data and successfully reproduce the histograms given by the fortran code?
I've attached the file analysis_root_aaa.f which is the way I'm currently writing the generated events to text files.
Thanks in advance!
Sam
My parameter settings look like this:
#NLOSM_FO model lite
generate p p > h mu+ mu- [QCD]
output NLOSM_ulite
y
launch
fixed_order=ON
set ebeam1 7000.0
set ebeam2 7000.0
set pdlabel cteq6l1
set ptj 0.0
set etaj 5.0
set ptl 10.0
set etal 2.5
set drll 0.0
set mll 0.0
set ptgmin 10.0
set R0gamma 0.1
set mt 1.725000e+02
set mz 9.118760e+01
set mh 1.250900e+02
set mu- : 0.105658367
set gf 1.166370e-05
set wz 2.495200
set ww 2.088720
set wh 4.08e-03
done
I changed these settings to decrease computing time so that I can debug more quickly (taken from run_card.dat):
#******
# Number of points per itegration channel (ignored for aMC@NLO runs) *
#******
-1 = req_acc_FO ! Required accuracy (-1=ignored, and use the
# These numbers are ignored except if req_acc_FO is equal to -1
50 = npoints_FO_grid ! number of points to setup grids
1 = niters_FO_grid ! number of iter. to setup grids
100 = npoints_FO ! number of points to compute Xsec
1 = niters_FO ! number of iter. to compute Xsec
c
c Example analysis for "p p > h mu+ mu- [QCD]" process
c
ccccccccccccccc
subroutine analysis_
ccccccccccccccc
implicit none
integer nwgt
character*(*) weights_info(*)
integer j,kk,l,
common/
character*6 cc(2)
data cc/'|T@NLO','|T@LO '/
real * 8 etaMin,
real * 8 ptMin,ptMax,
parameter (pi=3.141592653
call open_root_file()
nwgt_
etaBin=1.d-1
etaMin=-5.d0
etaMax=5.d0
eBin=1.d1
eMin=0.d0
eMax=1.d3
ptBin=2.d0
ptMin=0.d0
ptMax=2.5d2
phiBin=
phiMin=
phiMax=
do j=1,2
do kk=1,nwgt_analysis
l=
call rbook(l+ 1,'eMu1 '//cc(j)
& eBin,eMin,eMax)
call rbook(l+ 2,'ptMu1 '//cc(j)
& ptBin,ptMin,ptMax)
call rbook(l+ 3,'etaMu1 '//cc(j)
& etaBin,
call rbook(l+ 4,'phiMu1 '//cc(j)
& phiBin,
call rbook(l+ 5,'eMu2 '//cc(j)
& eBin,eMin,eMax)
call rbook(l+ 6,'ptMu2 '//cc(j)
& ptBin,ptMin,ptMax)
call rbook(l+ 7,'etaMu2 '//cc(j)
& etaBin,
call rbook(l+ 8,'phiMu2 '//cc(j)
& phiBin,
call rbook(l+ 9,'eZ '//cc(j)
& eBin,eMin,eMax)
call rbook(l+ 10,'ptZ '//cc(j)
& ptBin,ptMin,ptMax)
call rbook(l+ 11,'yZ '//cc(j)
& etaBin,
call rbook(l+ 12,'etaZ '//cc(j)
& etaBin,
call rbook(l+ 13,'phiZ '//cc(j)
& phiBin,
call rbook(l+ 14,'mZ '//cc(j)
& 1.d0,5.d1,1.3d2)
call rbook(l+ 15,'eH '//cc(j)
& eBin,eMin,eMax)
call rbook(l+ 16,'ptH '//cc(j)
& ptBin,ptMin,ptMax)
call rbook(l+ 17,'yH '//cc(j)
& etaBin,
call rbook(l+ 18,'etaH '//cc(j)
& etaBin,
call rbook(l+ 19,'phiH '//cc(j)
& phiBin,
call rbook(l+ 20,'mH '//cc(j)
& 1.d0,1.05d2,1.45d2)
call rbook(l+ 21,'eZH '//cc(j)
& eBin,eMin,eMax)
call rbook(l+ 22,'ptZH '//cc(j)
& ptBin,ptMin,ptMax)
call rbook(l+ 23,'yZH '//cc(j)
& etaBin,
call rbook(l+ 24,'etaZH '//cc(j)
& etaBin,
call rbook(l+ 25,'phiZH '//cc(j)
& phiBin,
call rbook(l+ 26,'mZH '//cc(j)
& 5.d0,1.
call rbook(l+ 27,'Mu1 nw '//cc(j)
& eBin,eMin,eMax)
call rbook(l+ 28,'Mu1 nw2 '//cc(j)
& eBin,eMin,eMax)
enddo
enddo
return
end
ccccccccccccccc
subroutine analysis_end(xnorm)
ccccccccccccccc
implicit none
double precision xnorm
integer i,jj
integer kk,l,nwgt_analysis
common/
call wxnorm(xnorm)
c Do not touch the following lines. These lines make sure that the
c histograms will have the correct overall normalisation: cross section
c (in pb) per bin.
do i=1,2
do kk=1,nwgt_analysis
l=
do jj=1,26
call ropera(
enddo
enddo
enddo
call close_root_file
return
end
ccccccccccccccc
subroutine analysis_
ccccccccccccccc
implicit none
include 'nexternal.inc'
integer istatus(nexternal)
integer iPDG(nexternal)
double precision p(0:4,nexternal)
double precision wgts(*)
integer ibody
double precision wgt,var
integer i,kk,l,
common/
double precision www
double precision p4Mu1(0:
double precision eMu1,ptMu1,
double precision eMu2,ptMu2,
double precision eZ,ptZ,
double precision eH,ptH,
double precision eZH,ptZH,
double precision getrapidity,
external getrapidity,
if (nexternal.ne.6 .and. nexternal.ne.7) then
write (*,*) 'error #1 in analysis_fill: '/
& /'"p p > h mu+ mu- [QCD]": external particles'
stop 1
endif
if (abs(ipdg(1)).gt.5 .and. abs(ipdg(1)).ne.21) then
write (*,*) 'error #2 in analysis_fill: '/
& /'"p p > h mu+ mu- [QCD]": incoming parton 1'
stop 1
endif
if (abs(ipdg(2)).gt.5 .and. abs(ipdg(2)).ne.21) then
write (*,*) 'error #3 in analysis_fill: '/
& /'"p p > h mu+ mu- [QCD]": incoming parton 2'
stop 1
endif
if (abs(ipdg(
write (*,*) 'error #4 in analysis_fill: '/
& /'"p p > h mu+ mu- [QCD]": Higgs'
stop 1
endif
if (abs(ipdg(4)).ne.13 .or. abs(ipdg(5)).ne.13) then
write (*,*) 'error #5 in analysis_fill: '/
& /'"p p > h mu+ mu- [QCD]": muons'
stop 1
endif
C
do i=0,3
enddo
eMu1=p4Mu1(0)
ptMu1=
etaMu1=
phiMu1=
eMu2=p4Mu2(0)
ptMu2=
etaMu2=
phiMu2=
eZ=p4Z(0)
mZ=
ptZ=
yZ=
etaZ=
phiZ=
eH=p4H(0)
mH=
ptH=
yH=
etaH=
phiH=
eZH=p4ZH(0)
mZH=
ptZH=
yZH=
etaZH=
phiZH=
C
call wweights(wgts, nwgt_analysis, ibody, p4Mu1, p4Mu2, p4H)
call rfill(28,eMu1,1.d0)
c call wdebug(p4Mu1, p4Mu2, p4H, mZ, mH, mZH, wgts, nwgt)
do i=1,2
do kk=1,nwgt_analysis
if (ibody.ne.3 .and.i.eq.2) cycle
call rfill(l+ 1,eMu1,WWW)
call rfill(l+ 2,ptMu1,WWW)
call rfill(l+ 3,etaMu1,WWW)
call rfill(l+ 4,phiMu1,WWW)
call rfill(l+ 5,eMu2,WWW)
call rfill(l+ 6,ptMu2,WWW)
call rfill(l+ 7,etaMu2,WWW)
call rfill(l+ 8,phiMu2,WWW)
call rfill(l+ 9,eZ,WWW)
call rfill(l+ 10,ptZ,WWW)
call rfill(l+ 11,yZ,WWW)
call rfill(l+ 12,etaZ,WWW)
call rfill(l+ 13,phiZ,WWW)
call rfill(l+ 14,mZ,WWW)
call rfill(l+ 15,eH,WWW)
call rfill(l+ 16,ptH,WWW)
call rfill(l+ 17,yH,WWW)
call rfill(l+ 18,etaH,WWW)
call rfill(l+ 19,phiH,WWW)
call rfill(l+ 20,mH,WWW)
call rfill(l+ 21,eZH,WWW)
call rfill(l+ 22,ptZH,WWW)
call rfill(l+ 23,yZH,WWW)
call rfill(l+ 24,etaZH,WWW)
call rfill(l+ 25,phiZH,WWW)
call rfill(l+ 26,mZH,WWW)
call rfill(l+ 27,eMu1,1.d0)
enddo
enddo
C
999 return
end
subroutine wweights(wgts, sz, ibody, p4Mu1, p4Mu2, p4H)
c This program is a prototype for writing weights to a file
c The weights are printed to a file.
double precision wgts(*), wsum, p4Mu1(0:3), p4Mu2(0:3), p4H(0:3)
integer k, sz, ibody
character
logical :: exist
wsum = 0.d0
do i = 2,sz
wsum = wsum + wgts(i)
end do
c print *, "The weight sum is", wsum
if (wsum == 0d0) then
return
else
c print *, "Destination is 'weights_sam' "
c read *, fn
fn = "weights_sam"
inquire(
if (exist) then
open(1, file=fn, status="old", position="append", action="write")
c print *, "~File named '",fn,"' was reopened"
else
open(1, file=fn, status="new", action="write")
print *, "~File named '",fn,"' was created"
end if
write (1,6) ibody
C write (1,9) wgts(1), wgts(2), wgts(3), wgts(4)
k = 0
do i = 1, sz
write (1,8) wgts(i)
end do
write (1,7) "p4Mu1: ", p4Mu1(0), p4Mu1(1), p4Mu1(2), p4Mu1(3)
write (1,7) "p4Mu2: ", p4Mu2(0), p4Mu2(1), p4Mu2(2), p4Mu2(3)
write (1,7) "p4H: ", p4H(0), p4H(1), p4H(2), p4H(3)
6 format (i5)
7 format(a8,d26.17," ",d26.17, " ",d26.17," ",d26.17)
8 format (d26.17)
9 format (d26.17, d26.17, d26.17, d26.17)
close(1)
end if
end
subroutine wdebug(p4Mu1, p4Mu2, mZ, p4H, mH, mZH)
c This program lets me write the values of xnorm to a file
double precision p4Mu1(0:3), p4Mu2(0:3), p4H(0:3)
double precision mZ, mH, mZH
character
logical :: exist
print *, "Destination is 'debug_sam' "
fn = "debug_sam"
inquire(
if (exist) then
open(1, file=fn, status="old", position="append", action="write")
print *, "~File named '",fn,"' was reopened"
else
open(1, file=fn, status="new", action="write")
print *, "~File named '",fn,"' was created"
end if
write (1,*) "BEGIN EVENT:"
write (1,8) "p4Mu1: ",p4Mu1(
write (1,8) "p4Mu2: ",p4Mu2(
write (1,8) "p4H: ",p4H(0)
write (1,5) "Masses: ", mZ, mH, mZH
write (1,*)
5 format (a8,d26.
8 format (a8,d26.
close(1)
end
subroutine wxnorm(xnorm)
c This program lets me write the values of xnorm to a file
double precision xnorm
character
logical :: exist
print *, "Destination is 'xnorm_sam' "
fn = "xnorm_sam"
inquire(
if (exist) then
open(1, file=fn, status="old", position="append", action="write")
print *, "~File named '",fn,"' was reopened"
else
open(1, file=fn, status="new", action="write")
print *, "~File named '",fn,"' was created"
end if
write (1,4) xnorm
4 format (d26.17)
close(1)
end
function getrapidity(en,pl)
implicit none
real*8 getrapidity,
parameter (tiny=1.d-8)
xplus=en+pl
xminus=en-pl
if(
if( (xplus/
else
endif
else
endif
getrapidity=y
return
end
function getpseudorap(
implicit none
real*8 getpseudorap,
parameter (tiny=1.d-5)
c
pt=
if(
else
endif
getpseudo
return
end
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- Rikkert Frederix Edit question
- Solved by:
- sgreydan
- Solved:
- Last query:
- Last reply: