[350] | 1 | // toiiter.h
|
---|
| 2 | // Eric Aubourg CEA/DAPNIA/SPP juillet 1999
|
---|
| 3 |
|
---|
[310] | 4 | #ifndef TOIITER_H
|
---|
| 5 | #define TOIITER_H
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | #include <vector>
|
---|
| 9 | #include <set>
|
---|
[350] | 10 | #include <map>
|
---|
[310] | 11 | #include <string>
|
---|
| 12 | #include "archeopsfile.h"
|
---|
[358] | 13 | #include "auxgps.h"
|
---|
[363] | 14 | #include "tsid.h"
|
---|
[310] | 15 |
|
---|
| 16 | enum TOIKind {
|
---|
[407] | 17 | sampleNum, // Numero d''echantillon (timer interne transputer)
|
---|
| 18 | internalTime, // temps transputer depuis debut manip, en secondes.
|
---|
| 19 | mjd, // UTC (en jours, MJD = JD - 2450000). index=0 : premier bloc GPS. 1: + sioux.
|
---|
| 20 | boloTens, // tension en microVolts, filtree avec filtre carre indexe par bolometre
|
---|
| 21 | boloTens2, // tension en microVolts, avec soustraction offset filtre
|
---|
| 22 | boloRaw, // tension brute en microVolts, non filtree indexe par bolometre, sans chgt signe
|
---|
| 23 | boloTemp, // Kelvins, need R(T) -> N/A
|
---|
| 24 | boloGainAmpli, // gain de l'ampli du bolo
|
---|
[408] | 25 | boloDACV, // tension de reference du DAC (microVolts)
|
---|
[410] | 26 | boloDACI, // courant (microAmps)
|
---|
[407] | 27 | boloRawCN, // compression noise on bolo raw
|
---|
| 28 | boloTens2T, // total, microVolts, avec consigne DAC
|
---|
[410] | 29 | boloRes, // Resistance, ohms
|
---|
| 30 | dilDAC, // dilution DAC, index = 0-47
|
---|
| 31 | dilSwitch, // dilution, mot de 32 bits
|
---|
[407] | 32 | sstDiode, // signal brut SST, indice = diode, 0-45
|
---|
| 33 | sstChannel, // signal brut SST, indice = canal, 0-47
|
---|
| 34 | sstDiodeCN, // compression noise
|
---|
| 35 | sstChannelCN, // compression noise
|
---|
| 36 | sstStarCnt, // nombre d''etoiles detectees durant ce sample
|
---|
| 37 | sstStarZ, // numero de diode d''une eventuelle etoile, i=etoile 0..n
|
---|
| 38 | sstStarF, // flux d''une eventuelle etoile, <0 si moins de i+1 etoiles
|
---|
| 39 | sstStarT, // temps d''une eventuelle etoile, <0 si moins de i+1 etoiles
|
---|
| 40 | gyroRaw, // valeur brute du gyro, index = 0,1,2
|
---|
| 41 | gyroTens, // tension gyro, V, index = 0,1,2
|
---|
| 42 | gyroSpeed, // vitesse gyro, deg/s, index = 0,1,2, calibree...
|
---|
| 43 | gpsTime, // temps fourni par GPS
|
---|
| 44 | longitude, // position ballon, degrees
|
---|
| 45 | latitude, // position ballon, degrees
|
---|
| 46 | altitude, // position ballon, m
|
---|
| 47 | tsid, // temps sideral en secondes
|
---|
| 48 | azimut, // azimut centre optique ???
|
---|
| 49 | alphaAxis, //
|
---|
| 50 | deltaAxis, //
|
---|
| 51 | alphaSst, //
|
---|
| 52 | deltaSst, //
|
---|
| 53 | alphaBolo, // sur le ciel, indexe par bolometre
|
---|
| 54 | deltaBolo // sur le ciel, indexe par bolometre
|
---|
| 55 | };
|
---|
[310] | 56 |
|
---|
[315] | 57 | class TOIInterpolator;
|
---|
[310] | 58 |
|
---|
| 59 | class TOIIter {
|
---|
| 60 | public:
|
---|
[315] | 61 | TOIIter(TOIIter const&); // $CHECK$ prevoir operator = ?
|
---|
[310] | 62 | ~TOIIter();
|
---|
| 63 | bool Next();
|
---|
| 64 |
|
---|
[315] | 65 | bool canGetValue(int column); // data is available for that...
|
---|
| 66 | double getValue(int column);
|
---|
| 67 | bool newValue(int column); // a juste change ?
|
---|
| 68 | bool extendValue(int column); // une valeur plus ancienne, etendue ?
|
---|
| 69 | bool interpValue(int column); // une valeur interpolee avec valeur future ?
|
---|
[342] | 70 | bool isTrig(int column);
|
---|
[310] | 71 | TOIKind getKind(int column);
|
---|
[315] | 72 | int getIndex(int column); // si plusieurs, exemple, tension bolo 2
|
---|
[310] | 73 |
|
---|
[315] | 74 | bool canGetTOI(TOIKind kind, int index=0);
|
---|
| 75 | double getTOI(TOIKind kind, int index=0);
|
---|
| 76 |
|
---|
| 77 |
|
---|
[342] | 78 | int getBlockSampleIndex(); // numero d''echantillon dans dernier bloc bolo
|
---|
| 79 | int getSampleIndex(); // numero d''echantillon
|
---|
[358] | 80 | double getMJD();
|
---|
[310] | 81 |
|
---|
| 82 | block_type_param* lastParam();
|
---|
| 83 | block_type_journal* lastJournal();
|
---|
| 84 | block_type_reglage* lastReglage();
|
---|
| 85 | block_type_dilution* lastDilution();
|
---|
| 86 | block_type_gps* lastGPS();
|
---|
| 87 | block_type_une_periode* lastUnePeriode();
|
---|
| 88 | block_type_synchro_sol* lastSynchroSol();
|
---|
| 89 | block_type_pointage_sol* lastPointageSol();
|
---|
| 90 | block_type_bolo* lastBolo();
|
---|
| 91 | block_type_gyro* lastGyro();
|
---|
| 92 | block_type_sst* lastSST();
|
---|
| 93 | block_type_bolo_comprime* lastBoloComp();
|
---|
| 94 | block_type_gyro_comprime* lastGyroComp();
|
---|
| 95 | block_type_sst_comprime* lastSSTComp();
|
---|
[342] | 96 |
|
---|
[393] | 97 | ArcheopsFile* currentFile() {if (!initDone) Init(); return file;}
|
---|
[310] | 98 |
|
---|
| 99 | protected:
|
---|
| 100 | TOIIter();
|
---|
| 101 | void Init(); // After setting the options, opens the first file.
|
---|
[350] | 102 | void ScanFiles(); // Parcourt tous les fichiers, cherche le premier echantillon...
|
---|
[310] | 103 |
|
---|
[350] | 104 | bool NextSample(); // no test of trange
|
---|
[310] | 105 | bool NextFile();
|
---|
| 106 |
|
---|
| 107 | ArcheopsFile* file;
|
---|
[350] | 108 | string directory; // If directory scanning
|
---|
| 109 | set<string> files; // list of files to be read...
|
---|
| 110 | map<string, long> file1stSamp; // premier echantillon de chaque fichier
|
---|
[310] | 111 | set<string>::iterator curFile;
|
---|
[342] | 112 | bool isOnBoardRecorder;
|
---|
[310] | 113 |
|
---|
| 114 | int imes;
|
---|
| 115 |
|
---|
| 116 | double tStart, tEnd;
|
---|
| 117 |
|
---|
[394] | 118 | //double tBlock0; // MJD du bloc numero zero...
|
---|
| 119 | //double perEch; // periode d''echantillonage en secondes
|
---|
[310] | 120 |
|
---|
| 121 | struct info {
|
---|
| 122 | TOIKind kind;
|
---|
| 123 | int index;
|
---|
| 124 | bool triggering;
|
---|
| 125 | bool interpolated;
|
---|
| 126 | };
|
---|
| 127 |
|
---|
[315] | 128 | int getColTOI(TOIKind kind, int index=0);
|
---|
| 129 |
|
---|
[310] | 130 | long trigMask;
|
---|
| 131 |
|
---|
| 132 | vector<info> infos;
|
---|
| 133 |
|
---|
| 134 | friend class TOISvr;
|
---|
| 135 |
|
---|
[342] | 136 | // Gestion de l''interpolation, par delegation a un autre iterateur
|
---|
[315] | 137 | TOIIter* rawIter; // iterateur sans interpolation, qui avance avec retard
|
---|
[401] | 138 | // en bufferisant les valeurs. S''il existe, on lui delegue
|
---|
[315] | 139 | // toutes les operations agissant sur le fichier.
|
---|
| 140 | TOIInterpolator* interp; // interpolateurs pour stocker les valeurs
|
---|
| 141 | long lastSample; // last interpolated sample
|
---|
| 142 | long maxLookAhead;
|
---|
[342] | 143 | bool fetchAhead(); // avance d''une TOI en nourrissant les interpolateurs
|
---|
[315] | 144 |
|
---|
[358] | 145 | AuxGPS* auxGPS;
|
---|
[363] | 146 | TSid tSid;
|
---|
[358] | 147 |
|
---|
[310] | 148 | private:
|
---|
[393] | 149 | bool initDone;
|
---|
[310] | 150 | };
|
---|
| 151 |
|
---|
| 152 | #endif
|
---|