[534] | 1 | // galcrosslocator.cc
|
---|
| 2 | // Eric Aubourg CEA/DAPNIA/SPP octobre 1999
|
---|
| 3 |
|
---|
| 4 | #include "galcrosslocator.h"
|
---|
| 5 | #include "archexc.h"
|
---|
| 6 | #include "archparam.h"
|
---|
| 7 | #include "templocator.h"
|
---|
| 8 |
|
---|
| 9 | #define alphaZenith "alphaZenith"
|
---|
| 10 | #define deltaZenith "deltaZenith"
|
---|
[555] | 11 | #define rotSpeed "rotSpeed0"
|
---|
[534] | 12 | #define rotSpeedSample1 "rotSpeedSample1"
|
---|
| 13 | #define rotSpeedSample2 "rotSpeedSample2"
|
---|
| 14 | #define lastCrossSample "lastCrossSample"
|
---|
| 15 | #define nextCrossSample "nextCrossSample"
|
---|
| 16 | #define azimuthFPC "azimuthFPC"
|
---|
| 17 | #define elvFPC "elvFPC"
|
---|
| 18 | #define alphaFPC "alphaFPC"
|
---|
| 19 | #define deltaFPC "deltaFPC"
|
---|
| 20 | #define azimuthBolo "azimuthBolo"
|
---|
| 21 | #define elvBolo "elvBolo"
|
---|
| 22 | #define alphaBolo "alphaBolo"
|
---|
| 23 | #define deltaBolo "deltaBolo"
|
---|
[555] | 24 | #define azimuthSST "azimuthSST"
|
---|
| 25 | #define elvSST "elvSST"
|
---|
| 26 | #define alphaSST "alphaSST"
|
---|
| 27 | #define deltaSST "deltaSST"
|
---|
[534] | 28 |
|
---|
[555] | 29 | // Note : rotSpeed is an estimate, does not take into account balloon drift.
|
---|
| 30 | // accurate value between two galactic crossings has to be determined afterwards
|
---|
| 31 | // as a derived TOI.
|
---|
[534] | 32 |
|
---|
| 33 | GalCrossLocator::GalCrossLocator() {
|
---|
[555] | 34 | possibleTOIs.insert(TOI(alphaZenith, TOI::unspec, "interp flag", "hours", ""));
|
---|
| 35 | possibleTOIs.insert(TOI(deltaZenith, TOI::unspec, "interp flag", "degrees", ""));
|
---|
| 36 | possibleTOIs.insert(TOI(rotSpeed, TOI::unspec, "interp flag", "deg/s", "galcross0"));
|
---|
| 37 | possibleTOIs.insert(TOI(rotSpeedSample1, TOI::unspec, "interp flag", "integer", "galcross0"));
|
---|
| 38 | possibleTOIs.insert(TOI(rotSpeedSample2, TOI::unspec, "interp flag", "integer", "galcross0"));
|
---|
| 39 | possibleTOIs.insert(TOI(lastCrossSample, TOI::unspec, "interp flag", "integer", "galcross0"));
|
---|
| 40 | possibleTOIs.insert(TOI(nextCrossSample, TOI::unspec, "interp flag", "integer", "galcross0"));
|
---|
| 41 | possibleTOIs.insert(TOI(azimuthFPC, TOI::unspec, "interp flag", "degrees", "galcross0"));
|
---|
| 42 | possibleTOIs.insert(TOI(elvFPC, TOI::unspec, "interp flag", "degrees", "galcross0"));
|
---|
| 43 | possibleTOIs.insert(TOI(alphaFPC, TOI::unspec, "interp flag", "hours", "galcross0"));
|
---|
| 44 | possibleTOIs.insert(TOI(deltaFPC, TOI::unspec, "interp flag", "degrees", "galcross0"));
|
---|
| 45 | possibleTOIs.insert(TOI(azimuthBolo, TOI::all, "interp flag", "degrees", "galcross0"));
|
---|
| 46 | possibleTOIs.insert(TOI(elvBolo, TOI::all, "interp flag", "degrees", "galcross0"));
|
---|
| 47 | possibleTOIs.insert(TOI(alphaBolo, TOI::all, "interp flag", "hours", "galcross0"));
|
---|
| 48 | possibleTOIs.insert(TOI(deltaBolo, TOI::all, "interp flag", "degrees", "galcross0"));
|
---|
| 49 | possibleTOIs.insert(TOI(azimuthSST, TOI::unspec, "interp flag", "degrees", "galcross0"));
|
---|
| 50 | possibleTOIs.insert(TOI(elvSST, TOI::unspec, "interp flag", "degrees", "galcross0"));
|
---|
| 51 | possibleTOIs.insert(TOI(alphaSST, TOI::unspec, "interp flag", "hours", "galcross0"));
|
---|
| 52 | possibleTOIs.insert(TOI(deltaSST, TOI::unspec, "interp flag", "degrees", "galcross0"));
|
---|
[534] | 53 | }
|
---|
| 54 |
|
---|
| 55 | string GalCrossLocator::getName() {
|
---|
| 56 | return("GalCrossLocator 1.0");
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | bool GalCrossLocator::canGetValue(long sampleNum, TOI const&) {
|
---|
| 60 | int dum;
|
---|
| 61 | return (tempLocator.getCrossSamples(sampleNum, dum, dum) == 0);
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | double GalCrossLocator::getValue(long sampleNum, TOI const& toi) {
|
---|
| 66 | if (!canGetValue(sampleNum, toi)) return -1;
|
---|
[555] | 67 |
|
---|
| 68 | if (toi.options.find("flag") != toi.options.end()) {
|
---|
| 69 | int SN1, SN2;
|
---|
| 70 | tempLocator.getCrossSamples(sampleNum, SN1, SN2);
|
---|
| 71 | if (sampleNum == SN1 || sampleNum == SN2) return 1;
|
---|
| 72 | return 0;
|
---|
| 73 | }
|
---|
[534] | 74 |
|
---|
[555] | 75 | map<TOI, TOIProducer*> & m = neededTOIs[toi];
|
---|
[534] | 76 | double lat, lon, ts;
|
---|
| 77 |
|
---|
| 78 | for (map<TOI, TOIProducer*>::iterator i = m.begin(); i != m.end(); i++) {
|
---|
[555] | 79 | TOI const& inToi = (*i).first;
|
---|
[534] | 80 | TOIProducer* prod = (*i).second;
|
---|
| 81 | if (inToi.name == "latitude") lat = prod->getValue(sampleNum, inToi);
|
---|
| 82 | if (inToi.name == "longitude") lon = prod->getValue(sampleNum, inToi);
|
---|
| 83 | if (inToi.name == "tsid") ts = prod->getValue(sampleNum, inToi);
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | tempLocator.setEarthPos(lon,lat);
|
---|
| 87 | tempLocator.setTSid(ts);
|
---|
| 88 |
|
---|
| 89 | if (toi.name == alphaZenith) return tempLocator.getAlphaZenith();
|
---|
| 90 | if (toi.name == deltaZenith) return tempLocator.getDeltaZenith();
|
---|
| 91 | if (toi.name == rotSpeed) return tempLocator.getRotSpeed(sampleNum);
|
---|
| 92 |
|
---|
| 93 | if (toi.name == azimuthFPC) return tempLocator.getAzimutCenter(sampleNum);
|
---|
| 94 | if (toi.name == elvFPC) return tempLocator.getElvCenter(sampleNum);
|
---|
| 95 | if (toi.name == alphaFPC) return tempLocator.getAlphaCenter(sampleNum);
|
---|
| 96 | if (toi.name == deltaFPC) return tempLocator.getDeltaCenter(sampleNum);
|
---|
| 97 |
|
---|
| 98 | if (toi.name == azimuthBolo) return tempLocator.getAzimutBolo(sampleNum, toi.index);
|
---|
| 99 | if (toi.name == elvBolo) return tempLocator.getElvBolo(sampleNum, toi.index);
|
---|
| 100 | if (toi.name == alphaBolo) return tempLocator.getAlphaBolo(sampleNum, toi.index);
|
---|
| 101 | if (toi.name == deltaBolo) return tempLocator.getDeltaBolo(sampleNum, toi.index);
|
---|
| 102 |
|
---|
[555] | 103 | if (toi.name == azimuthSST) return tempLocator.getAzimutSST(sampleNum);
|
---|
| 104 | if (toi.name == elvSST) return tempLocator.getElvSST(sampleNum);
|
---|
| 105 | if (toi.name == alphaSST) return tempLocator.getAlphaSST(sampleNum);
|
---|
| 106 | if (toi.name == deltaSST) return tempLocator.getDeltaSST(sampleNum);
|
---|
| 107 |
|
---|
[534] | 108 | if (toi.name == lastCrossSample || toi.name == rotSpeedSample1) {
|
---|
| 109 | int SN1, SN2;
|
---|
| 110 | tempLocator.getCrossSamples(sampleNum, SN1, SN2);
|
---|
| 111 | return SN1;
|
---|
| 112 | }
|
---|
| 113 | if (toi.name == nextCrossSample || toi.name == rotSpeedSample2) {
|
---|
| 114 | int SN1, SN2;
|
---|
| 115 | tempLocator.getCrossSamples(sampleNum, SN1, SN2);
|
---|
| 116 | return SN2;
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | return -1;
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 |
|
---|
| 123 | set<TOI> GalCrossLocator::reqTOIFor(TOI const&) {
|
---|
| 124 | set<TOI> t;
|
---|
| 125 | t.insert(TOI("latitude", TOI::unspec, "interp"));
|
---|
| 126 | t.insert(TOI("longitude", TOI::unspec, "interp"));
|
---|
| 127 | t.insert(TOI("tsid", TOI::unspec));
|
---|
| 128 | return t;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 |
|
---|
| 132 |
|
---|
| 133 |
|
---|
| 134 |
|
---|
| 135 |
|
---|
| 136 |
|
---|