~maddevelopers/mg5amcnlo/2.6.6_bug_1813292

« back to all changes in this revision

Viewing changes to Template/NLO/Source/rw_events.f

  • Committer: olivier-mattelaer
  • Date: 2017-05-26 07:48:55 UTC
  • mfrom: (271.1.33 2.5.5)
  • Revision ID: olivier-mattelaer-20170526074855-r463wfxlom110fiu
passĀ theĀ 2.5.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
      subroutine read_event(lun,P,wgt,nexternal,ic,ievent,scale,aqcd,aqed,buff2,done)
2
 
c********************************************************************
3
 
c     Reads one event from data file #lun
4
 
c     ic(*,1) = Particle ID
5
 
c     ic(*,2) = Mothup(1)
6
 
c     ic(*,3) = Mothup(2)
7
 
c     ic(*,4) = ICOLUP(1)
8
 
c     ic(*,5) = ICOLUP(2)
9
 
c     ic(*,6) = ISTUP   -1=initial state +1=final  +2=decayed
10
 
c     ic(*,7) = Helicity
11
 
c********************************************************************
12
 
      implicit none
13
 
 
14
 
      double precision pi
15
 
      parameter (pi = 3.1415926d0)
16
 
c
17
 
c     Arguments
18
 
c      
19
 
      integer lun
20
 
      integer nexternal, ic(7,*)
21
 
      logical done
22
 
      double precision P(0:4,*),wgt,aqcd,aqed,scale
23
 
      integer ievent
24
 
      character*140 buff2
25
 
c
26
 
c     Local
27
 
c
28
 
      integer i,j,k
29
 
      character*(256) buff
30
 
      double precision xdum1,xdum2
31
 
c
32
 
c     Global
33
 
c
34
 
      logical banner_open
35
 
      integer lun_ban
36
 
      common/to_banner/banner_open, lun_ban
37
 
 
38
 
      data lun_ban/37/
39
 
      data banner_open/.false./
40
 
c-----
41
 
c  Begin Code
42
 
c-----     
43
 
      buff2=' '
44
 
      done=.false.
45
 
      if (.not. banner_open) then
46
 
         open (unit=lun_ban, status='scratch')
47
 
         banner_open=.true.
48
 
      endif
49
 
 11   read(lun,'(a256)',end=99,err=99) buff
50
 
      do while(index(buff,"<event") .eq. 0)
51
 
         write(lun_ban,'(a)') buff
52
 
         read(lun,'(a256)',end=99,err=99) buff
53
 
      enddo
54
 
      read(lun,*,err=11, end=11) nexternal,ievent,wgt,scale,aqed,aqcd
55
 
      do i=1,nexternal
56
 
         read(lun,*,err=99,end=99) ic(1,i),ic(6,i),(ic(j,i),j=2,5),
57
 
     $     (p(j,i),j=1,3),p(0,i),p(4,i),xdum1,xdum2
58
 
         ic(7,i)=xdum2
59
 
      enddo
60
 
      do while(index(buff,"</event") .eq. 0)
61
 
         read(lun,'(a256)',end=99,err=99) buff
62
 
         if(buff(1:1).eq.'#') buff2=buff(1:140)
63
 
      enddo
64
 
c      gal(1) = sqrt(4d0*pi*aqed)
65
 
c      g      = sqrt(4d0*pi*aqcd)
66
 
      return
67
 
 99   done=.true.
68
 
      return
69
 
 55   format(i3,5e19.11)         
70
 
      end
71
 
 
72
 
      subroutine write_event(lun,P,wgt,nexternal,ic,ievent,scale,aqcd,aqed,buff)
73
 
c********************************************************************
74
 
c     Writes one event from data file #lun according to LesHouches
75
 
c     ic(1,*) = Particle ID
76
 
c     ic(2.*) = Mothup(1)
77
 
c     ic(3,*) = Mothup(2)
78
 
c     ic(4,*) = ICOLUP(1)
79
 
c     ic(5,*) = ICOLUP(2)
80
 
c     ic(6,*) = ISTUP   -1=initial state +1=final  +2=decayed
81
 
c     ic(7,*) = Helicity
82
 
c********************************************************************
83
 
      implicit none
84
 
c
85
 
c     parameters
86
 
c
87
 
      double precision pi
88
 
      parameter (pi = 3.1415926d0)
89
 
c
90
 
c     Arguments
91
 
c      
92
 
      integer lun, ievent
93
 
      integer nexternal, ic(7,*)
94
 
      double precision P(0:4,*),wgt
95
 
      double precision aqcd, aqed, scale
96
 
      character*140 buff
97
 
c
98
 
c     Local
99
 
c
100
 
      integer i,j,k
101
 
c
102
 
c     Global
103
 
c
104
 
 
105
 
c-----
106
 
c  Begin Code
107
 
c-----     
108
 
c      aqed= gal(1)*gal(1)/4d0/pi
109
 
c      aqcd = g*g/4d0/pi
110
 
 
111
 
      write(lun,'(a)') '<event>'
112
 
      write(lun,'(i2,i4,4e15.7)') nexternal,ievent,wgt,scale,aqed,aqcd
113
 
      do i=1,nexternal
114
 
         write(lun,51) ic(1,i),ic(6,i),(ic(j,i),j=2,5),
115
 
     $     (p(j,i),j=1,3),p(0,i),p(4,i),0.,real(ic(7,i))
116
 
      enddo
117
 
      if(buff(1:1).eq.'#') write(lun,'(a)') buff(1:len_trim(buff))
118
 
      write(lun,'(a)') '</event>'
119
 
      return
120
 
 51   format(i9,5i5,5e19.11,f3.0,f4.0)
121
 
      end
122
 
 
123
 
      subroutine write_comments(lun)
124
 
c********************************************************************
125
 
c     Outputs all of the banner comment lines back at the top of
126
 
c     the file lun.
127
 
c********************************************************************
128
 
      implicit none
129
 
c
130
 
c     Arguments
131
 
c
132
 
      integer lun
133
 
c
134
 
c     Local
135
 
c
136
 
      character*(80) buff
137
 
c
138
 
c     Global
139
 
c
140
 
      logical banner_open
141
 
      integer lun_ban
142
 
      common/to_banner/banner_open, lun_ban
143
 
 
144
 
c-----
145
 
c  Begin Code
146
 
c-----     
147
 
c      write(*,*) 'Writing comments'
148
 
      if (banner_open) then
149
 
         rewind(lun_ban)
150
 
         do while (.true.) 
151
 
            read(lun_ban,'(a79)',end=99,err=99) buff
152
 
            write(lun,'(a79)') buff
153
 
c            write(*,*) buff
154
 
         enddo
155
 
 99      close(lun_ban)
156
 
         banner_open = .false.
157
 
      endif
158
 
      end
159