21#include <lal/AVFactories.h>
22#include <lal/LALConfig.h>
23#include <lal/LALConstants.h>
24#include <lal/LALDatatypes.h>
25#include <lal/LALInspiralBank.h>
26#include <lal/LALMalloc.h>
27#include <lal/LALStatusMacros.h>
28#include <lal/LALStdlib.h>
29#include <lal/LIGOMetadataTables.h>
30#include <lal/MatrixUtils.h>
31#include <lal/SeqFactories.h>
34#define UNUSED __attribute__ ((unused))
39#define INSPIRALSPINBANKC_ENOTILES 5
40#define INSPIRALSPINBANKC_MSGENOTILES "No templates were generated"
135 for(loop = 1; loop <=17; loop++){
136 moments->
j[loop] *= pow((inspiralTemplate->
fLower/(*f0)), ((7.0-(
REAL4) loop)/3.0));
144 J11 = moments->
j[11];
145 J12 = moments->
j[12];
146 J14 = moments->
j[14];
147 J17 = moments->
j[17];
151 metric->
data[0] = (
REAL4) 0.5*(J17-J12*J12-(J9-J4*J12)*(J9-J4*J12)/(J1-J4*J4));
152 metric->
data[1] = (
REAL4) 0.5*(J14-J9*J12-(J6-J4*J9)*(J9-J4*J12)/(J1-J4*J4));
154 metric->
data[3] = (
REAL4) 0.5*(J14-J9*J12-(J6-J4*J9)*(J9-J4*J12)/(J1-J4*J4));
155 metric->
data[4] = (
REAL4) 0.5*(J11-J9*J9-(J6-J4*J9)*(J6-J4*J9)/(J1-J4*J4));
160 metric->
data[8] = (
REAL4) 0.5*(J11-J9*J9-(J6-J4*J9)*(J6-J4*J9)/(J1-J4*J4));
167 "psi0-psi0 %e\npsi0-psi3 %e psi3-psi3 %e\npsi0-beta %e "
168 "psi3-beta %e beta-beta %e\n", metric->
data[0] /
169 pow(*f0,10./3), metric->
data[3] / pow(*f0,7./3),
170 metric->
data[4] / pow(*f0,4./3), metric->
data[6] /
171 pow(*f0,7./3), metric->
data[7] / pow(*f0,4./3),
172 metric->
data[8] / pow(*f0,4./3) );
175 "j6=%f j9=%f j11=%f j12=%f j14=%f j17=%f", *f0, J1, J4,
176 J6, J9, J11, J12, J14, J17 );
197 REAL4 mass, eta, m1, m2;
203 eta = 16.0457 * pow( -
x*
x/
y/
y/
y/
y/
y, 0.3333333 );
204 m1 = 0.5*mass* (1 + sqrt(1 - 4*eta));
205 m2 = 0.5*mass* (1 - sqrt(1 - 4*eta));
209 (*tmplt)->mass1 = m1;
210 (*tmplt)->mass2 = m2;
212 (*tmplt)->mchirp = pow(m1*m2,0.6)/pow(m1+m2,0.2);
214 (*tmplt)->psi0 =
x*pow(f0,5./3);
215 (*tmplt)->psi3 =
y*pow(f0,2./3);
216 (*tmplt)->beta = z*pow(f0,2./3);
291 REAL4 xp0, yp0, UNUSED zp0;
295 REAL4 m1Min=0, m1Max=0;
296 REAL4 m2Min=0, m2Max=0;
309 LALINSPIRALBANKH_MSGENULL );
312 LALINSPIRALBANKH_MSGECHOICE );
314 if( coarseIn->
mMin > 0 )
317 LALINSPIRALBANKH_MSGECHOICE );
326 LALINSPIRALBANKH_MSGECHOICE );
330 LALINSPIRALBANKH_MSGECHOICE );
339 LALINSPIRALBANKH_MSGENULL );
341 LALINSPIRALBANKH_MSGENULL );
346 cleanup(
status->statusPtr, &metric, &metricDimensions, &eigenval, *tiles, tmplt, ntiles);
348 metricDimensions->
data[0] = 3;
349 metricDimensions->
data[1] = 3;
352 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt, ntiles);
357 cleanup(
status->statusPtr,&metric, &metricDimensions,&eigenval,*tiles,tmplt, ntiles);
376 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
382 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt, ntiles);
387 cleanup(
status->statusPtr,&metric, &metricDimensions,&eigenval,*tiles,tmplt, ntiles);
393 if ( *tiles == NULL )
395 cleanup(
status->statusPtr, &metric, &metricDimensions, &eigenval,
396 *tiles, tmplt, ntiles);
402 if( eigenval->
data[0] <= 0 || eigenval->
data[1] <=0 || eigenval->
data[2]
407 dxp = 1.333333*sqrt(2*(1-coarseIn->
mmCoarse)/eigenval->
data[0]);
408 dyp = 1.333333*sqrt(2*(1-coarseIn->
mmCoarse)/eigenval->
data[1]);
409 dzp = 0.6666667*sqrt(2*(1-coarseIn->
mmCoarse)/eigenval->
data[2]);
411printf(
"theta is %e\n",
theta );
423 x0 = 0.9*(3.0/128) / (pow(
LAL_PI*f0*(m1Max+m2Max),1.666667)
424 *(m1Max*m2Max/pow(m1Max+m2Max,2)));
425 myy0 = 1.1*(-.375*
LAL_PI) / (pow(
LAL_PI*f0*(m1Max+m2Min),0.6666667)*(m1Max*m2Min/pow(m1Max+m2Min,2)));
427 x1 = 1.1*(3.0/128) / (pow(
LAL_PI*f0*(m1Min+m2Min),1.666667)*(m1Min*m2Min/pow(m1Min+m2Min,2)));
428 myy1 = .9*(-.375*
LAL_PI) / (pow(
LAL_PI*f0*(m1Min+m2Max),0.6666667)*(m1Min*m2Max/pow(m1Min+m2Max,2)));
429 z1 = 3.8*
LAL_PI/29.961432 * (1+0.75*m2Max/m1Min) * (m1Max/m2Min) * pow(
LAL_MTSUN_SI*100.0/(m1Min+m2Min), 0.6666667);
435 x0 = coarseIn->
psi0Min / pow( f0, 5./3 );
436 x1 = coarseIn->
psi0Max / pow( f0, 5./3 );
437 myy0 = coarseIn->
psi3Min / pow( f0, 2./3 );
438 myy1 = coarseIn->
psi3Max / pow( f0, 2./3 );
439 z0 = coarseIn->
betaMin / pow( f0, 2./3 );
440 z1 = coarseIn->
betaMax / pow( f0, 2./3 );
445 yp0 = myy0 - cos(
theta)*sin(
theta) * (x1 - x0);
446 yp1 = sin(
theta) * (x1 - x0) + cos(
theta) * (myy1 - myy0);
447 xp1 = sin(
theta) * (myy1 - myy0) + cos(
theta) * (x1 - x0);
452 for (zp = 0; zp <= zp1; zp += dzp)
455 for (yp = 0; yp<= yp1; yp += dyp)
457 for (xp = 0; xp <= xp1; xp += dxp)
465 || ( ! havePsi &&
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
467 allocate(
x,
y, z, f0, &tmplt, ntiles, havePsi );
470 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
478 || ( ! havePsi && !
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
482 || ( ! havePsi &&
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
484 allocate(
x,
y, z, f0, &tmplt, ntiles, havePsi );
487 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
497 || ( ! havePsi && !
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
501 || ( ! havePsi &&
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
503 allocate(
x,
y, z, f0, &tmplt, ntiles, havePsi );
505 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
515 || ( ! havePsi && !
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
519 || ( ! havePsi &&
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
521 allocate(
x,
y, z, f0, &tmplt, ntiles, havePsi );
523 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
534 || ( ! havePsi && !
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
538 || ( ! havePsi &&
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
540 allocate(
x,
y, z, f0, &tmplt, ntiles, havePsi );
542 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
552 || ( ! havePsi && !
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
556 || ( ! havePsi &&
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
558 allocate(
x,
y, z, f0, &tmplt, ntiles, havePsi );
560 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
570 || ( ! havePsi && !
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
574 || ( ! havePsi &&
test(
x,
y,z,m1Min,m1Max,m2Min,m2Max,f0) ) )
576 allocate(
x,
y, z, f0, &tmplt, ntiles, havePsi );
578 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
588 tmplt = (*tiles)->
next;
595 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,*tiles,tmplt,ntiles);
600 cleanup(
status->statusPtr,&metric,&metricDimensions,&eigenval,NULL,NULL,&cnt);
631 while ((t->
next) && (*nt > 0))
654 return xp0 + (
n*dxp + xp+dxp/2.0*(bccFlag%2))*cos(
theta) -
655 (yp+dyp/2.0*(bccFlag%2))*sin(
theta);
667 return (yp0 + (xp+dxp/2.0*((bccFlag)%2))*sin(
theta) +
668 (
n*dyp + yp+dyp/2.0*((bccFlag)%2))*cos(
theta));
689 REAL4 mass, eta, m1, m2, betaMax;
693 eta = 16.0457 * pow( -
x*
x/
y/
y/
y/
y/
y, 0.3333333 );
694 if (eta > 0.25 || eta < 0)
696 m1 = 0.5*mass* (1 + sqrt(1 - 4*eta));
697 m2 = 0.5*mass* (1 - sqrt(1 - 4*eta));
698 if (m1 > m1Max || m1 < m1Min || m2 > m2Max || m2 < m2Min)
700 betaMax = 3.8*
LAL_PI/29.961432 * (1+0.75*m2/m1)*(m1/m2) * pow((
LAL_MTSUN_SI*100.0/mass),0.6666667);
716 REAL4 fac1 = pow( f0, 5./3 );
717 REAL4 fac2 = fac1 / f0;
719 if ( psi0 < coarseIn->psi0Min/fac1 )
721 if ( psi0 > coarseIn->
psi0Max/fac1 )
723 if ( psi3 < coarseIn->psi3Min/fac2 )
725 if ( psi3 > coarseIn->
psi3Max/fac2 )
727 if ( beta < coarseIn->betaMin/fac2 )
729 if ( beta > coarseIn->
betaMax/fac2 )
static void cleanup(LALStatus *, REAL4Array **, UINT4Vector **, REAL4Vector **, SnglInspiralTable *, SnglInspiralTable *, INT4 *)
static REAL4 calculateZ(REAL4, REAL4, REAL4)
static BOOLEAN inPsiRegion(REAL4, REAL4, REAL4, InspiralCoarseBankIn *, REAL4)
static INT4 test(REAL4, REAL4, REAL4, REAL4, REAL4, REAL4, REAL4, REAL4)
static void LALInspiralSpinBankMetric(LALStatus *status, REAL4Array *metric, InspiralMomentsEtc *moments, InspiralTemplate *inspiralTemplate, REAL4 *f0)
static void allocate(REAL4 x, REAL4 y, REAL4 z, REAL4 f0, SnglInspiralTable **tmplt, INT4 *ntiles, BOOLEAN havePsi)
static REAL4 calculateY(REAL4, REAL4, REAL4, REAL4, REAL4, REAL4, INT4, REAL4)
static REAL4 calculateX(REAL4, REAL4, REAL4, REAL4, REAL4, REAL4, INT4, REAL4)
#define INSPIRALSPINBANKC_MSGENOTILES
#define INSPIRALSPINBANKC_ENOTILES
#define ABORT(statusptr, code, mesg)
#define ENDFAIL(statusptr)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define BEGINFAIL(statusptr)
void LALSCreateArray(LALStatus *, REAL4Array **, UINT4Vector *)
void LALSDestroyArray(LALStatus *, REAL4Array **)
void LALSSymmetricEigenVectors(LALStatus *stat, REAL4Vector *values, REAL4Array *matrix)
int LALInfo(LALStatus *status, const char *info)
#define LALINSPIRALBANKH_ECHOICE
Invalid choice for an input parameter.
#define LALINSPIRALBANKH_ENULL
Null pointer.
void LALInspiralSpinBank(LALStatus *status, SnglInspiralTable **tiles, INT4 *ntiles, InspiralCoarseBankIn *coarseIn)
This function creates a bank of BCVSpin templates to search for precessing binaries.
void LALGetInspiralMoments(LALStatus *status, InspiralMomentsEtc *moments, REAL8FrequencySeries *psd, InspiralTemplate *params)
#define LALINSPIRALBANKH_EMEM
Memory allocation failure.
void LALU4CreateVector(LALStatus *, UINT4Vector **, UINT4)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALU4DestroyVector(LALStatus *, UINT4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
Input for choosing a template bank.
REAL8 mMin
minimum mass of components to search for
REAL8FrequencySeries shf
Frequency series containing the PSD.
REAL8 psi3Min
minimum value of the parameter
REAL8 betaMin
UNDOCUMENTED.
REAL8 MMax
alternatively, maximum total mass of binary to search for
REAL8 fUpper
Upper frequency cutoff.
REAL8 fLower
Lower frequency cutoff.
REAL8 psi3Max
maximum value of the parameter
REAL8 mmCoarse
Coarse grid minimal match.
REAL8 betaMax
UNDOCUMENTED.
REAL8 psi0Min
minimum value of the parameter
REAL8 psi0Max
maximum value of the parameter
Parameter structure that holds the moments of the PSD and other useful constants required in the comp...
REAL8 j[18]
The required moments are all computed once and stored in this array; The required moments are from J(...
The inspiral waveform parameter structure containing information about the waveform to be generated.
REAL8 fCutoff
upper frequency cutoff in Hz to be used in generating the waveform; If the last stable orbit frequenc...
REAL8 fLower
lower frequency cutoff of the detector in Hz (input)
struct tagSnglInspiralTable * next