CERN homepage INFN homepage
FLUKA: 12.2.6} Readout of the sample user output Previous Index Next

12.2.6} Readout of the sample user output


 A sample program to readout the output obtained from the previously
 shown MGDRAW routine is here presented. In this example the key routine
 in the one called VXREAD, where some trivial output is sent to logical
 units 66 and 67. Of course the user must adapt such a readout program
 to his own needs.

       PROGRAM MGREAD
       CHARACTER FILE*80
*
WRITE (*,*)' Name of the binary file?' READ (*,'(A)') FILE OPEN ( UNIT = 33, FILE = FILE, STATUS ='OLD', & FORM = 'UNFORMATTED' ) 1000 CONTINUE WRITE (*,*)' Event number?' READ (*,*) NCASE IF ( NCASE .LE. 0 ) GO TO 9999 CALL VXREAD (NCASE) GO TO 1000 9999 CONTINUE STOP END SUBROUTINE VXREAD (NCASE) PARAMETER ( MXH = 2000 ) PARAMETER ( MXPR = 300 ) DIMENSION XH (MXH), YH (MXH), ZH (MXH), DH (MXH), & EPR (MXPR), WPR (MXPR), XPR (MXPR), YPR (MXPR), & ZPR (MXPR), TXP (MXPR), TYP (MXPR), TZP (MXPR), & IPR (MXPR)
*
LUNSCR = 33 REWIND (LUNSCR)
*
* +-------------------------------------------------------------------*
* |
NEVT=0 DO 4000 I=1,2000000000 READ (LUNSCR,END=4100) NDUM,MDUM,JDUM,EDUM,WDUM IF(I.EQ.1) WRITE(*,*) 'NDUM,MDUM,JDUM,EDUM,WDUM',NDUM,MDUM,JDUM & ,EDUM,WDUM NEVT = NEVT + 1
* | +----------------------------------------------------------------*
* | | Real tracking data:
* | +----------------------------------------------------------------*
IF ( NDUM .GT. 0 ) THEN NTRACK=NDUM MTRACK=MDUM JTRACK=JDUM ETRACK=EDUM WTRACK=WDUM IF(NTRACK.GT.1) WRITE(67,*) 'NTRACK = ',NTRACK READ (LUNSCR)(XH(J),YH(J),ZH(J),J=1,NTRACK+1), & (DH(J),J=1,MTRACK), CTRACK READ (LUNSCR) CXX,CYY,CZZ IF(I.EQ.1) THEN WRITE(67,*) (XH(J),YH(J),ZH(J),J=1,NTRACK+1), & (DH(J),J=1,MTRACK), CTRACK WRITE(67,*) CXX,CYY,CZZ ENDIF DO J=1,NTRACK+1 WRITE(67,*) XH(J),YH(J),ZH(J), & CXX,CYY,CZZ END DO IF ( NEVT.EQ.NCASE ) THEN WRITE(66,*)' New step:' WRITE(66,*)' Part.id.:',JTRACK,' Kin.En.:',ETRACK, & ' N.of substep:', NTRACK WRITE(66,*)' X, Y, Z, i=0, # substep' WRITE(*,*)' New step:' WRITE(*,*)' Part.id.:',JTRACK,' Kin.En.:',ETRACK, & ' N.of substep:', NTRACK WRITE(*,*)' X, Y, Z, i=0, # substep' END IF
* | |
* | +----------------------------------------------------------------*
* | | Energy deposition data:
ELSE IF ( NDUM .EQ. 0 ) THEN ICODE1=MDUM/10 ICODE2=MDUM-ICODE1*10 IJDEPO=JDUM ENPART=EDUM WDEPOS=WDUM READ (LUNSCR) XSCO, YSCO, ZSCO, ENDEPO IF ( NEVT.EQ.NCASE ) THEN WRITE(66,*) ' En. dep. code n.:',MDUM WRITE(66,*) IJDEPO,' Tot. en. proj.:', ENPART, & ' Weight:',WDEPOS WRITE(66,*) ' Position:',XSCO,YSCO,ZSCO, & ' En. Dep.:',ENDEPO END IF
* | |
* | +----------------------------------------------------------------*
* | | Source particle:
ELSE NEVT =-NDUM LPRIMA = MDUM NSTMAX = JDUM TKESUM = EDUM WEIPRI = WDUM READ (LUNSCR) ( IPR(J),EPR(J),WPR(J),XPR(J),YPR(J), & ZPR(J),TXP(J),TYP(J),TZP(J),J=1,LPRIMA ) DO J = 1, LPRIMA IF ( ABS(IPR(J)) .LT. 10000 ) THEN LPTRUE=J END IF END DO LPROJ = LPRIMA - LPTRUE LPRIMA = LPTRUE IF (NEVT .EQ. NCASE) THEN WRITE(66,*)' Event #',NEVT IF ( LPROJ .GT. 0) THEN WRITE(66,*) & ' Original projectile(s),n. of:',LPROJ DO IJ = 1, LPROJ J=LPRIMA+IJ IPR(J) = IPR(J)/10000 WRITE(66,*) ' Part.id.:',IPR(J),' Kin.en.:', & EPR(J),' Weight:',WPR(J) WRITE(66,*) IPR(J),EPR(J),WPR(J) WRITE(66,*) ' Position :', XPR(J),YPR(J),ZPR(J) WRITE(66,*) ' Direction:', TXP(J),TYP(J),TZP(J) END DO END IF WRITE(66,*)' Source particle(s), n. of:',LPRIMA DO J = 1, LPRIMA WRITE(66,*) ' Part.id.:',IPR(J),' Kin.en.:', & EPR(J),' Weight:',WPR(J) WRITE(66,*) ' Position :', XPR(J),YPR(J),ZPR(J) WRITE(66,*) ' Direction:', TXP(J),TYP(J),TZP(J) C WRITE(67,*) XPR(J)/1.E+05,YPR(J)/1.E+05,ZPR(J)/1.E+05 END DO END IF IF (NEVT.GT.NCASE) GO TO 4100 END IF
* | |
* | +----------------------------------------------------------------*
4000 CONTINUE
* |
* +-------------------------------------------------------------------*
4100 CONTINUE RETURN END

Previous Index Next