/***************************************************************** * Name of source file: j_ima_iros_main.c * Version of source file: 6.0.10 * Parent component: None * Programmer: Niels Lund & Niels J. Westergaard * Affiliation: Danish National Space Center * Contact address: Juliane Maries Vej 30 * DK-2100 Copenhagen, Denmark * Phone: +45 35325705 FAX: +45 35362475 * njw@dnsc.dk * Purpose: Read a number of shadowgrams for a science window * and image reconstruction by backprojection * IROS and flux determination * Origin date: 041122 * Update history: 1.0.0 041122 First version * 1.0.4 050126 Test version for undue crash * 1.1.0 050131 Now reading FITS sky/backproj files * 1.1.1 050211 Keywords adapted to needs of j_ima_mosaic * 1.1.2 050303 Extra keyw:RLIMIDX, new cleaning * 1.1.3 050307 New DMAP: 51 radii * 1.1.4 050407 New clean, etc. * 1.1.4 050407 New clean, etc. * 1.1.5 050415 New clean again, updated flux determination * 1.1.6 050418 Now uses JMXi-DBKG-MOD as default for empty field shds * 1.2.0 050425 Deals with SPR 4102,4108 and reduces RAM requirement * 1.3.0 050503 Deals with SPR 4120 and copes with up to 6 shadowgrams * 1.3.1 050517 Deals with SPR 4143 and initializes ima_sigma properly * 1.3.2 050519 Closes SPR 4157 - bad size of three arrays * 1.3.3 050602 Changes some arrays to static (SPR 4202) * 1.4.0 050609 Introduction of pre-selected sources, correction of blindspot error * 1.4.0 050620 Include user defined sources (SCREW 1740) * 1.5.0 050620 Changes in connection with j_src_properties * 1.5.1 051129 Separating functions to jmx_lib_pif * 1.5.2 051202 Separating functions to jmx_lib_pif (2) * 1.5.3 051202 Give offX, x2x values in mm in IMOD-GRP * 1.5.4 060104 Bug in sh_depth corrected, detectmap now in mm * 1.5.5 060106 Introduced one more digit in logfile for src position * 1.5.6 060228 Removed parameter detMapFile and some obsolete variables * 1.5.7 060606 Shifted detCondMap to struct jmx_id and status_map * 1.6.0 060725 Reduce collimator height and disregard collimator thickness in b.proj-lists * 1.5.8 060807 SPR 04551 Bad assignment of RLIMIDX corrected * 1.5.9 060807 SPR 04533 Resetting status variable has been removed * 1.5.10 060807 SPR 04523 Declaring testsum as float iso. int * 1.5.11 060807 SPR 04458 A warning log line has been added * 1.5.12 060907 SPR 04301 A relative VIGNDOL path is given * 1.6.0 060911 SCREW 1918 Image correction map and parameters introduced * 1.6.1 060912 SPR 4441 Shadowgrams with too few counts are excluded * 1.6.2 060915 SCREW 1842 A significance map can now be obtained * 1.6.3 060915 An exposure (vignetting) map is now a product * 1.6.4 060928 Included test for zero divisor in peaktransfer.c * 1.6.5 061002 New defaults for par. skyImagesOut * 1.7.0 061110 Produces images with few or zero events (SPR 4594) * 1.7.1 061114 SPR 4603 Image unit (BUNIT) is now cts/dm2/s * 1.8.0 061213 SPR 4640 Error in findpeak has been corrected * 1.8.1 070123 SPR 4590 int changed to long for 64 bit code * 2.1.0 070730 Active use of input source catalog * 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 * 2.2.2 081111 Makes trigger rates from JEM-X HK available * 3.0.0 081111 SCREW 2080+1918 Electronic eff. corrections * 3.0.1 090114 SCREW 2098+2102+2105 and SPR 4812 * 3.0.2 090121 New table of sigma(PSF) is read * 3.0.X 090312 Catch exceptions for illegal aritmetic operations * 3.0.3 090324 SPR 4837 Floating point exceptions removed * 3.1.0 090401 SPR 4737,4846 floating exceptions and negative fluxes * 3.2.0 090422 SCREW 2135 Better time correction implemented * 3.2.1 090507 SPR 4863 Bug fix in interpolation algorithm * 3.2.2 090514 SPR 4866+4869 Uninitialized variable problem * 3.2.3 090602 SPR 4875 Error in peak reintroduction * 3.2.4 090720 SPR 4886 Fix a divide by zero (BEO) * 3.2.6 091204 SCREW 2180/2181 Improve source finding/remove ghosts * 4.0.3 120423 SPR ?: Better flux error, 100 flag sources allowed * 4.0.3 120423 SPR ?: Better flux error, 100 flag sources allowed * 4.0.4 120430 SPR ?: Still better flux error estimation * 4.0.5 120607 SPR ?: Still better flux error estimation * 4.0.6 120628 SPR ?: Reduced memory allocation demands * 4.0.7 120710 SPR ?: Flux error estimates as in version 3.2.7 * 4.0.8 120813 SPR ?: Fixes bug in significance image * 4.0.9 120820 SPR ?: Improve FITS header content * 4.0.10 120830 SPR ?: Initialize variables as suggested by valgrind * 4.0.12 120919 SPR ?: Introduce changes by LP and Co. * 5.0.0 121001 Derivation of light curves introduced (initially gnu- and reg-file output) * 5.1.0 150101 Light curve output to '..._lcn.fits' files introduced * 5.1.2 151106 Running version with LC generation * 5.1.9 160415 Update of light curve output and keywords according to agreement with ISDC * 5.1.10 160829 Circumvent analysis blocking caused by small amount of data in 'errorfit' * 5.1.11 160913 Update 'write_srcl_res' and 'work2d' to include 'pure burst' sources. * 5.1.12 160914 Update 'j_iir_Write_LC' to avoid floating point exc. for very short observation times * 5.1.13 160916 Update '*work2d.c' to avoid floating point exc. for very few time bins * 5.1.14 160922 Update 'j_iir_Write_LC' to avoid floating point exc. for few time bins * 5.1.16 160930 Update 'clean2,ex2trEvTslc,initPIF_LC,work2d' to avoid crashes due to marginal user srcs * 5.1.19 161002 Update 'clean2' and 'srcidentify'o avoid potential index errors * 5.1.21 161028 Update j_iir_Write_LC avoid floating point exc. for unknown bst src seen only at high E * 5.1.22 161215 Correct work2d.c. Wrong index in image transfer (line 3810). Update 'srcidentify'. * 5.1.23 161220 Correct peaktransfer & final_sky. Endless loop in peaktransfer for sources near edge of FOV * 5.1.24 161227 Correct work2d. Handling of 'edge'-bursts (ChanMax), Handling of bursts after 'summary_p' * 5.1.25 161228 Correct work2d. Initialization of Tslices[].threshold. Eliminate bad print in ex2trEvTslc * 5.1.28 170214 Replace 'srcidentify' (hard coded source list) with 'srcidentify2' reading the ISDC catalog * 5.1.29 170310 Multiply 'rateBuff,errBuff,bRateBuff,bErrBuff' by 100 before output in 'j_iir_Write_LC.c' * 5.1.30 170804 Modify max number of light curve energy bins (user def. + 3) from 7 to MAX_LC_EBIN * 5.1.31 170827 Limit burst search activity to energy bands with more than 25% of total SCW counts * 5.1.32 170906 Introduce 'typedef image_cor' and malloc of this structure (used in 'paltani_subs.c') * 5.1.33 171206 Write RTSTART/STOP in sky_ima, srcl_res iros_lc files. Introduce logger->LCgtiREF * 5.1.34 171214 Correct flux error calculation for user sources (new parameter in call to final_sky) * 6.0.0 170112 Rename V5.1.34 to V6.0.0 * 6.0.0 180112 Introduces LC generation and burst detection * 6.0.7 180913 Modified log and reg files to include %11.6lf burst start and stop times, and add obsID * 6.0.8 180916 Block writing of burst images into sky_ima files. Assure output of light curves for user sources * 6.0.9 180918 Reinstate writing of burst images in sky_ima files. * 6.0.10 181001 Assured initialization of Tslices[].GlobalLC[]-array * Type of element: Executable * Part of package: j_ima_iros * Name: j_ima_iros_main * Calls: * Returns: * Required components: DAL, PIL, RIL, DAL3GEN Basic error code offset: J_ERROR_CODE_START + J_IMA_IROS_ERR J_IIR_WRONG_JEMX_NUM (-1): Called with illegal value of jemxNum J_IIR_NOT_IN_SMODE (-2): Started when not in ISDC_SINGLE_MODE J_IIR_MEMB_WRONG_NUM (-3): Inconsistency: numbers of members J_IIR_SHDIDEN_ERROR (-4): Problem with shadowgram identifications J_IIR_IGNORE_ERROR (-5): Incorrect number of ignored anodes *****************************************************************/ /* Enable catching exceptions for illegal aritmetic operations */ /* Bruce O'Neel/NielsLund 20090314 */ /* But only for Linux */ #ifdef linux #include #endif #include long STRUCT_SIZE(void); int main (int argc, char *argv[]) { static struct instr_data JID; static struct log_con LOG; /* static struct imagerec IR; */ Events *bufevents = NULL; /* Created in j_ima_iros_prepare */ long numEvents = 0; /* Number of events in event list */ timeslices *Tslices = NULL; /* structure containing information about light curve time bins */ goodsrc *GOODSRC = NULL; /* structure containing information about source candidates found */ userbin *USERBIN = NULL; /* structure containing information about user defined energy bins */ pifmap *PIFmap = NULL; /* structure containing pixelmap information */ b_list *B_list = NULL; /* new structure containing information about bursts detected */ static struct scwlist SCW[2]; int status = ISDC_OK; int mode = 0; /* Running mode of this executable */ int chatter = 0; /* Level of debugging/monitoring output */ int showtime = 0; /* only used to control output of time spending in various functions */ Instrument jemxNum=JMX1; /* Number of JEM-X unit, should be JMX1 or JMX2 */ dal_element *theSWG = NULL; /* Pointer to SWG group */ char resultxt[150], greyname[32]; char instMod[DAL_FILE_NAME_STRING]; /* char bkgShdDOL[DAL_FILE_NAME_STRING]; */ char light_str[256], tal_str[10], AA={'A'}, GG={'G'}, II={'I'}, BB={'B'}; int i=0, j=0, crabfound=0, ntime, nGTI, ncr, loopnum, ActiveBins=0; int useDeadAnodes = 0; int yes2all=0; int images_out_control; int develop_control; int search_images_out; int mosaic_images_out; long GSRClength = 0; long USERlength = 0; long Tsliceslength = 0; long pifmaplength = 0; /* long burst_listlength = 0; */ long b_listlength = 0; long Bpifmaplength = 0; long longtime1, longtime2; long nPhaseBins = 0; long nReflong = 0; double expstart, expstop, gnut, gnuTime; double sumGTI, sumGTI2; double sumOnTime, sumExpos, sumDontUse; double LC_Toffset = 0.0; float diff_RA=0.0, diff_dec=0.0, diff=0.0, oldRA=0.0, olddec=0.0; /* double testG_L, testG_B, testRA, testdec; */ float tid=0.0; FILE *trace, *gnufil; struct instr_data *jmx_id = {&JID}; /*rr struct instr_data *jmx_id = calloc(1, sizeof(struct instr_data)); */ struct log_con *logger = {&LOG}; /*rr struct log_con *logger = calloc(1, sizeof(struct log_con)); */ struct backpro *backproj; struct shadowgrams *sh; struct backpro_lists *bp; swg_pointing point; Auxdata auxdata; /* Auxiliary data such as gain, deadtime, greyfilter, and GTI */ Shd_adhoc shd_adhoc; /* A struct to hold the current working shadowgram */ Shd_adhoc shd_burst; /* A struct to hold the current burst shadowgram */ /* typedef struct{ char *nameLC; char srcID[DAL_MED_STRING]; float srcRa; float srcDec; long nOutLCBins; double timeLC; double timeDel; double fracExp; long nBRateLC; double bRateLC; double bErrLC; int nChanBins; int *chanLow; int *chanHigh; long nPhaseBins; double timeStep; double timeStart; double tElapse; double onTime; double meanDead; double avgSrcRate; double avgSrcRateErr; char *instModDOL; int vignCorr; double vignetting; float srcOffAxisAngle; double radiusLimit; double detectorRadius; float openFractionAve; int diagnosticMode; double diagnosticParam; int precisionLevel; int fluxScaling; int chatter; int callingStatus; double *rateBuff; double *errBuff; double *bRateBuff; double *bErrBuff; } LC_auxData; */ static int func_local=-1, local_calling_num=0; clock_t calling_TT, TT_now; /* Enable catching exceptions for illegal aritmetic operations Bruce O'Neel/NielsLund 20090314 */ /* but only for Linux */ #ifdef linux feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW); #endif logger->trace = 0; logger->i5 = 5; images_out_control = 0; develop_control = 0; search_images_out = 0; mosaic_images_out = 0; logger->burstImagesOut = 0; logger->USER0_lc = 0; logger->USER1_lc = 0; logger->LC = 0; logger->TIMEstep = 4.0; system("rm -f imatrace.txt"); if (logger->trace == 1) { trace = fopen("imatrace.txt", "wt"); fprintf(trace, " main %d\n", 0); fprintf(trace, "j_ima_iros successfully started\n"); if (trace != NULL) fclose(trace); trace = NULL; } for (i=0; idontUseShdg[i] = 0; logger->LCMAXMASK = 7; if (MAX_LC_EBIN > 7) logger->LCMAXMASK |= 0x8; if (MAX_LC_EBIN > 15) logger->LCMAXMASK |= 0x10; for (i=0; ifunc_times[i] = 0.0; logger->func_calls[i] = 0; logger->func_write[i] = 0; logger->tracecalls[i] = 0; } do { /* Use a once-only do/while loop to force program termination whenever status returned is not ISDC_OK */ /* * * Initialisation * */ mode = CommonInit(COMPONENT_NAME, COMPONENT_VERSION,argc,argv); if (mode != ISDC_SINGLE_MODE) { RILlogMessage(NULL, Error_2, "Not started in ISDC_SINGLE_MODE, mode = %d", mode); status = J_ERROR_CODE_START + J_IMA_IROS_ERR + J_IIR_NOT_IN_SMODE; continue; } RILlogMessage( NULL, Log_0, "##0## of j_ima_iros_main" ); for (i=0; ifunc_times[i] = 0.0; /* function entry timing start */ if (func_local < 0) { func_local = 0; logger->func_used_num = 1; logger->func_calling_num = 0; sprintf(logger->func_names[func_local], "main"); if (logger->func_used_num >= J_IIR_MAX_NUM_FUNCS) { RILlogMessage( NULL, Error_1,"##1## func_used_num too large"); sprintf(logger->tmptxt, "func_used_num >= %d\n", J_IIR_MAX_NUM_FUNCS); logger->func_used_num--; logger->logstat = logprint(logger, logger->tmptxt, 6); logger->func_used_num = J_IIR_MAX_NUM_FUNCS; } } logger->func_calls[func_local]++; logger->TT = TT_now = clock(); calling_TT = logger->TT; local_calling_num = logger->func_calling_num; logger->func_calling_num = func_local; /* function entry timing end */ RILlogMessage( NULL, Log_0, "##2## of j_ima_iros_main" ); /* initialisation */ logger->develop = 8192; /* disable time_slope corrections */ logger->develop = 5123; /* disable off-axis corrections, disable all obs-period corrections */ /* no corrections active, call update, output calibout */ logger->develop = 4099; /* disable off-axis corrections */ /* obs. per. corrections active, call update, output calibout */ logger->develop = 2051; /* disable all obs-period corrections except for JMX1 Carls period */ /* off_axis corrections active, call update, output calibout */ logger->develop = 3; /* all corrections active, call update, output calibout */ logger->develop = 1; /* all corrections active, DO NOT call update, output calibout */ logger->develop = 0; /* OSA configuration */ /* |= 1: output of 'calibout.bin' and 'par_chk.txt' files */ /* |= 2: call of 'jmx_lib_pif/update_imod_data.c' */ /* |= 1024: Disable orbit efficiency correction for all observation periods */ /* |= 2048: Disable orbit efficiency correction for all periods except JMX1 after rev 170 */ /* |= 4096: Disable calls to off_axis_corretion subroutines */ /********* SHOW TIME ************/ if (develop_control) logger->develop = 1; /* all corrections active, DO NOT call update, output calibout */ else logger->develop = 0; /* OSA config, all corrections active, DO NOT call update, DO NOT output calibout */ logger->len_jmx_id = sizeof(struct instr_data); sprintf(logger->tmptxt, "sizeof(instr_data): %10d", logger->len_jmx_id); logger->logstat = logprint(logger, logger->tmptxt, 0); sprintf(logger->tmptxt, "sizeof(log_con): %10d", sizeof(struct log_con)); logger->logstat = logprint(logger, logger->tmptxt, 0); sprintf(logger->tmptxt, "sizeof(backpro_lists): %10d", sizeof(struct backpro_lists)); logger->logstat = logprint(logger, logger->tmptxt, 0); if ((bp = (struct backpro_lists*)(malloc(sizeof(struct backpro_lists)))) == NULL) { RILlogMessage( NULL, Error_1, "##3## Not enough memory for 'backpro_lists' malloc (%d bytes)", sizeof(struct backpro_lists)); continue; } sprintf(logger->tmptxt, "sizeof(backpro): %10d", sizeof(struct backpro)); logger->logstat = logprint(logger, logger->tmptxt, 0); if ((backproj = (struct backpro*)(calloc(1, sizeof(struct backpro)))) == NULL) { RILlogMessage( NULL, Error_1, "##4## Not enough memory for 'backpro' malloc (%d bytes)", sizeof(struct backpro)); continue; } sprintf(logger->tmptxt, "sizeof(shadowgrams): %10d", sizeof(struct shadowgrams)); logger->logstat = logprint(logger, logger->tmptxt, 0); if ((sh = (struct shadowgrams*)(calloc(1, sizeof(struct shadowgrams)))) == NULL) { RILlogMessage( NULL, Error_1, "##5## Not enough memory for 'shadowgram' malloc (%d bytes)", sizeof(struct shadowgrams)); continue; } for (i=0; ifitsimage[j][0][i] = 0.0; backproj->fitsimage[j][1][i] = 0.0; backproj->fitsimage[j][2][i] = 0.0; backproj->fitsimage[j][3][i] = 0.0; backproj->fitsimage[j][4][i] = 0.0; backproj->fitsimage[j][5][i] = 0.0; } backproj->skyim_r[i] = 0.0; backproj->skyeff[i] = 0.0; } RILlogMessage( NULL, Log_0, "##6## of j_ima_iros_main" ); for (i=0; id_allow_st[i] = 0; bp->d_allow_p[i] = 0; bp->d_allow_l[i] = 0; bp->o_allow_subl[i] = 0; bp->o_allow_st[i] = 0; bp->bad_pix_shdg[i] = 0.0; backproj->soft_gr[i] = 0.0; backproj->shadw[i] = 0.0; backproj->effic[i] = 0.0; backproj->src_only_map[i] = 0.0; backproj->empty_norm[i] = 0.0; backproj->current_src_map[i] = 0.0; for (j=0; jpif_maps[j][i] = 0.0; backproj->pifeff_maps[j][i] = 0.0; } for (j=0; jempty[j][i] = 0.0; sh->soft_shdgr[j][i] = 0.0; } sh->common_select_map[i] = 0; } backproj->blindnum = 0; backproj->blindnum_preset = 0; sh->accumT = 1.0; for (i=0; iabs_len[i] = 1.0; RILlogMessage( NULL, Log_0, "##7## of j_ima_iros_main" ); bp->d_allow = NULL; for (i=0; i<150; i++) resultxt[i] = 0; strcpy( resultxt, "Content of resultxt"); /* * * Get the parameters, get instrument data, and prepare access to * data structures (open the connections) * */ backproj->makeNewBPL = 0; backproj->newBackProjFile[0] = 0; if (images_out_control) { /* NL 2012_05_24 */ logger->detImagesOut = search_images_out; /* NL 2010_04_21 */ logger->userImagesOut = mosaic_images_out; /* NL 2012_05_24 */ } /* NL 2012_05_24 */ status = j_ima_iros_params( &theSWG, /* Pointer to the SWG */ &jemxNum, instMod, /* Instrument Model DOL */ /* bkgShdDOL, * DOL of empty field shadowgrams */ logger, backproj, bp, sh, &useDeadAnodes, /* same as 'dead_ano' in orig. version */ &yes2all, /* same as 'yes2all' in orig. version */ &chatter, status ); sprintf(logger->tmptxt, "After j_ima_iros_params: develop: %1d, detect/user/burst-ImaOut: %1d %1d %1d, limit_f, %5.3f,", logger->develop, logger->detImagesOut, logger->userImagesOut, logger->burstImagesOut, logger->limit_f); logger->limit_f = 0.010; sprintf(logger->tmptxt2, " after update: %5.3f", logger->limit_f); if ((strlen(logger->tmptxt) + strlen(logger->tmptxt2)) < MAX_STR_LEN) strcat(logger->tmptxt, logger->tmptxt2); logger->logstat = logprint(logger, logger->tmptxt, 0); if (status != ISDC_OK) { RILlogMessage(NULL, Error_2, "##8## Problem getting parameters etc., status = %d\n", status); continue; } if( chatter > J_CHATTY_VERBOSE ) { RILlogMessage( NULL, Log_0, "##9## returned from j_ima_iros_params"); RILlogMessage( NULL, Log_0, "##10## useDeadAnodes: %d", useDeadAnodes); RILlogMessage( NULL, Log_0, "##11## yes2all: %d", yes2all); RILlogMessage( NULL, Log_0, "##12## drl_par[3] = %f", logger->drl_par[3]); } logger->N_SCW = 0; logger->N_SRC = logger->N_SRC2 = 0; backproj->sky_version = 'n'; j = getNumShds(theSWG, jemxNum, sh, logger, chatter, status); /* get number of shadowgrams to process */ sh->numShds = j; backproj->ee_max = sh->numShds; if (sh->numShds > 256) sh->numShds = 256; USERlength = sh->numShds * sizeof(userbin); RILlogMessage( NULL, Log_0, "##13## USERBIN: no of bins: %3d, length of userbin: %d, length of USERBIN: %ld", sh->numShds, sizeof(userbin), USERlength); if ((USERBIN = (userbin*)(malloc(USERlength))) == NULL) { RILlogMessage( NULL, Error_1, "##14## Not enough memory for 'USERBIN' malloc (%ld bytes)", USERlength); continue; } RILlogMessage( NULL, Log_0, "##15## of j_ima_iros_main" ); for (i=0; inumShds; j++) { USERBIN[j].variance[i] = 0.0; USERBIN[j].fst_imag[i] = 0.0; USERBIN[j].eff_imag[i] = 0.0; USERBIN[j].illumnew[i] = 0; } } for (i=0; inumShds; j++) { USERBIN[j].shadow[i] = 0.0; USERBIN[j].soft_gr[i] = 0.0; USERBIN[j].f_shadgram[i] = 0.0; USERBIN[j].effic_shdg[i] = 0.0; } } for (j=0; jnumShds; j++) USERBIN[j].LCcorrec = 1.0; RILlogMessage( NULL, Log_0, "##16## of j_ima_iros_main" ); if( chatter > J_CHATTY_NORMAL ) { RILlogMessage( NULL, Log_0, "##17## just before j_ima_iros_prepare"); } status = j_ima_iros_prepare( theSWG, jemxNum, instMod, resultxt, /* bkgShdDOL, * DOL of empty field shadowgrams */ &bufevents, &numEvents, &auxdata, /* such as gain, GTI, and grey filter */ jmx_id, logger, /* struct log_con */ backproj, /* struct backpro */ sh, /* struct shadowgrams */ bp, /* struct backpro_lists */ USERBIN, /* struct userbin (with shadowgrams) */ /*RR &(SCW[logger->N_SCW]), */ SCW + logger->N_SCW, &point, useDeadAnodes, chatter, status); if (status != ISDC_OK) { RILlogMessage( NULL, Error_1, "##18## After j_ima_iros_prepare, status = %d", status); continue; } logger->edge2 = 100.0; if( chatter > J_CHATTY_NORMAL ) { RILlogMessage( NULL, Log_0, "##19## after j_ima_iros_prepare"); } RILlogMessage(NULL,Log_0,"##20## After prepare: logger->edge: %f, c_tiltx/y: %f %f", logger->edge, jmx_id->c_tiltx, jmx_id->c_tilty); sprintf(logger->tmptxt, "##20## After prepare: logger->edge: %f, c_tiltx/y: %f %f", logger->edge, jmx_id->c_tiltx, jmx_id->c_tilty); logger->logstat = logprint(logger, logger->tmptxt, 0); /* QQQQQ 20080930 Niels Lund. Test print of eeff parameters */ sprintf(logger->tmptxt, "orbit: %3d, eeff_pha vals: ", backproj->aux_orbit); for (i=0; i<16; i++) { sprintf(logger->tmptxt2, " %5.1f", jmx_id->eeff_pha[i]); if ((strlen(logger->tmptxt) + strlen(logger->tmptxt2)) < MAX_STR_LEN) strcat(logger->tmptxt, logger->tmptxt2); } logger->logstat = logprint(logger, logger->tmptxt, 0); sprintf(logger->tmptxt, "orbit: %3d, eeff_pha vals: ", backproj->aux_orbit); for (i=0; i<16; i++) { sprintf(logger->tmptxt2, " %5.1f", jmx_id->eeff_pha[i]); if ((strlen(logger->tmptxt) + strlen(logger->tmptxt2)) < MAX_STR_LEN) strcat(logger->tmptxt, logger->tmptxt2); } logger->logstat = logprint(logger, logger->tmptxt, 0); sprintf(logger->tmptxt, "orbit: %3d, XvsE[0][i] : ", backproj->aux_orbit); for (i=0; i<16; i++) { sprintf(logger->tmptxt2, " %5.3f", jmx_id->XvsE[0][i] ); if ((strlen(logger->tmptxt) + strlen(logger->tmptxt2)) < MAX_STR_LEN) strcat(logger->tmptxt, logger->tmptxt2); } logger->logstat = logprint(logger, logger->tmptxt, 0); sprintf(logger->tmptxt, "orbit: %3d, YvsE[0][i] : ", backproj->aux_orbit); for (i=0; i<16; i++) { sprintf(logger->tmptxt2, " %5.3f", jmx_id->YvsE[0][i]); if ((strlen(logger->tmptxt) + strlen(logger->tmptxt2)) < MAX_STR_LEN) strcat(logger->tmptxt, logger->tmptxt2); } logger->logstat = logprint(logger, logger->tmptxt, 0); sprintf(logger->tmptxt, "ZZZ obsID: %04d%04d%04d", backproj->aux_orbit, backproj->aux_pid, sh->aux_pidv); logger->logstat = logprint(logger, logger->tmptxt, 0); /* QQQQQ 20080512 Niels Lund. Modify Crab-like sources in catalog to JEM-X Crab coordinates */ crabfound = 0; for (j=0; jpreset_src; j++) { diff_RA = backproj->preset_src_RA[j] - 83.6308; diff_dec = backproj->preset_src_dec[j] - 22.0170; diff = diff_RA * diff_RA + diff_dec * diff_dec; diff = sqrt(diff); oldRA = backproj->preset_src_RA[j]; olddec = backproj->preset_src_dec[j]; if (diff < 0.01) { if (crabfound) { backproj->preset_src_RA[j] = 83.6308; backproj->preset_src_dec[j] = 92.0170; /* dummy value for all furter crab like sources */ } else { backproj->preset_src_RA[j] = 83.6308; /* mean JEM-X1/-X2 Crab position 20080512, Niels Lund */ backproj->preset_src_dec[j] = 22.0170; crabfound = 1; } RILlogMessage(NULL,Log_0,"##21## After prepare: Old Crab position: %8.4f %8.4f, new: %8.4f %8.4f, crab# %1d", oldRA, olddec, backproj->preset_src_RA[j], backproj->preset_src_dec[j], crabfound); } } /* Erased 080731/NJW * * get_CURTAIN_array(jmx_id->jmx_unit, jmx_id, logger); * * jmx_id->num_eeff_vals = get_EEFF_array(backproj, jmx_id, logger); */ /* status = report_arr("##22## f_shadgram[0]", USERBIN[0].f_shadgram, detdim, status); status = report_arr("##23## f_shadgram[1]", USERBIN[1].f_shadgram, detdim, status); status = report_arr("##24## f_shadgram[2]", USERBIN[2].f_shadgram, detdim, status); status = report_arr("##25## bp empty[0]", backproj->empty[0], detdim, status); status = report_arr("##26## bp empty[1]", backproj->empty[1], detdim, status); status = report_arr("##27## bp empty[2]", backproj->empty[2], detdim, status); status = report_arr("##28## soft_shdgr[0]", USERBIN[0].soft_shdgr, detdim, status); status = report_arr("##29## soft_shdgr[1]", USERBIN[1].soft_shdgr, detdim, status); status = report_arr("##30## soft_shdgr[2]", USERBIN[2].soft_shdgr, detdim, status); */ /* * If a name has been given for a new backprojection file (newBackProjFile) * and the Boolean parameter 'makeNewBPL' has been set to 'yes' * then create that but skip the remainder under the assumption that if the * user wants to create a new one then it is for use afterwards */ /* * skymap_init(backproj, jmx_id, logger, bp); * status = mask_test( logger, jmx_id, bp ); */ if( strlen(backproj->newBackProjFile) > 0 && backproj->makeNewBPL ) { if ((bp->d_allow = malloc(max_sky_bytes)) == NULL) { RILlogMessage( NULL, Error_1, "##31## Not enough memory for 'd_allow' malloc (%d bytes)", max_sky_bytes); continue; } sprintf(logger->tmptxt, "Before calling 'skymap_gen': mask_height: %f", jmx_id->mask_height); logger->logstat = logprint(logger, logger->tmptxt, 5); status = skymap_gen( jmx_id, logger, backproj, bp, sh, chatter, status); /* The filename is handed over via 'backproj' */ if( status != ISDC_OK ) { RILlogMessage( NULL, Error_1, "##32## After skymap_gen, status = %d", status); continue; } } else { if (backproj->preset_src > 100) backproj->preset_src = 100; sumGTI = sumGTI2 = 0.0; sprintf(logger->tmptxt, "NumGTIranges: %2d", auxdata.n_GTI); logger->logstat = logprint(logger, logger->tmptxt, 0); for (i=0; itmptxt, "%2d GTI_IJDstart: %4.10lf, GTI_IJDstop: %4.10lf, sumGTI: %6.2lf (s)", i, auxdata.GTI_IJDstart[i], auxdata.GTI_IJDstop[i], sumGTI); logger->logstat = logprint(logger, logger->tmptxt, 0); } if (sumGTI < 0.1) {status = -1; continue;} /* do not embark on unreasonable analyses NLNLNL July 2015 */ logger->USER1_lc = 1; logger->USER0_lc = 0; logger->source_burst_imaout = 0; logger->burst_lc_out = 1; goto noLC; if( logger->LC ) { /* Light curve analysis has been requested */ strcpy(light_str, strstr(logger->skyImagesOut, "LC") ); i = 2; if (light_str[i] == AA) { logger->USER1_lc = 1; /* output light curves for all 'user-flag-1' sources */ i++; } else logger->USER1_lc = 0; if (light_str[i] == GG) { logger->USER0_lc = 1; /* output all 'global' and 'edge' light curves */ i++; } else logger->USER0_lc = 0; if (light_str[i] == II) { logger->source_burst_imaout = 1; /* output burst images for all burst sources */ /* (default is: only 'global' and 'edge' images are output */ i++; } else logger->source_burst_imaout = 0; if (light_str[i] == BB) { logger->burst_lc_out = 1; /* output light curves for all burst sources */ i++; } else logger->burst_lc_out = 0; strcpy(tal_str, &light_str[i]); tal_str[3] = 0; j = atoi(tal_str); if ((j > 0) && (j <= 999)) logger->TIMEstep = j; sprintf(logger->tmptxt, "lightString: %s, LC: %1d, USER0_lc: %1d, USER1_lc: %1d, src_ima_out: %1d, lc_out: %d, TIMEstep: %3.1f", light_str, logger->LC, logger->USER0_lc, logger->USER1_lc, logger->source_burst_imaout, logger->burst_lc_out, logger->TIMEstep); logger->logstat = logprint(logger, logger->tmptxt, 0); } else logger->LC = 0; noLC: if (logger->trace) traces(func_local, 9000, logger); logger->gtiStartIJD = auxdata.GTI_IJDstart[0]; logger->gtiStopIJD = auxdata.GTI_IJDstop[auxdata.n_GTI-1]; logger->LCgtiStart = logger->gtiStartIJD; logger->LCgtiStop = logger->gtiStopIJD; if (logger->trace) traces(func_local, 9001, logger); if (logger->LCgtiStart < logger->TSTART) logger->LCgtiStart = logger->TSTART; if (logger->TSTOP < 0.0) logger->TSTOP = logger->LCgtiStop; if (logger->LCgtiStop > logger->TSTOP ) logger->LCgtiStop = logger->TSTOP ; if (logger->trace) traces(func_local, 9002, logger); logger->timestep = logger->TIMEstep * J_IIR_IJDSECOND; if (logger->trace) traces(func_local, 1000000+(int)(logger->timestep/J_IIR_IJDSECOND), logger); longtime1 = (long)(logger->LCgtiStart / logger->timestep); longtime2 = (long)(logger->LCgtiStop / logger->timestep + 1); if (logger->trace) traces(func_local, 9003, logger); logger->NumTimeBins = (int)(longtime2 - longtime1); if (logger->NumTimeBins < 1) logger->NumTimeBins = 1; GSRClength = (backproj->preset_src + SCW_SRCMAX + 18) * sizeof(goodsrc); /* room for 8 EDGE- and 10 extra burst sources */ Tsliceslength = logger->NumTimeBins * sizeof(timeslices); RILlogMessage(NULL,Log_0, "##33## GOODSRC: preset_src: %3d, SCW_SRCMAX: %4d, goodsrc lngth: %d, GOODSRC lngth: %ld, timeslice: %d, Ntimebins: %4d", backproj->preset_src, SCW_SRCMAX, sizeof(goodsrc), GSRClength, sizeof(timeslices), logger->NumTimeBins); if ((GOODSRC = (goodsrc*)(calloc(1, GSRClength))) == NULL) { RILlogMessage( NULL, Error_1, "##34## Not enough memory for 'GOODSRC' malloc (%ld bytes)", GSRClength); continue; } j = (backproj->preset_src + SCW_SRCMAX + 18); for (i=0; iLCgtiRef / logger->timestep; /* NLNLNL 20171123 */ LC_Toffset = logger->LCgtiRef - nReflong * logger->timestep; /* NLNLNL 20171123 */ sprintf(logger->tmptxt, "LCgtiRef: %17.3lf, timestep: %7.3f, nRef: %12ld, LC_Toffset: %8.6lf", logger->LCgtiRef, logger->timestep/J_IIR_IJDSECOND, nReflong, LC_Toffset); logger->logstat = logprint(logger, logger->tmptxt, 0); nGTI = 0; for (ntime=0; ntimeNumTimeBins; ntime++) { Tslices[ntime].Tstart = (double)(longtime1+ntime) * logger->timestep + LC_Toffset; Tslices[ntime].Tstop = (double)(longtime1+ntime+1) * logger->timestep + LC_Toffset; if (Tslices[ntime].Tstart > auxdata.GTI_IJDstart[nGTI]) expstart = Tslices[ntime].Tstart; else expstart = auxdata.GTI_IJDstart[nGTI]; if (Tslices[ntime].Tstop < auxdata.GTI_IJDstop[nGTI]) expstop = Tslices[ntime].Tstop; else expstop = auxdata.GTI_IJDstop[nGTI]; if (expstop > expstart) Tslices[ntime].exposure = expstop - expstart; else Tslices[ntime].exposure = 0.0; sumGTI2 += Tslices[ntime].exposure * 86400.0; if (Tslices[ntime].Tstop > auxdata.GTI_IJDstop[nGTI]) { nGTI++; if (nGTI >= auxdata.n_GTI) nGTI = auxdata.n_GTI-1; } } sprintf(logger->tmptxt, "sumGTI: %6.2lf (s), sumGTI2: %6.2lf (s)", sumGTI, sumGTI2); logger->logstat = logprint(logger, logger->tmptxt, 0); sumOnTime = sumExpos = sumDontUse = 0.0; for (ntime=0; ntimeNumTimeBins; ntime++) { initTsliceGlobal(&(Tslices[ntime]), auxdata, bufevents, sh, logger, chatter, status); sumExpos += Tslices[ntime].exposure; sumOnTime += Tslices[ntime].onTime; sumDontUse += Tslices[ntime].dontUse; if (ntime < 2) { sprintf(logger->tmptxt, "bin#: %5d, exposure: %6.2lf, final: %6.2f (s), fractional final expos: %5.3f", ntime, Tslices[ntime].exposure, Tslices[ntime].final_expo, Tslices[ntime].final_expo / logger->timestep); logger->logstat = logprint(logger, logger->tmptxt, 0); } if ((logger->NumTimeBins == 3) && (ntime == 2)) { sprintf(logger->tmptxt, "bin#: %5d, exposure: %6.2lf, final: %6.2f (s), fractional final expos: %5.3f", ntime, Tslices[ntime].exposure, Tslices[ntime].final_expo, Tslices[ntime].final_expo / logger->timestep); logger->logstat = logprint(logger, logger->tmptxt, 0); } if ((logger->NumTimeBins > 3) && (ntime >= logger->NumTimeBins-2)) { /* sprintf(logger->tmptxt, "bin#: %5d, exposure: %6.2lf (s), fractional exposure: %5.3f", ntime, Tslices[ntime].exposure, Tslices[ntime].exposure / logger->timestep); */ sprintf(logger->tmptxt, "bin#: %5d, exposure: %6.2lf, final: %6.2f (s), fractional final expos: %5.3f", ntime, Tslices[ntime].exposure, Tslices[ntime].final_expo, Tslices[ntime].final_expo / logger->timestep); logger->logstat = logprint(logger, logger->tmptxt, 0); } } sprintf(logger->tmptxt, "sumExpos: %6.2lf s, sumOnTime: %6.2lf s, NumTimeBins: %5d, sumDontUse: %5.0lf", sumExpos, sumOnTime, logger->NumTimeBins, sumDontUse); logger->logstat = logprint(logger, logger->tmptxt, 0); if (logger->develop == 0) goto nogreygnu; sprintf(greyname, "grey_J%1d_%04d%04d%04d.gnu", jmx_id->jmx_unit+1, backproj->aux_orbit, backproj->aux_pid, sh->aux_pidv); if ((gnufil = fopen(greyname, "wt")) != NULL) { gnut = (double)((int)(Tslices[0].Tstart / 10.0) * 10.0); ncr = 1; for (ntime=0; ntimeNumTimeBins; ntime++) { if ((Tslices[ntime].dontUse&1) == 0) { gnuTime = Tslices[ntime].Tstart - gnut; fprintf(gnufil, "%8.6lf %8.2f\n", gnuTime, Tslices[ntime].greyfilter); ncr = 0; } else { if (ncr < 1) fprintf(gnufil, "\n"); ncr = 1; } } if (ncr == 1) fprintf(gnufil, "\n"); else fprintf(gnufil, "\n\n"); ncr = 1; for (ntime=0; ntimeNumTimeBins; ntime++) { if ((Tslices[ntime].dontUse&1) == 0) { gnuTime = Tslices[ntime].Tstart - gnut; fprintf(gnufil, "%8.6lf %8.2f\n", gnuTime, Tslices[ntime].final_expo / logger->TIMEstep); ncr = 0; } else { if (ncr < 1) fprintf(gnufil, "\n"); ncr = 1; } } if (ncr == 1) fprintf(gnufil, "\n"); else fprintf(gnufil, "\n\n"); ncr = 1; for (ntime=0; ntimeNumTimeBins; ntime++) { if ((Tslices[ntime].dontUse&1) == 0) { gnuTime = Tslices[ntime].Tstart - gnut; fprintf(gnufil, "%8.6lf %8.2f\n", gnuTime, Tslices[ntime].livetime); ncr = 0; } else { if (ncr < 1) fprintf(gnufil, "\n"); ncr = 1; } } if (ncr == 1) fprintf(gnufil, "\n"); else fprintf(gnufil, "\n\n"); ncr = 1; for (ntime=0; ntimeNumTimeBins; ntime++) { if ((Tslices[ntime].dontUse&1) == 0) { gnuTime = Tslices[ntime].Tstart - gnut; fprintf(gnufil, "%8.6lf %8.2f\n", gnuTime, Tslices[ntime].onTime / logger->TIMEstep); ncr = 0; } else { if (ncr < 1) fprintf(gnufil, "\n"); ncr = 1; } } if (ncr == 1) fprintf(gnufil, "\n"); else fprintf(gnufil, "\n\n"); ncr = 1; for (ntime=0; ntimeNumTimeBins; ntime++) { if ((Tslices[ntime].dontUse&1) == 0) { gnuTime = Tslices[ntime].Tstart - gnut; loopnum = (Tslices[ntime].Tstart - Tslices[0].Tstart) / (8.0 * J_IIR_IJDSECOND); loopnum %= 1024; fprintf(gnufil, "%8.6lf %8.2f\n", gnuTime, logger->HWcounts[loopnum] / 50000.0); ncr = 0; } else { if (ncr < 1) fprintf(gnufil, "\n"); ncr = 1; } } if (ncr == 1) fprintf(gnufil, "\n"); else fprintf(gnufil, "\n\n"); fclose(gnufil); } if (logger->trace) traces(func_local, 5, logger); nogreygnu: ; pifmaplength = SCW_SRCMAX * sizeof(pifmap); if ((PIFmap = (pifmap*)(malloc(pifmaplength))) == NULL) { RILlogMessage( NULL, Error_1, "##36## Not enough memory for 'pifmaps' malloc (%ld bytes)", pifmaplength); continue; } b_listlength = 64 * sizeof(b_list); if ((B_list = (b_list*)(malloc(b_listlength))) == NULL) { RILlogMessage( NULL, Error_1, "##37## Not enough memory for 'b_list' malloc (%ld bytes)", b_listlength); continue; } for (i=0; i<64; i++) { B_list[i].start_chan = B_list[i].end_chan = B_list[i].sourceID = B_list[i].ee = B_list[i].lc_num = 0; B_list[i].sigmax = B_list[i].RA = B_list[i].dec = 0.0; B_list[i].triggers = 0; for (j=0; j<8; j++) { B_list[i].ID[j] = 0; B_list[i].IDima[j] = 0; B_list[i].sxy_skymax[j] = 0; B_list[i].Isignif[j] = 0.0; B_list[i].ISsignif[j] = 0.0; B_list[i].GLCsignif[j] = 0.0; B_list[i].SLCsignif[j] = 0.0; B_list[i].ULCsignif[j] = 0.0; sprintf(B_list[i].name[j], "UUibu%02dE%1d", i, j); } sprintf(B_list[i].regsrctxt, "InitStxt%02d", i); sprintf(B_list[i].regtxtlin, "InitTtxt%02d", i); } for (i=0; ipreset_src_N_SRC2[i] = -1; if( strstr( logger->skyImagesOut, "RAW_I" ) != NULL || strstr( logger->skyImagesOut, "RAWIN" ) != NULL || strstr( logger->skyImagesOut, "RAW_R" ) != NULL || strstr( logger->skyImagesOut, "RECTI" ) != NULL || strstr( logger->skyImagesOut, "VARIA" ) != NULL || strstr( logger->skyImagesOut, "RESID" ) != NULL || strstr( logger->skyImagesOut, "RES+S" ) != NULL || strstr( logger->skyImagesOut, "RECON" ) != NULL || strstr( logger->skyImagesOut, "EXPOS" ) != NULL || strstr( logger->skyImagesOut, "SIGNI" ) != NULL) logger->skyImaOut = 1; else logger->skyImaOut = 0; RILlogMessage(NULL,Log_0,"##38## Before work2: preset_src: %d", backproj->preset_src); logger->burstimage = 0; status = j_ima_iros_work( theSWG, auxdata, jmx_id, logger, &point, bufevents, backproj, sh, bp, &(SCW[logger->N_SCW]), GOODSRC, USERBIN, PIFmap, Tslices, B_list, shd_adhoc, shd_burst, chatter, status ); if (logger->trace) traces(func_local, 10, logger); if (status != ISDC_OK) { RILlogMessage( NULL, Error_1, "##39## After j_ima_iros_work, status = %d", status); continue; } if( chatter > J_CHATTY_NORMAL ) { RILlogMessage( NULL, Log_0, "##40## after j_ima_iros_work"); } if (logger->trace) traces(func_local, 20, logger); logger->N_SCW++; if (logger->trace) traces(func_local, 30, logger); /* * Write the JMXi-SRCL-RES data structure */ status = j_iir_write_srclres( theSWG, jemxNum, logger, GOODSRC, sh, backproj, chatter, status ); if( status != ISDC_OK ) { RILlogMessage( NULL, Error_1, "##42## After j_iir_write_srclres status = %d", status ); continue; } if (bp->d_allow != NULL) free(bp->d_allow); bp->d_allow = NULL; if (bufevents != NULL) free((Events*)bufevents); bufevents = NULL; if (USERBIN != NULL) free((userbin*)USERBIN); USERBIN = NULL; if (bp != NULL) free((struct backpro_lists*)(bp)); bp = NULL; ActiveBins = 0; for (ntime=0; ntimeNumTimeBins; ntime++) { if (Tslices[ntime].dontUse == 0) ActiveBins++; } sprintf(logger->tmptxt, "NumTimeBins: %d, ActiveBins: %d", logger->NumTimeBins, ActiveBins); logger->logstat = logprint(logger, logger->tmptxt, 0); if ((logger->LC) && (ActiveBins > 0) && (nPhaseBins == 0)) { status = ISDC_OK; if (logger->trace) traces(func_local, 48, logger); /* * Write the JMXi-LC-RES data structure */ status = j_iir_Write_LC( theSWG, auxdata, jmx_id, logger, &point, backproj, sh, GOODSRC, Tslices, B_list, nPhaseBins, chatter, status); if( status != ISDC_OK ) { RILlogMessage( NULL, Error_1, "##43## After j_iir_Write_LC status = %d", status ); continue; } } else { if (logger->trace) traces(func_local, 1048, logger); if (logger->trace) traces(func_local, (int)(logger->LC), logger); if (logger->trace) traces(func_local, (int)(ActiveBins), logger); if (logger->trace) traces(func_local, (int)(nPhaseBins), logger); } } if (logger->trace) traces(func_local, 50, logger); /* if (logger->develop == 0) { DELETE ALL GNU-FILES IF RUNNING IN OSA ENVIRONMENT */ if ( strstr(logger->skyImagesOut, "KPGNU") == NULL ) { /* DELETE ALL GNU-FILES UNLESS REQUESTED TO KEEP THEM */ system("pwd"); system("rm -f *.gnu"); } if ( strstr(logger->skyImagesOut, "DEVEL") == NULL ) { /* DELETE BurstIma fits test output unless we are running in DEVEL mode */ system("rm -f Burst*.fits"); } sprintf(logger->tmptxt, "Num preset sources: %3d, Num checked sources: %3d", backproj->preset_src, logger->N_SRC2); logger->logstat = logprint(logger, logger->tmptxt, 0); for (i=0; iN_SRC2; i++) { sprintf(logger->tmptxt, "%2d RA/dec: %7.3f %7.3f, %20s, burst: %2d, cm2: %5.1f", i, PIFmap[i].burstRA[24], PIFmap[i].burstdec[24], PIFmap[i].name, PIFmap[i].BURST_NUM, PIFmap[i].src_pixel_area*0.01); logger->logstat = logprint(logger, logger->tmptxt, 0); } if (logger->i5 == 0) showtime = 1; else showtime = 0; if( showtime ) { tid = 0.0; for (i=0; ifunc_used_num; i++) { logger->func_times[i] /= CLOCKS_PER_SEC; sprintf(logger->tmptxt, "##44## %3d %20s: calls: %7d, writes: %5d, traces: %5d, total time: %6.3f s", i, logger->func_names[i], logger->func_calls[i], logger->func_write[i], logger->tracecalls[i], logger->func_times[i]); logger->logstat = logprint(logger, logger->tmptxt, 0); tid += logger->func_times[i]; } if (logger->trace > 0) sprintf(logger->tmptxt, "##45## Total time used: %9.1f s (trace was active)\n", tid); else sprintf(logger->tmptxt, "##46## Total time used: %9.1f s (trace was not active)\n", tid); logger->logstat = logprint(logger, logger->tmptxt, 0); } if (logger->trace) traces(func_local, 60, logger); /* function exit timing start */ TT_now = clock(); logger->func_times[func_local] += difftime(TT_now, logger->TT); logger->TT = TT_now; logger->func_calling_num = local_calling_num; /* function exit timing end */ /* ******************************************************************** */ } while (0); if( status != ISDC_OK ) { RILlogMessage( NULL, Error_1,"##47## After one-pass-loop, status = %d", status ); /* status = ISDC_OK; SPR 4533 Removed 2006-08-07/NJW */ } status = CommonCloseSWG(theSWG, status); if (status != ISDC_OK) { RILlogMessage(NULL, Error_2, "##48## Failed to close the SWG"); } /* free(SCW); * free(jmx_id); * free(logger); */ if (logger->trace) traces(func_local, 99, logger); CommonExit(status); }