source: Sophya/trunk/Poubelle/archTOI.old/templocator.cc@ 424

Last change on this file since 424 was 424, checked in by ansari, 26 years ago

galcross

File size: 2.7 KB
RevLine 
[419]1#include "templocator.h"
2#include <math.h>
3extern "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
14TempLocator tempLocator;
15
16TempLocator::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]38void 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]45void 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]51void 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]58double TempLocator::getAlphaZenith() {
[423]59 if (ra < -100) ComputeZenith();
[419]60 return ra;
61}
62
63double TempLocator::getDeltaZenith() {
[423]64 if (dec < -100) ComputeZenith();
[419]65 return dec;
66}
67
[423]68void 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 }
[424]80 if (icross == 0 || icross >= nGalCross) return;
[423]81
[424]82 // On trouve l'azimut du croisement principal pour notre position actuelle
83 double alpG = 12. + 51./60. + 30./3600.;
84 double delG = 27. + 07./60. + 42./3600.;
85 double azCr1, azCr2;
86 int rc = PlGalCross(ts/3600., lat, (90. - 41.), alpG, delG, azCr1, azCr2);
[423]87
88}
[419]89
[423]90
91 // ;
92 // ; /\ 4 2
93 // ; elevation || positive scanning, clockwise
94 // ; || 6 1 5 ---------->
95 // ; || == positive azimut
96 // ; || x 3
97 // |----| = 0.78 deg / cos(elev)
98 // bol 1 = 41° elevation
99
Note: See TracBrowser for help on using the repository browser.