/***************************************************************** docbegin: * Name of file: jmx_lib_pif.h * Version of source file: 6.0.0 * Parent component: * Programmer: Niels Lund * Affiliation: Danish National Space Center * Contact address: Juliane Maries Vej 30 * DK-2100 Copenhagen, Denmark * Phone: +45 35325716 FAX: +45 35362475 * nl@dnsc.dk * Purpose: Header file for 'j_lib_pif' * Origin date: 051124 * Update history: 1.0.0 First version * 1.1.0 060726 Moved declaration of MaskSS structure to alignment_init * Placed pointer to 'struct MaskSS' in struct 'instr_data'. * Eliminated 'struct MaskSS *mss' as parameter in 'struchk'. * 2.0.0 070302 Simplified peak optimization involving 'radcor' routine * 2.1.0 070730 Active use of input source catalog * and feedback from sky_image analysis * 2.1.0 070809 SCREWs 2021-2023 * 2.1.1 070918 SPR 4729: Floating Point Exception * 2.1.2 070920 SPR 4731: Missing inialization fixed * 2.1.3 070920 SPR 4734: Another issing inialization fixed * 2.1.4 070921 SPR 4736: Fixing use of isnan function * 2.1.5 070925 SPR 4737: Bad array dimensioning fixed * 5.1.2 151106 Running version with LC generation * 6.0.0 180112 Introduces LC generation and burst detection * Type of element: Headerfile * Part of package: jmx_lib_pif docend: *****************************************************************/ #ifndef JMX_LIB_PIF_INCLUDED #define JMX_LIB_PIF_INCLUDED #define detdim 65536 /* shadowgram dimension [256x256] */ #define J_IIR_SKEWMASK_DIM 200 /* NJW skew shadowgram dimension */ #define J_NUM_PIF_ENERGIES 20 /* Special reference to j_src_properties */ #define J_NUM_RCCOEFS 9 /* Number of RC coefs */ #define J_NUM_RCCOEFSB 3 /* Number of RC coefs */ #define TWOPI (J_COR_PI * 2.0) #define GTORAD (J_COR_PI / 180.0) #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_NUM_SCI_BINS 256 /* Local error code definitions, begins with -390100 (see jemx.h) */ #define J_LPF_DIMTOOSMALL -1 #define J_LPF_BADJEMXNUM -2 #define J_LPF_MALLOC_ERR -3 #define J_LPF_BADNUMROWS -4 #define J_LPF_BADNUMGTIDS -5 #define J_LPF_WRONG_DIMS -6 #define J_LPF_WRONG_AXES -7 #define J_LPF_UNKNOWN_TYPE -8 #define XYvsE_Evals 16 /* number of energy intervals in 'XvsE' and 'YvsE' */ #define XvsE_Xvals 16 /* number of X intervals in 'XvsE' */ #define YvsE_Yvals 16 /* number of Y intervals in 'YvsE' */ /* Struct for mask support structure: */ struct MaskSS { double longspx[6][2]; double longspy[6][2]; double longspw; double longspw2; double longsph; double offs_lsp; double shortspx[6][2]; double shortspy[6][2]; double shortspw; double shortspw2; double shortsph; double offs_ssp; double ringri[3]; double ringro[3]; double ringh[3]; double rx[4]; double ringri2[3]; double ringro2[3]; double bolt1x[6]; double bolt1y[6]; double bolt1r; double bolt1s; double offs_b1; double bolth; double bolt2x[6]; double bolt2y[6]; double bolt2r; double bolt2s; double offs_b2; double bolt3x[6]; double bolt3y[6]; double bolt3r; double bolt3s; double offs_b3; double joint1x[6]; double joint1y[6]; double joint1r; double joint1h; double joint1r2; double offs_j1; double joint2x[6]; double joint2y[6]; double joint2r; double joint2h; double joint2r2; double offs_j2; double twist; double r_twist; double pi6; unsigned char struk[1100][1100]; double pi; /* pi */ double twopi; /* 2*pi */ double gtorad; /* pi/180.0 */ }; struct instr_data { /* structure with data describing the instrument geometry */ double coll_pitch; /* collimator pitch, nominally 7.05 mm */ double coll_h; /* height of collimator, nominally 57 mm */ double coll_w; /* halfthickness of lamellae, nominally 0.225 mm */ double coll_r; /* collimator radius nominally 125 mm */ double xshi; /* shift of microstrip X-axis (cathode number) wrt center collimator lamella (mm) */ double yshi; /* shift of microstrip Y-axis (backplane number) wrt center collimator lamella (mm)*/ double c_tiltx; /* average tilt of all collimator X lamellae - (mm shift of top edge wrt bottom edge) */ double c_tilty; /* average tilt of all collimator Y lamellae - (mm shift of top edge wrt bottom edge) */ double coll_wb; /* additional halfthickness of collimator bottom edge (in excess of coll_w) (mm) */ double coll_curv; /* scale factor for collimator pitch at top surfacce of the collimator */ double mask_r; /* radius of coded mask pattern nominally 267.5 mm */ double mask_height; /* distance from detectot window to coded mask plane nominally 3401 mm */ double hexa_dim; /* flat-to-flat dimension of the mask elements nominally 3.3 mm*/ short int njwmask[J_IIR_SKEWMASK_DIM][J_IIR_SKEWMASK_DIM]; /* mask description array a la Niels Joergen */ double alfa; /* twist of mask X-axis wrt 'common-X' ('common-X' from JEM-X2 towards JEM-X1) */ double beta; /* twist of collimator X-axis wrt 'common-X' */ double gammav; /* twist of microstrip X-axis wrt 'common-X' */ double mm2rad; /* convert mm (at mask level) to radians */ /* +++++++++++++++++++ JEM-X to sky conversion */ double phase2; /* twist of 'common-X' wrt star tracker Y */ double x2xmm; /* quadratic term in transformation from JEM-X X-coord to sky Y-coord */ double y2ymm; /* quadratic term in transformation from JEM-X Y-coord to sky Z-coord */ double offXmm; /* zero offset of JEM-X X-coord wrt star tracker Y-coord */ double offYmm; /* zero offset of JEM-X Y-coord wrt star tracker Z-coord */ double x2xpix; /* quadratic term in transformation from JEM-X X-coord to sky Y-coord */ double y2ypix; /* quadratic term in transformation from JEM-X Y-coord to sky Z-coord */ double offXpix; /* zero offset of JEM-X X-coord wrt star tracker Y-coord */ double offYpix; /* zero offset of JEM-X Y-coord wrt star tracker Z-coord */ double scaleX; /* scale factor in transformation from JEM-X X-coord to sky Y-coord */ double scaleY; /* scale factor in transformation from JEM-X Y-coord to sky Z-coord */ double offQrad; /* offset applied after transformation to star tracker coord. system */ double offRrad; /* offset applied after transformation to star tracker coord. system */ /* ++++++++++++++++++++ absorption & position uncertainty */ double absolen; /* mean absorption length of photons in the counter gas at current energy (mm) */ int scatt_len; /* number of valid values in 'scatt_list' & 'scatt_delta' arrays */ int scatt_delta[500]; /* derived distribution of detection points around interaction point (packed) */ float scatt_list[500]; /* derived distribution of detection points around interaction point (packed) */ int pixel_st[detdim]; /* input data for pixelfold routine */ unsigned char pixel_list[600000]; /* input data for pixelfold routine */ int jmx_unit; /* jemx unit no [0/1] */ double struc_h1; /* Height [mm] of mask support bars */ double struc_h2; /* Height [mm] of mask support bars */ /* ++++++++++++++++++++ absorption & position uncertainty: Tables ++++++ */ float e_min[J_NUM_SCI_BINS]; /* Lower energy limit for PI bins */ float e_max[J_NUM_SCI_BINS]; /* Upper energy limit for PI bins */ float escale[J_NUM_SCI_BINS]; /* Energy scale for following tables */ float cposres[J_NUM_SCI_BINS]; /* [mm] FWHM of cathode position resolution */ float bposres[J_NUM_SCI_BINS]; /* [mm] FWHM of back plane position resolution */ float attlen_xe[J_NUM_SCI_BINS]; /* [mm] Attenuation length in 1.5 bar Xe */ float quanteff[J_NUM_SCI_BINS]; /* Quantum efficiency of detector */ float pif_escale[J_NUM_PIF_ENERGIES]; /* Reduced energy scale for PIF shadowgrams */ int pif_pi_scale[J_NUM_PIF_ENERGIES]; /* Reduced PI scale for PIF shadowgrams */ /* +++++++++++++++++++++++ Detector pixel condition (status_map) ++++++ */ unsigned short status_map[detdim]; /* +++++++++++++++++++++++ Pointer to Mask_SS structure ++++++++++++++++++++ */ struct MaskSS *mss; /* +++++++++++++++++++++++ Temperature data extracted from SC-HK +++++++++++ */ float SC_HK[9]; float Tx0; float off_Tx0; float Ty0; float off_Ty0; float Tx7; float off_Tx7; float Ty7; float off_Ty7; /* +++++++++++++++++++++++ Trigger rate data extracted from JMX-HK +++++++++++ */ float JMX_HK[3]; /* hardware trigger, software trigger, accepted events */ /* +++++++++++++++++++++++ Radcor coefficients and absorption lengths +++++++++++ */ float RCcoeffs[J_NUM_RCCOEFS][J_NUM_RCCOEFSB]; float RCabslen[J_NUM_RCCOEFS]; /* +++++++++++++++++++++++ SPAG information combined to one array +++++++++++ */ float spagf[J_NUM_X_PIXELS][J_NUM_Y_PIXELS]; float spagj[detdim]; float curtain[J_NUM_X_PIXELS]; int checkpoint; float eeff_pha[200]; /* pha-values associated with eeff (electronic efficiency) factors */ float eeff[200]; /* electronic efficiency factors */ int num_eeff_vals; /* number of table entries into eeff_pha and eeff-Tables */ float sigma_cx; /* rms scatter of collimator lamellae (X-direction) [degrees] */ float sigma_cy; /* rms scatter of collimator lamellae (Y-direction) [degrees] */ float Elist[XYvsE_Evals+1]; /* Energy boundaries for the E-channels in 'XvsE' and 'YvsE' */ float XvsE[XYvsE_Evals][XvsE_Xvals]; /* Mean off-axis correction in 2-dim X vs E field */ float YvsE[XYvsE_Evals][YvsE_Yvals]; /* Mean off-axis correction in 2-dim Y vs E field */ float eeff_time_slope[XYvsE_Evals]; /* time slope-values associated with eeff (electronic efficiency) factors */ float eeff_value_origin[XYvsE_Evals]; /* relative efficiency values at start of epoch: 'eff_time_origin' */ float eeff_time_origin; /* time origin for time slope-values */ float LCcor[XYvsE_Evals]; }; #endif