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