
	options /extend_source

	program READ_EVENTNRS
c	=====================

	implicit none

c-------------------------------------------------------------------------------
c Programm, welches aus dem output eines
c
c   $ SEARCH mutrack$outDirectory:MU_nnnn.LOG "MCP2 getroffen" /OUT=SEARCHLIST.TMP
c
c die je Schleife bei einem cut auf MCP2-Treffer in ein NTupel gefuellte
c Anzahl simulierter Events bestimmt.
c-------------------------------------------------------------------------------

	INTEGER LOOP,NEVENT,IEVENT
	CHARACTER*80 ZEILE
	
c-------------------------------------------------------------------------------

	loop   = 0
	nEvent = 0
	iEvent = 1

	open (10,file='SEARCHLIST.TMP',status='old',readonly)
	open (11,file='EVENTNRS.TMP',status='unknown')
10	read(10,'(A)',err=999,end=100) ZEILE
	read(zeile(48:54),*,err=1000) nEvent
	loop = loop + 1
c	WRITE(*,*) loop,nEvent,iEvent
	write(11,*) loop,nEvent,iEvent
	iEvent = iEvent+nEvent
	goto 10

100	close(10)
	close(11)
	call exit

999	write(*,*) 'can''t read from SEARCHLIST.TMP'
	write(*,*) 'loop,nEvent,iEvent = ',loop,nEvent,iEvent
	call exit

1000	write(*,*)
	write(*,*) zeile
	write(*,*) zeile(48:54)

	end



