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