CCCCCCCCCCCCCCCCCCCCCCCC MAPGEN.SOURCE(MAPGEN) CCCCCCCCCCCCCCCCCCCCCCCCC
C
CH1  ROUTINE NAME:  MAPGEN
CH1
CH1  VERSION: 1.01              DATE: 01/29/90
CH1  $Id: mapgen.f,v 1.2 1998/10/06 12:52:23 silvis Exp $
CH1
CH1  PROGRAMMER(S) AND COMPLETION DATE:
CH1     ALBERT ETIENNE - S.T.X. - 02/13/89
CH1
CH1  FUNCTION: MAIN PROGRAM TO GENERATE MAPS OF GAMMA RAY EVENTS AS A
CH1            FUNCTION OF POSITION AND ENERGY USING THE SUMMARY DATA
CH1            BASE EVENTS.
CH1
CH1  SOFTWARE SYSTEM AND SPACECRAFT:  EGRET PROJECT
CH1
CH1  COMPUTER AND LANGUAGE:  IBM 3081 - VS FORTRAN
CH1
CH2  CALLING SEQUENCE:  N.A.
CH2     ARGUMENT    TYPE   I/O                 DESCRIPTION
CH2     --------    ----   ---  ----------------------------------------
CH2
CH2  CALLED BY:  NONE
CH2
CH2  CALLS:
CH2   INITLZ: INITALIZE THE PROGRAM
CH2   BINEVT: ACCUMULATE THE EVENT DATA INTO BINS
CH2   WRT_MAPFTS: WRITE THE MAP INTO A FITS FILE
CH2
CH3 COMMON USE:
CH3 COMMON BLOCK NAME: MAIN          (HOLDS THE MAIN VARIABLES)
CH3 VARIABLE     TYPE                        DEFINITION
CH3   NAME
CH3 --------   ---------   ---------------------------------------------
CH3 USRTIM(2)  REAL*8      COMBINED TJD/MSD USER TIME (1:START, 2:END)
CH3 RETCOD     INTEGER     PROGRAM RETURN CODE (0=NORMAL)
CH3 NUMLEV     INTEGER     NUMBER OF ENERGY LEVELS SELECTED mapgenBY THE USER
CH3 SKYLIM(4)  REAL        MAP BOUNDARIES SELECTED BY THE USER
CH3 BINSIZ     REAL        BIN SIZE SELECTED BY THE USER
CH3 USTIME(8)  INTEGER     START TIME (TJD,MSD,MONTH,DAY,YEAR,HR,MIN,SC)
CH3 UETIME(8)  INTEGER     END TIME (TJD,MSD,MONTH,DAY,YEAR,HR,MIN,SEC)
CH3 ENRGY1(20) INTEGER     MINIMUM VALUE FOR EACH OF THE ENERGY LEVELS
CH3 ENRGY2(20) INTEGER     MAXIMUM VALUE FOR EACH OF THE ENERGY LEVELS
CH3 CVTANG     REAL        FACTOR TO CONVERT DEGREES TO RADIANS
CH3 TWOPI      REAL        VALUE OF 2 PI IN RADIANS
CH3 AXLIMT(2)  INTEGER     MAXIMUM SIZE OF BIN DATA ARRAY IN 1ST 2 DIM.
CH3 PULVAL(4)  REAL*4      PULSAR PARAMETERS LIMITS
CH3 SYS        INTEGER     INDEX FOR THE COORDINATE SYSTEM TO USE
CH3 TESTPI     LOGICAL     DETERMINES IF PI IS BETWEEN THE USER LIMITS
CH3 NUMSAV     INTEGER     NUMBER OF FITS HEADER LINES SAVED
CH3 NUMEXC     INTEGER     TOTAL NUMBER OF EXCLUDED EVENTS
CH3 CSYSTM     CH*4        COORDINATE SYSTEM TO USE (GAL,CEL,INST,EARTH)
CH3 TIMFMT     CH*8        TIME FORMAT (CAL=CALENDAR, TJD=TJD/MSD)
CH3 FILNAM     CH*8        NAME EXTENSION OF THE OUTPUT FITS FILE
CH3 EVFILE     CH*24       NAME OF THE EVENT INPUT FILE
CH3
CH3 SIGNIFICANT LOCAL VARIABLES:  N.A.
CH3     VARIABLE   TYPE   INI. VAL.               DESCRIPTION
CH3     --------   ----   ---------  -----------------------------------
CH3
CH4  METHOD:
CH4     CALL INITLZ TO INITIALIZE THE PROGRAM
CH4     CALL BINEVT TO BIN THE EVENTS
CH4     CALL WRTFTS TO WRITE THE MAP TO A FITS FILE
CH4     TERMINATE THE PROGRAM WITH AN APPROPRIATE MESSAGE
CH4  END MAPGEN
CH4
CH5  MODIFICATIONS BETWEEN VERSIONS:
CH5     MOD #   MODIFIER    DATE                  DESCRIPTION
CH5     -----   --------  --------   -----------------------------------
CH5     1.01    A.ETIENNE 01/29/90   COSMETIC CHANGES
CH5
CH5 $Log: mapgen.f,v $
CH5 Revision 1.2  1998/10/06 12:52:23  silvis
CH5 A stop was removed from the main program so that the learn feature
CH5 for the par file would work properly and some minor changes were made
CH5 to the par file.
CH5
C Revision 2.1  1991/08/28  19:36:16  esp
C First really controlled version on SUN (ported from IBM 3081)
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C      PROGRAM MAPGEN
      subroutine emapgn()      
      implicit none 

       INCLUDE 'main.cmn.inc'

      character*80	id
C      
C      The character variable below has been added 
C      so that the code can use the fitsio routine 
C      fcecho. 
C      
C      Jeff Silvis 
C      RSTX 
C      29  July  98
 
      CHARACTER*250 FCECHO_STR 
      common	/id/	id
      id = '$Id: mapgen.f,v 1.2 1998/10/06 12:52:23 silvis Exp $'

C---> CALL INITLZ TO GET THE USER INPUT AND FIND THE FIRST FILE
      CALL INITLZ
      IF (RETCOD.NE.0) GOTO 100

C---> CALL BINEVT TO BIN THE EVENT DATA
      CALL BINEVT
      IF (RETCOD.NE.0) GOTO 100

C---> CALL WRTFTS TO WRITE THE FITS FILE
      CALL WRT_MAPFTS
      IF (RETCOD.NE.0) GOTO 100

      call FCECHO("  ")
      call FCECHO("  ")
      WRITE(FCECHO_STR,'('' MAPGEN PROGRAM TERMINATED'')') 
      call FCECHO(FCECHO_STR) 
      return
100   call FCERR("  ")
      call FCERR("  ")
      WRITE(FCECHO_STR,'('' MAPGEN PROGRAM TERMINATED DUE TO ERROR'')') 
      call FCERR(FCECHO_STR) 
      IF (RETCOD.EQ.8) STOP 8
      STOP 4

CCCCCCCCCCCCCCCCCCCCC END MAPGEN.SOURCE(MAPGEN) CCCCCCCCCCCCCCCCCCCCCCCC
      END
