Re: [fluka-discuss]: EVENTBIN Readout code

From: Paola Sala <paola.sala_at_mi.infn.it>
Date: Thu, 13 Mar 2014 19:32:50 +0100

Dear Alex,
try changing

READ(10)nhits
READ(10) (ihelp(I), gmhelp(I), I = 1, nhits)

with

READ(10)nhits
if ( nhits .gt. 0) READ(10) (ihelp(I), gmhelp(I), I = 1, nhits)

otherwise a record is read even if ..it is not there.

Hope it helps
Paola


> Dear FLUKA users and experts,
> I'm trying to process the binary output from the EVENTBIN card, in order
> to get a DETECT style output from a lattice geometry, however i am running
> into an issue where i seem to be reading out past the end of an
> unformatted file every time. Is anyone able to provide a simple summary of
> the order in which i'd need to read things out of the file, when only
> reading non-zero cells.
>
> my current understanding of it is, if im reading from unit 10 (i'm aware
> the code is hardly a complete compilable thing, but these key bits should
> show where my approach is in error hopefully)
>
> READ(10)RUNTIT, RUNTIM
>
> !a bunch of binning information, akin to usrbin, some other code i found
> suggests it is
> READ (10) NB, TITUSB, ITUSBN,&
> & IDUSBN, &
> & XLOW,XHIGH,NXBIN, &
> & DXUSBN,YLOW, &
> & YHIGH,NYBIN,DYUSBN, &
> & ZLOW,ZHIGH,NZBIN, &
> & DZUSBN,LNTZER,BKUSBN, &
> & B2USBN,TCUSBN
>
> !then it should just be the information for the hit cells, it seems to go
> out of file range in this loop
> READ(10)nhits
> READ(10) (ihelp(I), gmhelp(I), I = 1, nhits)
>
> !and we loop over this last bit for the number of primaries.
>
> clearly i've gone a bit wrong in my understanding of how this is all
> structured, or perhaps just how fortran likes to behave with unstructured
> files(i primarily know fortran 95, and im working from code written in 77
> as a guide) , so some guidance would be most appreciated.
>
> Regards
> Alex Metcalfe
>


Paola Sala
INFN Milano
tel. Milano +39-0250317374
tel. CERN +41-227679148
Received on Thu Mar 13 2014 - 20:42:14 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 13 2014 - 20:42:15 CET