~maddevelopers/mg5amcnlo/3.0.2-alpha0

« back to all changes in this revision

Viewing changes to Template/Source/sum.f

Added Template and HELAS into bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
      program sum
 
2
c********************************************************************************
 
3
c     Program to combine results from all of the different sub amplitudes 
 
4
c     and given total
 
5
c     cross section and error.
 
6
c*****************************************************************************
 
7
      implicit none
 
8
c
 
9
c     Constants
 
10
c
 
11
      character*(*) rfile
 
12
      parameter (rfile='result')
 
13
      character*(*) symfile
 
14
      parameter (symfile='symfact.dat')
 
15
      integer   max_amps
 
16
      parameter (max_amps=999)
 
17
c
 
18
c     local
 
19
c
 
20
      double precision xsec(max_amps), xerr(max_amps)
 
21
      character*80 fname
 
22
      integer i,j
 
23
      double precision xtot,errtot
 
24
c-----
 
25
c  Begin Code
 
26
c-----
 
27
      xtot=0d0
 
28
      errtot=0d0
 
29
      open(unit=15,file=symfile,status='old',err=999)
 
30
      do while (.true.)
 
31
         read(15,*,err=99) i,j
 
32
         if (j .gt. 0) then
 
33
            if (i .lt. 10) then
 
34
               write(fname,'(a,i1,a,a)') 'G',i,'/',rfile
 
35
c               write(*,*) fname
 
36
            else if (i .lt. 100) then
 
37
               write(fname,'(a,i2,a,a)') 'G',i,'/',rfile
 
38
c               write(*,*) fname
 
39
            else if (i .lt. 1000) then
 
40
               write(fname,'(a,i3,a,a)') 'G',i,'/',rfile
 
41
c               write(*,*) fname
 
42
            endif
 
43
            open(unit=25,file=fname,status='old',err=95)
 
44
            read(25,*) xsec(i), xerr(i)
 
45
            xtot = xtot+xsec(i)*j
 
46
            errtot=errtot+j*xerr(i)**2
 
47
            write(*,'(2i4,2e12.4)') i,j, xsec(i),xerr(i)
 
48
 95         close(25)
 
49
         endif
 
50
      enddo
 
51
 99   write(*,*) 'done',xtot,sqrt(errtot)
 
52
      close(15)
 
53
      stop
 
54
 999  write(*,*) 'error'
 
55
      end