Commit 4df60ef6 authored by Duncan Macleod's avatar Duncan Macleod Committed by Ian Harry
Browse files

Edits to several functions to allow the storage of the following attributes

 * SearchSummary.ifos
 * SearchSummary.nevents
 * MultiInspiral.ifos
Edits include fixing times stored in SearchSummary.out_end_time and SearchSummary.out_end_time_ns.
Added a couple of parameters to coh_PTF_params structure to accomodate carrying list of ifos about.
(cherry picked from commit 4333dbae598047882327b1ec9ac48f4cef3808e0)
Original: f4a239c0373169a0a30d5d4e4bb60ff9e63584c6
parent 41e0a922
......@@ -76,6 +76,7 @@
#define BUFFER_SIZE 256
#define FILENAME_SIZE 256
#define MAXIFO 4
/* macro for testing validity of a condition that prints an error if invalid */
#define sanity_check( condition ) \
......@@ -107,7 +108,8 @@ struct coh_PTF_params {
char *cvsRevision;
char *cvsSource;
char *cvsDate;
char ifoName[3];
char ifoName[MAXIFO][LIGOMETA_IFO_MAX];
UINT4 numIFO;
INT4 randomSeed;
INT4 haveTrig[LAL_NUM_IFO];
LIGOTimeGPS startTime;
......
......@@ -48,7 +48,6 @@ int main( int argc, char **argv )
COMPLEX8FFTPlan *invPlan = NULL;
/* input data and spectrum storage */
UINT4 numDetectors = 0;
UINT4 singleDetector = 0;
REAL4TimeSeries *channel[LAL_NUM_IFO+1];
REAL4FrequencySeries *invspec[LAL_NUM_IFO+1];
......@@ -141,15 +140,6 @@ int main( int argc, char **argv )
verbose( "Made fft plans %ld \n", timeval_subtract(&startTime) );
/* Determine if we are analyzing single or multiple ifo data */
for( ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++)
{
if ( params->haveTrig[ifoNumber] )
{
numDetectors++;
}
}
/* NULL out pointers where necessary */
for ( i = 0 ; i < 10 ; i++ )
{
......@@ -171,12 +161,12 @@ int main( int argc, char **argv )
if ( params->noSpinBank )
strncpy( noSpinFileName, params->noSpinBank, sizeof(noSpinFileName)-1 );
if (numDetectors == 0 )
if (params->numIFO == 0 )
{
fprintf( stderr, "You have not specified any detectors to analyse" );
return 1;
}
else if (numDetectors == 1 )
else if (params->numIFO == 1 )
{
fprintf( stdout, "You have only specified one detector, "
"why are you using the coherent code? \n" );
......@@ -919,6 +909,8 @@ int main( int argc, char **argv )
}
}
} // Main loop is ended here
/* calulate number of events */
params->numEvents = XLALCountMultiInspiral( eventList );
coh_PTF_output_events_xml( params->outputFile, eventList, procpar, params );
if (skyPoints->rightAscension)
......@@ -1958,6 +1950,31 @@ UINT8 coh_PTF_add_triggers(
currEvent->snr_dof = 2;
else
currEvent->snr_dof = 4;
/* store ifos */
if ( params->numIFO == 1 )
{
snprintf( currEvent->ifos, LIGOMETA_IFOS_MAX,\
"%s", params->ifoName[0] );
}
else if( params->numIFO == 2 )
{
snprintf( currEvent->ifos, LIGOMETA_IFOS_MAX,\
"%s%s", params->ifoName[0], params->ifoName[1] );
}
else if ( params->numIFO == 3 )
{
snprintf( currEvent->ifos, LIGOMETA_IFOS_MAX,\
"%s%s%s", params->ifoName[0], params->ifoName[1],
params->ifoName[2] );
}
else if ( params->numIFO == 4 )
{
snprintf( currEvent->ifos, LIGOMETA_IFOS_MAX,\
"%s%s%s%s", params->ifoName[0], params->ifoName[1],
params->ifoName[2], params->ifoName[3]);
}
}
}
}
......
......@@ -24,9 +24,12 @@ RCSID( "$Id$" );
/* parse command line arguments using getopt_long to get ring params */
int coh_PTF_parse_options(struct coh_PTF_params *params,int argc,char **argv )
{
CHAR ifo[LIGOMETA_IFO_MAX];
UINT4 ifoNumber;
static struct coh_PTF_params localparams;
memset( &localparams.haveTrig, 0, LAL_NUM_IFO * sizeof(int) );
struct option long_options[] =
struct option long_options[] =
{
{ "verbose", no_argument, &vrbflg, 1 },
{ "strain-data", no_argument, &localparams.strainData, 1 },
......@@ -348,6 +351,18 @@ int coh_PTF_parse_options(struct coh_PTF_params *params,int argc,char **argv )
exit( 1 );
}
/* set number of ifos */
localparams.numIFO = 0;
for ( ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++ )
if ( localparams.haveTrig[ifoNumber] )
{
XLALReturnIFO(ifo,ifoNumber);
snprintf( localparams.ifoName[localparams.numIFO], LIGOMETA_IFO_MAX,\
"%s", ifo );
localparams.numIFO++;
}
*params = localparams;
return 0;
......@@ -408,20 +423,10 @@ int coh_PTF_params_sanity_check( struct coh_PTF_params *params )
UINT4 segmentLength = 0;
UINT4 segmentStride = 0;
UINT4 truncateLength = 0;
UINT4 numDetectors = 0;
UINT4 ifoNumber;
INT8 startTime;
INT8 endTime;
/* Determine if we are analyzing single or multiple ifo data */
for( ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++)
{
if ( params->haveTrig[ifoNumber] )
{
numDetectors++;
}
}
if ( params->getSpectrum ) /* need data and response if not strain data */
sanity_check( params->getData && (params->strainData) );
......@@ -489,7 +494,7 @@ int coh_PTF_params_sanity_check( struct coh_PTF_params *params )
&& params->skyError <=LAL_PI/2. );
sanity_check( params->timingAccuracy > 0. );
if ( numDetectors == 2 )
if ( params->numIFO == 2 )
params->skyLooping = TWO_DET_SKY_POINT_ERROR;
else
params->skyLooping = SKY_POINT_ERROR;
......@@ -501,7 +506,7 @@ int coh_PTF_params_sanity_check( struct coh_PTF_params *params )
}
else
{
if ( numDetectors == 2 )
if ( params->numIFO == 2 )
params->skyLooping = TWO_DET_ALL_SKY;
else
params->skyLooping = ALL_SKY;
......
......@@ -221,7 +221,31 @@ ProcessTable *coh_PTF_create_process_table( struct coh_PTF_params *params )
LALAPPS_VCS_IDENT_ID,LALAPPS_VCS_IDENT_STATUS,LALAPPS_VCS_IDENT_DATE,0);
strncpy( processTable->comment, " ", LIGOMETA_COMMENT_MAX );
strncpy( processTable->ifos, params->ifoName, LIGOMETA_IFOS_MAX );
/* store ifos */
if ( params->numIFO == 1 )
{
snprintf( processTable->ifos, LIGOMETA_IFOS_MAX,\
"%s", params->ifoName[0] );
}
else if( params->numIFO == 2 )
{
snprintf( processTable->ifos, LIGOMETA_IFOS_MAX,\
"%s%s", params->ifoName[0], params->ifoName[1] );
}
else if ( params->numIFO == 3 )
{
snprintf( processTable->ifos, LIGOMETA_IFOS_MAX,\
"%s%s%s", params->ifoName[0], params->ifoName[1],
params->ifoName[2] );
}
else if ( params->numIFO == 4 )
{
snprintf( processTable->ifos, LIGOMETA_IFOS_MAX,\
"%s%s%s%s", params->ifoName[0], params->ifoName[1],
params->ifoName[2], params->ifoName[3]);
}
XLALGPSTimeNow(&processTable->end_time);
return processTable;
......@@ -260,11 +284,34 @@ SearchSummaryTable *coh_PTF_create_search_summary( struct coh_PTF_params *params
searchSummary->in_start_time = params->startTime;
searchSummary->in_end_time = params->endTime;
searchSummary->out_start_time = outStartTime;
XLALGPSAdd( &searchSummary->out_start_time, -1.0 * params->padData );
/*XLALGPSAdd( &searchSummary->out_start_time, -1.0 * params->padData ); */
searchSummary->out_end_time = outEndTime;
XLALGPSAdd( &searchSummary->out_end_time, 1.0 * params->padData);
/*XLALGPSAdd( &searchSummary->out_end_time, 1.0 * params->padData); */
searchSummary->nevents = params->numEvents;
strncpy( searchSummary->ifos, params->ifoName, LIGOMETA_IFOS_MAX );
/* store ifos */
if ( params->numIFO == 1 )
{
snprintf( searchSummary->ifos, LIGOMETA_IFOS_MAX,\
"%s", params->ifoName[0] );
}
else if( params->numIFO == 2 )
{
snprintf( searchSummary->ifos, LIGOMETA_IFOS_MAX,\
"%s%s", params->ifoName[0], params->ifoName[1] );
}
else if ( params->numIFO == 3 )
{
snprintf( searchSummary->ifos, LIGOMETA_IFOS_MAX,\
"%s%s%s", params->ifoName[0], params->ifoName[1],
params->ifoName[2] );
}
else if ( params->numIFO == 4 )
{
snprintf( searchSummary->ifos, LIGOMETA_IFOS_MAX,\
"%s%s%s%s", params->ifoName[0], params->ifoName[1],
params->ifoName[2], params->ifoName[3]);
}
return searchSummary;
}
......
......@@ -48,7 +48,6 @@ int main( int argc, char **argv )
COMPLEX8FFTPlan *invPlan = NULL;
/* input data and spectrum storage */
UINT4 numDetectors = 0;
UINT4 singleDetector = 0;
REAL4TimeSeries *channel[LAL_NUM_IFO+1];
REAL4FrequencySeries *invspec[LAL_NUM_IFO+1];
......@@ -141,15 +140,6 @@ int main( int argc, char **argv )
verbose( "Made fft plans %ld \n", timeval_subtract(&startTime) );
/* Determine if we are analyzing single or multiple ifo data */
for( ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++)
{
if ( params->haveTrig[ifoNumber] )
{
numDetectors++;
}
}
/* NULL out pointers where necessary */
for ( i = 0 ; i < 10 ; i++ )
{
......@@ -171,12 +161,12 @@ int main( int argc, char **argv )
if ( params->noSpinBank )
strncpy( noSpinFileName, params->noSpinBank, sizeof(noSpinFileName)-1 );
if (numDetectors == 0 )
if (params->numIFO == 0 )
{
fprintf( stderr, "You have not specified any detectors to analyse" );
return 1;
}
else if (numDetectors == 1 )
else if (params->numIFO == 1 )
{
fprintf( stdout, "You have only specified one detector, "
"why are you using the coherent code? \n" );
......@@ -919,6 +909,8 @@ int main( int argc, char **argv )
}
}
} // Main loop is ended here
/* calulate number of events */
params->numEvents = XLALCountMultiInspiral( eventList );
coh_PTF_output_events_xml( params->outputFile, eventList, procpar, params );
if (skyPoints->rightAscension)
......@@ -1958,6 +1950,31 @@ UINT8 coh_PTF_add_triggers(
currEvent->snr_dof = 2;
else
currEvent->snr_dof = 4;
/* store ifos */
if ( params->numIFO == 1 )
{
snprintf( currEvent->ifos, LIGOMETA_IFOS_MAX,\
"%s", params->ifoName[0] );
}
else if( params->numIFO == 2 )
{
snprintf( currEvent->ifos, LIGOMETA_IFOS_MAX,\
"%s%s", params->ifoName[0], params->ifoName[1] );
}
else if ( params->numIFO == 3 )
{
snprintf( currEvent->ifos, LIGOMETA_IFOS_MAX,\
"%s%s%s", params->ifoName[0], params->ifoName[1],
params->ifoName[2] );
}
else if ( params->numIFO == 4 )
{
snprintf( currEvent->ifos, LIGOMETA_IFOS_MAX,\
"%s%s%s%s", params->ifoName[0], params->ifoName[1],
params->ifoName[2], params->ifoName[3]);
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment