[419] | 1 | #include "templocator.h"
|
---|
| 2 | #include <math.h>
|
---|
| 3 | extern "C" {
|
---|
| 4 | #include "aa_hadec.h"
|
---|
| 5 | }
|
---|
| 6 |
|
---|
[423] | 7 | #include "fitsio.h"
|
---|
| 8 | #include "plgalcross.h"
|
---|
| 9 |
|
---|
[419] | 10 | #ifndef M_PI
|
---|
| 11 | #define M_PI 3.14159265358979323846
|
---|
| 12 | #endif
|
---|
| 13 |
|
---|
| 14 | TempLocator tempLocator;
|
---|
| 15 |
|
---|
| 16 | TempLocator::TempLocator()
|
---|
| 17 | {
|
---|
| 18 | lon = lat = ts = 0;
|
---|
[423] | 19 | ra = dec = -99999;
|
---|
| 20 | xSampleNum = -99999;
|
---|
| 21 | fitsfile* fptr;
|
---|
| 22 | int status=0;
|
---|
| 23 | fits_open_file(&fptr, "samplenum_gal_cross.fits", READONLY, &status);
|
---|
| 24 | int simple, bitpix, naxis;
|
---|
| 25 | long naxes;
|
---|
| 26 | long pcount, gcount;
|
---|
| 27 | int extend;
|
---|
| 28 | fits_read_imghdr(fptr, 1, &simple, &bitpix, &naxis, &naxes, &pcount, &gcount, &extend, &status);
|
---|
| 29 | nGalCross = naxes;
|
---|
| 30 | crossings = new long[nGalCross];
|
---|
| 31 | int anynul;
|
---|
| 32 | fits_read_img_lng(fptr, 0, 1, nGalCross, 0, crossings, &anynul, &status);
|
---|
| 33 | fits_close_file(fptr, &status);
|
---|
| 34 | fits_report_error(stderr, status); /* print out any error messages */
|
---|
[419] | 35 | }
|
---|
[423] | 36 |
|
---|
| 37 |
|
---|
[419] | 38 | void TempLocator::setEarthPos(double lon, double lat) {
|
---|
[423] | 39 | if (this->lon == lon && this->lat == lat) return;
|
---|
[419] | 40 | this->lon = lon;
|
---|
| 41 | this->lat = lat;
|
---|
[423] | 42 | ra = dec = -99999; xSampleNum = -99999;
|
---|
[419] | 43 | }
|
---|
[423] | 44 |
|
---|
[419] | 45 | void TempLocator::setTSid(double ts) {
|
---|
[423] | 46 | if (this->ts == ts) return;
|
---|
[419] | 47 | this->ts = ts;
|
---|
[423] | 48 | ra = dec = -99999; xSampleNum = -99999;
|
---|
[419] | 49 | }
|
---|
| 50 |
|
---|
[423] | 51 | void TempLocator::ComputeZenith() {
|
---|
| 52 | double ha;
|
---|
| 53 | aa_hadec (lat * M_PI/180, .5 * M_PI, 0, &ha, &dec);
|
---|
| 54 | ra = - (ha * 180. / M_PI / 15) + (ts/3600.);
|
---|
| 55 | dec = dec * 180. / M_PI;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
[419] | 58 | double TempLocator::getAlphaZenith() {
|
---|
[423] | 59 | if (ra < -100) ComputeZenith();
|
---|
[419] | 60 | return ra;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | double TempLocator::getDeltaZenith() {
|
---|
[423] | 64 | if (dec < -100) ComputeZenith();
|
---|
[419] | 65 | return dec;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
[423] | 68 | void TempLocator::findGeomFromGC(int sampleNum) // pour le bolo qui voit les xing
|
---|
| 69 | {
|
---|
| 70 | if (sampleNum == xSampleNum) return;
|
---|
| 71 | if (dec < -100) ComputeZenith();
|
---|
| 72 |
|
---|
| 73 | azimBolGC = -9999;
|
---|
| 74 |
|
---|
| 75 | // On trouve les croisements juste avant et juste apres notre sampleNum
|
---|
| 76 | int icross;
|
---|
| 77 | for (icross=0; icross<nGalCross; icross++) {
|
---|
| 78 | if (crossings[icross] > sampleNum) break;
|
---|
| 79 | }
|
---|
| 80 | if (icross == 0 || icross >= nGalCross) return;
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | }
|
---|
[419] | 84 |
|
---|
[423] | 85 |
|
---|
| 86 | // ;
|
---|
| 87 | // ; /\ 4 2
|
---|
| 88 | // ; elevation || positive scanning, clockwise
|
---|
| 89 | // ; || 6 1 5 ---------->
|
---|
| 90 | // ; || == positive azimut
|
---|
| 91 | // ; || x 3
|
---|
| 92 | // |----| = 0.78 deg / cos(elev)
|
---|
| 93 | // bol 1 = 41° elevation
|
---|
| 94 | |
---|