42#include <lal/LALConfig.h>
43#include <lal/LALgetopt.h>
44#include <lal/LALStdio.h>
45#include <lal/LALStdlib.h>
46#include <lal/LALError.h>
47#include <lal/LALDatatypes.h>
48#include <lal/AVFactories.h>
49#include <lal/LIGOLwXML.h>
50#include <lal/LIGOLwXMLRead.h>
51#include <lal/LIGOMetadataTables.h>
52#include <lal/LIGOMetadataUtils.h>
55#include <lal/LALInspiral.h>
56#include <lal/LALInspiralBank.h>
60#define CVS_ID_STRING "$Id$"
61#define CVS_NAME_STRING "$Name$"
62#define CVS_REVISION "$Revision$"
63#define CVS_SOURCE "$Source$"
64#define CVS_DATE "$Date$"
65#define PROGRAM_NAME "tmpltbank"
92int main (
int argc,
char *argv[] )
150 fprintf( stdout,
"obtaining random seed from /dev/urandom: " );
153 fpRand = fopen(
"/dev/urandom",
"r" );
156 for ( randByte = 0; randByte < 4 ; ++randByte )
158 INT4 tmpSeed = (
INT4) fgetc( fpRand );
165 perror(
"error obtaining random seed from /dev/urandom" );
172 fprintf( stdout,
"using user specified random seed: " );
217 if ( ! templateBank )
219 thisTmplt = templateBank =
224 thisTmplt = thisTmplt->
next =
231 thisTmplt->
eta = newTmplt.
eta;
232 thisTmplt->
tau0 = newTmplt.
t0;
233 thisTmplt->
tau2 = newTmplt.
t2;
234 thisTmplt->
tau3 = newTmplt.
t3;
235 thisTmplt->
tau4 = newTmplt.
t4;
236 thisTmplt->
tau5 = newTmplt.
t5;
241 thisTmplt->
eta = newTmplt.
eta;
258 snprintf(
fname,
sizeof(
fname),
"P1-TMPLTBANK_%s-%d-%d.xml",
264 snprintf(
fname,
sizeof(
fname),
"P1-TMPLTBANK_%s-%d-%d.xml.gz",
270 snprintf(
fname,
sizeof(
fname),
"P1-TMPLTBANK-%d-%d.xml.gz",
276 snprintf(
fname,
sizeof(
fname),
"P1-TMPLTBANK-%d-%d.xml",
291 procparams = procparams->
next;
292 free( emptyPPtable );
302 while ( templateBank )
304 thisTmplt = templateBank;
305 templateBank = templateBank->
next;
321#define ADD_PROCESS_PARAM( pptype, format, ppvalue ) \
322this_proc_param = this_proc_param->next = (ProcessParamsTable *) \
323 calloc( 1, sizeof(ProcessParamsTable) ); \
324 snprintf( this_proc_param->program, LIGOMETA_PROGRAM_MAX, "%s", \
326 snprintf( this_proc_param->param, LIGOMETA_PARAM_MAX, "--%s", \
327 long_options[option_index].name ); \
328 snprintf( this_proc_param->type, LIGOMETA_TYPE_MAX, "%s", pptype ); \
329 snprintf( this_proc_param->value, LIGOMETA_VALUE_MAX, format, ppvalue );
332" --help display this message\n"\
333" --version print version information and exit\n"\
334" --user-tag STRING set the process_params usertag to STRING\n"\
336" --gps-start-time SEC GPS second of data start time\n"\
337" --gps-end-time SEC GPS second of data end time\n"\
338" --low-frequency-cutoff F Compute tau parameters from F Hz\n"\
339" --minimum-mass MASS set minimum component mass of bank to MASS\n"\
340" --maximum-mass MASS set maximum component mass of bank to MASS\n"\
341" --number-of-template N create N random templatess of bank to MASS\n"\
342" --random-seed SEED set random number seed for injections to SEED\n"\
343 " (urandom|integer)\n"\
344" --write-compress write a compressed xml file\n"\
381 int option_index = 0;
382 size_t LALoptarg_len;
385 long_options, &option_index );
397 if ( long_options[option_index].
flag != 0 )
403 fprintf( stderr,
"error parsing option %s with argument %s\n",
434 fprintf( stdout,
"invalid argument to --%s:\n"
435 "miniumum component mass must be > 0: "
436 "(%f solar masses specified)\n",
447 fprintf( stdout,
"invalid argument to --%s:\n"
448 "maxiumum component mass must be > 0: "
449 "(%f solar masses specified)\n",
474 fprintf( stderr,
"invalid argument to --%s:\n"
475 "number of template bank simulations"
476 "must be greater than 1: (%d specified)\n",
486 if ( gstartt < 441417609 )
488 fprintf( stderr,
"invalid argument to --%s:\n"
489 "GPS start time is prior to "
490 "Jan 01, 1994 00:00:00 UTC:\n"
492 long_options[option_index].
name, gstartt );
504 if ( gendt < 441417609 )
506 fprintf( stderr,
"invalid argument to --%s:\n"
507 "GPS end time is prior to "
508 "Jan 01, 1994 00:00:00 UTC:\n"
510 long_options[option_index].
name, gendt );
523 fprintf( stdout,
"invalid argument to --%s:\n"
524 "low frequency cutoff is less than 0 Hz: "
525 "(%f Hz specified)\n",
526 long_options[option_index].
name,
fLow );
538 fprintf( stderr,
"unknown error while parsing options\n" );
546 fprintf( stderr,
"extraneous command line arguments:\n" );
563 fprintf( stderr,
"--minimum-mass must be specified\n" );
568 fprintf( stderr,
"--maximum-mass must be specified\n" );
575 fprintf( stderr,
"--number-of-templates must be specified\n" );
582#undef ADD_PROCESS_PARAM
const LALVCSInfo lalAppsVCSIdentInfo
Identable VCS and build information for LALApps.
lal_errhandler_t lal_errhandler
int LAL_ERR_EXIT(LALStatus *stat, const char *func, const char *file, const int line, volatile const char *id)
#define LAL_CALL(function, statusptr)
void LALInspiralParameterCalc(LALStatus *status, InspiralTemplate *params)
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 XLALWriteLIGOLwXMLProcessTable(LIGOLwXMLStream *, const ProcessTable *)
int XLALWriteLIGOLwXMLProcessParamsTable(LIGOLwXMLStream *, const ProcessParamsTable *)
int XLALWriteLIGOLwXMLSnglInspiralTable(LIGOLwXMLStream *xml, const SnglInspiralTable *sngl_inspiral)
LIGOTimeGPS * XLALGPSTimeNow(LIGOTimeGPS *gpstime)
#define XLAL_INIT_DECL(var,...)
void LALCreateRandomParams(LALStatus *status, RandomParams **params, INT4 seed)
void LALUniformDeviate(LALStatus *status, REAL4 *deviate, RandomParams *params)
void LALDestroyRandomParams(LALStatus *status, RandomParams **params)
char name[LIGOMETA_SOURCE_MAX]
int main(int argc, char *argv[])
#define ADD_PROCESS_PARAM(pptype, format, ppvalue)
int vrbflg
defined in lal/lib/std/LALError.c
int arg_parse_check(int argc, char *argv[], ProcessParamsTable *procparams)
RandomParams * randParams
const char *const vcsDate
const char *const vcsStatus
CHAR type[LIGOMETA_TYPE_MAX]
CHAR param[LIGOMETA_PARAM_MAX]
CHAR value[LIGOMETA_VALUE_MAX]
struct tagProcessParamsTable * next
CHAR program[LIGOMETA_PROGRAM_MAX]
CHAR ifos[LIGOMETA_IFOS_MAX]
CHAR ifo[LIGOMETA_IFO_MAX]
struct tagSnglInspiralTable * next
CHAR channel[LIGOMETA_CHANNEL_MAX]
CHAR search[LIGOMETA_SEARCH_MAX]