/*
*
*	jemx.h V 8.02 2006/03/20
*
*	File:			jemx.h
*	Version:		8.02
*	Date:			20th March 2006
*	Author:			Carol Anne Oxborrow 
*	Affiliation:		DSRI, Copenhagen
*	Component:		Header for JEM-X Science Analysis executables
*				
*	Change History Log
*
*	Date		Revision Who	What
*
*   28/12/99	1.0	CAO	First version of this header, delivered
*				with JCreateStatusTable version 1.0
*   25/2/00	2.0	CAO	Second version of this header, delivered
*				separately but updated to work with
*				version 1.0 of j_correction executables
*   3/3/00	2.1	CAO	Added j_prp_frss error code from Nicolas
*   28/3/00	2.2	CAO	Added max. grey filter value from Peter.
*   10/5/00	3.0	CAO	Updated for v3.0 delivery of 
*						j_calib_gain_fitting 
*				Added J_BKG_ERROR_START for Sami
*   22/5/00	3.1	CAO	Added position correction table data structures
*				This version delivered with j_cor_position 1.0
*				and j_cor_position1.2
*  13/07/00	3.2	CAO	Added 1 sec in clock ticks - useful for making
*				test data. This version delivered with
*				j_prp_status_table1.5
*  29/07/00	3.3	CAO 	Added J_GAINIDX-DS defined constant.
*  07/08/00	3.4	CAO	Added revolution length in ticks
*				Updated number of calibration spectra to 8
*				Removed all data structures related to ADC
*				correction executables
*				Added gain history index data structure name
*				This version delivered with j_cor_gain_events1.0
* 				Added status byte bit descriptors
*		3.9	CAO	Special version for j_gain_fitting-3.2, includes
*				J_NUM_CALIB_SPECTRA=4 which is not the currently
*				forseen value, which is actually 8
*  25/08/00	4.0	CAO	Added data structure names for the background
*				data structures and mask description
*  07/09/00	4.1	CAO	Version delivered with j_src_lc 1.0, includes
*				data structures for source light curves
*  15/09/00	4.2	CAO	Version delivered with j_src_spec 1.0, includes
*				data structures for source spectra
*  19/09/00     4.3     CAO     Added `out of detector' value for Sami
*				Version delivered with j_bkg_spec_sel 1.1
*  22/09/00	4.4	CAO	Added `out of mask' value for Stefan.
*				Material attenuation files split into two
* 				instrument-specific versions, like all other 
*				data structures
*				Version delivered with j_src_lc 1.1 and
*				j_src_spectra 1.1
*  24/10/00	5.0	CAO	Corrected all data structure index table names
*				to be 17 characters long
*  25/10/00	5.1	CAO	Added more index table names from NJW. All new
*				index tables have defined name with ending _IDX
*  26/10/00	5.2	CAO	Added auxilliary data structure names as defined
*				constants
*  31/10/00	5.3 	CAO	Updated data structure list to agree with
*				templates released with ISDC RP2.0 
*				Assigned a responsible person to each data
*				structure
*  02/11/00	5.4	CAO	Changed -CFG energy binning tables to -MOD
*  03/11/00	5.5	CAO	INTE becomes SKY. in data structures
*  07/11/00	5.6	CAO	All new error codes arrangement to match new
*				ISDC architecture (ISDCLEVL)
*  09/11/00	5.7	CAO	Updated all of Sami's data structures
*  28/11/00	5.8	CAO	Added new ancilliary functions DS for sources
*				for Stefan and removed the old one
*  29/11/00	5.9	CAO	Updated data structure list for templates 2.0.4
*  11/01/01	5.10	CAO	Removed all data structure names with -IDX 
*				suffix - these will be made by concatination
*  13/03/01	5.11	CAO	Added further mask values for STATUS byte
*  26/03/01	5.12	CAO	Added Reiner's OSM instrument mode defined
*				constants
*  30/03/01	5.13	CAO	Made JEMX_OBT_SEC_TICKs equal to DAL3_OBT_SECOND
*  04/04/01	5.14	CAO	Chatty defined levels made linear: 0,1,2,3,4
*  24/04/01	5.15	CAO	Added version number string for error checking
*  30/04/01	5.16	CAO	Added bad pixel constant
*  14/05/01	5.17	CAO	Changed error codes to merge j_cor_gain_events
*				and j_cor_gain_spectral into j_cor_gain
*  17/05/01	6.00	CAO	Complete new arrangment of beginning error
*				codes for each component after PK's suggestion
*  12/06/01	6.01	CAO	Removed leading zeros from revolution pipeline
*				error codes
*  19/06/01	6.02	CAO	Added housekeeping data structures
*  03/07/01	6.03	CAO	Added error codes for upper level scripts
*  23/07/01	6.04	CAO	Changed names for upper level pipeline
*				script error codes, to make them all unique
*  16/08/01	6.05	CAO	Added Anode status values
*				Added JMXi-ECAL-MOD string
*  17/09/01	7.00	CAO	Added constants to describe telemetry packets
*  16/10/01	7.01	CAO	Added vignetting data structure name
*  15/01/02	7.02	CAO	Added J_NUM_ARF_BINS, J_ENRG_DS, J_VIGN_DIM 
*				for Stefan Larsson
*  07/01/02	7.03	CAO	Extended error ranges for j_calib-gain_fitting
*				and j_ical tools
*  18/01/02	7.04	CAO	Added diagnostic mode data structure
*  10/04/02	7.05	CAO	Added event type counters: J_EVT_MODE_NUM,
*					J_NONEVT_MODE_NUM, J_TOT_MODE_NUM
*  19/04/02	7.06	CAO	Removed big arrow from data structure list
*  29/04/02	7.07	CAO	Changed "-DEAD-STA" to "-DEAD-SCP"
*  2/05/02	7.08	CAO	Changed J_JEMX_H_VERSION to J_JEMX_H_EDITION
*  13/06/02	7.09	CAO	Removed J_SRCLC_ARF_DS and J_SRCSP_ARF_DS
*				Added J_SRCL_ARF_DS and J_AXISARF_DS
*  28/06/02	7.10	CAO	Corrected J_MAX_RATE_PKT to 406 `events'
*				Added  J_LOBT_TICK_SHIFT, J_LOBT_FOBT_SHIFT
*				J_LOBT_MASK_SHIFT for j_prp_verify 2.0
*  2003/02/11	7.11	CAO	Complete overhaul of status flag values based
*				on PK's recommendations
*  2003/03/14	7.12	CAO	Added Onboard Software (DPE) identification
*				numbers for the HK event/rejection counters
*  2003/03/20	7.13	CAO	Added calibration spectrum and Xe peak energies
*  2003/06/11	7.14	CAO	Added more event STATUS bit values
*  2003/07/02	7.15	CAO	Added data structure label J_ANOD_HIS_DS 
*  2003/11/05	7.16 	CAO	Added constant J_NORM_AREA
*  2003/11/10	7.17	CAO	Updated error codes for offline tools
*  2004/01/05	7.18	CAO	Corrected typo in error codes
*  2004/01/14	7.19	CAO	Fixed typo
*				Added first ICAL data structures: j_ical_gain
*  2004/01/24	7.20	CAO	Added J_COLL_OPEN_FRAC 0.876
*				Added J_IDEAL_ILLUM 103.20 (cm^2)
*				Changed value and definition of J_MASK_OPEN_FRAC
*				Added error range JEMX_SHARED_ERR -91000
*				for shared software functions and individual
*				functions: J_GET_GTI_ERR, J_GOOD_FRAC_ERR
*  2004/04/22	7.21	CAO	Added error code start value 
*				J_IMA_FINE_RESOL_ERR at NJW's request
*  2004/05/17	7.22	CAO	Added -ALL data structure names
*  2004/08/23	7.23	CAO	Changed around the order of the STATUS mask
*				values as agreed at SDAST meeting #29:
*				J_COR_BAD_NEIGHBOUR	32
*  2004/11/15	7.24	CAO	Corrected value of Pi from 3.1415926358979323846
*				to 3.14159265358979323846           ^^
*                                           ^^
*  2004/11/29 	7.25	CAO 	Added Error range for the shared library
*				JEMXLIB_ERR. Corrected description of status=4
*				problem.
*  2005/03/17	8.0	CAO	Jemx.h for OSA 5.0 deliveries. Added data 
*				structure names -DETE-CCR and -DETE-CCR-IDX.
*  2005/04/26	8.01	CAO	Added error base code for j_ima_iros
*				J_IMA_IROS_ERR  -32600 and for j_ima_mosaic
*				J_IMA_MOSAIC_ERR -55000, also needed for OSA 5.0
*  2006/03/20	8.02	CAO	Added error base code for j_src_properties
*				J_SRC_PROPERTIES_ERR     -33200
*/

#ifndef JEMX_H_INCLUDED
#define JEMX_H_INCLUDED

#define J_JEMX_H_EDITION "8.01"		/* Header version number string */

/*	Instrument description definitions

	All the definitions here can be found in the JEM-X Users Manual
*/
#define J_EVT_MODE_NUM 4		/* Number of different event modes */
#define J_NONEVT_MODE_NUM 2		/* Number of non-event modes */
#define J_TOT_MODE_NUM	6		/* Total number of data-taking modes */
#define J_MAX_GREY_FILTER 31            /* Maximum value of Grey Filter */
#define	J_ORIG_CHAN_NUM	4096		/* Maximum number of energy channels
					   in JEM-X on-board data.*/
#define J_NUM_CALIB_BINS 256		/* Number of JEMX energy channels 
					   in the  calibration telemetry*/
#define J_NUM_SCI_BINS 256		/* Number of JEMX energy channels 
					   in the science telemetry: Full 
					   imaging, and Spectral-Timing */
#define J_NUM_REST_BINS	8		/* Number of JEMX energy channels in 
					   the restricted imaging telemetry */
#define J_NUM_SPEC_BINS 64              /* Number of JEMX energy channels 
                                           in the spectrum mode telemetry */
#define J_NUM_PI_BINS 256		/* Number of JEMX energy channels in
					   the PI binning scheme */
#define J_NUM_CALIB_SPECTRA 4		/* Number of calibration spectra in
					   each calibration package. One for
					   each instrument anode. */
#define J_NUM_GAIN_COEFFS 2		/* Number of detector gain coefficients
					   to scale calibration spectra */
#define J_RATE_INTEGRATION_TIME  0.125   /* Integration time for Count Rate
                                            data in seconds */
#define J_SPEC_INTEGRATION_TIME  0.125   /* Integration time for Spectrum Mode
                                            data in seconds */
#define J_NUM_X_PIXELS	256		/* Number of detector pixels on X axis*/
#define J_NUM_Y_PIXELS	256		/* Number of detector pixels on Y axis*/
#define J_MAX_SSC_VAL	16383		/* Max value of the SSC counter value */
#define J_OBT_SEC_TICKS DAL3_OBT_SECOND	/* Number of OBT `ticks' in a second */
#define J_REV_SEC_TICKS 259200*J_OBT_SEC_TICKS
					/* Number OBT ticks in a revolution */
#define J_COR_PI	3.1415926538979323846		
					/* Pi */
#define J_DIM_MASK	200		/* Dimension of the mask array*/
#define J_MASK_CLOSED_CELL	0	/* Value of closed mask cell */
#define J_MASK_OPEN_CELL	6	/* Value of open mask cell */
#define J_MASK_OUT_CELL		7	/* Value of out-of-mask cell */
#define J_MASK_OPEN_FRAC	0.24 	/* Ratio of (open: all) mask cells*/
#define J_COLL_OPEN_FRAC 	0.876	/* Open fraction of collimator */ 
#define J_IDEAL_ILLUM    	103.20	/* Area in cm^2 of the ideal illuminated
					   detector area for on axis sources.
					   This takes into account area obscured
					   by closed mask cells and collimator*/
#define J_PIXEL_OUT_OF_DETECTOR  0      /* Pixel not in active
                                          detector area */
#define J_COLL_DIM		500	/*  Dimension of collimator description
					   array in JMXi-COLL-MOD  */
#define J_COR_BAD_PIXEL_OFFSET	1000.00 /* Value put in instrument model tables
					   to indicate a bad pixel */
#define J_ANODE1_ON		14	/* Value of anode status bits for
					   anode 1 only activated */
#define J_ANODE2_ON		13	/* Value of anode status bits for
					   anode 2 only activated */
#define J_ANODE3_ON		11	/* Value of anode status bits for
					   anode 3 only activated */
#define J_ANODE4_ON		7	/* Value of anode status bits for
					   anode 4 only activated */
#define J_ANODEALL_ON		0	/* Value of anode status bits for all
					   anodes activated 
					   (normal data taking)*/
#define J_MAX_FULL_PKT		105	/* Maximum raw events in a FULL mode
					   telemetry packet */
#define J_MAX_REST_PKT		412	/* Maximum raw events in a REST mode
					   telemetry packet */
#define J_MAX_SPTI_PKT		211	/* Maximum raw events in an SPTI  mode
					   telemetry packet */
#define J_MAX_SPEC_PKT		10	/* Maximum raw spectra in a SPEC  mode
					   telemetry packet */
#define J_MAX_TIME_PKT		563	/* Maximum raw events in a TIME  mode
					   telemetry packet */
#define J_MAX_RATE_PKT		406	/* Maximum raw countrates in a RATE mode
					   telemetry packet */
#define J_NUM_ARF_BINS		500	/* Number of ARF bins */
#define J_VIGN_DIM		256	/*  Dimension of vigneting table
					   array in JMXi-COLL-MOD  */
#define J_NORM_AREA		100	/* Ideal detector area in cm^2, for
					   flux normalisation */
					   
/*	Line energies used for gain calibration */

#define J_XE_ENERGY 29.78		/* Energy of Xe major fluoresence line
					   Source: Table of Isotopes p. 563*/
#define J_CD_ENERGY_ONE 22.1		/* Energy of Cd first line in Kev 
					   Source: Table of Isotopes p. 563*/
#define J_CD_ENERGY_TWO 25.0		/* Energy of Cd second line in KeV 
					   Source: Table of Isotopes p. 563*/
#define J_FE_ENERGY_ONE 5.895		/* Energy of Fe(Mn) first line in KeV
					   Source: Table of Isotopes p. 570 */
#define J_FE_ENERGY_TWO 6.50		/* Energy of Fe(Mn) second line in KeV
					   Source: Table of Isotopes p. 570 */
#define J_CD_INT_RATIO 0.2156862	/* Intensity ratio of Cd doublet lines.
 					   Source: Table of Isotopes p. 563 */
#define J_FE_INT_RATIO 0.10596		/* Intensity ratio of Fe doublet lines.
					   Source: Table of Isotopes p. 570 */


/*	The following OBT bit shift values can be seen on page 15 of
	DAL3GEN users manual
*/
#define J_LOBT_TICK_SHIFT	3	/* JEM-X LOBT uses 2^(-13) as LOBT tick
					   unit, not 2^(-19) seconds
					   which is INTEGRAL standard */
#define J_LOBT_MASK_SHIFT	3	/* Masked bits that do not appear in
					   telemetry LOBTs */
#define J_LOBT_FOBT_SHIFT	1	/* Extra bits in FOBT not used in LOBT
					   */

/*	Instrument mode enumeration from OSM
*/
#define JMX_MODE_OFF           11
#define JMX_MODE_STDBY_CSSW    21
#define JMX_MODE_STDBY_IASW    22
#define JMX_MODE_SAFE          23
#define JMX_MODE_SETUP         31
#define JMX_MODE_DATA          40
#define JMX_MODE_DATA_FULL     41
#define JMX_MODE_DATA_SPTI     42
#define JMX_MODE_DATA_REST     43
#define JMX_MODE_DATA_TIME     44
#define JMX_MODE_DATA_SPEC     45
#define JMX_MODE_DIAGNOSTIC    51
#define JMX_MODE_MEMORY_DUMP   52
#define JMX_MODE_CALIBRATION   61

/*	HK event/trigger/rejection counter IDs 
	All these values are found in the JEM-X Instrument User Manual 
	(specifically p.167 of version 5.5 from 2002/10/10) */

#define	JMX_SOFT_TRIG_ID	5199
#define JMX_ACCEPTED_EVTS_ID 5377
#define JMX_GREY_LOSS_ID 5121
#define JMX_BUFFER_LOSS_ID 5136
#define JMX_FIFO_LOSS_ID 5135
#define JMX_HIGH_ANODE_ID 5123
#define JMX_CRUDE_RTIME_ID 5128
#define JMX_FINE_RTIME_ID 5127
#define JMX_VETO_REJ_ID 5130
#define JMX_CALIB_EVTS_ID 5100
#define JMX_HIGH_BACK_ID 5134
#define JMX_LOW_BACK_ID 5132
#define JMX_HIGH_CATH_ID 5133
#define JMX_LOW_CATH_ID	5131


/* Event status byte description:
*/
#define J_COR_BAD_ANODE_SEG	4	/* Events fall on an anode segment 
					   where the entire segment is faulty */
#define J_COR_BAD_OBT		8 	/* Mask value to indicate event has
					   uncertain time correlation */
#define J_COR_BAD_ANODE		16 	/* Mask value to indicate event comes
					   from an anode position regarded
                                           as bad */
#define J_COR_BAD_NEIGHBOUR	32	/* Mask value for events coming from
					   position next to a bad anode */
#define J_COR_BAD_GAIN_PARAMS	64	/* Mask value to indicate bad energy 
                                           determination due to poor detector 
					   gain history determination */
#define J_COR_BAD_GAIN_PIXEL	128	/* Mask value to set in status bytes to
					   indicate bad energy determination 
                                           due to event position */
#define J_COR_BAD_XPOS_BIT	256 	/* Mask value to set in status byte
					   to indicate bad X position 
					   determination */
#define J_COR_BAD_YPOS_BIT	512 	/* Mask value in status byte
					   to indicate bad Y position
					   determination */
#define J_COR_BAD_CAL_SOURCE	1024	/* Mask value to indicate event
					   which has probably leaked from
					   a calibration source */
#define J_COR_PRE_SETUP		2048	/* Mask value for events occurring
					   before SETUP of instrument */
#define	J_COR_OUTSIDE		4096	/* Mask value for events falling outside
					   active area of the detector 	*/
#define J_COR_HOTSPOT		8192	/* Mask value for events coming from
					   a hotspot */
/* 	Error code offsets
*
*	Each start code indicates a range of error codes, relative to the
*	ISDC-assigned JEMX start code J_ERROR_CODE_START (value -300000).
*	Each executable has 100 error codes assigned to it and each pipeline
*	groups together its executables within a particular 1000-value range
*	where in the last 100 values are reserved for pipeline/script errors.
*	
*	Larger blocks of code are assigned error codes as follows:
*	-3 0xxxx => JEM-X V1 ISSW in Rev. File Pipeline  
*	-3 1xxxx => JEM-X V1 ISSW in ScW Pipeline
*	-3 2xxxx => JEM-X V2 ISSW upto and including the BKG level
*           (incl. scripts which have only generic children)
*	-3 3xxxx => JEM-X V2 ISSW from BIN_I to BIN_T inclusive
*	-3 4xxxx => JEM-X V3 ISSW - Interactive Background analysis
*	-3 5xxxx => JEM-X V3 - Science Format and other generic applications
*       -3 55xxx => JEM-X V3 Level IMA2 (just mosaicking so far)
*	-3 6xxxx => JEM-X V3 ISSW - Offline Calibration Analysis
*	-3 7xxxx => JEM-X V3 ISSW - Performance analysis
*	-3 8xxxx => Highest level pipeline scripts
*	-3 91xxx => JEM-X Shared functions
*	-3 92000+ => Future software expansion for JEM-X
*/


/*	Data preparation  error codes for Revolution file pipeline */
#define J_PRP_FRSS_OBT_ERR		-1100 
#define	J_CALIB_GAIN_FITTING_ERR	-2100
/*	Next useable number here is -2300 */
#define J_CALIB_ADC_ERR			-3100

/*	j_data_preparation error codes for ScW Pipeline */
#define	J_PRP_EVTS_OBT_ERR		-11100
#define J_PRP_RATE_OBT_ERR		-11200
#define J_PRP_SPEC_OBT_ERR		-11300
#define J_PRP_STATUS_TABLE_ERR		-11400
#define J_PRP_VERIFY_ERR		-11500

/* 	j_correction starting error codes	*/
#define J_COR_GAIN_ERR			-21100
#define J_COR_POSITION_ERR		-21300
#define J_CORRECTION_SCRIPT_ERR		-21900

/*	j_gti script starting error code */
#define	J_GTI_SCRIPT_ERR		-22900

/*	j_dead_time starting error codes */
#define J_DEAD_TIME_CALC_ERR		-23100
#define J_DEAD_SCRIPT_ERR		-23900

/*	j_cat_extract script starting error code	*/
#define J_CAT_SCRIPT_ERR		-24900

/*	j_bkg_model starting error codes	*/
#define J_BKG_SPEC_SELECT_ERR		-25100
#define J_BKG_SPAT_SELECT_ERR		-25200
#define J_BKG_SCAL_CALC_ERR		-25300
#define J_BKG_MODEL_SCRIPT_ERR		-25900

/*	j_image_bin starting error codes */
#define J_IMA_SHADOWGRAM_ERR		-31100
#define J_IMAGE_BIN_SCRIPT_ERR		-31900

/* 	j_imaging starting error codes */
#define J_IMA_BASIC_RECON_ERR		-32100
#define J_IMA_SRC_FIND_ERR		-32200
#define J_IMA_COR_INTENSITY_ERR		-32300
#define J_IMA_REFINED_RECON_ERR		-32400
#define J_IMA_FINE_RESOL_ERR		-32500
#define J_IMA_IROS_ERR  		-32600

#define J_IMAGING_SCRIPT_ERR		-32900

/*	j_src_extract_spectra	starting error codes */
#define J_SRC_SPECTRA_ERR		-33100
#define J_SRC_PROPERTIES_ERR     	-33200
#define J_SRC_SPECTRA_SCRIPT_ERR        -33900

/*	j_src_extract_lc starting error codes */
#define J_SRC_LC_ERR			-34100
#define J_SRC_EXTRACT_LC_SCRIPT_ERR	-34900

/*	j_bin_spectra starting error codes */
#define J_BIN_EVTS_SPECTRA_ERR		-35100
#define J_BIN_SPEC_SPECTRA_ERR		-35200
#define J_BIN_BKG_SPECTRA_ERR		-35300
#define J_BIN_SPECTRA_SCRIPT_ERR	-35900

/* 	j_bin_lc starting error codes */
#define J_BIN_EVTS_LC_ERR		-36100
#define J_BIN_RATE_LC_ERR		-36200
#define J_BIN_BKG_LC_ERR		-36300
#define J_BIN_LC_SCRIPT_ERR		-36900

/*	j_bkg_interactive starting error codes */
#define J_BKG_INT_SPEC_SEL_ERR		-41100
#define J_BKG_INT_SPAT_SEL_ERR		-41200
#define J_BKG_INT_SCAL_CALC_ERR		-41300
#define J_BKG_INTERACTIVE_SCRIPT_ERR	-41900

/*	j_sci_format script starting error code */
#define J_SCI_SCRIPT_ERR		-51900

/*	IMA2 level starting error codes */
#define J_IMA_MOSAIC_ERR		-55000

/* 	j_known_src_calib starting error codes */
/*	Currently it is not known which executables will be in this pipeline */
#define J_ICAL_COLLIMATOR_ERR		-61100
#define J_ICAL_GAIN_ERR			-61200
#define J_ICAL_ECAL_ERR			-61300
#define J_ICAL_FRSS_ERR			-61400
#define J_ICAL_ANODES_ERR		-61500
#define J_ICAL_SCRIPT_ERR		-61900

/*	j_performance starting error codes */
#define J_PERF_COLLECT_DATA_ERR		-71100
#define J_PERFORMANCE_SCRIPT_ERR	-71900

/*	Codes for upper level pipeline scripts jemx_sci_analysis,
	jemx_scw_analysis and jemx_obs_analysis
*/
#define J_SCI_PIPE_ERR			-81000
#define J_SCW_PIPE_ERR			-82000
#define J_OBS_PIPE_ERR			-83000


/*	Codes for shared JEM-X functions
*/
#define JEMXLIB_ERR			-90000


/*	Data structure definitions 
*
*	All of these names can be found on the JEM-X Data Definition page
*	at http://obswww.unige.ch/isdc/  		(ISDC)
*	or at the developer's forum site at DSRI:
*	http://www.dsri.dk/~oxborrow/sdast/sdast_forum.html  (DSRI)
*	
*	These partial names can be used for either the JEM-X1 instrument
*	or the JEM-X2 instrument depending on the prefix: JMX1 or JMX2.
*	The names also refer to both the actual data structure extension name
*	in the ISDC fits files, and the template file *****.tpl used to 
*	create each data structure for the first time.
*	
*	This list does not include certain index table data structures that 
*	are never used directly by the JEMX ISSW.
*	
*	Under each data structure is the name of the SDAST person responsible 
*	for maintaining/creating the data structure template.
*	
*	Entries are ordered alphabetically by the data structure name
*			     |
*			     |
*			    V|V
*			     V
*/
#define J_ATTIHIS_DS	"AUXL-ATTI-HIS"	/* Historic spacecraft attitude data */
/* PK */
#define J_ATTINRT_DS	"AUXL-ATTI-NRT"	/* Near real time spacecraft attitude */
/* PK */
#define J_ORBIHIS_DS	"AUXL-ORBI-HIS" /* Historic orbit data */
/* PK */
#define J_TCORHIS_DS	"AUXL-TCOR-HIS"	/* Historic time correlation data */
/* PK */
#define J_ALRT_LIM	"-ALRT-LIM"	/* Limits for out of bounds alerts */
/* PK */
#define J_ANOD_HIS_DS	"-ANOD-PRP"	/* Histogram of anode populations*/
/* CAO */
#define J_ASPE_DS	"-ASPE-BKG"	/* Sun aspect angle scaling factor */
/* SM */
#define J_ALUM_DS   	"-ATAL-MOD"	/* Aluminium attenuation data table */
/* NJW */
#define J_COPPER_DS 	"-ATCU-MOD"	/* Copper attenuation data table */
/* NJW */
#define J_MOL_DS    	"-ATMO-MOD"	/* Molybdenum attenuation data table */
/* NJW */
#define J_ATTIBKG_DS	"-ATTI-BKG"	/* Attitude background scaling factor */
/* SM */
#define J_ATTIDBG_DS	"-ATTI-DBG"	/* Attitude background scaling factor */
/* SM */
#define J_XENON_DS  	"-ATXE-MOD"	/* Xenon attenuation data  table */
/* NJW */
#define J_AXISARF_DS    "-AXIS-ARF"     /* Axis default ARF */
/* SL */
#define J_CALBCORR_DS	"-CALB-MOD"	/* Corrected calibration energy bin */
/* NJW 				   	   limits, in ADC channels. */
#define J_COLL_DS	"-COLL-MOD"	/* Collimator model information */
/* NJW */
#define J_CONV_DS	"-CONV-MOD"	/* Conversion curves for HK parameters*/
/* NJW */
#define J_CORX_DS	"-CORX-MOD"	/* X position correction table. */
/* CAO */
#define J_CORY_DS	"-CORY-MOD"	/* Y-position correction table. */
/* CAO */
#define J_HKRAW_DS	"-CSSW-HRW"	/* Raw housekeeping data*/
/* CAO */
#define J_HKPRP_DS	"-CSSW-CNV"	/* Prepared/convered housekeeping data*/
/* CAO */
#define J_DEAD_DS	"-DEAD-SCP"	/* Dead-time table */
/* CAO */
#define J_DEADMOD_DS	"-DEAD-MOD"	/* Dead-time model table */
/* CAO */
#define J_PLATEMAP_DS	"-DETE-CCR"	/* Detector map model */
/* CAO */
#define J_PLTMAPIDX_DS	"-DETE-CCR-IDX"	/* Index of detector map models */
/* CAO */
#define J_DETECTOR_DS	"-DETE-MOD"	/* Detector instrument model */
/* NJW */
#define J_DIAG_DS	"-DIAG-CRW"	/* Diagnostic mode raw data */
/* CAO */
#define J_DPOS_DS	"-DPOS-MOD"	/* Detector position determination */
/* NJW */
#define J_ECAL_MOD_DS	"-ECAL-MOD"	/* ADC electronic calibration models */
/* CAO */
#define J_ENRG_DS   	"-ENRG-MOD"	/* Default line energy table for RMF*/ 
/* SL */
#define J_EVTSSHD_DS	"-EVTS-SHD"	/* Shadowgram from FULL or REST events*/
/* NJW */
#define J_PIBINS_DS	"-FBDS-MOD"	/* PI bin limits for full, spectral- */
/* CAO 				   	   timing, and calibration modes. */
#define	J_FINDRES_DS	"-FIND-RES"	/* List of found sources */
/* NJW */
#define J_CALSPEC_DS	"-FRSS-CRW"	/* Raw calibration spectra.  */
/* CAO */
#define J_SCIBCORR_DS	"-FULB-MOD"	/* Corrected energy binning limits for*/
/* CAO  				   full and spectral-timing modes */
#define J_FULLALL_DS	"-FULL-ALL"	/* Total event list for FULL events */
/*cao*/
#define J_FULLBLC_DS	"-FULL-BLC"	/* Background lightcurve for FULL */
/* PK   				   imaging mode */
#define J_FULLBSPEC_DS	"-FULL-BSP"	/* Background spectra for detector in */
/* PK  				   full imaging mode */
#define J_FULLCOR_DS	"-FULL-COR"	/* Full imaging corrected data */
/* CAO */
#define J_FULLDLC_DS	"-FULL-DLC"	/* Full imaging detector lightcurve */
/* PK */
#define J_FULLDSP_DS	"-FULL-DSP"	/* Full imaging detector spectrum */
/* PK */
#define J_FULLPREP_DS	"-FULL-PRP"	/* Full imaging prepared data */
/* CAO  				   (full OBT) ISDC */
#define J_FULLPKT_DS	"-FULL-PRW"	/* Full imaging raw packet data */
/* CAO */
#define J_FULLRAW_DS	"-FULL-RAW"	/* Full imaging raw data.  */
/* CAO */
#define J_FULLDMY_DS	"-FULL-SRW"	/* Full imaging dummy(grey) events*/
/* CAO */
#define J_GAINHIST_DS 	"-GAIN-CAL"	/* Calibration gain history  DSRI */
/* CAO */
#define J_GLITCHES_DS	"-GLTC-ICL"	/* Glitch history image */
/* CAO */
#define J_GMODHIST_DS	"-GMOD-ICL"	/* Modelled/smoothed gain history */
/* CAO */
#define J_GREVHIST_DS	"-GREV-ICL"	/* Average gain history per revolution*/
/* CAO */
#define J_IMOD_DS	"-IMOD-GRP"	/* Instrument model group */
/* NJW */
#define J_STATHIS_DS	"-INST-STA"	/* Instrument status history table */
/* CAO */
#define J_MASK_DS	"-MASK-MOD"	/* Mask pattern data structure */
/* NJW */
#define J_GTI_ALL_DS	"-MERG-GTI"	/* Merged Good Time Interval list */
/* NJW */
#define J_MOSA_DS	"-MOSA-IMA"	/* Mosaic'ed images */
/* NJW */
#define J_ORBIBKG_DS	"-ORBI-BKG"	/* Orbital background scaling */
/* SM */
#define J_POSICORR_DS	"-POSI-MOD"	/* Position accuracydetermined by */
/* NJW  				   pre-flight calibration */
#define J_POSIKSC_DS	"-POSI-CAL"	/* Position accuracy refinements */
/* NJW  				   determined by j_known_src_calib */
#define J_QEFF_DS	"-QEFF-MOD"	/* Quantum efficiency table */
/* NJW */
#define J_RADBKG_DS	"-RADL-BKG"	/* Radiation level background scaling */
/* SM					   factors */
#define J_RATEBLC_DS	"-RATE-BLC"	/* Rate background lightcurve */
/* PK */
#define J_RATECOR_DS	"-RATE-COR"	/* Countrate corrected data */
/* CAO */
#define J_RATEDET_DS	"-RATE-DLC"	/* Rate detector lightcurve */
/* PK */
#define J_RATEPREP_DS	"-RATE-PRP"	/* Countrate prepared data (OBT) */
/* CAO */
#define J_RATEPKT_DS	"-RATE-PRW"	/* Countrate packet raw data */
/* CAO */
#define J_RATERAW_DS	"-RATE-RAW"	/* Countrate raw data */
/* CAO */
#define J_RESPI_DS	"-RBDS-MOD"	/* PI energy binning  table for */
/* CAO  				   restricted mode data DSRI */
#define J_RESTBCORR_DS	"-RESB-MOD"	/* Corrected restricted imaging energy*/
/* CAO  				   bin limits, in ADC channels. DSRI*/
#define J_RESTALL_DS	"-REST-ALL"	/* Total event list for REST events */
/*cao*/
#define J_RESTBSP_DS	"-REST-BSP"	/* Background spectrum for restricted*/
/* PK   				   imaging events */
#define J_RESTCOR_DS	"-REST-COR"	/* Restricted imaging corrected data */
/* CAO */
#define J_RESTDET_DS	"-REST-DSP"	/* Detector spectrum for restricted */
/* PK 					   imaging events */
#define J_RESTPREP_DS	"-REST-PRP"	/* Restricted imaging prepared raw */
/* CAO  				(event OBT) ISDC */
#define J_RESTPRW_DS	"-REST-PRW"	/* Restricted imaging packet raw data*/
/* CAO */
#define J_RESTRAW_DS	"-REST-RAW"	/* Restricted imaging raw events ISDC*/
/* CAO */
#define J_RESTSRW_DS	"-REST-SRW"	/* Restricted imaging image */
/* CAO 					   secondary raw data */
#define J_RESTORED_DS	"-RSTI-IMA"	/* `skew' image made by correlation */
/* NJW  				   in basic image reconstruction */
#define J_SPECPI_DS	"-SBDS-MOD"	/* PI binning table for spectral mode*/
/* CAO */
#define J_IBGSCAL_DS    "-SCAL-BKG"	/* Scaling for instrument background */
/* SM */
#define J_DBGSCAL_DS    "-SCAL-DBG"	/* Scaling for diffuse background */
/* SM */
#define J_IBGSPEC_DS    "-SCAT-BKG"     /* Instrm. background spectra */
/* SM */          
#define J_DBGSPEC_DS    "-SCAT-DBG"     /* Diffuse  background spectra */
/* SM */
#define J_IBGSIDX_DS	"-SIDX-BKG"     /* Instr. background spectral model */
/* SM 					   index table*/
#define J_DBGSIDX_DS    "-SIDX-DBG"     /* Diffuse background spectral */
/* SM */				    /* model index table  */  
#define J_SKYIMA_DS	"-SKY.-IMA"	/* Sky image */
/* NJW */
#define J_SPATGAIN_DS	"-SPAG-MOD"	/* Spatial gain corrections determined*/
/* CAO 					   by pre-flight calibration */
#define J_SPATKSC_DS	"-SPAG-CAL"	/* Spatial gain correction refinements*/
/* SM 					   determined by j_known_src_calib */
#define J_IBGSPAT_DS    "-SPAT-BKG"	/* Instrm. background spatial model */
/* SM */
#define J_DBGSPAT_DS    "-SPAT-DBG"	/* Diffuse background spatial model */
/* SM */
#define J_SPECBCORR_DS	"-SPCB-MOD"	/* Corrected SPEC energy bin */
/* CAO 					   limits, in ADC channels. DSRI*/
#define J_SPECALL_DS	"-SPEC-ALL"	/* Total event list for SPEC events */
/*cao*/
#define J_SPECMODI_DS	"-SPEC-BSP"	/* Time-resolved instrument background*/
/* PK 					   spectra */
#define J_SPECCOR_DS	"-SPEC-COR"	/* Spectral mode corrected data */
/* CAO */
#define	J_DIFFSPEC_DS	"-SPEC-DSP"	/* Time-resolved diffuse background */
/* PK 					   spectra */
#define J_SPECPREP_DS	"-SPEC-PRP"	/* Spectral mode packet data */
/* CAO 					   events */
#define J_SPECPKT_DS	"-SPEC-PRW"	/* Spectral mode packet data */
/* CAO 					   events */
#define J_SPECRAW_DS	"-SPEC-RAW"	/* Spectral mode raw data */
/* CAO 					   events */
#define J_SPTIALL_DS	"-SPTI-ALL"	/* Total event list for SPTI events */
/*cao*/
#define J_SPTIBLC_DS	"-SPTI-BLC"	/* Background lightcurve for SPTI mode*/
/* PK */
#define J_SPTIBSP_DS	"-SPTI-BSP"	/* Background spectra for SPTI mode*/
/* PK */
#define J_SPTICOR_DS	"-SPTI-COR"	/* Spectral-timing mode corrected data*/
/* CAO 					   events */
#define J_SPTIDLC_DS	"-SPTI-DLC"	/* Detector background lightcurve for */
/* PK 					   SPTI mode*/
#define J_SPTIDSP_DS	"-SPTI-DSP"	/* Detector background spectra for */
/* PK 					   SPTI mode*/
#define J_SPTIPREP_DS	"-SPTI-PRP"	/* Spectral timing prepared data */
/* CAO 					   (full OBT) */
#define J_SPTIPKT_DS	"-SPTI-PRW"	/* Spectral timing raw packet data */
/* CAO 					   events */
#define J_SPTIRAW_DS	"-SPTI-RAW"	/* Spectral timing raw data.  */
/* CAO 					   events */
#define J_SPTIDMY_DS	"-SPTI-SRW"	/* Spectral timing grey events  */
/* CAO 					   events */
#define J_SRCL_ARF_DS   "-SRCL-ARF"     /* Ancilliary response function  */
/* SL */
#define J_SRC_BLC_DS	"-SRCL-BLC"	/* Background LCs for each source */
/* SL */
#define J_SRC_BSP_DS	"-SRCL-BSP"	/* Background spectra for each source */
/* SL */
#define J_SRC_CAT_DS	"-SRCL-CAT"	/* Point sources taken from general*/
/* SL 					   catalogue as input to ISSW */
#define J_SRC_LCR_DS	"-SRCL-LCR"	/* Countrate lightcurves for listed */
/* SL 					   sources */
#define J_SRC_LIST_DS	"-SRCL-RES"	/* List of found sources in FOV */
/* SL */
#define J_SRC_SPEC_DS	"-SRCL-SPE"	/* Source spectra for each source */
/* SL */
#define J_TIMEALL_DS	"-TIME-ALL"	/* Total event list for TIME events */
/*cao*/
#define J_TIMEBLC_DS	"-TIME-BLC"	/* Background countrate lightcurve */
/* PK 					   for timing mode */
#define J_TIMEDLC_DS	"-TIME-DLC"	/* Detector background lightcurve for*/
/* PK 					   timing mode */
#define J_TIMEPREP_DS	"-TIME-PRP"	/* Prepared data (OBT) for timing mode*/
/* CAO 					   events */
#define J_TIMEPRW_DS	"-TIME-PRW"	/* Timing mode packet raw data */
/* CAO */
#define J_TIMERAW_DS	"-TIME-RAW"	/* Raw timing mode data */
/* CAO 					   events */
#define J_TIMESRW_DS	"-TIME-SRW"	/* Autonomous grey filter changes */
/* CAO 					   during timing mode data taking */
#define J_TIMEVER_DS	"-TVER-CRW"	/* Time verification data */
/* PK */
#define J_VIGN_DS       "-VIGN-MOD"     /* Vignetting information */
/* NJW */

/*	Message output controls (chatty parameter)
*/

#define J_CHATTY_VERY_QUIET 0  /* Only system messages and fatal errors */
#define J_CHATTY_QUIET      1  /* Errors and severe warnings only */
#define J_CHATTY_NORMAL     2  /* + important Log messages, extend warnings */
#define J_CHATTY_VERBOSE   3  /* + program flow comments */
#define J_CHATTY_VERY_VERBOSE 4 /* + miscellaneous program control values */
#define J_CHATTY_MAXIMAL     5 /* Everything you want */

#endif

