36#include <lal/LALgetopt.h>
38#include <lal/LIGOLwXML.h>
39#include <lal/LIGOLwXMLRead.h>
40#include <lal/LIGOMetadataTables.h>
44#define SIM_MIN 1.0e-30
45#define SIM_MAX 1.0e+10
49"Usage: gwf2xml [options]\n"\
51 " --help display this message\n"\
52 " --input FILE read input data from frame FILE\n"\
53 " --output FILE write output data to xml FILE\n"\
54 " --snr-threshold SNR set the minimum SNR of triggers (default 6)\n"\
55 " --ifo IFO set the IFO from which the triggers have come\n"\
62 union {
const char *
c;
char *
s; }
u = {
s};
69 FrEvent *frEvt = NULL;
76 for( snglEvt = *snglInspiralEvent; snglEvt; snglEvt=snglEvt->
next);
79 for(frEvt=frameEvent; frEvt; frEvt=frEvt->next, ++numEvt)
81 if ( !(*snglInspiralEvent) )
94 snglEvt->
snr = frEvt->amplitude;
97 timeAfter = frEvt->timeAfter;
119 FrSimEvent *frSimEvent )
121 FrSimEvent *frSimEvt = NULL;
127 for( simEvt = *simInspiralEvent; simEvt; simEvt = simEvt->
next);
130 for( frSimEvt = frSimEvent; frSimEvt; frSimEvt = frSimEvt->next, ++numSim)
132 if ( !(*simInspiralEvent) )
160int main(
int argc,
char *argv[] )
163 char *inputFileName = NULL;
169 FrEvent *frameEvent = NULL;
170 FrSimEvent *frSimEvent = NULL;
216 int option_index = 0;
217 size_t LALoptarg_len;
220 long_options, &option_index );
230 if ( long_options[option_index].
flag != 0 )
236 fprintf( stderr,
"error parsing option %s with argument %s\n",
250 inputFileName = (
CHAR *) calloc( LALoptarg_len,
sizeof(
CHAR));
251 memcpy( inputFileName,
LALoptarg, LALoptarg_len );
264 ifo = (
CHAR *) calloc( LALoptarg_len,
sizeof(
CHAR));
272 fprintf( stdout,
"invalid argument to --%s:\n"
273 "threshold must be >= 0: "
275 long_options[option_index].
name, snrMin );
285 fprintf( stderr,
"unknown error while parsing options\n" );
292 fprintf( stderr,
"extraneous command line arguments:\n" );
306 iFile = FrFileINew(inputFileName);
311 tStart = FrFileITStart(iFile);
312 tEnd = FrFileITEnd(iFile);
323 fprintf( stdout,
"Read in %d triggers from frEvent structure in %s\n",
324 numEvt, inputFileName );
327 FrEventFree(frameEvent);
342 fprintf( stdout,
"Read in %d injections from frEvent structure in %s\n",
343 numSim, inputFileName );
346 FrSimEventFree(frSimEvent);
358 searchsumm->in_start_time.gpsSeconds = tStart;
361 searchsumm->out_start_time.gpsSeconds = tStart;
388 if ( snglInspiralEvent )
392 if ( simInspiralEvent )
407 while ( snglInspiralEvent )
409 snglEvt = snglInspiralEvent;
410 snglInspiralEvent = snglInspiralEvent->
next;
415 while ( simInspiralEvent )
417 simEvt = simInspiralEvent;
418 simInspiralEvent = simInspiralEvent->
next;
void LALCheckMemoryLeaks(void)
int LALgetopt_long_only(int argc, char *const *argv, const char *options, const struct LALoption *long_options, int *opt_index)
#define required_argument
int XLALCloseLIGOLwXMLFile(LIGOLwXMLStream *xml)
LIGOLwXMLStream * XLALOpenLIGOLwXMLFile(const char *path)
int XLALWriteLIGOLwXMLSimInspiralTable(LIGOLwXMLStream *, const SimInspiralTable *)
int XLALWriteLIGOLwXMLSnglInspiralTable(LIGOLwXMLStream *xml, const SnglInspiralTable *sngl_inspiral)
int XLALWriteLIGOLwXMLSearchSummaryTable(LIGOLwXMLStream *, const SearchSummaryTable *)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
int main(int argc, char *argv[])
static int frEvent2snglInspiral(SnglInspiralTable **snglInspiralEvent, FrEvent *frameEvent)
static int frSimEvent2simInspiral(SimInspiralTable **simInspiralEvent, FrSimEvent *frSimEvent)
static char * ignore_const(const char *s)
char name[LIGOMETA_SOURCE_MAX]
LIGOTimeGPS geocent_end_time
struct tagSimInspiralTable * next
CHAR waveform[LIGOMETA_WAVEFORM_MAX]
CHAR ifo[LIGOMETA_IFO_MAX]
struct tagSnglInspiralTable * next
CHAR search[LIGOMETA_SEARCH_MAX]