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

From: Francesco Cerutti <Francesco.Cerutti_at_cern.ch>
Date: Tue, 13 Dec 2011 08:09:59 +0100

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 Tue Dec 13 2011 - 12:00:12 CET

This archive was generated by hypermail 2.2.0 : Tue Dec 13 2011 - 12:00:24 CET