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