LALApps 10.1.0.1-eeff03c
coh_PTF_inspiral.c
Go to the documentation of this file.
1#include "config.h"
2#include "coh_PTF.h"
3
4#define PROGRAM_NAME "lalapps_coh_PTF_inspiral"
5#define CVS_REVISION "$Revision$"
6#define CVS_SOURCE "$Source$"
7#define CVS_DATE "$Date$"
8
9/* This function should be migrated to option.c */
10/* warning: returns a pointer to a static variable... not reenterant */
11/* only call this routine once to initialize params! */
12/* also do not attempt to free this pointer! */
13static struct coh_PTF_params *coh_PTF_get_params(int argc, char **argv)
14{
15 static struct coh_PTF_params params;
16 static char programName[] = PROGRAM_NAME;
17 static char cvsRevision[] = CVS_REVISION;
18 static char cvsSource[] = CVS_SOURCE;
19 static char cvsDate[] = CVS_DATE;
20 coh_PTF_parse_options(&params, argc, argv);
21 coh_PTF_params_sanity_check(&params); /* this also sets various params */
23 params.programName = programName;
24 params.cvsRevision = cvsRevision;
25 params.cvsSource = cvsSource;
26 params.cvsDate = cvsDate;
27 return &params;
28}
29
31{
32 UINT4 ui;
33 int length = 0;
35 /* count the number of events in the list */
36 for (ui=0; ui < len; ui++)
37 {
38 for(temp = head[ui]; temp; temp = temp->next)
39 length++;
40 }
41
42 return(length);
43}
44
45int main(int argc, char **argv)
46{
47
48 /* Declarations of parameters */
49 INT4 i,j,k;
50 UINT4 uj,sp,slideNum;
51
52 /* process structures */
53 struct coh_PTF_params *params = NULL;
54 ProcessParamsTable *procpar = NULL;
55
56 /* sky position+time slide structures */
57 UINT4 numSkyPoints,currAnalStart,currAnalEnd;
59 INT8 *slideIDList,currSlideID;
60 TimeSlide *time_slide_head = NULL;
61 TimeSlideVectorList *longTimeSlideList = NULL;
62 TimeSlideVectorList * shortTimeSlideList = NULL;
63 SegmentTable *segment_table_head = NULL;
64 TimeSlideSegmentMapTable *time_slide_map_head = NULL;
65
66 /* FFT structures */
67 REAL4FFTPlan *fwdplan = NULL;
68 REAL4FFTPlan *psdplan = NULL;
69 REAL4FFTPlan *revplan = NULL;
70 COMPLEX8FFTPlan *invplan = NULL;
71
72 /* input data and spectrum storage */
75 RingDataSegments *segments[LAL_NUM_IFO+1];
76 INT4 numSegments = 0;
77
78 /* template counters */
79 INT4 numTmplts = 0;
80 INT4 numSpinTmplts = 0;
81 INT4 numNoSpinTmplts = 0;
82
83 /* template indexes */
84 INT4 startTemplate = -1;
85 INT4 stopTemplate = -1;
86
87 /* template and findchirp data structures */
88 InspiralTemplate *PTFSpinTemplate = NULL;
89 InspiralTemplate *PTFNoSpinTemplate = NULL;
90 InspiralTemplate *PTFtemplate = NULL;
91 InspiralTemplate *PTFbankhead = NULL;
92 FindChirpTemplate *fcTmplt = NULL;
93 FindChirpTemplate *bankFcTmplts = NULL;
94 FindChirpTmpltParams *fcTmpltParams = NULL;
95 UINT4 ifoNumber,spinTemplate;
96 REAL8Array *PTFM[LAL_NUM_IFO+1];
97 REAL8Array *PTFN[LAL_NUM_IFO+1];
99 UINT4 *acceptPointList = NULL;
100 UINT4 numAcceptPoints;
101
102 /* triggered sky position and sensitivity structures */
105 segStartTime.gpsSeconds = 0;
106 segStartTime.gpsNanoSeconds = 0;
107 struct timeval startTime;
109 REAL4 *timeOffsets,*slidTimeOffsets;
110 REAL4 *Fplus;
111 REAL4 *Fcross;
112 REAL4 *Fplustrig;
113 REAL4 *Fcrosstrig;
114 REAL4 *timeSlideVectors;
115
116 /* coherent statistic structures */
117 REAL4TimeSeries *cohSNR = NULL;
118 REAL4TimeSeries *pValues[10];
119 REAL4TimeSeries *snrComps[LAL_NUM_IFO];
120 UINT4 *snglAcceptPoints[LAL_NUM_IFO];
121 UINT4 snglAcceptCount[LAL_NUM_IFO];
122 REAL4TimeSeries *gammaBeta[2];
123 REAL4TimeSeries *nullSNR = NULL;
124 REAL4TimeSeries *traceSNR = NULL;
125
126 /* consistency test structures */
127 REAL4TimeSeries *bankVeto[LAL_NUM_IFO+1];
128 REAL4TimeSeries *autoVeto[LAL_NUM_IFO+1];
129 REAL4TimeSeries *chiSquare[LAL_NUM_IFO+1];
130 struct bankDataOverlaps *chisqOverlaps = NULL;
131 struct bankDataOverlaps *chisqSnglOverlaps = NULL;
132 REAL4 *frequencyRangesPlus[LAL_NUM_IFO+1];
133 REAL4 *frequencyRangesCross[LAL_NUM_IFO+1];
134 UINT4 subBankSize = 0;
135 struct bankTemplateOverlaps *bankNormOverlaps = NULL;
136 struct bankComplexTemplateOverlaps *bankOverlaps = NULL;
137 struct bankDataOverlaps *dataOverlaps = NULL;
138 UINT4 timeStepPoints = 0;
139 struct bankComplexTemplateOverlaps *autoTempOverlaps = NULL;
140 REAL4 **overlapCont = NULL;
141 REAL4 **snglOverlapCont = NULL;
142
143 /* output event structures */
144 MultiInspiralTable **eventList = NULL;
145 MultiInspiralTable **thisEvent = NULL;
146 MultiInspiralTable *finalEvents = NULL;
147 SnglInspiralTable *snglEventList = NULL;
148 SnglInspiralTable *snglThisEvent = NULL;
149 UINT8 eventId = 0;
150 INT4 timeDiff;
151
152 /*------------------------------------------------------------------------*
153 * initialise *
154 *------------------------------------------------------------------------*/
155
156 gettimeofday(&startTime, NULL);
157
158 /* set error handlers to abort on error */
160
161 /*
162 * no lal mallocs before this! *
163 */
164
165 /* options are parsed and debug level is set here... */
166 params = coh_PTF_get_params(argc, argv);
167
168 /* create process params */
169 procpar = create_process_params(argc, argv, PROGRAM_NAME);
170
171 verbose("Read input params %ld \n", timeval_subtract(&startTime));
172
173 /* create forward and reverse fft plans */
178
179 verbose("Made fft plans %ld \n", timeval_subtract(&startTime));
180
181 /* NULL out pointers where necessary */
192 coh_PTF_set_null_input_REAL4(frequencyRangesPlus,LAL_NUM_IFO+1);
193 coh_PTF_set_null_input_REAL4(frequencyRangesCross,LAL_NUM_IFO+1);
195
196 /* allocate memory for time offsets and detector responses */
197 timeOffsets = LALCalloc(1, LAL_NUM_IFO*sizeof(REAL4));
198 slidTimeOffsets = LALCalloc(1, LAL_NUM_IFO*sizeof(REAL4));
199 Fplus = LALCalloc(1, LAL_NUM_IFO*sizeof(REAL4));
200 Fcross = LALCalloc(1, LAL_NUM_IFO*sizeof(REAL4));
201 Fplustrig = LALCalloc(1, LAL_NUM_IFO*sizeof(REAL4));
202 Fcrosstrig = LALCalloc(1, LAL_NUM_IFO*sizeof(REAL4));
203
204 /* Initialize template and filtering structures */
205 coh_PTF_initialize_structures(params,&fcTmplt,&fcTmpltParams,\
206 PTFM,PTFN,PTFqVec,fwdplan);
207
208 /*------------------------------------------------------------------------*
209 * read the data, generate segments and the PSD *
210 *------------------------------------------------------------------------*/
211
212
214 fwdplan,psdplan,revplan,&timeSlideVectors,startTime);
215
216
217 /*------------------------------------------------------------------------*
218 * Create a list of time slide ids for each segment and create time slide *
219 * table. *
220 *------------------------------------------------------------------------*/
221
222 slideIDList = LALCalloc(1, numSegments*sizeof(INT8));
223 coh_PTF_create_time_slide_table(params,slideIDList,segments,&time_slide_head,\
224 &time_slide_map_head,&segment_table_head,\
225 &longTimeSlideList,&shortTimeSlideList,\
226 timeSlideVectors,numSegments);
227
228 /*------------------------------------------------------------------------*
229 * Determine the list of sky points. *
230 * Determine time delays and response functions for central point *
231 * This is computed for all detectors, even if not being analyzed *
232 *------------------------------------------------------------------------*/
233
234 /* generate sky points array */
236 numSkyPoints = skyPoints->numPoints;
237
238 /*------------------------------------------------------------------------*
239 * Initialize the trigger storage structures *
240 *------------------------------------------------------------------------*/
241
242 timeDiff = params->endTime.gpsSeconds - params->startTime.gpsSeconds + 1;
243 eventList = LALCalloc(1, timeDiff*params->numShortSlides*sizeof(MultiInspiralTable*));
244 thisEvent = LALCalloc(1, timeDiff*params->numShortSlides*sizeof(MultiInspiralTable*));
245 for (i = 0; (i < (INT4) (timeDiff*params->numShortSlides)); i++)
246 {
247 eventList[i] = NULL;
248 thisEvent[i] = NULL;
249 }
250
251
252 /* loop over ifos if doing triggered search and determine the time-offset */
253 /* and detector responses for the "preferred" sky location. For GRBs where */
254 /* a central sky point is provided, this will be that point. For cases */
255 /* where a list of points is given this will be the first point. */
256 /* For all sky search there is no "preferred" sky location. */
257 /* This preferred location is used to center the chi-squared */
258 /* (I THINK!!!) */
259 /* The preferred location is also used for the null stream, if active */
260 if ((params->skyLooping != ALL_SKY) &&
261 (params->skyLooping != TWO_DET_ALL_SKY))
262 {
263 coh_PTF_calculate_det_stuff(params,detectors,timeOffsets,Fplustrig,\
264 Fcrosstrig,skyPoints,0);
265 }
266
267 /*------------------------------------------------------------------------*
268 * Construct the null stream, its segments and its PSD *
269 *------------------------------------------------------------------------*/
270
271 if (params->doNullStream)
272 {
274 segments,Fplustrig,Fcrosstrig,timeOffsets,\
275 fwdplan,revplan,psdplan,timeSlideVectors,startTime);
276 }
277
278 /*------------------------------------------------------------------------*
279 * At this point we can discard the calibrated data, only the segments *
280 * and spectrum are needed now *
281 *------------------------------------------------------------------------*/
282
283 for(ifoNumber = 0; ifoNumber < (LAL_NUM_IFO+1); ifoNumber++)
284 {
285 if (channel[ifoNumber])
286 {
288 LALFree(channel[ifoNumber]);
289 channel[ifoNumber] = NULL;
290 }
291 }
292
293 /*------------------------------------------------------------------------*
294 * Read in the tmpltbank xml files *
295 *------------------------------------------------------------------------*/
296
297 /* read spinning bank */
298 if (params->spinBank)
299 {
300 numSpinTmplts = InspiralTmpltBankFromLIGOLw(&PTFSpinTemplate,
301 params->spinBankName,startTemplate, stopTemplate);
302 if (numSpinTmplts != 0)
303 {
304 PTFtemplate = PTFSpinTemplate;
305 numTmplts = numSpinTmplts;
306 }
307 else
308 params->spinBank = 0;
309 }
310
311 /* read non-spinning bank */
312 if (params->noSpinBank)
313 {
314 numNoSpinTmplts = InspiralTmpltBankFromLIGOLw(&PTFNoSpinTemplate,
315 params->noSpinBankName,startTemplate, stopTemplate);
316 if (numNoSpinTmplts != 0)
317 {
318 PTFtemplate = PTFNoSpinTemplate;
319 numTmplts = numNoSpinTmplts;
320 }
321 else
322 params->noSpinBank = 0;
323 }
324
325 /* If both banks present combine them and mark where to swap over */
326 if (params->spinBank && params->noSpinBank)
327 {
328 for (i = 0; (i < numNoSpinTmplts); PTFtemplate = PTFtemplate->next, i++)
329 {
330 if (i == (numNoSpinTmplts - 1))
331 {
332 PTFtemplate->next = PTFSpinTemplate;
333 numTmplts = numSpinTmplts + numNoSpinTmplts;
334 }
335 }
336 PTFtemplate = PTFNoSpinTemplate;
337 }
338 PTFbankhead = PTFtemplate;
339
340 /*------------------------------------------------------------------------*
341 * Allocate RAM for the various time series that get calculated *
342 *------------------------------------------------------------------------*/
343
345 params->lowTemplateFrequency,&cohSNR,&nullSNR,&traceSNR,bankVeto,\
346 autoVeto,chiSquare,snrComps,pValues,gammaBeta,numSpinTmplts);
347 /* FIXME: Move into function above if this works */
348 overlapCont = LALCalloc(1, LAL_NUM_IFO*sizeof(*overlapCont));
349 snglOverlapCont = LALCalloc(1, LAL_NUM_IFO*sizeof(*overlapCont));
350 acceptPointList = LALCalloc(params->numAnalPoints, sizeof(UINT4));
351 for (ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++)
352 {
353 overlapCont[ifoNumber] = NULL;
354 snglOverlapCont[ifoNumber] = NULL;
355 if (params->haveTrig[ifoNumber])
356 {
357 snglAcceptPoints[ifoNumber] = \
358 LALCalloc(params->numAnalPointsBuf, sizeof(UINT4));
359 }
360 }
361
362 verbose("Initialized storage arrays at %ld\n",timeval_subtract(&startTime));
363
364
365 /*------------------------------------------------------------------------*
366 * Initialise bank veto - This function does the following:
367 * - Generate the set of bank veto templates and store \tilde{h}
368 * - Calculate the overlaps between each pair of templates
369 *------------------------------------------------------------------------*/
370
371 if (params->doBankVeto)
372 {
373 subBankSize = coh_PTF_initialize_bank_veto(params,&bankNormOverlaps,\
374 &bankOverlaps,&dataOverlaps,&bankFcTmplts,fcTmplt,fcTmpltParams,\
375 invspec,startTime);
376 }
377
378 /*------------------------------------------------------------------------*
379 * initialise auto veto
380 * - Create the structures needed for the auto veto, if necessary
381 *------------------------------------------------------------------------*/
382
383 if (params->doAutoVeto)
384 {
385 timeStepPoints = coh_PTF_initialize_auto_veto(params,&autoTempOverlaps,\
386 startTime);
387 }
388
389 /*------------------------------------------------------------------------*
390 * find gravitational waves
391 *------------------------------------------------------------------------*/
392
393 UINT4 numPoints = params->numTimePoints;
394
395 /* This is the primary loop over segments */
396 for (j = 0; j < numSegments; ++j)
397 {
398 /* Reset the template list to the first one */
399 PTFtemplate = PTFbankhead;
400
401 /* Determine the epoch of this segment */
402 for (ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++)
403 {
404 if (params->haveTrig[ifoNumber])
405 {
406 segStartTime = segments[ifoNumber]->sgmnt[j].epoch;
407 segEndTime = segments[ifoNumber]->sgmnt[j].epoch;
408 break;
409 }
410 }
411 /* We only analyse middle half so add duration/4 to epoch */
412 XLALGPSAdd(&segStartTime, params->analStartTime);
413 XLALGPSAdd(&segEndTime, params->analEndTime);
414
415 /* Test if trig-start and trig-end options overlap this segment at all */
417 continue;
418
419 if (params->doBankVeto)
420 {
421 /* For every segment we need to calculate the overlap between bank veto
422 * templates and the data for use in bank veto calculation */
423 coh_PTF_bank_veto_segment_setup(params,dataOverlaps,bankFcTmplts,\
424 segments,PTFqVec,invplan,j,startTime);
425 }
426
427 /* This is the primary loop over templates in the bank */
428 for (i = 0; (i < numTmplts); PTFtemplate = PTFtemplate->next, i++)
429 {
430 /* If running injections, check whether to analyse this template*/
431 if ( params->injectFile && params->injMchirpWindow )
432 {
433 if (! checkInjectionMchirp(params,PTFtemplate,&segStartTime))
434 {
435 verbose("Injection not within mchirp window for segment %d, template %d at %ld \n", j, i, timeval_subtract(&startTime));
436 continue;
437 }
438 }
439
440 /* Determine if this template is non-spinning */
441 if (i >= numNoSpinTmplts)
442 spinTemplate = 1;
443 else
444 spinTemplate = 0;
445
446 /* This value is used for template generation */
447 PTFtemplate->fLower = params->lowTemplateFrequency;
448
449 /* This function generates the template */
450 coh_PTF_template(fcTmplt,PTFtemplate,fcTmpltParams);
451
452 /* Put the template in the array used by the coh_PTF filtering */
453 if (params->approximant != FindChirpPTF)
454 {
455 for (uj = 0 ; uj < (numPoints/2 +1) ; uj++)
456 {
457 fcTmplt->PTFQtilde->data[uj] = fcTmplt->data->data[uj];
458 }
459 }
460
461 if (spinTemplate)
462 verbose("Generated spin template %d at %ld\n",\
464 else
465 verbose("Generated nospin template %d at %ld\n",\
467
468 /* Reset the epoch here and memset to 0 all entries */
470 cohSNR,nullSNR,traceSNR,bankVeto,\
471 autoVeto,chiSquare,snrComps,pValues,gammaBeta,numSpinTmplts);
472 verbose("Initialized storage arrays for segment %d at %ld\n",\
474
475 /* Calculate single detector filters */
477 PTFqVec,snrComps,snglAcceptPoints,snglAcceptCount,segments,\
478 invplan,spinTemplate,j);
479 verbose("Calculated sngl filters for segment %d template %d at %ld\n",\
481
482 /* Calculate single detector bank veto filters for this template */
483 if (params->doBankVeto)
484 {
486 fcTmplt,invspec,bankOverlaps);
487 verbose("Calculated bank-veto filters for template %d at %ld\n",\
489 }
490
491 /* Calculate single detector auto veto filters */
492 if (params->doAutoVeto)
493 {
495 autoTempOverlaps,invspec,invplan,timeStepPoints);
496 verbose("Calculated auto-veto filters for template %d at %ld\n",\
498 }
499
500 /* Calculate null stream filters */
501 if (params->doNullStream)
502 {
504 PTFqVec,segments,invplan,spinTemplate,j);
505 verbose(\
506 "Calculated null stream filters for segment %d template %d at %ld\n",\
508 }
509
510 verbose("Begin loop over sky points at %ld \n",
512
513 /* Primary loop over sky points */
514 for (sp = 0; sp < numSkyPoints ; sp++)
515 {
516/* if (! ((sp == 0) || (sp == 3285)))
517 {
518 continue;
519 } */
520 /* Calculate offsets and responses for this sky point */
522 Fcross,skyPoints,sp);
523 /* Loop over short slides */
524 for (slideNum = 0; slideNum < params->numShortSlides ; slideNum++)
525 {
526/* if (! ((slideNum == 30) || (slideNum == 21)))
527 {
528 continue;
529 }*/
530 /* Update the offsets */
531 for(ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++)
532 {
533 if (params->haveTrig[ifoNumber])
534 {
535 slidTimeOffsets[ifoNumber] = timeOffsets[ifoNumber] + \
536 shortTimeSlideList[slideNum].timeSlideVectors[ifoNumber];
537 }
538 else
539 {
540 slidTimeOffsets[ifoNumber] = 0;
541 }
542 }
543 /* Determine slide ID */
544 currSlideID = slideIDList[j]*params->numShortSlides;
545 currSlideID += shortTimeSlideList[slideNum].timeSlideID;
546
547 /* FIXME: This is a hack when doing faceOn+faceAway analysis */
548 if (params->faceAwayAnalysis && params->faceOnAnalysis)
549 {
550 params->faceOnStatistic = 1;
551 }
552
553 // This function calculates the cohSNR time series and all of the
554 // signal based vetoes as appropriate
555 numAcceptPoints = coh_PTF_statistic(\
556 cohSNR, PTFM, PTFqVec, params, spinTemplate,
557 slidTimeOffsets, Fplus, Fcross,
558 j, pValues, gammaBeta, snrComps, nullSNR,
559 traceSNR, bankVeto, autoVeto,
560 chiSquare, subBankSize, bankOverlaps,
561 bankNormOverlaps, dataOverlaps, autoTempOverlaps,
562 fcTmplt, invspec, segments, invplan,
563 &chisqOverlaps,&chisqSnglOverlaps, frequencyRangesPlus,
564 frequencyRangesCross, overlapCont, snglOverlapCont,
565 startTime,
566 shortTimeSlideList[slideNum].analStartPoint,
567 shortTimeSlideList[slideNum].analEndPoint,\
568 snglAcceptPoints,snglAcceptCount,acceptPointList);
569
570 verbose("Made coherent statistic for segment %d, template %d, "
571 "sky point %d at %ld \n", j, i, sp,
573
574 currAnalStart = shortTimeSlideList[slideNum].analStartPoint - \
575 params->analStartPoint;
576 currAnalEnd = shortTimeSlideList[slideNum].analEndPoint - \
577 params->analStartPoint;
578
579 /* This function construct triggers from loud events */
580 if (! params->writeSnglInspiralTable)
581 {
582 eventId = coh_PTF_add_triggers(params, eventList, thisEvent,
583 cohSNR, fcTmplt, *PTFtemplate, eventId,
584 spinTemplate,
585 pValues, gammaBeta, snrComps,
586 nullSNR, traceSNR, bankVeto,
587 autoVeto, chiSquare, PTFM,
588 skyPoints->data[sp].longitude,
589 skyPoints->data[sp].latitude,
590 currSlideID, slidTimeOffsets,
591 acceptPointList,numAcceptPoints,
592 slideNum, timeDiff,
593 params->startTime.gpsSeconds);
594 }
595 else
596 {
597 eventId = coh_PTF_add_sngl_triggers(params, &snglEventList,\
598 &snglThisEvent,cohSNR,fcTmplt,*PTFtemplate,eventId,\
599 pValues,bankVeto,autoVeto,chiSquare,PTFM,\
600 currAnalStart,currAnalEnd);
601 }
602
603 /* FIXME: Also part of the faceAway + faceOn hack */
604 if (params->faceAwayAnalysis && params->faceOnAnalysis)
605 {
606 params->faceOnStatistic = 2;
607
608 numAcceptPoints = coh_PTF_statistic(\
609 cohSNR, PTFM, PTFqVec, params, spinTemplate,
610 slidTimeOffsets, Fplus, Fcross,
611 j, pValues, gammaBeta, snrComps, nullSNR,
612 traceSNR, bankVeto, autoVeto,
613 chiSquare, subBankSize, bankOverlaps,
614 bankNormOverlaps, dataOverlaps, autoTempOverlaps,
615 fcTmplt, invspec, segments, invplan,
616 &chisqOverlaps,&chisqSnglOverlaps, frequencyRangesPlus,
617 frequencyRangesCross, overlapCont, snglOverlapCont,
618 startTime,
619 shortTimeSlideList[slideNum].analStartPoint,
620 shortTimeSlideList[slideNum].analEndPoint,\
621 snglAcceptPoints,snglAcceptCount,acceptPointList);
622
623 verbose("Made coherent statistic for segment %d, template %d, "
624 "sky point %d at %ld \n", j, i, sp,
626
627 eventId = coh_PTF_add_triggers(params, eventList, thisEvent,
628 cohSNR, fcTmplt, *PTFtemplate, eventId,
629 spinTemplate,
630 pValues, gammaBeta, snrComps,
631 nullSNR, traceSNR, bankVeto,
632 autoVeto, chiSquare, PTFM,
633 skyPoints->data[sp].longitude,
634 skyPoints->data[sp].latitude,
635 currSlideID, slidTimeOffsets,
636 acceptPointList,numAcceptPoints,
637 slideNum, timeDiff,
638 params->startTime.gpsSeconds);
639 } /* End of if faceaway and faceon block */
640
641 if (vrbflg)
642 {
643 if (! params->writeSnglInspiralTable)
644 {
645 params->numEvents = XLALCountMultiInspiralTable(eventList,
646 timeDiff*params->numShortSlides);
647 }
648 else
649 {
650 params->numEvents = XLALCountSnglInspiral(snglEventList);
651 }
652 verbose("There are currently %d triggers.\n", params->numEvents);
653 verbose("Generated triggers for segment %d, template %d, sky point %d, short slide %d at %ld \n", j, i, sp, slideNum, timeval_subtract(&startTime));
654 }
655 }/* End loop over time slides */
656 }/* End loop over sky points*/
657
658 /* Free memory for temporary chisq products */
659
660 if (chisqOverlaps)
661 {
662 for(uj = 0; uj < 2*params->numChiSquareBins; uj++)
663 {
664 for(k = 0; k < LAL_NUM_IFO; k++)
665 {
666 if (chisqOverlaps[uj].PTFqVec[k])
667 {
668 XLALDestroyCOMPLEX8VectorSequence(chisqOverlaps[uj].PTFqVec[k]);
669 }
670 }
671 }
672 LALFree(chisqOverlaps);
673 chisqOverlaps = NULL;
674 }
675 if (chisqSnglOverlaps)
676 {
677 for(uj = 0; uj < params->numChiSquareBins; uj++)
678 {
679 for(k = 0; k < LAL_NUM_IFO; k++)
680 {
681 if (chisqSnglOverlaps[uj].PTFqVec[k])
682 {
683 XLALDestroyCOMPLEX8VectorSequence(chisqSnglOverlaps[uj].PTFqVec[k]);
684 }
685 }
686 }
687 LALFree(chisqSnglOverlaps);
688 chisqSnglOverlaps = NULL;
689 }
690 for(ifoNumber = 0; ifoNumber < LAL_NUM_IFO+1; ifoNumber++)
691 {
692 if (frequencyRangesPlus[ifoNumber])
693 {
694 LALFree(frequencyRangesPlus[ifoNumber]);
695 frequencyRangesPlus[ifoNumber] = NULL;
696 }
697 if (frequencyRangesCross[ifoNumber])
698 {
699 LALFree(frequencyRangesCross[ifoNumber]);
700 frequencyRangesCross[ifoNumber] = NULL;
701 }
702 }
703 for(ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++)
704 {
705 if (overlapCont[ifoNumber])
706 {
707 LALFree(overlapCont[ifoNumber]);
708 overlapCont[ifoNumber] = NULL;
709 }
710 if (snglOverlapCont[ifoNumber])
711 {
712 LALFree(snglOverlapCont[ifoNumber]);
713 snglOverlapCont[ifoNumber] = NULL;
714 }
715 }
716
717 } /* End of loop over templates */
718
719 } /* End of loop over segments */
720
721 /* calulate number of events and cluster if needed */
722 if (! params->writeSnglInspiralTable)
723 {
724 params->numEvents = XLALCountMultiInspiralTable(eventList,
725 timeDiff*params->numShortSlides);
726 }
727 else
728 {
729 params->numEvents = XLALCountSnglInspiral(snglEventList);
730 }
731
732 verbose("There are %d total triggers before cluster.\n", params->numEvents);
733 if ( params->clusterFlag )
734 {
735 if (! params->writeSnglInspiralTable)
736 {
737 coh_PTF_cluster_triggers(params,eventList,&finalEvents,
738 params->numShortSlides, timeDiff);
739 params->numEvents = XLALCountMultiInspiralTable(&finalEvents, 1);
740 }
741 else
742 {
743 coh_PTF_cluster_sngl_triggers(params,&snglEventList,&snglThisEvent);
744 params->numEvents = XLALCountSnglInspiral(snglEventList);
745 }
746 verbose("There are %d total triggers after cluster.\n", params->numEvents);
747 }
748
749 /* Output events to xml */
750 coh_PTF_output_events_xml(params->outputFile, finalEvents, snglEventList,\
751 params->injectList, procpar, time_slide_head,\
752 time_slide_map_head, segment_table_head, params);
753
754 /* Everything that follows is memory cleanup */
755 coh_PTF_destroy_time_series(cohSNR,nullSNR,traceSNR,bankVeto,autoVeto,\
756 chiSquare,pValues,gammaBeta,snrComps);
757
758 coh_PTF_cleanup(params,procpar,fwdplan,psdplan,revplan,invplan,channel,
759 invspec,segments,finalEvents,snglEventList,\
760 PTFbankhead,fcTmplt,fcTmpltParams,
761 PTFM,PTFN,PTFqVec,timeOffsets,slidTimeOffsets,Fplus,Fcross,\
762 Fplustrig,Fcrosstrig,skyPoints,time_slide_head,longTimeSlideList,
763 shortTimeSlideList,timeSlideVectors,detectors, slideIDList,\
764 time_slide_map_head,segment_table_head);
765 LALFree(eventList);
766
767 coh_PTF_free_veto_memory(params,bankNormOverlaps,bankFcTmplts,bankOverlaps,\
768 dataOverlaps,autoTempOverlaps);
769
770 /* FIXME: Move into above if this works */
771 for (ifoNumber = 0; ifoNumber < LAL_NUM_IFO; ifoNumber++)
772 {
773 if (params->haveTrig[ifoNumber])
774 {
775 LALFree(snglAcceptPoints[ifoNumber]);
776 }
777 }
778 LALFree(acceptPointList);
779
780 verbose("Generated output xml file, cleaning up and exiting at %ld \n",
782
783 /* And check for memory leaks*/
785 return 0;
786}
787
789 REAL4TimeSeries *cohSNR,
790 REAL8Array *PTFM[LAL_NUM_IFO+1],
791 COMPLEX8VectorSequence *PTFqVec[LAL_NUM_IFO+1],
792 struct coh_PTF_params *params,
793 UINT4 spinTemplate,
794 REAL4 *timeOffsets,
795 REAL4 *Fplus,
796 REAL4 *Fcross,
797 INT4 segmentNumber,
798 REAL4TimeSeries *pValues[10],
799 UNUSED REAL4TimeSeries *gammaBeta[2],
800/* NOTE: This is unused because the spin record extrinsic parameters function
801 * is broken. When fixed, this will be used, so DO NOT DELETE */
802 REAL4TimeSeries *snrComps[LAL_NUM_IFO],
803 REAL4TimeSeries *nullSNR,
804 REAL4TimeSeries *traceSNR,
805 REAL4TimeSeries *bankVeto[LAL_NUM_IFO+1],
806 REAL4TimeSeries *autoVeto[LAL_NUM_IFO+1],
807 REAL4TimeSeries *chiSquare[LAL_NUM_IFO+1],
808 UINT4 subBankSize,
809 struct bankComplexTemplateOverlaps *bankOverlaps,
810 struct bankTemplateOverlaps *bankNormOverlaps,
811 struct bankDataOverlaps *dataOverlaps,
812 struct bankComplexTemplateOverlaps *autoTempOverlaps,
813 FindChirpTemplate *fcTmplt,
814 REAL4FrequencySeries *invspec[LAL_NUM_IFO+1],
815 RingDataSegments *segments[LAL_NUM_IFO+1],
816 COMPLEX8FFTPlan *invPlan,
817 struct bankDataOverlaps **chisqOverlapsP,
818 struct bankDataOverlaps **chisqSnglOverlapsP,
819 REAL4 *frequencyRangesPlus[LAL_NUM_IFO+1],
820 REAL4 *frequencyRangesCross[LAL_NUM_IFO+1],
821 REAL4 **overlapCont,
822 REAL4 **snglOverlapCont,
823 struct timeval startTime,
824 UINT4 segStartPoint,
825 UINT4 segEndPoint,
826 UINT4 **snglAcceptPoints,
827 UINT4 *snglAcceptCount,
828 UINT4 *acceptPointList
829)
830
831{
832 verbose("Entering the statistic loop at %ld \n",
834
835 /* This function generates the SNR for every point in time and, where
836 * appropriate calculates the desired signal based vetoes. */
837
838 /* Begin with all the declarations */
839 UINT4 csVecLength,csVecLengthTwo;
840 UINT4 i, j, k, vecLength, vecLengthTwo;
841 INT4 timeOffsetPoints[LAL_NUM_IFO],numPointCheck;
842 REAL4 *v1p,*v2p; /*snglSNRthresh;*/
843 /*REAL4 cohSNRThreshold, cohSNRThresholdSq;*/
844 REAL4 *powerBinsPlus[LAL_NUM_IFO+1],*powerBinsCross[LAL_NUM_IFO+1];
845 REAL4 *snrData;
846 UINT4 currPointLoc,numAcceptPoints;
847 struct bankCohTemplateOverlaps *bankCohOverlaps,*autoCohOverlaps;
848 gsl_matrix *eigenvecs,*eigenvecsNull,*Autoeigenvecs;
849 gsl_vector *eigenvals,*eigenvalsNull,*Autoeigenvals;
850 eigenvecs = NULL;
851 eigenvecsNull = NULL;
852 Autoeigenvecs = NULL;
853 eigenvals = NULL;
854 eigenvalsNull = NULL;
855 Autoeigenvals = NULL;
856 /* FIXME: the 50s below seem to hardcode a limit on the number of templates
857 * this should not be hardcoded. Note that this value is hardcoded in some
858 * function declarations as well as here! Double pointers will fix this*/
859 gsl_matrix *Bankeigenvecs[50];
860 gsl_vector *Bankeigenvals[50];
861
862 struct bankDataOverlaps *chisqOverlaps = *chisqOverlapsP;
863 struct bankDataOverlaps *chisqSnglOverlaps = *chisqSnglOverlapsP;
864
865 /* Code works slightly differently if spin/non spin and single/coherent */
866 /* First we set the various vector lengths */
867 if (spinTemplate)
868 vecLength = 5;
869 else
870 vecLength = 1;
871 if (params->numIFO == 1 || params->singlePolFlag || params->faceOnStatistic)
872 vecLengthTwo = vecLength;
873 else
874 vecLengthTwo = 2* vecLength;
875
876 csVecLength = 1;
877 csVecLengthTwo = 2;
878 if (params->numIFO == 1 || params->singlePolFlag || params->faceOnStatistic)
879 csVecLengthTwo = 1;
880
881 /* Initialize pointers, some initialize to NULL */
882 Autoeigenvals = NULL;
883 bankCohOverlaps = NULL;
884 autoCohOverlaps = NULL;
885 for (i = 0; i < 50; i++)
886 {
887 Bankeigenvecs[i] = NULL;
888 Bankeigenvals[i] = NULL;
889 }
890 for(i = 0; i < LAL_NUM_IFO+1; i++)
891 {
892 powerBinsPlus[i] = NULL;
893 powerBinsCross[i] = NULL;
894 }
895 eigenvecs = gsl_matrix_alloc(vecLengthTwo,vecLengthTwo);
896 eigenvals = gsl_vector_alloc(vecLengthTwo);
897 eigenvecsNull = gsl_matrix_alloc(vecLength,vecLength);
898 eigenvalsNull = gsl_vector_alloc(vecLength);
899 v1p = LALCalloc(vecLengthTwo , sizeof(REAL4));
900 v2p = LALCalloc(vecLengthTwo , sizeof(REAL4));
901
902 /* Pick the relevant SNR threshold */
903 /*cohSNRThreshold = params->threshold;
904 if (spinTemplate)
905 cohSNRThreshold = params->spinThreshold;
906 snglSNRthresh = params->snglSNRThreshold;
907 cohSNRThresholdSq = cohSNRThreshold*cohSNRThreshold;*/
908
909 /* This function takes the (Q_i|Q_j) matrices, combines it across the ifos
910 * and returns the eigenvalues and eigenvectors of this new matrix.
911 * We later rotate and rescale the (Q_i|s) values such that in the new basis
912 * this matrix will be the identity matrix.
913 * For non-spin this describes the rotation into the dominant polarization
914 */
915 coh_PTF_calculate_bmatrix(params,eigenvecs,eigenvals,Fplus,Fcross,PTFM,\
916 vecLength,vecLengthTwo,vecLength);
917
918 /* If required also calculate these eigenvalues/vectors for the null stream*/
919 if (params->doNullStream)
920 {
921 coh_PTF_calculate_null_stream_norms(vecLength,eigenvecsNull,eigenvalsNull,\
922 PTFM);
923 }
924
925 /* This function takes the time offset in seconds and converts to time offset
926 * in data points (rounded) */
927 coh_PTF_convert_time_offsets_to_points(params,timeOffsets,timeOffsetPoints);
928
929 /* If we have injections we only want to analyse the time around the
930 * injection. Here we figure out what that time shou/rd be. No injections
931 * equates to analyse the whole segment.
932 */
933
934 if ( params->injectFile && params->analyzeInjSegsOnly )
935 {
936 findInjectionSegment(&segStartPoint, &segEndPoint, &cohSNR->epoch, params);
937 }
938
939 if (! segStartPoint)
940 {
941 segStartPoint = params->analStartPoint;
942 segEndPoint = params->analEndPoint;
943 }
944
945 verbose("-->Begin SNR calculation at %ld \n",timeval_subtract(&startTime));
946
947 snrData = cohSNR->data->data;
948
949 coh_PTF_calculate_coherent_SNR(params,snrData,pValues,snrComps,\
950 timeOffsetPoints,PTFqVec,Fplus,Fcross,\
951 eigenvecs,eigenvals,segStartPoint,segEndPoint,\
952 vecLength,vecLengthTwo,spinTemplate,\
953 snglAcceptPoints,snglAcceptCount);
954
955 verbose("-->Calculated all SNRs at %ld \n",timeval_subtract(&startTime));
956
957 numPointCheck = floor(params->timeWindow/cohSNR->deltaT + 0.5);
958
960 cohSNR,acceptPointList,timeOffsetPoints,\
961 numPointCheck,\
962 segStartPoint - params->analStartPoint,\
963 segEndPoint - params->analStartPoint,\
964 snglAcceptPoints,snglAcceptCount);
965
966 verbose("-->Done template clustering at %ld \n",timeval_subtract(&startTime));
967
968 /* Now we calculate all the extrinsic parameters and signal based vetoes
969 * Only calculated if this will be a trigger
970 */
971
972 for (j = 0; j < numAcceptPoints; ++j) /* loop over time */
973 { /* We only loop over points that are not already rejected for speed */
974 currPointLoc = acceptPointList[j];
975 i = currPointLoc + params->analStartPoint;
976 /* Check if point is going to be rejected */
977 if (snrData[currPointLoc])
978 {
979 /* First sbv to be calculated is the null stream SNR. */
980 if (params->doNullStream)
981 {
983 eigenvecsNull,eigenvalsNull,spinTemplate,vecLength,i,\
984 currPointLoc);
985 }
986
987 /* Next up is Trace SNR */
988 if (params->doTraceSNR)
989 {
990 coh_PTF_calculate_trace_snr(params,traceSNR,PTFqVec,eigenvecs,\
991 eigenvals,Fplus,Fcross,timeOffsetPoints,spinTemplate,vecLength,\
992 vecLengthTwo,i,currPointLoc);
993 }
994
995 /* Next is the bank veto */
996 if (params->doBankVeto)
997 {
998 if (params->numIFO != 1)
999 {
1000 /* Begin by calculating variouse overlaps that are needed.
1001 * This only needs to doing once (and is only done once), but might
1002 * be better put outside of a loop over time. However, do not want
1003 * to calculate this if *no* points will be stored in this instance
1004 */
1005 coh_PTF_bank_veto_coh_setup(params,Bankeigenvecs,Bankeigenvals,\
1006 &bankCohOverlaps,bankOverlaps,Fplus,Fcross,PTFM,\
1007 bankNormOverlaps,csVecLength,csVecLengthTwo,vecLength);
1008 /* In this function all the filters are combined to produce the
1009 * value of the bank veto. */
1010 bankVeto[LAL_NUM_IFO]->data->data[currPointLoc] = \
1011 coh_PTF_calculate_bank_veto(params->numTimePoints,i,subBankSize,\
1012 Fplus,Fcross,params,bankCohOverlaps,NULL,dataOverlaps,NULL,\
1013 PTFqVec,NULL,timeOffsetPoints,Bankeigenvecs,Bankeigenvals,\
1014 LAL_NUM_IFO,csVecLength,csVecLengthTwo);
1015 }
1016 /* As well as the coherent bank veto calculated above, we calculate
1017 * the single detector bank veto */
1018 if (params->doSnglChiSquared)
1019 {
1020 for(k = 0; k < LAL_NUM_IFO; k++)
1021 {
1022 if (params->haveTrig[k])
1023 {
1024 bankVeto[k]->data->data[currPointLoc] = \
1025 coh_PTF_calculate_bank_veto(params->numTimePoints,i,\
1026 subBankSize,Fplus,Fcross,params,NULL,bankOverlaps,\
1027 dataOverlaps,bankNormOverlaps,PTFqVec,PTFM,\
1028 timeOffsetPoints,NULL,NULL,k,1,1);
1029 }
1030 }
1031 }
1032 }
1033
1034 /* Now we do the auto veto */
1035 if (params->doAutoVeto)
1036 {
1037 if (params->numIFO!=1)
1038 {
1039 /* As with bank_veto, we begin by calculating the various coherent
1040 * overlaps that are needed. Same caveats as with bank veto */
1041 coh_PTF_auto_veto_coh_setup(params,&Autoeigenvecs,&Autoeigenvals,\
1042 &autoCohOverlaps,autoTempOverlaps,Fplus,Fcross,PTFM,\
1043 csVecLength,csVecLengthTwo,vecLength);
1044 /* Auto veto is calculated */
1045 autoVeto[LAL_NUM_IFO]->data->data[currPointLoc] = \
1046 coh_PTF_calculate_auto_veto(params->numTimePoints,i,Fplus,Fcross,\
1047 params,autoCohOverlaps,NULL,PTFqVec,NULL,timeOffsetPoints,\
1048 Autoeigenvecs,Autoeigenvals,LAL_NUM_IFO,csVecLength,\
1049 csVecLengthTwo);
1050 }
1051 /* Also do single detector auto veto */
1052 if (params->doSnglChiSquared)
1053 {
1054 for(k = 0; k < LAL_NUM_IFO; k++)
1055 {
1056 if (params->haveTrig[k])
1057 {
1058 autoVeto[k]->data->data[currPointLoc] = \
1059 coh_PTF_calculate_auto_veto(params->numTimePoints,i,Fplus,\
1060 Fcross,params,NULL,autoTempOverlaps,PTFqVec,PTFM,\
1061 timeOffsetPoints,NULL,NULL,k,1,1);
1062 }
1063 }
1064 }
1065
1066 }
1067 }
1068 }
1069
1070 verbose("-->Calculated most vetoes at %ld \n",timeval_subtract(&startTime));
1071
1072 /* And do the loop again to calculate chi square */
1073
1074 if (params->doChiSquare)
1075 {
1076 for (j = 0; j < numAcceptPoints; ++j) /* loop over time */
1077 { /* We only loop over points that are not already rejected for speed */
1078 currPointLoc = acceptPointList[j];
1079 i = currPointLoc + params->analStartPoint;
1080 if (snrData[currPointLoc])
1081 {
1082 /* Test whether to do chi^2 */
1083 if (params->chiSquareCalcThreshold)
1084 {
1085 /* FIXME: Does not work for single detector runs */
1086 if (params->numIFO!=1)
1087 {
1088 if ( coh_PTF_test_veto_vals(params,cohSNR,nullSNR,bankVeto,\
1089 autoVeto,currPointLoc ) )
1090 {
1091 chiSquare[LAL_NUM_IFO]->data->data[currPointLoc] = 0;
1092 continue;
1093 }
1094 }
1095 }
1096 /* If no problems then calculate chi squared */
1097 if (params->numIFO != 1)
1098 {
1099 /* As with bank_veto, we begin by calculating the various coherent
1100 * overlaps that are needed. Same caveats as with bank veto
1101 * For chi square there are two types of variables here some of the
1102 * variables are only calculated once for all sky points, at the first
1103 * sky point they are needed. This includes the computationally
1104 * expensive filters, which means we must also use the same frequency
1105 * ranges for all sky points. Because of this we recalculate the
1106 * unequal power bins each time.
1107 */
1108 coh_PTF_chi_square_coh_setup(params,&Autoeigenvecs,\
1109 &Autoeigenvals,frequencyRangesPlus,frequencyRangesCross,\
1110 powerBinsPlus,powerBinsCross,overlapCont,&chisqOverlaps,fcTmplt,\
1111 invspec,segments,Fplus,Fcross,PTFM,invPlan,segmentNumber,\
1112 csVecLength,csVecLengthTwo,vecLength);
1113
1114 /* Calculate chi square here */
1115 chiSquare[LAL_NUM_IFO]->data->data[currPointLoc] = \
1116 coh_PTF_calculate_chi_square(params,i,chisqOverlaps,\
1117 PTFqVec,NULL,Fplus,Fcross,timeOffsetPoints,Autoeigenvecs,\
1118 Autoeigenvals,powerBinsPlus[LAL_NUM_IFO],\
1119 powerBinsCross[LAL_NUM_IFO],LAL_NUM_IFO,csVecLength,\
1120 csVecLengthTwo);
1121 }
1122 if (params->doSnglChiSquared)
1123 {
1124 /* Begin with the setup, this is only done once. As with the
1125 * coherent chi squared, the filters are reused for every sky point
1126 */
1127 coh_PTF_chi_square_sngl_setup(params,frequencyRangesPlus,\
1128 frequencyRangesCross,powerBinsPlus,powerBinsCross,\
1129 snglOverlapCont,&chisqSnglOverlaps,fcTmplt,invspec,segments,\
1130 PTFM,invPlan,segmentNumber);
1131 for(k = 0; k < LAL_NUM_IFO; k++)
1132 {
1133 if (params->haveTrig[k])
1134 {
1135 /* Calculate chi squared */
1136 chiSquare[k]->data->data[currPointLoc] = \
1137 coh_PTF_calculate_chi_square(params,i,\
1138 chisqSnglOverlaps,PTFqVec,PTFM,Fplus,Fcross,\
1139 timeOffsetPoints,NULL,NULL,powerBinsPlus[k],\
1140 powerBinsCross[k],k,1,1);
1141 }
1142 } /* End loop over ifos */
1143 }
1144 }
1145 } /* End loop over time */
1146 }
1147
1148 verbose("-->Calculated chi squared at %ld \n",timeval_subtract(&startTime));
1149
1150 /* Free memory of stuff that will not be reused. */
1151 if (params->doBankVeto)
1152 {
1153 for (j = 0 ; j < subBankSize+1 ; j++)
1154 {
1155 if (Bankeigenvecs[j])
1156 gsl_matrix_free(Bankeigenvecs[j]);
1157 if (Bankeigenvals[j])
1158 gsl_vector_free(Bankeigenvals[j]);
1159 }
1160 if (bankCohOverlaps)
1161 {
1162 for (j = 0 ; j < subBankSize ; j++)
1163 {
1164 gsl_matrix_free(bankCohOverlaps[j].rotReOverlaps);
1165 gsl_matrix_free(bankCohOverlaps[j].rotImOverlaps);
1166 }
1167 LALFree(bankCohOverlaps);
1168 }
1169 }
1170
1171 if (params->doAutoVeto)
1172 {
1173 if (Autoeigenvecs)
1174 gsl_matrix_free(Autoeigenvecs);
1175 Autoeigenvecs = NULL;
1176 if (Autoeigenvals)
1177 gsl_vector_free(Autoeigenvals);
1178 Autoeigenvals = NULL;
1179 if (autoCohOverlaps)
1180 {
1181 for (j = 0 ; j < params->numAutoPoints ; j++)
1182 {
1183 gsl_matrix_free(autoCohOverlaps[j].rotReOverlaps);
1184 gsl_matrix_free(autoCohOverlaps[j].rotImOverlaps);
1185 }
1186 LALFree(autoCohOverlaps);
1187 }
1188 }
1189
1190 if (params->doChiSquare)
1191 {
1192 if (Autoeigenvecs)
1193 gsl_matrix_free(Autoeigenvecs);
1194 if (Autoeigenvals)
1195 gsl_vector_free(Autoeigenvals);
1196 for(k = 0; k < LAL_NUM_IFO+1; k++)
1197 {
1198 if (powerBinsPlus[k])
1199 LALFree(powerBinsPlus[k]);
1200 if (powerBinsCross[k])
1201 LALFree(powerBinsCross[k]);
1202 }
1203 }
1204
1205 LALFree(v1p);
1206 LALFree(v2p);
1207 gsl_matrix_free(eigenvecs);
1208 gsl_vector_free(eigenvals);
1209 gsl_matrix_free(eigenvecsNull);
1210 gsl_vector_free(eigenvalsNull);
1211
1212 *chisqOverlapsP = chisqOverlaps;
1213 *chisqSnglOverlapsP = chisqSnglOverlaps;
1214
1215 verbose("-->Completed memory cleanup and exiting loop at %ld \n",\
1217
1218 return numAcceptPoints;
1219}
1220
1222 struct coh_PTF_params *params,
1223 MultiInspiralTable **eventList,
1224 MultiInspiralTable **thisEvent,
1225 REAL4TimeSeries *cohSNR,
1226 FindChirpTemplate *fcTmplt,
1227 InspiralTemplate PTFTemplate,
1228 UINT8 eventId,
1229 UINT4 spinTrigger,
1230 REAL4TimeSeries *pValues[10],
1231 REAL4TimeSeries *gammaBeta[2],
1232 REAL4TimeSeries *snrComps[LAL_NUM_IFO],
1233 REAL4TimeSeries *nullSNR,
1234 REAL4TimeSeries *traceSNR,
1235 REAL4TimeSeries *bankVeto[LAL_NUM_IFO+1],
1236 REAL4TimeSeries *autoVeto[LAL_NUM_IFO+1],
1237 REAL4TimeSeries *chiSquare[LAL_NUM_IFO+1],
1238 REAL8Array *PTFM[LAL_NUM_IFO+1],
1239 REAL4 rightAscension,
1240 REAL4 declination,
1241 INT8 slideId,
1242 REAL4 *timeOffsets,
1243 UINT4 *acceptPointList,
1244 UINT4 numAcceptPoints,
1245 UINT4 slideNum,
1246 INT4 timeDiff,
1247 INT4 startTime
1248)
1249{
1250 // This function adds a trigger to the event list
1251
1252 UINT4 i,j;
1253 UINT4 currTimeDiff, currStorageID;
1254 INT4 timeOffsetPoints[LAL_NUM_IFO];
1255 MultiInspiralTable *lastEvent = NULL;
1256 MultiInspiralTable *currEvent = NULL;
1257
1258 coh_PTF_convert_time_offsets_to_points(params,timeOffsets,timeOffsetPoints);
1259
1260 for (j = 0; j < numAcceptPoints; ++j)
1261 {
1262 i = acceptPointList[j];
1263 if (cohSNR->data->data[i])
1264 {
1265 currEvent = coh_PTF_create_multi_event(params,cohSNR,fcTmplt,PTFTemplate,\
1266 &eventId,spinTrigger,pValues,gammaBeta,snrComps,nullSNR,traceSNR,\
1267 bankVeto,autoVeto,chiSquare,PTFM,rightAscension,declination,slideId,\
1268 timeOffsetPoints,i);
1269 /* Important to zero out the cohSNR array as we go */
1270 cohSNR->data->data[i] = 0.;
1271
1272 /* Check trigger against trig times */
1273 if (coh_PTF_trig_time_check(params,currEvent->end_time,\
1274 currEvent->end_time))
1275 {
1276 LALFree(currEvent);
1277 continue;
1278 }
1279 currTimeDiff = (currEvent->end_time.gpsSeconds - startTime);
1280 currStorageID = timeDiff * slideNum + currTimeDiff;
1281 /* And add the trigger to the lists. IF it passes clustering! */
1282 if (!eventList[currStorageID])
1283 {
1284 eventList[currStorageID] = currEvent;
1285 thisEvent[currStorageID] = currEvent;
1286 }
1287 else
1288 {
1289 lastEvent = thisEvent[currStorageID];
1290 if (! params->clusterFlag)
1291 {
1292 lastEvent->next = currEvent;
1293 thisEvent[currStorageID] = currEvent;
1294 }
1295 else if (coh_PTF_accept_trig_check(params,eventList,*currEvent,
1296 timeDiff, currTimeDiff,
1297 currStorageID) )
1298 {
1299 lastEvent->next = currEvent;
1300 thisEvent[currStorageID] = currEvent;
1301 }
1302 else
1303 {
1304 LALFree(currEvent);
1305 }
1306 }
1307 }
1308 }
1309 return eventId;
1310}
1311
1313 struct coh_PTF_params *params,
1314 MultiInspiralTable **eventList,
1315 MultiInspiralTable **newEventHead,
1316 UINT4 numSlides,
1317 INT4 timeDiff
1318)
1319{
1320 UINT4 slideNum, currTimeDiff, currStorageID;
1321 UINT4 triggerNum, lenTriggers;
1322 UINT4 **rejectTriggers;
1323 rejectTriggers = LALCalloc(1, numSlides*timeDiff*sizeof(UINT4*));
1324
1325 MultiInspiralTable *currEvent=NULL;
1326 MultiInspiralTable *currEvent2=NULL;
1327 MultiInspiralTable *newEvent=NULL;
1328
1329 for (slideNum = 0; slideNum < numSlides; slideNum++)
1330 {
1331 for (currTimeDiff = 0; currTimeDiff < (UINT4)timeDiff; currTimeDiff++)
1332 {
1333 currStorageID = timeDiff * slideNum + currTimeDiff;
1334
1335 currEvent = eventList[currStorageID];
1336 currEvent2 = NULL;
1337 triggerNum = 0;
1338 lenTriggers = 0;
1339
1340 /* find number of triggers */
1341 while (currEvent)
1342 {
1343 lenTriggers+=1;
1344 currEvent = currEvent->next;
1345 }
1346
1347 currEvent = eventList[currStorageID];
1348 rejectTriggers[currStorageID] = LALCalloc(1, lenTriggers*sizeof(UINT4));
1349
1350 /* for each trigger, find out whether a louder trigger is within the
1351 * clustering time */
1352 while (currEvent)
1353 {
1354 if (coh_PTF_accept_trig_check(params,eventList,*currEvent,
1355 timeDiff, currTimeDiff,
1356 currStorageID) )
1357 {
1358 rejectTriggers[currStorageID][triggerNum] = 0;
1359 triggerNum += 1;
1360 }
1361 else
1362 {
1363 rejectTriggers[currStorageID][triggerNum] = 1;
1364 triggerNum += 1;
1365 }
1366 currEvent = currEvent->next;
1367 }
1368
1369 }
1370 }
1371
1372 for (slideNum = 0; slideNum < numSlides; slideNum++)
1373 {
1374 for (currTimeDiff = 0; currTimeDiff < (UINT4)timeDiff; currTimeDiff++)
1375 {
1376 triggerNum = 0;
1377 currStorageID = timeDiff * slideNum + currTimeDiff;
1378 currEvent = eventList[currStorageID];
1379 /* construct new event table with triggers to keep */
1380 while (currEvent)
1381 {
1382 if (! rejectTriggers[currStorageID][triggerNum])
1383 {
1384 if (! *newEventHead)
1385 {
1386 *newEventHead = currEvent;
1387 newEvent = currEvent;
1388 }
1389 else
1390 {
1391 newEvent->next = currEvent;
1392 newEvent = currEvent;
1393 }
1394 currEvent = currEvent->next;
1395 }
1396 else
1397 {
1398 currEvent2 = currEvent->next;
1399 LALFree(currEvent);
1400 currEvent = currEvent2;
1401 }
1402 triggerNum+=1;
1403 }
1404 LALFree(rejectTriggers[currStorageID]);
1405 }
1406 }
1407 LALFree(rejectTriggers);
1408
1409 /* write new table over old one */
1410 if (newEvent)
1411 {
1412 newEvent->next = NULL;
1413 }
1414}
1415
1417 struct coh_PTF_params *params,
1418 MultiInspiralTable **eventList,
1419 MultiInspiralTable thisEvent,
1420 INT4 timeDiff,
1421 UINT4 currTimeDiff,
1422 UINT4 currStorageID
1423)
1424{
1425 MultiInspiralTable *currEvent = *eventList;
1426 LIGOTimeGPS time1,time2;
1427 UINT4 loudTrigBefore=0,loudTrigAfter=0;
1428 INT4 checkOffset;
1429 REAL8 GPSDiff;
1430
1431 time1.gpsSeconds=thisEvent.end_time.gpsSeconds;
1432 time1.gpsNanoSeconds = thisEvent.end_time.gpsNanoSeconds;
1433
1434 for (checkOffset=-1; checkOffset < 2; checkOffset++)
1435 {
1436 if ((currTimeDiff + checkOffset) == 0)
1437 {
1438 continue;
1439 }
1440 if ((INT4)(currTimeDiff + checkOffset) == timeDiff)
1441 {
1442 continue;
1443 }
1444
1445 currEvent = eventList[currStorageID+checkOffset];
1446
1447 /* for each trigger, find out whether a louder trigger is within the
1448 * clustering time */
1449 while (currEvent)
1450 {
1451 time2.gpsSeconds=currEvent->end_time.gpsSeconds;
1452 time2.gpsNanoSeconds=currEvent->end_time.gpsNanoSeconds;
1453 if (thisEvent.time_slide_id == currEvent->time_slide_id)
1454 {
1455 GPSDiff = XLALGPSDiff(&time1,&time2);
1456 if (fabs(GPSDiff) < params->clusterWindow)
1457 {
1458 if (thisEvent.snr_dof == currEvent->snr_dof)
1459 {
1460 if (thisEvent.snr < currEvent->snr\
1461 && (thisEvent.event_id != currEvent->event_id))
1462 {
1463 /* If at identical time, return 0 */
1464 if (GPSDiff == 0)
1465 return 0;
1466 else if ( GPSDiff < 0 )
1467 loudTrigBefore = 1;
1468 else
1469 loudTrigAfter = 1;
1470
1471 if (loudTrigBefore && loudTrigAfter)
1472 {
1473 return 0;
1474 }
1475 }
1476 }
1477 }
1478 }
1479 currEvent = currEvent->next;
1480 }
1481 }
1482
1483 return 1;
1484}
int InspiralTmpltBankFromLIGOLw(InspiralTemplate **bankHead, const CHAR *fileName, INT4 startTmplt, INT4 stopTmplt)
int j
int k
void LALCheckMemoryLeaks(void)
#define LALCalloc(m, n)
#define LALFree(p)
INT4 XLALCountSnglInspiral(SnglInspiralTable *head)
LAL_NUM_IFO
int verbose
Definition: chirplen.c:77
void coh_PTF_initialize_time_series(struct coh_PTF_params *params, LIGOTimeGPS segStartTime, REAL8 fLower, REAL4TimeSeries **cohSNRP, REAL4TimeSeries **nullSNRP, REAL4TimeSeries **traceSNRP, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL4TimeSeries **snrComps, REAL4TimeSeries **pValues, REAL4TimeSeries **gammaBeta, UINT4 spinTemplates)
int coh_PTF_output_events_xml(char *outputFile, MultiInspiralTable *events, SnglInspiralTable *snglEvents, SimInspiralTable *injections, ProcessParamsTable *processParamsTable, TimeSlide *time_slide_head, TimeSlideSegmentMapTable *time_slide_map_head, SegmentTable *segment_table_head, struct coh_PTF_params *params)
void coh_PTF_chi_square_sngl_setup(struct coh_PTF_params *params, REAL4 **frequencyRangesPlus, REAL4 **frequencyRangesCross, REAL4 **powerBinsPlus, REAL4 **powerBinsCross, REAL4 **overlapCont, struct bankDataOverlaps **chisqSnglOverlapsP, FindChirpTemplate *fcTmplt, REAL4FrequencySeries **invspec, RingDataSegments **segments, REAL8Array **PTFM, COMPLEX8FFTPlan *invPlan, INT4 segmentNumber)
void coh_PTF_set_null_input_REAL4(REAL4 **array, UINT4 length)
REAL4FFTPlan * coh_PTF_get_fft_revplan(struct coh_PTF_params *params)
void coh_PTF_calculate_bank_veto_template_filters(struct coh_PTF_params *params, FindChirpTemplate *bankFcTmplts, FindChirpTemplate *fcTmplt, REAL4FrequencySeries **invspec, struct bankComplexTemplateOverlaps *bankOverlaps)
@ ALL_SKY
Definition: coh_PTF.h:290
@ TWO_DET_ALL_SKY
Definition: coh_PTF.h:291
void coh_PTF_create_time_slide_table(struct coh_PTF_params *params, INT8 *slideIDList, RingDataSegments **segments, TimeSlide **time_slide_headP, TimeSlideSegmentMapTable **time_slide_map_headP, SegmentTable **segment_table_headP, TimeSlideVectorList **longTimeSlideListP, TimeSlideVectorList **shortTimeSlideListP, REAL4 *timeSlideVectors, INT4 numSegments)
void coh_PTF_convert_time_offsets_to_points(struct coh_PTF_params *params, REAL4 *timeOffsets, INT4 *timeOffsetPoints)
void coh_PTF_setup_null_stream(struct coh_PTF_params *params, REAL4TimeSeries **channel, REAL4FrequencySeries **invspec, RingDataSegments **segments, REAL4 *Fplustrig, REAL4 *Fcrosstrig, REAL4 *timeOffsets, REAL4FFTPlan *fwdplan, REAL4FFTPlan *revplan, REAL4FFTPlan *psdplan, REAL4 *timeSlideVectors, struct timeval startTime)
void coh_PTF_calculate_single_detector_filters(struct coh_PTF_params *params, FindChirpTemplate *fcTmplt, REAL4FrequencySeries **invspec, REAL8Array **PTFM, COMPLEX8VectorSequence **PTFqVec, REAL4TimeSeries **snrComps, UINT4 **snglAcceptPoints, UINT4 *snglAcceptCount, RingDataSegments **segments, COMPLEX8FFTPlan *invPlan, UINT4 spinTemplate, UINT4 segNum)
UINT4 coh_PTF_trig_time_check(struct coh_PTF_params *params, LIGOTimeGPS segStartTime, LIGOTimeGPS segEndTime)
void coh_PTF_calculate_null_stream_snr(struct coh_PTF_params *params, REAL4TimeSeries *nullSNR, COMPLEX8VectorSequence **PTFqVec, gsl_matrix *eigenvecsNull, gsl_vector *eigenvalsNull, UINT4 spinTemplate, UINT4 vecLength, UINT4 vecLoc, UINT4 snrLoc)
void coh_PTF_bank_veto_coh_setup(struct coh_PTF_params *params, gsl_matrix **Bankeigenvecs, gsl_vector **Bankeigenvals, struct bankCohTemplateOverlaps **bankCohOverlapsP, struct bankComplexTemplateOverlaps *bankOverlaps, REAL4 *Fplus, REAL4 *Fcross, REAL8Array **PTFM, struct bankTemplateOverlaps *bankNormOverlaps, UINT4 csVecLength, UINT4 csVecLengthTwo, UINT4 vecLength)
void coh_PTF_destroy_time_series(REAL4TimeSeries *cohSNR, REAL4TimeSeries *nullSNR, REAL4TimeSeries *traceSNR, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL4TimeSeries **pValues, REAL4TimeSeries **gammaBeta, REAL4TimeSeries **snrComps)
UINT8 coh_PTF_add_sngl_triggers(struct coh_PTF_params *params, SnglInspiralTable **eventList, SnglInspiralTable **thisEvent, REAL4TimeSeries *cohSNR, FindChirpTemplate *fcTmplt, InspiralTemplate PTFTemplate, UINT8 eventId, REAL4TimeSeries **pValues, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL8Array **PTFM, UINT4 startPoint, UINT4 endPoint)
void coh_PTF_auto_veto_coh_setup(struct coh_PTF_params *params, gsl_matrix **AutoeigenvecsP, gsl_vector **AutoeigenvalsP, struct bankCohTemplateOverlaps **autoCohOverlapsP, struct bankComplexTemplateOverlaps *autoTempOverlaps, REAL4 *Fplus, REAL4 *Fcross, REAL8Array **PTFM, UINT4 csVecLength, UINT4 csVecLengthTwo, UINT4 vecLength)
int coh_PTF_parse_options(struct coh_PTF_params *params, int argc, char **argv)
void coh_PTF_bank_veto_segment_setup(struct coh_PTF_params *params, struct bankDataOverlaps *dataOverlaps, FindChirpTemplate *bankFcTmplts, RingDataSegments **segments, COMPLEX8VectorSequence **PTFqVec, COMPLEX8FFTPlan *invplan, INT4 segmentNum, struct timeval startTime)
UINT4 coh_PTF_initialize_bank_veto(struct coh_PTF_params *params, struct bankTemplateOverlaps **bankNormOverlapsP, struct bankComplexTemplateOverlaps **bankOverlapsP, struct bankDataOverlaps **dataOverlapsP, FindChirpTemplate **bankFcTmpltsP, FindChirpTemplate *fcTmplt, FindChirpTmpltParams *fcTmpltParams, REAL4FrequencySeries **invspec, struct timeval startTime)
void coh_PTF_set_null_input_RingDataSegments(RingDataSegments **segment, UINT4 length)
CohPTFSkyPositions * coh_PTF_generate_sky_points(struct coh_PTF_params *params)
void coh_PTF_initialize_structures(struct coh_PTF_params *params, FindChirpTemplate **fcTmpltP, FindChirpTmpltParams **fcTmpltParamsP, REAL8Array **PTFM, REAL8Array **PTFN, COMPLEX8VectorSequence **PTFqVec, REAL4FFTPlan *fwdplan)
UINT4 coh_PTF_initialize_auto_veto(struct coh_PTF_params *params, struct bankComplexTemplateOverlaps **autoTempOverlapsP, struct timeval startTime)
void coh_PTF_template(FindChirpTemplate *fcTmplt, InspiralTemplate *InspTmplt, FindChirpTmpltParams *params)
INT4 coh_PTF_data_condition(struct coh_PTF_params *params, REAL4TimeSeries **channel, REAL4FrequencySeries **invspec, RingDataSegments **segments, REAL4FFTPlan *fwdplan, REAL4FFTPlan *psdplan, REAL4FFTPlan *revplan, REAL4 **timeSlideVectors, struct timeval startTime)
Definition: coh_PTF_utils.c:4
REAL4FFTPlan * coh_PTF_get_fft_fwdplan(struct coh_PTF_params *params)
void coh_PTF_cleanup(struct coh_PTF_params *params, ProcessParamsTable *procpar, REAL4FFTPlan *fwdplan, REAL4FFTPlan *psdplan, REAL4FFTPlan *revplan, COMPLEX8FFTPlan *invPlan, REAL4TimeSeries **channel, REAL4FrequencySeries **invspec, RingDataSegments **segments, MultiInspiralTable *events, SnglInspiralTable *snglEvents, InspiralTemplate *PTFbankhead, FindChirpTemplate *fcTmplt, FindChirpTmpltParams *fcTmpltParams, REAL8Array **PTFM, REAL8Array **PTFN, COMPLEX8VectorSequence **PTFqVec, REAL4 *timeOffsets, REAL4 *slidTimeOffsets, REAL4 *Fplus, REAL4 *Fcross, REAL4 *Fplustrig, REAL4 *Fcrosstrig, CohPTFSkyPositions *skyPoints, TimeSlide *time_slide_head, TimeSlideVectorList *longTimeSlideList, TimeSlideVectorList *shortTimeSlideList, REAL4 *timeSlideVectors, LALDetector **detectors, INT8 *slideIDList, TimeSlideSegmentMapTable *time_slide_map_head, SegmentTable *segment_table_head)
void coh_PTF_calculate_trace_snr(struct coh_PTF_params *params, REAL4TimeSeries *traceSNR, COMPLEX8VectorSequence **PTFqVec, gsl_matrix *eigenvecs, gsl_vector *eigenvals, REAL4 *Fplus, REAL4 *Fcross, INT4 *timeOffsetPoints, UINT4 spinTemplate, UINT4 vecLength, UINT4 vecLengthTwo, UINT4 vecLoc, UINT4 snrLoc)
int coh_PTF_params_inspiral_sanity_check(struct coh_PTF_params *params)
UINT4 checkInjectionMchirp(struct coh_PTF_params *params, InspiralTemplate *tmplt, LIGOTimeGPS *epoch)
void coh_PTF_chi_square_coh_setup(struct coh_PTF_params *params, gsl_matrix **AutoeigenvecsP, gsl_vector **AutoeigenvalsP, REAL4 **frequencyRangesPlus, REAL4 **frequencyRangesCross, REAL4 **powerBinsPlus, REAL4 **powerBinsCross, REAL4 **overlapCont, struct bankDataOverlaps **chisqOverlapsP, FindChirpTemplate *fcTmplt, REAL4FrequencySeries **invspec, RingDataSegments **segments, REAL4 *Fplus, REAL4 *Fcross, REAL8Array **PTFM, COMPLEX8FFTPlan *invPlan, INT4 segmentNumber, UINT4 csVecLength, UINT4 csVecLengthTwo, UINT4 vecLength)
ProcessParamsTable * create_process_params(int argc, char **argv, const char *program)
void coh_PTF_calculate_det_stuff(struct coh_PTF_params *params, LALDetector **detectors, REAL4 *timeOffsets, REAL4 *Fplustrig, REAL4 *Fcrosstrig, CohPTFSkyPositions *skyPoints, UINT4 skyPointNum)
void coh_PTF_calculate_bmatrix(struct coh_PTF_params *params, gsl_matrix *eigenvecs, gsl_vector *eigenvals, REAL4 Fplus[LAL_NUM_IFO], REAL4 Fpcross[LAL_NUM_IFO], REAL8Array *PTFM[LAL_NUM_IFO+1], UINT4 vecLength, UINT4 vecLengthTwo, UINT4 PTFMlen)
REAL4FFTPlan * coh_PTF_get_fft_psdplan(struct coh_PTF_params *params)
void coh_PTF_calculate_auto_veto_template_filters(struct coh_PTF_params *params, FindChirpTemplate *fcTmplt, struct bankComplexTemplateOverlaps *autoTempOverlaps, REAL4FrequencySeries **invspec, COMPLEX8FFTPlan *invplan, UINT4 timeStepPoints)
void coh_PTF_set_null_input_UINT4(UINT4 **array, UINT4 length)
void coh_PTF_set_null_input_REAL4FrequencySeries(REAL4FrequencySeries **freqSeries, UINT4 length)
void coh_PTF_cluster_sngl_triggers(struct coh_PTF_params *params, SnglInspiralTable **eventList, SnglInspiralTable **thisEvent)
void coh_PTF_free_veto_memory(struct coh_PTF_params *params, struct bankTemplateOverlaps *bankNormOverlaps, FindChirpTemplate *bankFcTmplts, struct bankComplexTemplateOverlaps *bankOverlaps, struct bankDataOverlaps *dataOverlaps, struct bankComplexTemplateOverlaps *autoTempOverlaps)
void coh_PTF_calculate_null_stream_norms(UINT4 vecLength, gsl_matrix *eigenvecsNull, gsl_vector *eigenvalsNull, REAL8Array *PTFM[LAL_NUM_IFO+1])
UINT4 coh_PTF_template_time_series_cluster(struct coh_PTF_params *params, REAL4TimeSeries *cohSNR, UINT4 *acceptPoints, INT4 *timeOffsetPoints, INT4 numPointCheck, UINT4 startPoint, UINT4 endPoint, UINT4 **snglAcceptPoints, UINT4 *snglAcceptCount)
COMPLEX8FFTPlan * coh_PTF_get_fft_invplan(struct coh_PTF_params *params)
void findInjectionSegment(UINT4 *start, UINT4 *end, LIGOTimeGPS *epoch, struct coh_PTF_params *params)
void coh_PTF_set_null_input_LALDetector(LALDetector **detector, UINT4 length)
long int timeval_subtract(struct timeval *t1)
int coh_PTF_params_sanity_check(struct coh_PTF_params *params)
void coh_PTF_reset_time_series(struct coh_PTF_params *params, LIGOTimeGPS segStartTime, REAL4TimeSeries *cohSNR, REAL4TimeSeries *nullSNR, REAL4TimeSeries *traceSNR, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL4TimeSeries **snrComps, REAL4TimeSeries **pValues, REAL4TimeSeries **gammaBeta, UINT4 spinTemplates)
void coh_PTF_calculate_coherent_SNR(struct coh_PTF_params *params, REAL4 *snrData, REAL4TimeSeries **pValues, REAL4TimeSeries **snrComps, INT4 *timeOffsetPoints, COMPLEX8VectorSequence **PTFqVec, REAL4 *Fplus, REAL4 *Fcross, gsl_matrix *eigenvecs, gsl_vector *eigenvals, UINT4 segStartPoint, UINT4 segEndPoint, UINT4 vecLength, UINT4 vecLengthTwo, UINT4 spinTemplate, UINT4 **snglAcceptPoints, UINT4 *snglAcceptCount)
MultiInspiralTable * coh_PTF_create_multi_event(struct coh_PTF_params *params, REAL4TimeSeries *cohSNR, FindChirpTemplate *fcTmplt, InspiralTemplate PTFTemplate, UINT8 *eventId, UINT4 spinTrigger, REAL4TimeSeries **pValues, REAL4TimeSeries **gammaBeta, REAL4TimeSeries **snrComps, REAL4TimeSeries *nullSNR, REAL4TimeSeries *traceSNR, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL8Array **PTFM, REAL4 rightAscension, REAL4 declination, INT8 slideId, INT4 *timeOffsetPoints, UINT4 currPos)
void coh_PTF_set_null_input_REAL4TimeSeries(REAL4TimeSeries **timeSeries, UINT4 length)
UINT4 coh_PTF_test_veto_vals(struct coh_PTF_params *params, REAL4TimeSeries *cohSNR, REAL4TimeSeries *nullSNR, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, UINT4 currPointLoc)
void coh_PTF_calculate_null_stream_filters(struct coh_PTF_params *params, FindChirpTemplate *fcTmplt, REAL4FrequencySeries **invspec, REAL8Array **PTFM, COMPLEX8VectorSequence **PTFqVec, RingDataSegments **segments, COMPLEX8FFTPlan *invPlan, UINT4 spinTemplate, UINT4 segNum)
#define CVS_REVISION
static struct coh_PTF_params * coh_PTF_get_params(int argc, char **argv)
#define CVS_DATE
#define PROGRAM_NAME
int main(int argc, char **argv)
static int XLALCountMultiInspiralTable(MultiInspiralTable **head, UINT4 len)
UINT4 coh_PTF_accept_trig_check(struct coh_PTF_params *params, MultiInspiralTable **eventList, MultiInspiralTable thisEvent, INT4 timeDiff, UINT4 currTimeDiff, UINT4 currStorageID)
void coh_PTF_cluster_triggers(struct coh_PTF_params *params, MultiInspiralTable **eventList, MultiInspiralTable **newEventHead, UINT4 numSlides, INT4 timeDiff)
UINT4 coh_PTF_statistic(REAL4TimeSeries *cohSNR, REAL8Array *PTFM[LAL_NUM_IFO+1], COMPLEX8VectorSequence *PTFqVec[LAL_NUM_IFO+1], struct coh_PTF_params *params, UINT4 spinTemplate, REAL4 *timeOffsets, REAL4 *Fplus, REAL4 *Fcross, INT4 segmentNumber, REAL4TimeSeries *pValues[10], UNUSED REAL4TimeSeries *gammaBeta[2], REAL4TimeSeries *snrComps[LAL_NUM_IFO], REAL4TimeSeries *nullSNR, REAL4TimeSeries *traceSNR, REAL4TimeSeries *bankVeto[LAL_NUM_IFO+1], REAL4TimeSeries *autoVeto[LAL_NUM_IFO+1], REAL4TimeSeries *chiSquare[LAL_NUM_IFO+1], UINT4 subBankSize, struct bankComplexTemplateOverlaps *bankOverlaps, struct bankTemplateOverlaps *bankNormOverlaps, struct bankDataOverlaps *dataOverlaps, struct bankComplexTemplateOverlaps *autoTempOverlaps, FindChirpTemplate *fcTmplt, REAL4FrequencySeries *invspec[LAL_NUM_IFO+1], RingDataSegments *segments[LAL_NUM_IFO+1], COMPLEX8FFTPlan *invPlan, struct bankDataOverlaps **chisqOverlapsP, struct bankDataOverlaps **chisqSnglOverlapsP, REAL4 *frequencyRangesPlus[LAL_NUM_IFO+1], REAL4 *frequencyRangesCross[LAL_NUM_IFO+1], REAL4 **overlapCont, REAL4 **snglOverlapCont, struct timeval startTime, UINT4 segStartPoint, UINT4 segEndPoint, UINT4 **snglAcceptPoints, UINT4 *snglAcceptCount, UINT4 *acceptPointList)
UINT8 coh_PTF_add_triggers(struct coh_PTF_params *params, MultiInspiralTable **eventList, MultiInspiralTable **thisEvent, REAL4TimeSeries *cohSNR, FindChirpTemplate *fcTmplt, InspiralTemplate PTFTemplate, UINT8 eventId, UINT4 spinTrigger, REAL4TimeSeries *pValues[10], REAL4TimeSeries *gammaBeta[2], REAL4TimeSeries *snrComps[LAL_NUM_IFO], REAL4TimeSeries *nullSNR, REAL4TimeSeries *traceSNR, REAL4TimeSeries *bankVeto[LAL_NUM_IFO+1], REAL4TimeSeries *autoVeto[LAL_NUM_IFO+1], REAL4TimeSeries *chiSquare[LAL_NUM_IFO+1], REAL8Array *PTFM[LAL_NUM_IFO+1], REAL4 rightAscension, REAL4 declination, INT8 slideId, REAL4 *timeOffsets, UINT4 *acceptPointList, UINT4 numAcceptPoints, UINT4 slideNum, INT4 timeDiff, INT4 startTime)
#define CVS_SOURCE
void set_abrt_on_error(void)
Definition: errutil.c:82
sigmaKerr data[0]
int vrbflg
void XLALDestroyCOMPLEX8VectorSequence(COMPLEX8VectorSequence *vecseq)
uint64_t UINT8
double REAL8
int64_t INT8
uint32_t UINT4
int32_t INT4
float REAL4
FindChirpPTF
void XLALDestroyREAL4Vector(REAL4Vector *vector)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
int i
Definition: inspinj.c:596
struct @3 * skyPoints
int numSkyPoints
Definition: inspinj.c:558
head
temp
segStartTime
segEndTime
int startTime
INT4 numTmplts
Definition: randombank.c:84
LALDetector detectors[LAL_NUM_DETECTORS]
char * channel
COMPLEX8 * data
This structure contains a frequency domain template used as input to the FindChirpFilter() routine.
COMPLEX8Vector * data
Vector of length containing the frequency template data ; For a template generated in the frequency ...
COMPLEX8VectorSequence * PTFQtilde
UNDOCUMENTED.
This structure contains the parameters for generation of templates by the various template generation...
struct tagInspiralTemplate * next
INT4 gpsNanoSeconds
struct tagMultiInspiralTable * next
LIGOTimeGPS end_time
REAL4Sequence * data
LIGOTimeGPS epoch
REAL4 * data
COMPLEX8FrequencySeries * sgmnt
Definition: coh_PTF.h:263
UINT4 analStartPoint
Definition: coh_PTF.h:278
COMPLEX8Array * PTFM[LAL_NUM_IFO]
Definition: coh_PTF.h:247
COMPLEX8VectorSequence * PTFqVec[LAL_NUM_IFO+1]
Definition: coh_PTF.h:252
char * cvsRevision
Definition: coh_PTF.h:111
char * cvsSource
Definition: coh_PTF.h:112
char * programName
Definition: coh_PTF.h:110
char * cvsDate
Definition: coh_PTF.h:113
const char * channel[LAL_NUM_IFO]
Definition: coh_PTF.h:126
INT4 numSegments
Definition: tmpltbank.c:400
INT4 numPoints
Definition: tmpltbank.c:399