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