*------------------------------------------------------------------------ * RECON standard HMS reconstruction * -=====- * * HMS reconstruction (ignoreing the target magnetic field and vertical * beam offsets) * - reads the data from a PAW/hbook ntuple written by hms.f * - writtes the results to a new PAW/hbook ntuple file * * written by Markus Muehlbauer *------------------------------------------------------------------------ IMPLICIT NONE INTEGER nwpawc,icycle,istat PARAMETER (nwpawc = 1000000) REAL paw(nwpawc) COMMON /pawc/paw CHARACTER*8 tags(17) REAL event(17) CHARACTER name*80,filename1*80,filename2*80 DATA tags/'x0','dx0dz','y0','dy0dz','z0','delta0', + 'x', 'dxdz', 'y', 'dydz', 'z', + 'x1','dx1dz','y1','dy1dz','z1','delta1'/ ! other variables INTEGER i,j,cnt 10 FORMAT (X,A,$) 20 FORMAT (A) PRINT *,'RECON - struct simulated Gen data' PRINT *,'=====' PRINT * PRINT * PRINT 10,'Enter the name of the event file: ' READ (5,20) filename1 PRINT 10,'Enter the name of the reconstruction matrix: ' READ (5,20) filename2 PRINT * ! read the matrix name = filename2(:INDEX(filename2,' ')-1)//'.map' print *, 'Reading the reconstruction matrix '// > name(:index(name,' ')) CALL hmsInitRecon (name) ! init HBOOK CALL hlimit(nwpawc) ! open the data ntuple file name = filename1(:INDEX(filename1,' ')-1)//'.hbook' print *, 'Reading the event data '//name(:index(name,' ')) CALL hropen(20,'Input',name,' ',4096,istat) CALL hcdir ('//Input',' ') CALL hrin (0,999999,0) CALL hgnpar(20,'MAIN') CALL hnoent(20,cnt) ! open the reconstructed data ntuple file name = filename1(:INDEX(filename1,' ')-1)//'_'// > filename2(:INDEX(filename2,' ')-1)//'.hbook' print *, 'Writing the reconstructed data ' > //name(:index(name,' ')) CALL hropen(21,'Output',name,'NX',4096,istat) CALL hcdir ('//Output',' ') CALL hbookn(30,'Reconstructed Events',17,'//Output',4096,tags) DO i=1,cnt CALL hcdir ('//Input',' ') CALL hgnf (20,i,event,j) CALL hmsReconInPlane (event(7),event(12)) CALL hcdir ('//Output',' ') CALL hfn (30,event) ENDDO CALL hdelet(10) CALL hdelet(20) CALL hrout(0,ICYCLE,' ') CALL hrend('Output') CALL hrend('Input') STOP END