~maddevelopers/mg5amcnlo/3.0.2-alpha0

« back to all changes in this revision

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

Added Template and HELAS into bzr

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