1
c Same as plot_events.f, but relevant to LH showered files (ntuples).
3
c f77 -g -ffixed-line-length-132 -fno-automatic
4
c -o plot_events_lhef plot_events_lhef.f madfks_plot*.f madfks_dbook.f
5
c handling_lhe_events.f any-dependencies-in-madfksplot
6
c Copy in this directory
7
c reweight0.inc dbook.inc
10
integer maxevt,ifile,i,npart,itype
11
integer IDBMUP(2),PDFGUP(2),PDFSUP(2),IDWTUP,NPRUP,LPRUP
12
double precision EBMUP(2),XSECUP,XERRUP,XMAXUP
14
PARAMETER (MAXNUP=500)
15
INTEGER NUP,IDPRUP,IDUP(MAXNUP),ISTUP(MAXNUP),
16
# MOTHUP(2,MAXNUP),ICOLUP(2,MAXNUP)
17
DOUBLE PRECISION XWGTUP,SCALUP,AQEDUP,AQCDUP,
18
# PUP(5,MAXNUP),VTIMUP(MAXNUP),SPINUP(MAXNUP)
19
double precision sum_wgt,sum_wgt_resc,rat,www
20
integer isorh_lhe,ifks_lhe,jfks_lhe,fksfather_lhe,ipartner_lhe
21
double precision scale1_lhe,scale2_lhe
22
double precision wgtcentral,wgtmumin,wgtmumax,wgtpdfmin,wgtpdfmax
26
real*8 rndec(10),fk88random
28
character*80 event_file
32
logical keepevent,rescale,doscale
34
logical usexinteg,mint
35
common/cusexinteg/usexinteg,mint
37
common/citmax/itmax,ncall
39
double precision evtsgn
40
common /c_unwgt/evtsgn,unwgt
41
include 'reweight0.inc'
44
parameter (nexternal=20)
46
real*8 ecm,xmass(3*nexternal),xmom(0:3,3*nexternal)
47
character*10 MonteCarlo
54
c evtsgn and unwgt used by plotting routines. Sort of fake values here
62
rndec(i)=fk88random(ifk88seed)
65
write(*,*)'Enter event file name'
68
write(*,*)'Enter (kr,kf) -- central result is (1,1)'
69
write(*,*)' Enter (0,0) to skip'
71
if(kr.eq.0.or.kf.eq.0)then
72
write(*,*)'Enter number of PDF error set (e.g. 1,..,40)'
73
write(*,*)' Enter 0 to skip'
78
if(kr.eq.0.and.kf.eq.0.and.npdfset.eq.0)then
79
write(*,*)'Will not rescale weights'
82
write(*,*)'Will rescale weights'
92
open (unit=ifile,file=event_file,status='old')
95
call read_lhef_header_full(ifile,maxevt,isc,ipdf,MonteCarlo)
96
numscales=int(sqrt(dble(isc)))
98
c Showered LH files have maxevt<0; in that case, it is not the number of
99
c events, but its upper bound
101
write(*,*)'This is unlikely to be a showered LH file'
105
call read_lhef_init(ifile,
106
& IDBMUP,EBMUP,PDFGUP,PDFSUP,IDWTUP,NPRUP,
107
& XSECUP,XERRUP,XMAXUP,LPRUP)
114
dowhile(i.lt.maxevt.and.keepevent)
115
call read_lhef_event_catch(ifile,
116
& NUP,IDPRUP,XWGTUP,SCALUP,AQEDUP,AQCDUP,
117
& IDUP,ISTUP,MOTHUP,ICOLUP,PUP,VTIMUP,SPINUP,buff)
119
if(index(buff,'endoffile').ne.0)then
125
sum_wgt=sum_wgt+XWGTUP
128
rat=wgtxsecmu(kr,kf)/wgtref
130
rat=wgtxsecPDF(npdfset)/wgtref
137
sum_wgt_resc=sum_wgt_resc+www
139
if(i.eq.1.and.buff(1:1).eq.'#')AddInfoLHE=.true.
141
if(buff(1:1).ne.'#')then
142
write(*,*)'Inconsistency in event file',i,' ',buff
145
read(buff,*)ch1,iSorH_lhe,ifks_lhe,jfks_lhe,
146
# fksfather_lhe,ipartner_lhe,
147
# scale1_lhe,scale2_lhe,
148
# jwgtinfo,mexternal,iwgtnumpartn,
149
# wgtcentral,wgtmumin,wgtmumax,wgtpdfmin,wgtpdfmax
154
if(abs(ISTUP(k)).eq.1)then
156
xmass(npart)=pup(5,k)
158
xmom(mod(j,4),npart)=pup(j,k)
163
c Showered LH files only contain final-state particles.
164
c Don't check momentum conservation
166
call outfun(xmom,zero,www,itype)
174
open(unit=99,file='events.top',status='unknown')
178
write (*,*) 'The total number of events is:',i
179
write (*,*) 'The sum of weights is:',sum_wgt
181
# write (*,*) 'The sum of rescaled weights is:',sum_wgt_resc
186
c Dummy subroutine (normally used with vegas when resuming plots)
191
FUNCTION FK88RANDOM(SEED)
193
* Ref.: K. Park and K.W. Miller, Comm. of the ACM 31 (1988) p.1192
194
* Use seed = 1 as first value.
196
IMPLICIT INTEGER(A-Z)
197
REAL*8 MINV,FK88RANDOM
199
PARAMETER(M=2147483647,A=16807,Q=127773,R=2836)
200
PARAMETER(MINV=0.46566128752458d-09)
204
IF(SEED.LE.0) SEED = SEED + M
205
FK88RANDOM = SEED*MINV
209
subroutine boostwdir2(chybst,shybst,chybstmo,xd,xin,xout)
210
c chybstmo = chybst-1; if it can be computed analytically it improves
211
c the numerical accuracy
213
real*8 chybst,shybst,chybstmo,xd(1:3),xin(0:3),xout(0:3)
217
if(abs(xd(1)**2+xd(2)**2+xd(3)**2-1).gt.1.d-6)then
218
write(*,*)'Error #1 in boostwdir2',xd
223
pz=xin(1)*xd(1)+xin(2)*xd(2)+xin(3)*xd(3)
224
xout(0)=en*chybst-pz*shybst
226
xout(i)=xin(i)+xd(i)*(pz*chybstmo-en*shybst)