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