00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "config.h"
00026
00027 #include <lal/DetectorSite.h>
00028
00029 #include <lalapps.h>
00030
00031 #include "set_source_params.h"
00032 #include "util.h"
00033 #include "skygrid.h"
00034 #include "make_gridding.h"
00035
00036 #include <string.h>
00037
00038 int lalDebugLevel = 0;
00039 int verbosity_level = 0;
00040 struct gengetopt_args_info args_info;
00041
00042 int main(int argc, char **argv)
00043 {
00044 static LALStatus s;
00045 FILE *cross = NULL;
00046 FILE *plus = NULL;
00047 LALGPSandAcc time_info;
00048 EphemerisData ephem;
00049 LALSource source;
00050 LALFrDetector frdetector;
00051 LALDetector detector;
00052 LALDetAndSource det_and_src = {NULL,NULL};
00053 LALDetAMResponse response;
00054 gridding_t g;
00055 UINT4 i, j;
00056 UINT4 n_ra, n_dec;
00057 REAL8 src_orientation;
00058
00059 if (argc != 7)
00060 {
00061 fprintf(stderr, "Error: need N_RA, N_DEC, bar longitude, bar latitude, bar azimuth, src orientation\n");
00062 exit(13);
00063 }
00064
00065
00066
00067
00068 s.statusPtr = NULL;
00069 init_ephemeris(&s, &ephem);
00070 init_gridding(&g);
00071
00072 n_ra = atoi(argv[1]);
00073 n_dec = atoi(argv[2]);
00074
00075 cross = xfopen("bar_cross.txt","wo");
00076 plus = xfopen("bar_plus.txt","wo");
00077
00078 src_orientation = atof(argv[6]);
00079
00080
00081
00082
00083 (void)mystrlcpy(frdetector.name, "FOOBAR", LALNameLength);
00084 frdetector.vertexLongitudeRadians = atof(argv[3]);
00085 frdetector.vertexLatitudeRadians = atof(argv[4]);
00086 frdetector.vertexElevation = 0.0;
00087 frdetector.xArmAltitudeRadians = 0.0;
00088 frdetector.xArmAzimuthRadians = atof(argv[5]);
00089 frdetector.yArmAltitudeRadians = 0.0;
00090 frdetector.yArmAzimuthRadians = 0.0;
00091
00092 LALCreateDetector(&s, &detector, &frdetector, LALDETECTORTYPE_CYLBAR);
00093
00094 if (verbosity_level > 0)
00095 {
00096 PrintLALDetector(&detector);
00097 printf("\n\n");
00098 }
00099
00100
00101
00102
00103 time_info.accuracy = LALLEAPSEC_STRICT;
00104 time_info.gps.gpsSeconds = 709398013;
00105 time_info.gps.gpsNanoSeconds = 0;
00106
00107 make_gridding(&s, &g, n_ra, DETRESP_REGGRID, n_dec, DETRESP_REGGRID,
00108 &ephem, &(time_info.gps), time_info.accuracy);
00109
00110 print_ra_grid(&g, "bar_ra_grid.txt");
00111 print_dec_grid(&g, "bar_dec_grid.txt");
00112
00113 for (i = 0; i < g.ra->length; ++i)
00114 {
00115 for (j = 0; j < g.dec->length; ++j)
00116 {
00117
00118
00119
00120 set_source_params(&source, "BIGSTAR", g.ra->data[i],
00121 g.dec->data[j], src_orientation);
00122
00123
00124
00125
00126
00127
00128 det_and_src.pDetector = &detector;
00129 det_and_src.pSource = &source;
00130
00131 LALComputeDetAMResponse(&s, &response, &det_and_src, &time_info);
00132
00133 if (verbosity_level > 0)
00134 {
00135 print_response(&response);
00136 printf("\n\n");
00137 }
00138
00139 fprintf(cross, "%14e\t", response.cross);
00140 fprintf(plus, "%14e\t", response.plus);
00141 }
00142 fprintf(cross, "\n");
00143 fprintf(plus, "\n");
00144 }
00145
00146
00147
00148
00149 fclose(cross);
00150 fclose(plus);
00151
00152 cleanup_ephemeris(&s, &ephem);
00153 cleanup_gridding(&s, &g);
00154
00155 LALCheckMemoryLeaks();
00156
00157 return 0;
00158 }