Re: USRYIELD to look at photon emittance (mgdraw and BXDRAW)

From: Mina Nozar <nozarm_at_triumf.ca>
Date: Tue, 13 Dec 2011 11:33:18 -0800

Dear Francesco,

After making the changes/corrections you suggested, it worked with the exception that the output file was empty. I
suspected it had something to do with the conditional statement. A WRITE statement for IdUCx0 through IdUCx6 after the
following call statements:

CALL GEON2R ('rdUCx0', IdUCx0, IERR)
CALL GEON2R ('rdUCx1', IdUCx1, IERR)
...
...
...

was reporting -1 for IdUCx0 through IdUCx6. That's because of the 8 characters reserved for region names.
Changing to CALL GEON2R ('rdUCx0 ', IdUCx0, IERR), etc. fixed that.

I admit, it has been quite some time since I have programmed in Fortran!

So, the output for the write statement:

WRITE(IODRAW,100) JTRACK,XSCO,YSCO,ZSCO,CXTRCK,CYTRCK,CZTRCK,
       & ETRACK

looks like:
   7 -.4857E+00 0.1834E+01 0.1062E+02 0.1627E-01 0.1386E+00 0.9902E+00 0.4324E-02
   7 -.2254E+01 -.1175E+01 0.1062E+02 -.2342E+00 -.8640E-01 0.9683E+00 0.4644E-02
   7 0.2485E+01 -.1682E+01 0.1062E+02 0.1730E+00 -.9396E-01 0.9804E+00 0.3141E-02
   7 -.2905E+00 -.1178E+00 0.1062E+02 -.4254E-01 0.9717E-02 0.9990E+00 0.4182E-02
   7 0.2137E+00 0.1275E+01 0.1062E+02 -.2071E-01 0.1091E+00 0.9938E+00 0.4162E-02
   7 0.2142E+01 -.1491E+01 0.1062E+02 0.1638E+00 -.1547E+00 0.9743E+00 0.1539E-01
...
...
...

THANK YOU for your help and patience.
Best wishes,
Mina

On 11-12-12 11:09 PM, Francesco Cerutti wrote:
> Add
>
> FILNAM = CFDRAW
>
> before the OPEN statement (or change FILNAM into CFDRAW inside OPEN) and
> mostly correct all your region number variables, because they must be
> integer i.e. their name must start with a letter in the interval
> I-N
>
> Francesco
>
> **************************************************
> Francesco Cerutti
> CERN-EN/STI
> CH-1211 Geneva 23
> Switzerland
> tel. ++41 22 7678962
> fax ++41 22 7668854
>
> On Tue, 13 Dec 2011, Mina Nozar wrote:
>
>> Dear Frencesco,
>>
>> Hi and thank you for your help.
>>
>> I made the changes you have suggested here to mgdraw/bxdraw and recompiled.
>> I now get past the compiling and linking but when I attempt a run I get a
>> core dump. I couldn't find anything useful pointing to the error in the err
>> and log files.
>>
>> Thanks again and best wishes,
>> Mina
>>
>>
>> **********************************************************************************************************************
>> I am including the simplified mgdraw.f (in my working area) below:
>>
>> *$ CREATE MGDRAW.FOR
>> * COPY MGDRAW
>> * *
>> *=== mgdraw ===========================================================*
>> * *
>> SUBROUTINE MGDRAW ( ICODE, MREG )
>>
>> INCLUDE '(DBLPRC)'
>> INCLUDE '(DIMPAR)'
>> INCLUDE '(IOUNIT)'
>> *
>> *----------------------------------------------------------------------*
>> * *
>> * Copyright (C) 1990-2006 by Alfredo Ferrari *
>> * All Rights Reserved. *
>> * *
>> * *
>> * MaGnetic field trajectory DRAWing: actually this entry manages *
>> * all trajectory dumping for *
>> * drawing *
>> * *
>> * Created on 01 march 1990 by Alfredo Ferrari *
>> * INFN - Milan *
>> * Last change 05-may-06 by Alfredo Ferrari *
>> * INFN - Milan *
>> * *
>> *----------------------------------------------------------------------*
>> *
>> INCLUDE '(CASLIM)'
>> INCLUDE '(COMPUT)'
>> INCLUDE '(SOURCM)'
>> INCLUDE '(FHEAVY)'
>> INCLUDE '(FLKSTK)'
>> INCLUDE '(GENSTK)'
>> INCLUDE '(MGDDCM)'
>> INCLUDE '(PAPROP)'
>> INCLUDE '(QUEMGD)'
>> INCLUDE '(SUMCOU)'
>> INCLUDE '(TRACKR)'
>> *
>> * DIMENSION DTQUEN ( MXTRCK, MAXQMG )
>> *
>> CHARACTER*20 FILNAM
>> LOGICAL LFCOPE
>> SAVE LFCOPE
>> DATA LFCOPE / .FALSE. /
>> *
>> *----------------------------------------------------------------------*
>> * *
>> * Icode = 1: call from Kaskad *
>> * Icode = 2: call from Emfsco *
>> * Icode = 3: call from Kasneu *
>> * Icode = 4: call from Kashea *
>> * Icode = 5: call from Kasoph *
>> * *
>> *----------------------------------------------------------------------*
>> RETURN
>>
>> *======================================================================*
>> * *
>> * Boundary-(X)crossing DRAWing: *
>> * *
>> * Icode = 1x: call from Kaskad *
>> * 19: boundary crossing *
>> * Icode = 2x: call from Emfsco *
>> * 29: boundary crossing *
>> * Icode = 3x: call from Kasneu *
>> * 39: boundary crossing *
>> * Icode = 4x: call from Kashea *
>> * 49: boundary crossing *
>> * Icode = 5x: call from Kasoph *
>> * 59: boundary crossing *
>> * *
>> *======================================================================*
>> *
>>
>> ENTRY BXDRAW ( ICODE, MREG, NEWREG, XSCO, YSCO, ZSCO )
>> * Write in event file the position, direction, energy, and weight of photons
>> crossing Ta into target
>> IF(.NOT. LFCOPE)THEN
>> LFCOPE=.TRUE.
>> OPEN (UNIT=IODRAW, FILE=FILNAM, STATUS='NEW',
>> & FORM = 'FORMATTED')
>> END IF
>> CALL GEON2R ('rTaEnUsW' , TaREG, IERR)
>> CALL GEON2R ('rdUCx0' , dUCX0, IERR)
>> CALL GEON2R ('rdUCx1' , dUCX1, IERR)
>> CALL GEON2R ('rdUCx2' , dUCX2, IERR)
>> CALL GEON2R ('rdUCx3' , dUCX3, IERR)
>> CALL GEON2R ('rdUCx4' , dUCX4, IERR)
>> CALL GEON2R ('rdUCx5' , dUCX5, IERR)
>> CALL GEON2R ('rdUCx6' , dUCX6, IERR)
>>
>> IF ((MREG .EQ. TaREG) .AND.
>> & ((NEWREG.EQ.dUCX0).OR.(NEWREG.EQ.dUCx1)
>> & .OR. (NEWREG.EQ.dUCx2).OR.(NEWREG.EQ.dUCx3)
>> & .OR. (NEWREG.EQ.dUCx4).OR.(NEWREG.EQ.dUCx5)
>> & .OR. (NEWREG.EQ.dUCx6))
>> & .AND.
>> & (JTRACK .EQ. 7)) THEN
>> WRITE(25,100) XSCO,YSCO,ZSCO,CXTRCK,CYTRCK,CZTRCK,
>> & ETRACK,WTRACK
>> END IF
>>
>> 100 FORMAT(8(E10.4,1X))
>> RETURN
>>
>>
>> ENTRY EEDRAW ( ICODE )
>> RETURN
>>
>> ENTRY ENDRAW ( ICODE, MREG, RULL, XSCO, YSCO, ZSCO )
>> RETURN
>>
>> ENTRY SODRAW
>> RETURN
>>
>> ENTRY USDRAW ( ICODE, MREG, XSCO, YSCO, ZSCO )
>> RETURN
>>
>> *=== End of subrutine Mgdraw ==========================================*
>> END
>>
>>
>>
>> On 11-12-12 01:15 PM, Francesco Cerutti wrote:
>>> Dear Mina,
>>>
>>> i. comment out all the WRITE statements in mgdraw but yours as well as all
>>> the lines of the structures
>>>
>>> IF ( .NOT. LFCOPE ) THEN
>>>
>>> but the one you added under BXDRAW. Correct back the latter putting
>>>
>>> OPEN ( UNIT = IODRAW, FILE = FILNAM, STATUS = 'NEW', FORM =
>>> & 'FORMATTED' )
>>>
>>> This way the unit number and the file name can be controlled at input
>>> level through the USERDUMP card (WHAT(2) and SDUM, respectively)
>>>
>>> ii. NEVER call the geometry routines (GEOR2N) runtime (they take time!!).
>>> Call instead, adopting an opposite logics, GEON2R and store once for
>>> ever in your own integer variables (in principle to be saved by the SAVE
>>> command) the region numbers corresponding to your region names:
>>> CALL GEON2R ( 'rdUCx0 ', MYREG0, IERR )
>>> The above statement should go together with the OPEN command under the
>>> LFCOPE condition, in order to be executed only once as the file is opened
>>> and basta. Then your IF conditions will have to refer directly to MREG and
>>> NEWREG, and by the way you will not need to define/use CHARACTER variables
>>>
>>> [iii. Why do you define the FORMAT 100 and not use it in your WRITE
>>> statement?]
>>>
>>> Ciao
>>>
>>> Francesco
>>
>
Received on Wed Dec 14 2011 - 10:12:59 CET

This archive was generated by hypermail 2.2.0 : Wed Dec 14 2011 - 10:13:10 CET