Loading [MathJax]/extensions/TeX/AMSsymbols.js
LAL 7.7.0.1-00ddc7f
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
CreateDetector.c
Go to the documentation of this file.
1/*
2* Copyright (C) 2007 David Chin, Jolien Creighton, Peter Shawhan, John Whelan
3*
4* This program is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation; either version 2 of the License, or
7* (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with with program; see the file COPYING. If not, write to the
16* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17* MA 02110-1301 USA
18*/
19
20#include <lal/LALStdlib.h>
21#include <lal/LALConstants.h>
22#include <math.h>
23#include <string.h>
24#include <lal/DetectorSite.h>
25
26/**
27 * \defgroup CreateDetector_c Module CreateDetector.c
28 * \ingroup LALDetectors_h
29 *
30 * \author J. T. Whelan <john.whelan@ligo.org>
31 *
32 * \brief Creates a \c LALDetector structure from a \c LALFrDetector structure and the type of detector.
33 *
34 * This routine takes the site geometry described in the
35 * \c LALFrDetector structure, along with a
36 * \c LALDetectorType parameter, and constructs the Cartesian
37 * detector location and response tensor needed to fill the
38 * \c LALDetector output.
39 *
40 * The detector type is needed because different types of detectors have
41 * different response tensors. In each case the response tensor is
42 * determined by the unit vectors \f$\hat{u}_X\f$ and \f$\hat{u}_Y\f$
43 * which are constant in an Earth-fixed rotating reference frame and
44 * point in the "X arm" and "Y arm" directions, respectively; the
45 * headings of these directions in a local frame at the detector are
46 * stored in the \c LALFrDetector structure.
47 *
48 * The detector types recognized are (all names are prefaced by \c LALDETECTORTYPE_):
49 * <ul>
50 * <li>[\c IFODIFF] An interferometer in differential mode. The
51 * response tensor is given by \f$d^{ab}=\frac{1}{2} (u_X^au_X^b-u_Y^au_Y^b)\f$.
52 * Note that this is the preferred form even in the two arms of the
53 * detector are not perpendicular (e.g., at the GEO600 site).</li>
54 * <li>[\c IFOXARM] An interferometer in one-armed mode with the
55 * X arm active. The response tensor is given by
56 * \f$d^{ab}=\frac{1}{2}u_X^au_X^b\f$.</li>
57 * <li>[\c IFOYARM] An interferometer in one-armed mode with the
58 * Y arm active. The response tensor is given by
59 * \f$d^{ab}=\frac{1}{2}u_Y^au_Y^b\f$.</li>
60 * <li>[\c IFOCOMM] An interferometer in common mode. The
61 * response tensor is given by \f$d^{ab}=\frac{1}{2} (u_X^au_X^b+u_Y^au_Y^b)\f$.</li>
62 * <li>[\c CYLBAR] A cylindrical bar detector. In this case the
63 * "X arm" is actually the symmetry axis of the bar, and the "Y arm"
64 * is ignored. The response tensor is
65 * \f$d^{ab}=u_X^au_X^b\f$.</li>
66 * </ul>
67 *
68 * In each of these cases, the basic transformation needed is to express a
69 * unit vector \f$\hat{u}\f$ in terms of its
70 * components in the Earth-fixed basis
71 * \f$\{\hat{e}_1,\hat{e}_2,\hat{e}_3\}\f$. The altitude angle \f${\mathcal{A}}\f$ and
72 * azimuth angle \f$\zeta\f$ allow us to express the unit vector \f$\hat{u}\f$
73 * corresponding to a direction in terms of an orthonormal basis consisting
74 * of a vector \f$\hat{e}_{\scriptstyle\textrm{E}}\f$ pointing due East within the
75 * local horizontal, a vector \f$\hat{e}_{\scriptstyle\textrm{N}}\f$ pointing due
76 * North within the local horizontal, and an upward-pointing vector
77 * \f$\hat{e}_{\scriptstyle\textrm{U}}\f$ normal to the local horizontal
78 * plane. [These form a right-handed basis, providing an answer to
79 * the age-old question "What's Up?": "East cross North."]
80 * The relationship is
81 * \f{equation}{
82 * \hat{u} = ( \hat{e}_{\scriptstyle\textrm{E}}\sin\zeta
83 * + \hat{e}_{\scriptstyle\textrm{N}}\cos\zeta )
84 * \cos{\mathcal{A}}
85 * + \hat{e}_{\scriptstyle\textrm{U}} \sin{\mathcal{A}}
86 * \ .
87 * \f}
88 * Since the local horizontal is defined as the tangent plane to the
89 * reference ellipsoid at the point with the detector's latitude \f$\beta\f$
90 * and longitude \f$\lambda\f$, the local basis is related to the orthonormal
91 * basis
92 * \f$\{\hat{e}_\rho,\hat{e}_\lambda,\hat{e}_z\}\f$ of a cylindrical
93 * coördinate system (related to the Earth-fixed Cartesian
94 * coördinates by \f$x^1=\rho\cos\lambda\f$, \f$x^2=\rho\sin\lambda\f$, \f$x^3=z\f$,
95 * so that \f$\hat{e}_\rho\f$ points away from the Earth's axis,
96 * \f$\hat{e}_\lambda\f$ points in the direction of increasing longitude, and
97 * n\f$\hat{e}_z\f$ points in the direction of increasing \f$x^3\f$)
98 * by
99 * \f{align}{
100 * \hat{e}_{\scriptstyle\textrm{E}} &= \hat{e}_\lambda \\
101 * \hat{e}_{\scriptstyle\textrm{N}} &= - \hat{e}_\rho \sin\beta
102 * + \hat{e}_z \cos\beta \\
103 * \hat{e}_{\scriptstyle\textrm{U}} &= \hat{e}_\rho \cos\beta
104 * + \hat{e}_z \sin\beta
105 * \f}
106 * It is then straightforward to relate the cylindrical basis vectors to
107 * those in the Earth-fixed Cartesian system by
108 * \f{align}{
109 * \hat{e}_\rho &= \hat{e}_1\cos\lambda + \hat{e}_2\sin\lambda \\
110 * \hat{e}_\lambda &= -\hat{e}_1\sin\lambda + \hat{e}_2\cos\lambda \\
111 * \hat{e}_z &= \hat{e}_3
112 * \f}
113 *
114 * To express \f$\hat{u}\f$ in the Cartesian basis, we need
115 * \f$\hat{u}\cdot\hat{e}_1\f$, \f$\hat{u}\cdot\hat{e}_2\f$, and
116 * \f$\hat{u}\cdot\hat{e}_3\f$. We first observe that
117 * \f{align}{
118 * \label{tools_e_eE}
119 * \hat{u}\cdot\hat{e}_{\scriptstyle\textrm{E}} &= \cos{\mathcal{A}}\,\sin\zeta \\
120 * \hat{u}\cdot\hat{e}_{\scriptstyle\textrm{N}} &= \cos{\mathcal{A}}\,\cos\zeta \\
121 * \hat{u}\cdot\hat{e}_{\scriptstyle\textrm{U}} &= \sin{\mathcal{A}}
122 * \f}
123 * then that
124 * \f{align}{
125 * \hat{u}\cdot\hat{e}_\rho &= (\hat{u}\cdot\hat{e}_{\scriptstyle\textrm{N}})
126 * (\hat{e}_{\scriptstyle\textrm{N}}\cdot\hat{e}_\rho)
127 * + (\hat{u}\cdot\hat{e}_{\scriptstyle\textrm{U}})
128 * (\hat{e}_{\scriptstyle\textrm{U}}\cdot\hat{e}_\rho)
129 * = -(\hat{u}\cdot\hat{e}_{\scriptstyle\textrm{N}}) \sin\beta
130 * +(\hat{u}\cdot\hat{e}_{\scriptstyle\textrm{U}}) \cos\beta \\
131 * \hat{u}\cdot\hat{e}_\lambda &=& \hat{u}\cdot\hat{e}_{\scriptstyle\textrm{E}}\\
132 * \hat{u}\cdot\hat{e}_z &= (\hat{u}\cdot\hat{e}_{\scriptstyle\textrm{N}})
133 * (\hat{e}_{\scriptstyle\textrm{N}}\cdot\hat{e}_z)
134 * + (\hat{u}\cdot\hat{e}_{\scriptstyle\textrm{U}})
135 * (\hat{e}_{\scriptstyle\textrm{U}}\cdot\hat{e}_z)
136 * = (\hat{u}\cdot\hat{e}_{\scriptstyle\textrm{N}}) \cos\beta
137 * +(\hat{u}\cdot\hat{e}_{\scriptstyle\textrm{U}}) \sin\beta
138 * \f}
139 * and finally that
140 * \f{align}{
141 * \label{tools_e_e3ez}
142 * \hat{u}\cdot\hat{e}_1 &= (\hat{u}\cdot\hat{e}_\rho)
143 * (\hat{e}_\rho\cdot\hat{e}_1)
144 * + (\hat{u}\cdot\hat{e}_\lambda)
145 * (\hat{e}_\lambda\cdot\hat{e}_1)
146 * = (\hat{u}\cdot\hat{e}_\rho) \cos\lambda
147 * -(\hat{u}\cdot\hat{e}_\lambda) \sin\lambda \\
148 * \hat{u}\cdot\hat{e}_2 &= (\hat{u}\cdot\hat{e}_\rho)
149 * (\hat{e}_\rho\cdot\hat{e}_2)
150 * + (\hat{u}\cdot\hat{e}_\lambda)
151 * (\hat{e}_\lambda\cdot\hat{e}_2)
152 * = (\hat{u}\cdot\hat{e}_\rho) \sin\lambda
153 * +(\hat{u}\cdot\hat{e}_\lambda) \cos\lambda \\
154 * \hat{u}\cdot\hat{e}_3 &= \hat{u}\cdot\hat{e}_z
155 * \f}
156 *
157 * ### Cached Detectors ###
158 *
159 * To avoid repeatedly calculating the Cartesian coördinates and
160 * response tensor of known detectors, the constant array
161 * <tt>lalCachedDetectors[]</tt> contains the site geometry and
162 * response tensors of the most commonly used detectors. These are
163 * defined in this file and listed in \ref tools_tab_cached "this table".
164 *
165 * ### Algorithm ###
166 *
167 * <tt>XLALCreateDetector()</tt> first checks the
168 * <tt>lalCachedDetectors[]</tt> array to see if the specified type and
169 * the name in the input \c LALFrDetector match any of the
170 * predefined constant detectors. If so, it returns a copy of the
171 * constant detector (not just a pointer to the constant).
172 *
173 * If not, it calculates the Cartesian coördinates \f$\{x^1,x^2,x^3\}\f$
174 * of the detector location defined by \eqref{tools_e_cart1}--\eqref{tools_e_cart3};
175 * in
176 * particular, it calculates the denominator
177 * \f$\sqrt{a^2\cos^2\beta+b^2\sin^2\beta}\f$ and the distance from the axis
178 * \f{equation}{
179 * \rho = \left(\frac{a^2}{\sqrt{a^2\cos^2\beta+b^2\sin^2\beta}} + h \right)
180 * \cos\beta
181 * \f}
182 * as intermediate steps.
183 *
184 * It then calculates the Cartesian components of the unit vectors
185 * \f$\hat{u}_X\f$ and \f$\hat{u}_Y\f$ in the arm directions from the altitude
186 * and azimuth angles by use of a \c static function which
187 * implements \eqref{tools_e_eE}--\eqref{tools_e_e3ez}. (Depending on the detector
188 * type specified, only the unit vector(s) which are actually needed are
189 * calculated.) Using this components it constructs \f$d^{ab}\f$ according
190 * to the formula appropriate to the detector type.
191 *
192 * The calculation of \f$x^a\f$ is done to double precision, that of \f$d^{ab}\f$
193 * to single precision.
194 *
195 * ### Notes ###
196 *
197 * <ul>
198 * <li> The conventions in the \c LALFrDetector structure are based
199 * on version 6 of the frame specification \cite LIGOVIRGO_2000 .</li>
200 * <li> If the location and response tensor information for a
201 * \c LALDetector are filled in by hand (e.g., for testing
202 * purposes), the \c type field should be set to
203 * #LALDETECTORTYPE_ABSENT.</li>
204 * <li> The range of \c LALDetectorType could be expanded to
205 * include the monopole and five quadrupole modes for a spherical
206 * resonant detector
207 * \cite Maggiore2000b , \cite Zhou_1995 , \cite Bianchi_1998 , \cite Maggiore2000a .</li>
208 * </ul>
209 *
210 * <b>Table tools_tab_cached:</b> Selected redefined gravitational wave detectors, contained in the ::lalCachedDetectors array.
211 * Not shown in the table are the LHO 2km detector (H2) and the bar detectors ALLEGRO, AURIGA, EXPLORER, NIOBE and NAUTILUS.
212 * The LIGO site data come directly from \cite Althouse_1999 , including the Cartesian position vectors \f$x^a\f$ and the response tensor
213 * \f$d^{ab}\f$, which was dermined from the quoted components of the detector frame basis vectors \f$\hat{x}_G\equiv\hat{u}_X\f$ and
214 * \f$\hat{y}_G\equiv\hat{u}_Y\f$. The data on the other detectors comes from \cite ABCCRW_2001 .
215 * \anchor tools_tab_cached
216 * <table>
217 * <tr><th>index</th><th>\c LAL_LHO_4K_DETECTOR</th><th>\c LAL_LLO_4K_DETECTOR</th></tr>
218 * <tr><td> prefix</td><td>\c H1 </td><td>\c L1 </td></tr>
219 * <tr><td> \f$x^a\f$</td><td>
220 * \f[
221 * \left(
222 * \begin{array}{c}
223 * -2.1614149 \times 10^6 \\
224 * -3.8346952 \times 10^6 \\
225 * 4.6003502 \times 10^6 \\
226 * \end{array}
227 * \right)
228 * \f]
229 * </td><td>
230 * \f[
231 * \left(
232 * \begin{array}{c}
233 * -74276.044\\
234 * -5.496283721\times 10^6\\
235 * 3.224257018\times 10^6\\
236 * \end{array}
237 * \right)
238 * \f]
239 * </td></tr>
240 * <tr><td> \f$d^{ab}\f$
241 * </td><td>
242 * \f[
243 * \left(
244 * \begin{array}{ccc}
245 * v -0.3926141 & -0.0776130 & -0.2473886 \\
246 * -0.0776130 & 0.3195244 & 0.2279981 \\
247 * -0.2473886 & 0.2279981 & 0.0730903 \\
248 * \end{array}
249 * \right)
250 * \f]
251 * </td><td>
252 * \f[
253 * \left(
254 * \begin{array}{ccc}
255 * 0.4112809 & 0.1402097 & 0.2472943 \\
256 * 0.1402097 & -0.1090056 & -0.1816157 \\
257 * 0.2472943 & -0.1816157 & -0.3022755 \\
258 * \end{array}
259 * \right)
260 * \f]
261 * </td></tr>
262 * <tr><td> type</td><td>\c LALDETECTORTYPE_IFODIFF</td><td>\c LALDETECTORTYPE_IFODIFF</td></tr>
263 * <tr><td> name</td><td>LHO_4k</td><td>LLO_4k</td></tr>
264 * <tr><td> \f$(\lambda,\beta,h)\f$
265 * </td><td>\f$(-(119^\circ24'27"\!\!.5657),46^\circ27'18"\!\!.528, 142.544\,\textrm{m})\f$
266 * </td><td>\f$(-(90^\circ46'27"\!\!.2654),30^\circ33'46\!\!.4196, -6.574\,\textrm{m})\f$
267 * </td></tr>
268 * <tr><td> \f$({\mathcal{A}}_X,\zeta_X)\f$
269 * </td><td>\f$( -6.195\times 10^{-4}, 324^\circ\!\!.0006)\f$
270 * </td><td>\f$( -3.121\times 10^{-4}, 252^\circ\!\!.2835)\f$
271 * </td></tr>
272 * <tr><td> \f$({\mathcal{A}}_Y,\zeta_Y)\f$
273 * </td><td>\f$( 1.25\times 10^{-5}, 234^\circ\!\!.0006)\f$
274 * </td><td>\f$( -6.107\times 10^{-4}, 162^\circ\!\!.2835)\f$
275 * </td></tr>
276 * <tr><td> \f$(L_X/2,L_Y/2)\f$ </td><td>\f$(2000\,\textrm{m},2000\,\textrm{m})\f$ </td><td>\f$(2000\,\textrm{m},2000\,\textrm{m})\f$ </td></tr>
277 * </table>
278 *
279 * <br>
280 * <table class="doxtable">
281 * <tr><th> index</th><th>\c LAL_VIRGO_DETECTOR </th><th>\c LAL_GEO_600_DETECTOR</th></tr>
282 * <tr><td> \f$x^a\f$
283 * </td><td>
284 * \f[
285 * \left(
286 * \begin{array}{c}
287 * 4.54637409863 \times 10^6 \\
288 * 842989.697467 \\
289 * 4.37857696275\times 10^6 \\
290 * \end{array}
291 * \right)
292 * \f]
293 * </td><td>
294 * \f[
295 * \left(
296 * \begin{array}{c}
297 * 3.85630994953 \times 10^6 \\
298 * 666598.956352 \\
299 * 5.01964141692 \times 10^6 \\
300 * \end{array}
301 * \right)
302 * \f]
303 * </td></tr>
304 * <tr><td> \f$d^{ab}\f$
305 * </td><td>
306 * \f[
307 * \left(
308 * \begin{array}{ccc}
309 * 0.2438740 & -0.0990838 & -0.2325762 \\
310 * -0.0990838 & -0.4478258 & 0.1878331 \\
311 * -0.2325762 & 0.1878331 & 0.2039518 \\
312 * \end{array}
313 * \right)
314 * \f]
315 * </td><td>
316 * \f[
317 * \left(
318 * \begin{array}{ccc}
319 * -0.0968250 & -0.3657823 & 0.1221373 \\
320 * -0.3657823 & 0.2229681 & 0.2497174 \\
321 * 0.1221373 & 0.2497174 & -0.1261431 \\
322 * \end{array}
323 * \right)
324 * \f]
325 * </td></tr>
326 * <tr><td> type</td><td>\c LALDETECTORTYPE_IFODIFF</td><td>\c LALDETECTORTYPE_IFODIFF </td></tr>
327 * <tr><td> name</td><td>VIRGO</td><td>GEO_600 </td></tr>
328 * <tr><td> \f$(\lambda,\beta,h)\f$
329 * </td><td>\f$(10^\circ30'16"\!\!.1878,43^\circ37'\!\!53".0921, 51.884\,\textrm{m})\f$
330 * </td><td>\f$(9^\circ48'25"\!\!.894,52^\circ14'42"\!\!.528, 114.425\,\textrm{m})\f$
331 * </td></tr>
332 * <tr><td> \f$({\mathcal{A}}_X,\zeta_X)\f$
333 * </td><td>\f$( 0, 19^\circ\!\!.4326)\f$
334 * </td><td>\f$( 0, 68^\circ\!\!.3883)\f$
335 * </td></tr>
336 * <tr><td> \f$({\mathcal{A}}_Y,\zeta_Y)\f$
337 * </td><td>\f$( 0, 289^\circ\!\!.4326)\f$
338 * </td><td>\f$( 0, 334^\circ\!\!.0569)\f$
339 * </td></tr>
340 * <tr><td> \f$(L_X/2,L_Y/2)\f$ </td><td>\f$(1500\,\textrm{m},1500\,\textrm{m})\f$ </td><td>\f$(300\,\textrm{m},300\,\textrm{m})\f$ </td></tr>
341 * </table>
342 *
343 * <br>
344 * <table class="doxtable">
345 * <tr><th>index</th><th>\c LAL_TAMA_300_DETECTOR </th><th>\c LAL_CIT_40_DETECTOR </th></tr>
346 * <tr><td> \f$x^a\f$
347 * </td><td>
348 * \f[
349 * \left(
350 * \begin{array}{c}
351 * -3.94640898771 \times 10^6 \\
352 * 3.36625903242 \times 10^6 \\
353 * 3.69915069189 \times 10^6 \\
354 * \end{array}
355 * \right)
356 * \f]
357 * </td><td>
358 * \f[
359 * \left(
360 * \begin{array}{c}
361 * -2.49064958399 \times 10^6 \\
362 * -4.65869968229 \times 10^6 \\
363 * 3.56206411337 \times 10^6 \\
364 * \end{array}
365 * \right)
366 * \f]
367 * </td></tr>
368 * <tr><td> \f$d^{ab}\f$
369 * </td><td>
370 * \f[
371 * \left(
372 * \begin{array}{ccc}
373 * 0.1121397 & 0.3308421 & -0.1802193 \\
374 * 0.3308421 & 0.2177940 & 0.1537258 \\
375 * -0.1802193 & 0.1537258 & -0.3299337 \\
376 * \end{array}
377 * \right)
378 * \f]
379 * </td><td>
380 * \f[
381 * \left(
382 * \begin{array}{ccc}
383 * -0.3537959 & 0.2734713 & 0.1095458 \\
384 * 0.2734713 & 0.0115214 & 0.2049027 \\
385 * 0.1095458 & 0.2049027 & 0.3422745 \\
386 * \end{array}
387 * \right)
388 * \f]
389 * </td></tr>
390 * <tr><td> type</td><td>\c LALDETECTORTYPE_IFODIFF</td><td>\c LALDETECTORTYPE_IFODIFF </td></tr>
391 * <tr><td> name</td><td>TAMA_300</td><td>CIT_40 </td></tr>
392 * <tr><td> \f$(\lambda,\beta,h)\f$
393 * </td><td>\f$(139^\circ32'9"\!\!.8,35^\circ40'35"\!\!.6, 90\,\textrm{m})\f$
394 * </td><td>\f$(-118^\circ\!\!.13,34^\circ\!\!.17, 0\,\textrm{m})\f$
395 * </td></tr>
396 * <tr><td> \f$({\mathcal{A}}_X,\zeta_X)\f$
397 * </td><td>\f$( 0, 270^\circ)\f$
398 * </td><td>\f$( 0, 180^\circ)\f$
399 * </td></tr>
400 * <tr><td> \f$({\mathcal{A}}_Y,\zeta_Y)\f$
401 * </td><td>\f$( 0, 180^\circ)\f$
402 * </td><td>\f$(0, 90^\circ)\f$
403 * </td></tr>
404 * <tr><td> \f$(L_X/2,L_Y/2)\f$
405 * </td><td>\f$(150\,\textrm{m},150\,\textrm{m})\f$
406 * </td><td>\f$(20\,\textrm{m},20\,\textrm{m})\f$
407 * </td></tr>
408 * </table>
409 */
410/** @{ */
411
412/* { name,
413 vertexLatitiudeRadians,
414 vertexLongitudeRadians,
415 vertexElevation,
416 xArmAltitudeRadians, xArmAzimuthRadians,
417 yArmAltitudeRadians, yArmAzimuthRadians } */
418
419/* New method for creating cached detectors:
420 *
421 * Construct the detector structures from the macros describing the
422 * detectors.
423 *
424 * Use a bit of macro magic to do this.
425 */
426
427#define LAL_CAT(x,y) x ## y
428#define LAL_XCAT(x,y) LAL_CAT(x,y)
429
430/** expands to constant c of detector d */
431#define LAL_DETECTOR_CONSTANT(d,c) LAL_XCAT(LAL_XCAT(LAL_,d),LAL_XCAT(_,c))
432
433/** initializer for detector location vector */
434#define LAL_DETECTOR_LOCATION(d) \
435{ \
436 LAL_DETECTOR_CONSTANT(d,VERTEX_LOCATION_X_SI),\
437 LAL_DETECTOR_CONSTANT(d,VERTEX_LOCATION_Y_SI),\
438 LAL_DETECTOR_CONSTANT(d,VERTEX_LOCATION_Z_SI) \
439}
440
441/** expands to component c (X,Y,Z) of arm X of detector d */
442#define LAL_ARM_X(d,c) LAL_DETECTOR_CONSTANT(d,LAL_XCAT(ARM_X_DIRECTION_,c))
443
444/** expands to component c (X,Y,Z) of arm Y of detector d */
445#define LAL_ARM_Y(d,c) LAL_DETECTOR_CONSTANT(d,LAL_XCAT(ARM_Y_DIRECTION_,c))
446
447/** expands to component c (X,Y,Z) of axis of detector d */
448#define LAL_AXIS(d,c) LAL_DETECTOR_CONSTANT(d,LAL_XCAT(AXIS_DIRECTION_,c))
449
450/** expands to a 3x3 matix initializer for the response for IFODIFF detector d */
451#define LAL_DETECTOR_RESPONSE_IFODIFF(d) \
452{ \
453 { \
454 0.5*( LAL_ARM_X(d,X) * LAL_ARM_X(d,X) - LAL_ARM_Y(d,X) * LAL_ARM_Y(d,X) ), \
455 0.5*( LAL_ARM_X(d,X) * LAL_ARM_X(d,Y) - LAL_ARM_Y(d,X) * LAL_ARM_Y(d,Y) ), \
456 0.5*( LAL_ARM_X(d,X) * LAL_ARM_X(d,Z) - LAL_ARM_Y(d,X) * LAL_ARM_Y(d,Z) ) \
457 }, \
458 { \
459 0.5*( LAL_ARM_X(d,Y) * LAL_ARM_X(d,X) - LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,X) ), \
460 0.5*( LAL_ARM_X(d,Y) * LAL_ARM_X(d,Y) - LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,Y) ), \
461 0.5*( LAL_ARM_X(d,Y) * LAL_ARM_X(d,Z) - LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,Z) ) \
462 }, \
463 { \
464 0.5*( LAL_ARM_X(d,Z) * LAL_ARM_X(d,X) - LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,X) ), \
465 0.5*( LAL_ARM_X(d,Z) * LAL_ARM_X(d,Y) - LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,Y) ), \
466 0.5*( LAL_ARM_X(d,Z) * LAL_ARM_X(d,Z) - LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,Z) ) \
467 } \
468}
469
470/** expands to a 3x3 matix initializer for the response for IFOCOMM detector d */
471#define LAL_DETECTOR_RESPONSE_IFOCOMM(d) \
472{ \
473 { \
474 0.5*( LAL_ARM_X(d,X) * LAL_ARM_X(d,X) + LAL_ARM_Y(d,X) * LAL_ARM_Y(d,X) ), \
475 0.5*( LAL_ARM_X(d,X) * LAL_ARM_X(d,Y) + LAL_ARM_Y(d,X) * LAL_ARM_Y(d,Y) ), \
476 0.5*( LAL_ARM_X(d,X) * LAL_ARM_X(d,Z) + LAL_ARM_Y(d,X) * LAL_ARM_Y(d,Z) ) \
477 }, \
478 { \
479 0.5*( LAL_ARM_X(d,Y) * LAL_ARM_X(d,X) + LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,X) ), \
480 0.5*( LAL_ARM_X(d,Y) * LAL_ARM_X(d,Y) + LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,Y) ), \
481 0.5*( LAL_ARM_X(d,Y) * LAL_ARM_X(d,Z) + LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,Z) ) \
482 }, \
483 { \
484 0.5*( LAL_ARM_X(d,Z) * LAL_ARM_X(d,X) + LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,X) ), \
485 0.5*( LAL_ARM_X(d,Z) * LAL_ARM_X(d,Y) + LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,Y) ), \
486 0.5*( LAL_ARM_X(d,Z) * LAL_ARM_X(d,Z) + LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,Z) ) \
487 } \
488}
489
490/** expands to a 3x3 matix initializer for the response for IFOXARM detector d */
491#define LAL_DETECTOR_RESPONSE_IFOXARM(d) \
492{ \
493 { \
494 0.5 * LAL_ARM_X(d,X) * LAL_ARM_X(d,X), \
495 0.5 * LAL_ARM_X(d,X) * LAL_ARM_X(d,Y), \
496 0.5 * LAL_ARM_X(d,X) * LAL_ARM_X(d,Z) \
497 }, \
498 { \
499 0.5 * LAL_ARM_X(d,Y) * LAL_ARM_X(d,X), \
500 0.5 * LAL_ARM_X(d,Y) * LAL_ARM_X(d,Y), \
501 0.5 * LAL_ARM_X(d,Y) * LAL_ARM_X(d,Z) \
502 }, \
503 { \
504 0.5 * LAL_ARM_X(d,Z) * LAL_ARM_X(d,X), \
505 0.5 * LAL_ARM_X(d,Z) * LAL_ARM_X(d,Y), \
506 0.5 * LAL_ARM_X(d,Z) * LAL_ARM_X(d,Z) \
507 } \
508}
509
510/** expands to a 3x3 matix initializer for the response for IFOYARM detector d */
511#define LAL_DETECTOR_RESPONSE_IFOYARM(d) \
512{ \
513 { \
514 0.5 * LAL_ARM_Y(d,X) * LAL_ARM_Y(d,X), \
515 0.5 * LAL_ARM_Y(d,X) * LAL_ARM_Y(d,Y), \
516 0.5 * LAL_ARM_Y(d,X) * LAL_ARM_Y(d,Z) \
517 }, \
518 { \
519 0.5 * LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,X), \
520 0.5 * LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,Y), \
521 0.5 * LAL_ARM_Y(d,Y) * LAL_ARM_Y(d,Z) \
522 }, \
523 { \
524 0.5 * LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,X), \
525 0.5 * LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,Y), \
526 0.5 * LAL_ARM_Y(d,Z) * LAL_ARM_Y(d,Z) \
527 } \
528}
529
530/** expands to a 3x3 matix initializer for the response for CYLBAR detector d */
531#define LAL_DETECTOR_RESPONSE_CYLBAR(d) \
532{ \
533 { \
534 LAL_AXIS(d,X) * LAL_AXIS(d,X), \
535 LAL_AXIS(d,X) * LAL_AXIS(d,Y), \
536 LAL_AXIS(d,X) * LAL_AXIS(d,Z) \
537 }, \
538 { \
539 LAL_AXIS(d,Y) * LAL_AXIS(d,X), \
540 LAL_AXIS(d,Y) * LAL_AXIS(d,Y), \
541 LAL_AXIS(d,Y) * LAL_AXIS(d,Z) \
542 }, \
543 { \
544 LAL_AXIS(d,Z) * LAL_AXIS(d,X), \
545 LAL_AXIS(d,Z) * LAL_AXIS(d,Y), \
546 LAL_AXIS(d,Z) * LAL_AXIS(d,Z) \
547 } \
548}
549
550#define LAL_FR_STREAM_DETECTOR_STRUCT(d) \
551{ \
552 LAL_DETECTOR_CONSTANT(d,DETECTOR_NAME), \
553 LAL_DETECTOR_CONSTANT(d,DETECTOR_PREFIX), \
554 LAL_DETECTOR_CONSTANT(d,DETECTOR_LONGITUDE_RAD), \
555 LAL_DETECTOR_CONSTANT(d,DETECTOR_LATITUDE_RAD), \
556 LAL_DETECTOR_CONSTANT(d,DETECTOR_ELEVATION_SI), \
557 LAL_DETECTOR_CONSTANT(d,DETECTOR_ARM_X_ALTITUDE_RAD), \
558 LAL_DETECTOR_CONSTANT(d,DETECTOR_ARM_X_AZIMUTH_RAD), \
559 LAL_DETECTOR_CONSTANT(d,DETECTOR_ARM_Y_ALTITUDE_RAD), \
560 LAL_DETECTOR_CONSTANT(d,DETECTOR_ARM_Y_AZIMUTH_RAD), \
561 LAL_DETECTOR_CONSTANT(d,DETECTOR_ARM_X_MIDPOINT_SI), \
562 LAL_DETECTOR_CONSTANT(d,DETECTOR_ARM_Y_MIDPOINT_SI) \
563}
564
565#define LAL_DETECTOR_RESPONSE(d,t) \
566 LAL_XCAT( LAL_DETECTOR_RESPONSE_, t )(d)
567
568#define LAL_DETECTOR_STRUCT(d,t) \
569{ \
570 LAL_DETECTOR_LOCATION(d), \
571 LAL_DETECTOR_RESPONSE(d,t), \
572 LAL_XCAT(LALDETECTORTYPE_,t), \
573 LAL_FR_STREAM_DETECTOR_STRUCT(d) \
574}
575
576/** Pre-existing detectors. */
578 LAL_DETECTOR_STRUCT( TAMA_300, IFODIFF ),
579 LAL_DETECTOR_STRUCT( VIRGO_CITF, IFODIFF ),
580 LAL_DETECTOR_STRUCT( VIRGO, IFODIFF ),
581 LAL_DETECTOR_STRUCT( GEO_600, IFODIFF ),
582 LAL_DETECTOR_STRUCT( LHO_2K, IFODIFF ),
583 LAL_DETECTOR_STRUCT( LHO_4K, IFODIFF ),
584 LAL_DETECTOR_STRUCT( LLO_4K, IFODIFF ),
585 LAL_DETECTOR_STRUCT( CIT_40, IFODIFF ),
586 LAL_DETECTOR_STRUCT( ALLEGRO_320, CYLBAR ),
587 LAL_DETECTOR_STRUCT( AURIGA, CYLBAR ),
588 LAL_DETECTOR_STRUCT( EXPLORER, CYLBAR ),
589 LAL_DETECTOR_STRUCT( NIOBE, CYLBAR ),
590 LAL_DETECTOR_STRUCT( NAUTILUS, CYLBAR ),
591 LAL_DETECTOR_STRUCT( ACIGA, IFODIFF ),
592 LAL_DETECTOR_STRUCT( KAGRA, IFODIFF ),
593 LAL_DETECTOR_STRUCT( LIO_4K, IFODIFF ),
594 LAL_DETECTOR_STRUCT( ET1, IFODIFF ),
595 LAL_DETECTOR_STRUCT( ET2, IFODIFF ),
596 LAL_DETECTOR_STRUCT( ET3, IFODIFF ),
597 LAL_DETECTOR_STRUCT( ET0, IFODIFF ),
598};
599
600
601static
603 REAL8 cosAlt, REAL8 sinAlt,
604 REAL8 cosAz, REAL8 sinAz,
605 REAL8 cosLat, REAL8 sinLat,
606 REAL8 cosLon, REAL8 sinLon )
607{
608 REAL8 uNorth = cosAlt * cosAz;
609 REAL8 uEast = cosAlt * sinAz;
610 /* uUp == sinAlt */
611 REAL8 uRho = - sinLat * uNorth + cosLat * sinAlt;
612 /* uLambda == uEast */
613
614#if LALDETECTORSH_PRINTF
615 printf("uNorth = %g\n",uNorth);
616 printf("uEast = %g\n",uEast);
617 printf("uUp = %g\n",sinAlt);
618 printf("uRho = %g\n",uRho);
619#endif
620
621 u[0] = cosLon * uRho - sinLon * uEast;
622 u[1] = sinLon * uRho + cosLon * uEast;
623 u[2] = cosLat * uNorth + sinLat * sinAlt;
624
625 return;
626}
627
628
629/** UNDOCUMENTED */
631 const LALFrDetector *frDetector, LALDetectorType type )
632
633{
634 INT2 i, j;
635 REAL8 latRad, lonRad;
636 REAL8 cosLat, sinLat, cosLon, sinLon;
637 REAL8 locationRho, ellipsoidalDenominator;
638 REAL4 xArm[3], yArm[3];
639 const LALDetector *detectorPtr, *detectorStopPtr;
640
641 /* if detector is NULL, we are to allocate memory for it */
642 if ( ! detector )
643 detector = LALCalloc( 1, sizeof( *detector ) );
644
645 if ( ! detector )
647
648 /* if frDetector is NULL, just return a blank detector structure,
649 * but set the type */
650 if ( ! frDetector )
651 {
652 detector->type = type;
653 return detector;
654 }
655
656 /* Check to see if this is a cached detector */
657 detectorStopPtr = lalCachedDetectors + LAL_NUM_DETECTORS;
658
659 for ( detectorPtr = lalCachedDetectors;
660 detectorPtr < detectorStopPtr;
661 ++detectorPtr )
662 {
663 if ( type == detectorPtr->type
664 && !strncmp(detectorPtr->frDetector.name, frDetector->name,
666 )
667 {
668 *detector = *detectorPtr;
669 return detector;
670 }
671 }
672
673 /* If it's not, construct Cartesian position vector and response tensor */
674
675 latRad = frDetector->vertexLatitudeRadians;
676 lonRad = frDetector->vertexLongitudeRadians;
677
678#if LALDETECTORSH_PRINTF
679 printf("LAT = %g radians, LON = %g radians\n", latRad, lonRad);
680#endif
681
682 cosLat = cos(latRad); sinLat = sin(latRad);
683#if LALDETECTORSH_PRINTF
684 printf("cos(LAT) = %g, sin(LAT) = %g\n", cosLat, sinLat);
685#endif
686 cosLon = cos(lonRad); sinLon = sin(lonRad);
687#if LALDETECTORSH_PRINTF
688 printf("cos(LON) = %g, sin(LON) = %g\n", cosLon, sinLon);
689#endif
690 ellipsoidalDenominator = sqrt( (LAL_AWGS84_SI * LAL_AWGS84_SI)
691 * (cosLat * cosLat)
693 * (sinLat * sinLat) );
694
695 locationRho
696 = cosLat * ( (LAL_AWGS84_SI * LAL_AWGS84_SI) / ellipsoidalDenominator
697 + (REAL8) frDetector->vertexElevation );
698 detector->location[0] = locationRho * cosLon;
699 detector->location[1] = locationRho * sinLon;
700 detector->location[2]
701 = sinLat * ( (LAL_BWGS84_SI * LAL_BWGS84_SI) / ellipsoidalDenominator
702 + (REAL8) frDetector->vertexElevation );
703
704#if LALDETECTORSH_PRINTF
705 printf("%d %d\n", type, LALDETECTORTYPE_IFODIFF);
706#endif
707
708 if (type != LALDETECTORTYPE_IFOYARM)
709 {
711 cos(frDetector->xArmAltitudeRadians),
712 sin(frDetector->xArmAltitudeRadians),
713 cos(frDetector->xArmAzimuthRadians),
714 sin(frDetector->xArmAzimuthRadians),
715 cosLat, sinLat, cosLon, sinLon );
716
717#if LALDETECTORSH_PRINTF
718 printf("xArm = (%g, %g, %g)\n", xArm[0], xArm[1], xArm[2]);
719#endif
720 }
721
722 if (type != LALDETECTORTYPE_IFOXARM && type != LALDETECTORTYPE_CYLBAR)
723 {
725 cos(frDetector->yArmAltitudeRadians),
726 sin(frDetector->yArmAltitudeRadians),
727 cos(frDetector->yArmAzimuthRadians),
728 sin(frDetector->yArmAzimuthRadians),
729 cosLat, sinLat, cosLon, sinLon );
730
731#if LALDETECTORSH_PRINTF
732 printf("yArm = (%g, %g, %g)\n", yArm[0], yArm[1], yArm[2]);
733#endif
734 }
735
736
737 switch (type)
738 {
740 for ( i=0; i<3; ++i )
741 {
742 detector->response[i][i]
743 = ( xArm[i] * xArm[i] - yArm[i] * yArm[i] ) / 2;
744 for ( j=i+1; j<3; ++j )
745 {
746 detector->response[i][j] = detector->response[j][i]
747 = ( xArm[i] * xArm[j] - yArm[i] * yArm[j] ) / 2;
748 }
749 }
750 break;
752 for ( i=0; i<3; ++i )
753 {
754 detector->response[i][i]
755 = ( xArm[i] * xArm[i] ) / 2;
756 for ( j=i+1; j<3; ++j )
757 {
758 detector->response[i][j] = detector->response[j][i]
759 = ( xArm[i] * xArm[j] ) / 2;
760 }
761 }
762 break;
764 for ( i=0; i<3; ++i )
765 {
766 detector->response[i][i]
767 = ( yArm[i] * yArm[i] ) / 2;
768 for ( j=i+1; j<3; ++j )
769 {
770 detector->response[i][j] = detector->response[j][i]
771 = ( yArm[i] * yArm[j] ) / 2;
772 }
773 }
774 break;
776 for ( i=0; i<3; ++i )
777 {
778 detector->response[i][i]
779 = ( xArm[i] * xArm[i] + yArm[i] * yArm[i] ) / 2;
780 for ( j=i+1; j<3; ++j )
781 {
782 detector->response[i][j] = detector->response[j][i]
783 = ( xArm[i] * xArm[j] + yArm[i] * yArm[j] ) / 2;
784 }
785 }
786 break;
788 for ( i=0; i<3; ++i )
789 {
790 detector->response[i][i]
791 = xArm[i] * xArm[i];
792 for ( j=i+1; j<3; ++j )
793 {
794 detector->response[i][j] = detector->response[j][i]
795 = xArm[i] * xArm[j];
796 }
797 }
798 break;
799 default:
801 } /* switch (type) */
802
803 detector->frDetector = *frDetector;
804 detector->type = type;
805 return detector;
806}
807/** @} */
#define LALCalloc(m, n)
Definition: LALMalloc.h:94
LALDetector * XLALCreateDetector(LALDetector *detector, const LALFrDetector *frDetector, LALDetectorType type)
UNDOCUMENTED.
static void getCartesianComponents(REAL4 u[3], REAL8 cosAlt, REAL8 sinAlt, REAL8 cosAz, REAL8 sinAz, REAL8 cosLat, REAL8 sinLat, REAL8 cosLon, REAL8 sinLon)
const LALDetector lalCachedDetectors[LAL_NUM_DETECTORS]
Pre-existing detectors.
#define LAL_DETECTOR_STRUCT(d, t)
#define LAL_BWGS84_SI
Semiminor axis of WGS-84 Reference Ellipsoid, m.
Definition: LALConstants.h:436
#define LAL_AWGS84_SI
Semimajor axis of WGS-84 Reference Ellipsoid, m.
Definition: LALConstants.h:422
double REAL8
Double precision real floating-point number (8 bytes).
int16_t INT2
Two-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
@ LALNameLength
Definition: LALDatatypes.h:508
LALDetectorType
Detector type, which determines how the detector response is determined.
Definition: LALDetectors.h:238
@ LALDETECTORTYPE_CYLBAR
Cylindrical bar.
Definition: LALDetectors.h:244
@ LALDETECTORTYPE_IFOCOMM
IFO in common mode.
Definition: LALDetectors.h:243
@ LALDETECTORTYPE_IFOYARM
IFO in one-armed mode (Y arm)
Definition: LALDetectors.h:242
@ LALDETECTORTYPE_IFOXARM
IFO in one-armed mode (X arm)
Definition: LALDetectors.h:241
@ LALDETECTORTYPE_IFODIFF
IFO in differential mode.
Definition: LALDetectors.h:240
@ LAL_NUM_DETECTORS
Definition: LALDetectors.h:189
#define XLAL_ERROR_NULL(...)
Macro to invoke a failure from a XLAL routine returning a pointer.
Definition: XLALError.h:713
@ XLAL_ENOMEM
Memory allocation error.
Definition: XLALError.h:407
@ XLAL_EINVAL
Invalid argument.
Definition: XLALError.h:409
Detector structure.
Definition: LALDetectors.h:278
REAL4 response[3][3]
The Earth-fixed Cartesian components of the detector's response tensor .
Definition: LALDetectors.h:280
LALDetectorType type
The type of the detector (e.g., IFO in differential mode, cylindrical bar, etc.)
Definition: LALDetectors.h:281
REAL8 location[3]
The three components, in an Earth-fixed Cartesian coordinate system, of the position vector from the ...
Definition: LALDetectors.h:279
LALFrDetector frDetector
The original LALFrDetector structure from which this was created.
Definition: LALDetectors.h:282
Detector frame data structure Structure to contain the data that appears in a FrDetector structure in...
Definition: LALDetectors.h:255
REAL8 vertexLongitudeRadians
The geodetic longitude of the vertex in radians.
Definition: LALDetectors.h:258
REAL8 vertexLatitudeRadians
The geodetic latitude of the vertex in radians.
Definition: LALDetectors.h:259
REAL4 vertexElevation
The height of the vertex above the reference ellipsoid in meters.
Definition: LALDetectors.h:260
REAL4 xArmAzimuthRadians
The angle clockwise from North to the projection of the X arm (or bar's cylidrical axis) into the lo...
Definition: LALDetectors.h:262
REAL4 yArmAltitudeRadians
The angle up from the local tangent plane of the reference ellipsoid to the Y arm in radians (unused...
Definition: LALDetectors.h:263
REAL4 yArmAzimuthRadians
The angle clockwise from North to the projection of the Y arm into the local tangent plane of the re...
Definition: LALDetectors.h:264
REAL4 xArmAltitudeRadians
The angle up from the local tangent plane of the reference ellipsoid to the X arm (or bar's cylidric...
Definition: LALDetectors.h:261
CHAR name[LALNameLength]
A unique identifying string.
Definition: LALDetectors.h:256