| 1 | // toiiter.cc
 | 
|---|
| 2 | // Eric Aubourg         CEA/DAPNIA/SPP   juillet 1999
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #ifndef nb_max_bolo
 | 
|---|
| 5 | #define _archeops               //  Acquisition Archeops (avec transputer) 
 | 
|---|
| 6 | #define programme
 | 
|---|
| 7 | extern "C" {
 | 
|---|
| 8 | #include "archeops.h"
 | 
|---|
| 9 | #include "arcunit.h"
 | 
|---|
| 10 | }
 | 
|---|
| 11 | #endif
 | 
|---|
| 12 | 
 | 
|---|
| 13 | 
 | 
|---|
| 14 | #include "toiiter.h"
 | 
|---|
| 15 | #include "toiinterpolator.h"
 | 
|---|
| 16 | #include "archparam.h"
 | 
|---|
| 17 | #include <dirent.h>
 | 
|---|
| 18 | #include <iostream.h>
 | 
|---|
| 19 | #include "templocator.h"
 | 
|---|
| 20 | 
 | 
|---|
| 21 | // Format bloc GPS
 | 
|---|
| 22 | // $GPGGA,hhmmss.ss,ddmm.mmmm,n,dddmm.mmmm,e,q,ss,y.y,a.a,z,
 | 
|---|
| 23 | 
 | 
|---|
| 24 | TOIIter::TOIIter() {
 | 
|---|
| 25 |  // Toutes les valeurs initialisees par defaut. Le TOISvr les positionnera,
 | 
|---|
| 26 |  // puis lancera l'initialisation
 | 
|---|
| 27 |  
 | 
|---|
| 28 |  file = NULL;
 | 
|---|
| 29 |  directory = "";
 | 
|---|
| 30 |  
 | 
|---|
| 31 |  files.clear();
 | 
|---|
| 32 | 
 | 
|---|
| 33 |  isOnBoardRecorder = false;
 | 
|---|
| 34 |    
 | 
|---|
| 35 |  imes=0;
 | 
|---|
| 36 | 
 | 
|---|
| 37 |  tStart = -9.e99;
 | 
|---|
| 38 |  tEnd   = 9.e99;
 | 
|---|
| 39 |  utcStart = -9.e99;
 | 
|---|
| 40 |  utcEnd   = 9.e99;
 | 
|---|
| 41 |  
 | 
|---|
| 42 |  sStart = -999999999;
 | 
|---|
| 43 |  sEnd   =  999999999;
 | 
|---|
| 44 |  
 | 
|---|
| 45 |  //tBlock0 = -1;
 | 
|---|
| 46 |  // perEch = -1;
 | 
|---|
| 47 |  // Values for Trapani 99 = default values
 | 
|---|
| 48 |  //tBlock0 = 1376.8358818;
 | 
|---|
| 49 |  //perEch = 0.005836818076;
 | 
|---|
| 50 |  
 | 
|---|
| 51 |  trigMask = 0;
 | 
|---|
| 52 |  rawIter = NULL;
 | 
|---|
| 53 |  interp  = NULL;
 | 
|---|
| 54 |  lastSample = -1;
 | 
|---|
| 55 |  maxLookAhead = 10000;
 | 
|---|
| 56 |  
 | 
|---|
| 57 |  auxGPS = NULL;
 | 
|---|
| 58 |  
 | 
|---|
| 59 |  initDone = false;
 | 
|---|
| 60 |  
 | 
|---|
| 61 |  underSample = 1;
 | 
|---|
| 62 | }
 | 
|---|
| 63 | 
 | 
|---|
| 64 | TOIIter::TOIIter(TOIIter const& x) {
 | 
|---|
| 65 |   directory = x.directory;
 | 
|---|
| 66 |   files = x.files;
 | 
|---|
| 67 |   if (x.initDone && x.curFile != x.files.end()) curFile = files.find(*(x.curFile));
 | 
|---|
| 68 |   isOnBoardRecorder = x.isOnBoardRecorder;
 | 
|---|
| 69 |   imes   = x.imes;
 | 
|---|
| 70 |   
 | 
|---|
| 71 |   tStart   = x.tStart;
 | 
|---|
| 72 |   tEnd     = x.tEnd;
 | 
|---|
| 73 |   utcStart = x.utcStart;
 | 
|---|
| 74 |   utcEnd   = x.utcEnd;
 | 
|---|
| 75 |   sStart   = x.sStart;
 | 
|---|
| 76 |   sEnd     = x.sEnd;
 | 
|---|
| 77 |   
 | 
|---|
| 78 |   trigMask = x.trigMask;
 | 
|---|
| 79 |   infos = x.infos;   
 | 
|---|
| 80 | 
 | 
|---|
| 81 |   if (x.file)
 | 
|---|
| 82 |     file = new ArcheopsFile(*x.file);
 | 
|---|
| 83 |   else 
 | 
|---|
| 84 |     file = NULL;
 | 
|---|
| 85 |     
 | 
|---|
| 86 |   if (x.rawIter) {
 | 
|---|
| 87 |     rawIter = new TOIIter(*x.rawIter);
 | 
|---|
| 88 |     interp = new TOIInterpolator[infos.size()];
 | 
|---|
| 89 |     for (int i=0; i<infos.size(); i++)
 | 
|---|
| 90 |       interp[i] = x.interp[i];
 | 
|---|
| 91 |   } else {
 | 
|---|
| 92 |     rawIter = NULL;
 | 
|---|
| 93 |     interp  = NULL;
 | 
|---|
| 94 |   }
 | 
|---|
| 95 |   
 | 
|---|
| 96 |   lastSample = x.lastSample;
 | 
|---|
| 97 |   maxLookAhead = x.maxLookAhead;
 | 
|---|
| 98 |   
 | 
|---|
| 99 |   auxGPS = x.auxGPS; 
 | 
|---|
| 100 |   if (auxGPS) auxGPS = auxGPS->clone();
 | 
|---|
| 101 |   
 | 
|---|
| 102 |   initDone = x.initDone;
 | 
|---|
| 103 |   underSample = x.underSample;
 | 
|---|
| 104 | }
 | 
|---|
| 105 | 
 | 
|---|
| 106 | TOIIter::~TOIIter() {
 | 
|---|
| 107 |   delete file;
 | 
|---|
| 108 |   delete rawIter;
 | 
|---|
| 109 |   delete[] interp;
 | 
|---|
| 110 |   delete auxGPS;
 | 
|---|
| 111 | }
 | 
|---|
| 112 | 
 | 
|---|
| 113 | #ifdef __MWERKS__
 | 
|---|
| 114 | #define filesep ':'
 | 
|---|
| 115 | #else
 | 
|---|
| 116 | #define filesep '/'
 | 
|---|
| 117 | #endif
 | 
|---|
| 118 | 
 | 
|---|
| 119 | void TOIIter::Init() {
 | 
|---|
| 120 |  if (initDone) return;
 | 
|---|
| 121 |  initDone = true;
 | 
|---|
| 122 |  if (utcStart > 0) {
 | 
|---|
| 123 |    double t = (utcStart/24.) + archParam.acq.utcOrigin;
 | 
|---|
| 124 |    if (t > tStart) tStart=t;
 | 
|---|
| 125 |  }
 | 
|---|
| 126 |  if (utcEnd > 0) {
 | 
|---|
| 127 |    double t = (utcEnd/24.) + archParam.acq.utcOrigin;
 | 
|---|
| 128 |    if (t < tEnd) tEnd=t;
 | 
|---|
| 129 |  }
 | 
|---|
| 130 |  // On a soit un repertoire, soit une liste de fichiers....
 | 
|---|
| 131 |   if (directory == "") {
 | 
|---|
| 132 |     if (files.empty()) {   // Ni repertoire, ni fichiers
 | 
|---|
| 133 |       cerr << "toiiter : pas de repertoire, pas de fichiers" << endl;
 | 
|---|
| 134 |       exit(-1);
 | 
|---|
| 135 |     } else {
 | 
|---|
| 136 |       // On a deja une liste de fichiers
 | 
|---|
| 137 |     }
 | 
|---|
| 138 |   } else { // On a un repertoire a explorer
 | 
|---|
| 139 |     // On cherche soit les fichiers dans le repertoire donne, soit des fichiers
 | 
|---|
| 140 |     // dans un sous-repertoire "arch-YY_MM_DD". Les fichiers ont un nom en
 | 
|---|
| 141 |     // "hYY_MM_DD-hh_mm_ss".
 | 
|---|
| 142 |     // Pour l'enregistreur de vol, les fichiers ont un nom en ARKxxxxxx.DAT
 | 
|---|
| 143 |     if (directory[directory.length()-1] != filesep) 
 | 
|---|
| 144 |       directory += filesep;
 | 
|---|
| 145 |     DIR* dir = opendir(directory.c_str());
 | 
|---|
| 146 |     struct dirent* ent;
 | 
|---|
| 147 |     while ((ent = readdir(dir)) != NULL) {
 | 
|---|
| 148 |       // si c'est un repertoire, avec un nom de jour, il faut l'explorer...
 | 
|---|
| 149 |       if (!strncmp(ent->d_name, "arch-", 5)) {
 | 
|---|
| 150 |         double mjd = ArcheopsFile::decodeMJD(ent->d_name+5) - 2./24.; // ENTIER + .5 en temps local!
 | 
|---|
| 151 |         if (mjd >= tStart - 1. && mjd <= tEnd) {
 | 
|---|
| 152 |           string direc2 = directory + ent->d_name + filesep;
 | 
|---|
| 153 |           DIR* dir2 = opendir(direc2.c_str());
 | 
|---|
| 154 |           struct dirent* ent2;
 | 
|---|
| 155 |           while ((ent2 = readdir(dir2)) != NULL) {
 | 
|---|
| 156 |             if (*ent2->d_name == 'h') {
 | 
|---|
| 157 |               double mjd2 = ArcheopsFile::decodeMJD(ent->d_name+1) - 2./24.;
 | 
|---|
| 158 |               if (mjd2 >= tStart - 1./24. && mjd2 <= tEnd) {
 | 
|---|
| 159 |                 files.insert(direc2 + ent2->d_name);
 | 
|---|
| 160 |               }
 | 
|---|
| 161 |             }
 | 
|---|
| 162 |           }
 | 
|---|
| 163 |         }
 | 
|---|
| 164 |       } else {
 | 
|---|
| 165 |         if (!isOnBoardRecorder && *ent->d_name == 'h') {
 | 
|---|
| 166 |           double mjd = ArcheopsFile::decodeMJD(ent->d_name+1) - 2./24.; // $CHECK$ UTCOffset
 | 
|---|
| 167 |           if (mjd >= tStart - 1./24. && mjd <= tEnd) {
 | 
|---|
| 168 |             files.insert(directory + ent->d_name);
 | 
|---|
| 169 |           }
 | 
|---|
| 170 |         } else if (isOnBoardRecorder) {
 | 
|---|
| 171 |           if (strncmp(ent->d_name, "ARK", 3) && strncmp(ent->d_name, "ark", 3)) continue;
 | 
|---|
| 172 |           char * sfx = ent->d_name + strlen(ent->d_name) - 4;
 | 
|---|
| 173 |           if (strcmp(sfx, ".DAT") && strcmp(sfx, ".dat")) continue;
 | 
|---|
| 174 |           files.insert(directory + ent->d_name);
 | 
|---|
| 175 |         }
 | 
|---|
| 176 |       }
 | 
|---|
| 177 |     }
 | 
|---|
| 178 |     closedir(dir);
 | 
|---|
| 179 |   }
 | 
|---|
| 180 |     
 | 
|---|
| 181 |   ScanFiles();
 | 
|---|
| 182 |   
 | 
|---|
| 183 |   curFile = files.begin();
 | 
|---|
| 184 |   file = new ArcheopsFile((*curFile).c_str());
 | 
|---|
| 185 |   cout << "opening file " << (*curFile).c_str() << endl;
 | 
|---|
| 186 | 
 | 
|---|
| 187 |   // On avance jusqu'a avoir au moins un bloc param et un bloc reglage,
 | 
|---|
| 188 |   // car on ne peut rien faire sans...
 | 
|---|
| 189 |   // Si on a des donnees de l'enregistreur de vol, pas de bloc param, et
 | 
|---|
| 190 |   // on en simule un
 | 
|---|
| 191 |   double oldTStart = tStart;
 | 
|---|
| 192 |   tStart = -9.e99; // pour init, on accepte des blocs avant tstart....
 | 
|---|
| 193 |   
 | 
|---|
| 194 |   if (!file->lastParam()) {
 | 
|---|
| 195 |     if (isOnBoardRecorder) {
 | 
|---|
| 196 |       extern param_bolo  parametr;
 | 
|---|
| 197 |       block_type_param block;
 | 
|---|
| 198 |       block.param = parametr;
 | 
|---|
| 199 |       valide_block((block_type_modele*)&block, block_param, 0);
 | 
|---|
| 200 |       file->forceBlock((block_type_modele*)&block);
 | 
|---|
| 201 |     } else {
 | 
|---|
| 202 |       file->nextBlock(block_param_mask);
 | 
|---|
| 203 |     }
 | 
|---|
| 204 |   }
 | 
|---|
| 205 |   if (!file->lastReglage()) file->nextBlock(block_reglage_mask);
 | 
|---|
| 206 |   
 | 
|---|
| 207 |   // On cherche un bloc GPS pour avoir la correspondance timestamp/UTC.
 | 
|---|
| 208 |   // Pour le moment, on se fonde sur le premier bloc GPS. On pourra faire
 | 
|---|
| 209 |   // mieux en prenant le min de tous les delta_T, a condition d'avoir un 
 | 
|---|
| 210 |   // peu plus de details sur la facon dont le GPS est lu.
 | 
|---|
| 211 |   
 | 
|---|
| 212 |   if (archParam.acq.tBlock0 < 0) {
 | 
|---|
| 213 |     archParam.acq.tBlock0 = file->getStartMJD();
 | 
|---|
| 214 | 
 | 
|---|
| 215 |     file->pushMark();
 | 
|---|
| 216 |     if (file->lastGPS() || file->nextBlock(block_gps_mask)) {
 | 
|---|
| 217 |       // le temps du bloc courant, en secondes
 | 
|---|
| 218 |       double dt = file->blockNum() * file->perBlock();
 | 
|---|
| 219 |       archParam.acq.tBlock0 = file->getGPSMJD() - dt/86400.;
 | 
|---|
| 220 |     } else { // pas de bloc GPS...
 | 
|---|
| 221 |       archParam.acq.tBlock0 = file->getStartMJD();
 | 
|---|
| 222 |     }
 | 
|---|
| 223 |     file->popMark();
 | 
|---|
| 224 |   }
 | 
|---|
| 225 |   tStart = oldTStart;  // on restaure
 | 
|---|
| 226 |   
 | 
|---|
| 227 |   if (archParam.acq.perEch < 0)
 | 
|---|
| 228 |     archParam.acq.perEch = file->perEchant();
 | 
|---|
| 229 | 
 | 
|---|
| 230 |   bool hasInterp = false;
 | 
|---|
| 231 |   
 | 
|---|
| 232 |   trigMask = 0;
 | 
|---|
| 233 |   for (vector<info>::iterator i = infos.begin(); i != infos.end(); i++) {
 | 
|---|
| 234 |     if ((*i).interpolated) hasInterp = true;
 | 
|---|
| 235 |     if ((*i).triggering) {
 | 
|---|
| 236 |       switch ((*i).kind) {
 | 
|---|
| 237 |       case boloMuV:
 | 
|---|
| 238 |       case boloMuV2:
 | 
|---|
| 239 |       case boloRawMuV:
 | 
|---|
| 240 |       case boloRawMuVCN:
 | 
|---|
| 241 |         trigMask |= block_bolo_mask;
 | 
|---|
| 242 |         break;
 | 
|---|
| 243 |       case boloMuV2T:
 | 
|---|
| 244 |       case boloRes:
 | 
|---|
| 245 |       case boloTemp:
 | 
|---|
| 246 |          trigMask |= block_bolo_mask | block_reglage_mask;
 | 
|---|
| 247 |         break;
 | 
|---|
| 248 |       case dilDAC:
 | 
|---|
| 249 |       case dilSwitch:
 | 
|---|
| 250 |         trigMask |= block_dilution_mask;
 | 
|---|
| 251 |       case boloGainAmpli:
 | 
|---|
| 252 |       case boloDACV:
 | 
|---|
| 253 |       case boloDACI:
 | 
|---|
| 254 |         trigMask |= block_reglage_mask;
 | 
|---|
| 255 |         break;
 | 
|---|
| 256 |       case gpsTime:
 | 
|---|
| 257 |       case longitude:
 | 
|---|
| 258 |       case latitude:
 | 
|---|
| 259 |       case altitude:
 | 
|---|
| 260 |         trigMask |= block_gps_mask;
 | 
|---|
| 261 |         break;
 | 
|---|
| 262 |       case azimuthBolo:
 | 
|---|
| 263 |         trigMask |= block_bolo_mask;
 | 
|---|
| 264 |         //file->needSSTProcessMask(SSTHandler::findPeriod);
 | 
|---|
| 265 |         //trigMask |= block_sst_mask;
 | 
|---|
| 266 |         break;
 | 
|---|
| 267 |       case sstStarCnt:
 | 
|---|
| 268 |       case sstStarZ:
 | 
|---|
| 269 |       case sstStarF:
 | 
|---|
| 270 |       case sstStarT:
 | 
|---|
| 271 |         file->needSSTProcessMask(SSTHandler::findStars);
 | 
|---|
| 272 |         trigMask |= block_sst_mask;
 | 
|---|
| 273 |         break;
 | 
|---|
| 274 |       case sstDiode:
 | 
|---|
| 275 |       case sstDiodeCN:
 | 
|---|
| 276 |         file->needSSTProcessMask(SSTHandler::permDiode);
 | 
|---|
| 277 |         trigMask |= block_sst_mask;
 | 
|---|
| 278 |         break;
 | 
|---|
| 279 |       case sstChannel:
 | 
|---|
| 280 |       case sstChannelCN:
 | 
|---|
| 281 |         trigMask |= block_sst_mask;
 | 
|---|
| 282 |         break;
 | 
|---|
| 283 |       case gyroRaw:
 | 
|---|
| 284 |       case gyroV:
 | 
|---|
| 285 |         trigMask |= block_gyro_mask;
 | 
|---|
| 286 |         break;
 | 
|---|
| 287 |       case gyroSpeed:
 | 
|---|
| 288 |         trigMask |= block_gyro_mask; // $CHECK$ + info to calibrate gyros
 | 
|---|
| 289 |         break;
 | 
|---|
| 290 |       case alphaRotAxis:
 | 
|---|
| 291 |       case deltaRotAxis:
 | 
|---|
| 292 |       case alphaSst:
 | 
|---|
| 293 |       case deltaSst:
 | 
|---|
| 294 |       case alphaFPAxis:
 | 
|---|
| 295 |       case deltaFPAxis:
 | 
|---|
| 296 |       case alphaBolo:
 | 
|---|
| 297 |       case deltaBolo:
 | 
|---|
| 298 |         trigMask |= block_bolo_mask;
 | 
|---|
| 299 |         //file->needSSTProcessMask(SSTHandler::findAxis);
 | 
|---|
| 300 |         //trigMask |= block_sst_mask;
 | 
|---|
| 301 |         break;
 | 
|---|
| 302 |       case alphaZenith:
 | 
|---|
| 303 |       case deltaZenith:
 | 
|---|
| 304 |         trigMask |= block_gps_mask;
 | 
|---|
| 305 |         break;
 | 
|---|
| 306 |       case voyantEVO:
 | 
|---|
| 307 |       case voyantEVF:
 | 
|---|
| 308 |       case commandeEV0:
 | 
|---|
| 309 |       case commandeEVF:
 | 
|---|
| 310 |       case commandeEVB:
 | 
|---|
| 311 |       case commandeEVV:
 | 
|---|
| 312 |       case pressEnt3He:
 | 
|---|
| 313 |       case debit3He:
 | 
|---|
| 314 |       case pressSor3He:
 | 
|---|
| 315 |       case pressEnt4He:
 | 
|---|
| 316 |       case debit4He:
 | 
|---|
| 317 |       case pressSor4He:
 | 
|---|
| 318 |       case pressAirVanne:
 | 
|---|
| 319 |       case pressPompChar:
 | 
|---|
| 320 |       case pressMembrane:
 | 
|---|
| 321 |       case pressExterne:
 | 
|---|
| 322 |       case tensPile10T:
 | 
|---|
| 323 |       case tensPileP18D:
 | 
|---|
| 324 |       case tensPileM18D:
 | 
|---|
| 325 |       case tensPile10B:
 | 
|---|
| 326 |       case tensPileP18B:
 | 
|---|
| 327 |       case tensPileM18B:
 | 
|---|
| 328 |       case tensPileCh:
 | 
|---|
| 329 |       case swPile5:
 | 
|---|
| 330 |       case swPile15:
 | 
|---|
| 331 |       case tempCaissH1:
 | 
|---|
| 332 |       case tempCaissH2:
 | 
|---|
| 333 |       case tempCaissB1:
 | 
|---|
| 334 |       case tempCaissB2:
 | 
|---|
| 335 |       case tempCaissTHe:
 | 
|---|
| 336 |       case tempCaissPiles:
 | 
|---|
| 337 |       case tempCaissDrv:
 | 
|---|
| 338 |       case pressHeBain:
 | 
|---|
| 339 |       case pressPirani:
 | 
|---|
| 340 |         trigMask |= block_dilution_mask;
 | 
|---|
| 341 |         break;
 | 
|---|
| 342 |       }
 | 
|---|
| 343 |     }
 | 
|---|
| 344 |   }
 | 
|---|
| 345 |   
 | 
|---|
| 346 |   if (trigMask & (block_bolo_mask | block_sst_mask)) {
 | 
|---|
| 347 |     imes = 9999;
 | 
|---|
| 348 |   } else {
 | 
|---|
| 349 |     imes = 0;
 | 
|---|
| 350 |   }
 | 
|---|
| 351 |   
 | 
|---|
| 352 |   if (hasInterp) {
 | 
|---|
| 353 |     rawIter = new TOIIter(*this);
 | 
|---|
| 354 |     interp = new TOIInterpolator[infos.size()];
 | 
|---|
| 355 |     for (int i=0; i<infos.size(); i++) {
 | 
|---|
| 356 |       rawIter->infos[i].interpolated = false;
 | 
|---|
| 357 |     }
 | 
|---|
| 358 |     delete file; file = NULL; // on ne travaille plus sur le fichier directement...
 | 
|---|
| 359 |   }
 | 
|---|
| 360 | }
 | 
|---|
| 361 | 
 | 
|---|
| 362 | void TOIIter::ScanFiles() {
 | 
|---|
| 363 |   file1stSamp.clear();
 | 
|---|
| 364 |   cout << "Scanning all files" << endl;
 | 
|---|
| 365 |   // Petite astuce pour les STL non conformes comme celles de digital
 | 
|---|
| 366 |   // qui ne supportent pas files.erase(i) suivi de i++....
 | 
|---|
| 367 |   set<string> copy = files;
 | 
|---|
| 368 |   for (set<string>::iterator i = copy.begin(); i != copy.end(); i++) {
 | 
|---|
| 369 |     ArcheopsFile fich((*i).c_str());
 | 
|---|
| 370 |     if (fich.nextBlock()) {
 | 
|---|
| 371 |       file1stSamp[*i] = fich.blockNum()*72; // premier numsample
 | 
|---|
| 372 |       cout << "File " << *i << " 1st sample = " << fich.blockNum()*72 << endl;
 | 
|---|
| 373 |     } else {
 | 
|---|
| 374 |       cout << "File " << *i << " unrecoverable, skipping" << endl;
 | 
|---|
| 375 |       files.erase(*i);
 | 
|---|
| 376 |     }
 | 
|---|
| 377 |   }
 | 
|---|
| 378 |   cout << "Scan done" << endl;
 | 
|---|
| 379 |   
 | 
|---|
| 380 |   // Et maintenant, on ne garde que ceux qui tombent dans l'intervalle...
 | 
|---|
| 381 |   copy = files;
 | 
|---|
| 382 |   string prev="";
 | 
|---|
| 383 |   for (set<string>::iterator i = copy.begin(); i != copy.end(); i++) {
 | 
|---|
| 384 |     double smp = file1stSamp[*i];
 | 
|---|
| 385 |     double t   = archParam.acq.tBlock0 + smp * archParam.acq.perEch/86400.;
 | 
|---|
| 386 |     if (t>tEnd || smp>sEnd) {  // premier echantillon apres tEnd
 | 
|---|
| 387 |      files.erase(*i);
 | 
|---|
| 388 |      prev = "";
 | 
|---|
| 389 |      continue;
 | 
|---|
| 390 |     }
 | 
|---|
| 391 |     if (t<tStart || smp<sStart) { // premier echantillon avant tStart -> on vire le precedent si existe
 | 
|---|
| 392 |       if (prev != "") {
 | 
|---|
| 393 |         files.erase(prev);
 | 
|---|
| 394 |       }
 | 
|---|
| 395 |     }
 | 
|---|
| 396 |     prev = *i;
 | 
|---|
| 397 |   }
 | 
|---|
| 398 | }
 | 
|---|
| 399 | 
 | 
|---|
| 400 | bool TOIIter::NextFile() {
 | 
|---|
| 401 |   if (rawIter)
 | 
|---|
| 402 |     return rawIter->NextFile();
 | 
|---|
| 403 |     
 | 
|---|
| 404 |   if (files.empty()) {
 | 
|---|
| 405 |     return false;
 | 
|---|
| 406 |   } else {
 | 
|---|
| 407 |     if (curFile == files.end()) return false;
 | 
|---|
| 408 |     curFile++;
 | 
|---|
| 409 |     if (curFile == files.end()) return false;
 | 
|---|
| 410 |     cout << "opening file " << (*curFile).c_str() << endl;
 | 
|---|
| 411 |     ArcheopsFile* newfile = new ArcheopsFile((*curFile).c_str());
 | 
|---|
| 412 |     newfile->grabLastBlocs(*file);
 | 
|---|
| 413 |     delete file;
 | 
|---|
| 414 |     file = newfile;
 | 
|---|
| 415 |     return true;
 | 
|---|
| 416 |   }
 | 
|---|
| 417 | }
 | 
|---|
| 418 | 
 | 
|---|
| 419 | bool TOIIter::Next() {
 | 
|---|
| 420 |   for (int ii=0; ii<underSample; ii++)
 | 
|---|
| 421 |     if (!Next1()) return false;
 | 
|---|
| 422 |   return true;
 | 
|---|
| 423 | }
 | 
|---|
| 424 | 
 | 
|---|
| 425 | bool TOIIter::Next1() {
 | 
|---|
| 426 |   if (!initDone) Init();
 | 
|---|
| 427 |   while (1) {
 | 
|---|
| 428 |     if (!NextSample()) return false; // end of files
 | 
|---|
| 429 |     double t = getMJD();
 | 
|---|
| 430 |     if (t < tStart) continue;
 | 
|---|
| 431 |     if (t > tEnd) return false;
 | 
|---|
| 432 |     return true;
 | 
|---|
| 433 |   }
 | 
|---|
| 434 | }
 | 
|---|
| 435 | 
 | 
|---|
| 436 | bool TOIIter::NextSample() {
 | 
|---|
| 437 |   if (rawIter) {  // Delegation pour interpolation
 | 
|---|
| 438 |     // Trouve prochain sample disponible
 | 
|---|
| 439 |     for (int k=0; k<2; k++) {
 | 
|---|
| 440 |       long smp = 2147483647L;
 | 
|---|
| 441 |       for (int i=0; i<infos.size(); i++) {
 | 
|---|
| 442 |         long ss = interp[i].nextSample(lastSample+1);
 | 
|---|
| 443 |         if (ss > 0 && ss < smp) smp=ss;
 | 
|---|
| 444 |       }
 | 
|---|
| 445 |       if (smp != 2147483647L) {
 | 
|---|
| 446 |         lastSample = smp;
 | 
|---|
| 447 |         break;
 | 
|---|
| 448 |       }
 | 
|---|
| 449 |       if (!fetchAhead())  // tout le monde etait en bout de course,
 | 
|---|
| 450 |         return false;     // on lit un echantillon, ca suffit, d'ou le k<2
 | 
|---|
| 451 |     }
 | 
|---|
| 452 |     // Verifie que tous les interpolateurs ont assez de donnees pour
 | 
|---|
| 453 |     // trouver la valeur correspondante
 | 
|---|
| 454 |     for (int i=0; i<infos.size(); i++) {
 | 
|---|
| 455 |       //rif (infos[i].interpolated) 
 | 
|---|
| 456 |         while (interp[i].needMoreDataFor(lastSample) && 
 | 
|---|
| 457 |                rawIter->getSampleIndex() - lastSample < maxLookAhead)
 | 
|---|
| 458 |           if (!fetchAhead()) return false;
 | 
|---|
| 459 |     }
 | 
|---|
| 460 |     
 | 
|---|
| 461 |     // On est pret...
 | 
|---|
| 462 |     return true;
 | 
|---|
| 463 |   }
 | 
|---|
| 464 | 
 | 
|---|
| 465 |   // trigger sur info indexee dans bloc bolo, bloc gyro ou bloc sst ?
 | 
|---|
| 466 |   if (trigMask & (block_bolo_mask | block_sst_mask | block_gyro_mask )) {
 | 
|---|
| 467 |     imes++;
 | 
|---|
| 468 |     if (imes < file->nEchBlock()) return true;
 | 
|---|
| 469 |     imes = 0;
 | 
|---|
| 470 |   }
 | 
|---|
| 471 |   
 | 
|---|
| 472 |   // soit pas d'info indexee, soit fin bloc courant...
 | 
|---|
| 473 |   while (1) {
 | 
|---|
| 474 |     if (file->nextBlock(trigMask)) {
 | 
|---|
| 475 |       while (file->sameBlockNumAhead()) {  // tant que meme numero de bloc, on lit
 | 
|---|
| 476 |         if (!file->nextBlock()) {          // fin de fichier ?
 | 
|---|
| 477 |           if (NextFile()) file->nextBlock(); // fichier suivant
 | 
|---|
| 478 |           else return false;    // tout fini
 | 
|---|
| 479 |         }
 | 
|---|
| 480 |       }
 | 
|---|
| 481 |       return true;
 | 
|---|
| 482 |     }
 | 
|---|
| 483 |     if (!NextFile()) return false;
 | 
|---|
| 484 |   }
 | 
|---|
| 485 | }
 | 
|---|
| 486 | 
 | 
|---|
| 487 | /* double TOIIter::getTime() {                // MJD 
 | 
|---|
| 488 |    // le temps du bloc courant, en secondes
 | 
|---|
| 489 |    double dt = file->blockNum() * file->perBlock();
 | 
|---|
| 490 |    return tBlock0 + dt/86400. + imes*file->perEchant()/86400.;
 | 
|---|
| 491 |  }
 | 
|---|
| 492 |  */
 | 
|---|
| 493 |  
 | 
|---|
| 494 | bool TOIIter::canGetValue(int column) {
 | 
|---|
| 495 |   if (!initDone) Init();
 | 
|---|
| 496 |    if (column < 0 || column >= infos.size()) return false;
 | 
|---|
| 497 |    TOIKind kind = infos[column].kind;
 | 
|---|
| 498 |    if (auxGPS && 
 | 
|---|
| 499 |        (kind == longitude || kind == latitude || kind == altitude || kind == tsid ||
 | 
|---|
| 500 |         kind == alphaZenith || kind == deltaZenith)) {
 | 
|---|
| 501 |          double dummy;
 | 
|---|
| 502 |          return auxGPS->getLocation(getMJD(), dummy, dummy, dummy) == 0;
 | 
|---|
| 503 |    }
 | 
|---|
| 504 |    if (rawIter) {
 | 
|---|
| 505 |        return interp[column].canGet(lastSample);
 | 
|---|
| 506 |    }
 | 
|---|
| 507 |    int index = infos[column].index;
 | 
|---|
| 508 |    switch (kind) {
 | 
|---|
| 509 |    case sampleNum:
 | 
|---|
| 510 |    case internalTime:
 | 
|---|
| 511 |    case mjd:
 | 
|---|
| 512 |    case mutc:
 | 
|---|
| 513 |      return true;
 | 
|---|
| 514 |    case boloMuV:
 | 
|---|
| 515 |    case boloMuV2:
 | 
|---|
| 516 |    case boloMuV2T:
 | 
|---|
| 517 |    case boloRes:
 | 
|---|
| 518 |    case boloRawMuVCN:
 | 
|---|
| 519 |    case boloTemp:
 | 
|---|
| 520 |      if (imes==0 && file->llastBolo()==NULL) return false;
 | 
|---|
| 521 |      return file->lastBolo() != NULL;
 | 
|---|
| 522 |    case boloRawMuV:
 | 
|---|
| 523 |      return file->lastBolo() != NULL;
 | 
|---|
| 524 |    case boloGainAmpli:
 | 
|---|
| 525 |    case boloDACV:
 | 
|---|
| 526 |    case boloDACI:
 | 
|---|
| 527 |      return file->lastReglage() != NULL;
 | 
|---|
| 528 |    case dilDAC:
 | 
|---|
| 529 |    case dilSwitch:
 | 
|---|
| 530 |      return file->lastDilution() != NULL;
 | 
|---|
| 531 |    case sstDiode:
 | 
|---|
| 532 |    case sstChannel:
 | 
|---|
| 533 |    case sstDiodeCN:
 | 
|---|
| 534 |    case sstChannelCN:
 | 
|---|
| 535 |      return file->lastSST() != NULL;
 | 
|---|
| 536 |    case sstStarCnt:
 | 
|---|
| 537 |    case sstStarZ:
 | 
|---|
| 538 |    case sstStarF:
 | 
|---|
| 539 |    case sstStarT:{
 | 
|---|
| 540 |      if (file->lastSST() == NULL) return false;
 | 
|---|
| 541 |      int n = file->getNumbStar(imes);
 | 
|---|
| 542 |      return (n > 0 && index < n);
 | 
|---|
| 543 |    }
 | 
|---|
| 544 |    case gyroRaw:
 | 
|---|
| 545 |    case gyroV:
 | 
|---|
| 546 |    case gyroSpeed:
 | 
|---|
| 547 |      return (file->lastGyro() != NULL);
 | 
|---|
| 548 |    case gpsTime:
 | 
|---|
| 549 |      return file->hasGPSTime();
 | 
|---|
| 550 |    case longitude:
 | 
|---|
| 551 |    case latitude:
 | 
|---|
| 552 |    case alphaZenith:
 | 
|---|
| 553 |    case deltaZenith:
 | 
|---|
| 554 |      return file->hasGPSPos();
 | 
|---|
| 555 |    case altitude:
 | 
|---|
| 556 |      return file->hasGPSAlt();
 | 
|---|
| 557 |    case tsid:
 | 
|---|
| 558 |      return file->hasGPSPos();
 | 
|---|
| 559 |    case azimuthBolo:
 | 
|---|
| 560 |    case alphaRotAxis:
 | 
|---|
| 561 |    case deltaRotAxis:
 | 
|---|
| 562 |    case alphaFPAxis:
 | 
|---|
| 563 |    case deltaFPAxis:
 | 
|---|
| 564 |    case alphaBolo:
 | 
|---|
| 565 |    case deltaBolo:
 | 
|---|
| 566 |      return true;
 | 
|---|
| 567 |      //return (file->lastGPS() != NULL && file->lastSST() != NULL);
 | 
|---|
| 568 |    case alphaSst:
 | 
|---|
| 569 |    case deltaSst:
 | 
|---|
| 570 |      return false;
 | 
|---|
| 571 |    case voyantEVO:
 | 
|---|
| 572 |    case voyantEVF:
 | 
|---|
| 573 |    case commandeEV0:
 | 
|---|
| 574 |    case commandeEVF:
 | 
|---|
| 575 |    case commandeEVB:
 | 
|---|
| 576 |    case commandeEVV:
 | 
|---|
| 577 |    case pressEnt3He:
 | 
|---|
| 578 |    case debit3He:
 | 
|---|
| 579 |    case pressSor3He:
 | 
|---|
| 580 |    case pressEnt4He:
 | 
|---|
| 581 |    case debit4He:
 | 
|---|
| 582 |    case pressSor4He:
 | 
|---|
| 583 |    case pressAirVanne:
 | 
|---|
| 584 |    case pressPompChar:
 | 
|---|
| 585 |    case pressMembrane:
 | 
|---|
| 586 |    case pressExterne:
 | 
|---|
| 587 |    case tensPile10T:
 | 
|---|
| 588 |    case tensPileP18D:
 | 
|---|
| 589 |    case tensPileM18D:
 | 
|---|
| 590 |    case tensPile10B:
 | 
|---|
| 591 |    case tensPileP18B:
 | 
|---|
| 592 |    case tensPileM18B:
 | 
|---|
| 593 |    case tensPileCh:
 | 
|---|
| 594 |    case swPile5:
 | 
|---|
| 595 |    case swPile15:
 | 
|---|
| 596 |    case tempCaissH1:
 | 
|---|
| 597 |    case tempCaissH2:
 | 
|---|
| 598 |    case tempCaissB1:
 | 
|---|
| 599 |    case tempCaissB2:
 | 
|---|
| 600 |    case tempCaissTHe:
 | 
|---|
| 601 |    case tempCaissPiles:
 | 
|---|
| 602 |    case tempCaissDrv:
 | 
|---|
| 603 |    case pressHeBain:
 | 
|---|
| 604 |    case pressPirani:
 | 
|---|
| 605 |      return file->lastDilution() != NULL;
 | 
|---|
| 606 |    }
 | 
|---|
| 607 |    return false;
 | 
|---|
| 608 | }
 | 
|---|
| 609 | 
 | 
|---|
| 610 | 
 | 
|---|
| 611 | double TOIIter::getValue(int column) {
 | 
|---|
| 612 |   if (!initDone) Init();
 | 
|---|
| 613 |    if (column < 0 || column >= infos.size()) return -1;
 | 
|---|
| 614 |    TOIKind kind = infos[column].kind;
 | 
|---|
| 615 |    if (auxGPS && 
 | 
|---|
| 616 |        (kind == longitude || kind == latitude || kind == altitude || kind == tsid)) {
 | 
|---|
| 617 |          double lat,lon,alt;
 | 
|---|
| 618 |          if (auxGPS->getLocation(getMJD(), lat, lon, alt)) return -99999;
 | 
|---|
| 619 |          if (kind == longitude) return lon;
 | 
|---|
| 620 |          if (kind == latitude)  return lat;
 | 
|---|
| 621 |          if (kind == altitude)  return alt;
 | 
|---|
| 622 |          if (kind == tsid) {
 | 
|---|
| 623 |            tSid.setLongitude(lon);
 | 
|---|
| 624 |            return tSid.getLST(getMJD());
 | 
|---|
| 625 |          }
 | 
|---|
| 626 |          
 | 
|---|
| 627 |    }
 | 
|---|
| 628 |    if (rawIter) {
 | 
|---|
| 629 |      if (infos[column].interpolated)
 | 
|---|
| 630 |        return interp[column].getIValue(lastSample);
 | 
|---|
| 631 |      else
 | 
|---|
| 632 |        return interp[column].getEValue(lastSample);
 | 
|---|
| 633 |    }
 | 
|---|
| 634 |    int index = infos[column].index;
 | 
|---|
| 635 |    switch (kind) {
 | 
|---|
| 636 |    case sampleNum:
 | 
|---|
| 637 |      return getSampleIndex();
 | 
|---|
| 638 |    case internalTime:
 | 
|---|
| 639 |      return getSampleIndex() * archParam.acq.perEch;
 | 
|---|
| 640 |    case mjd:
 | 
|---|
| 641 |      return getMJD();
 | 
|---|
| 642 |    case mutc:
 | 
|---|
| 643 |      return (getMJD()-archParam.acq.utcOrigin)*24.;
 | 
|---|
| 644 |    case boloMuV:
 | 
|---|
| 645 |      return file->getBoloMuV(index, imes);
 | 
|---|
| 646 |    case boloMuV2:
 | 
|---|
| 647 |      return file->getBoloMuV2(index, imes);
 | 
|---|
| 648 |    case boloRawMuV:
 | 
|---|
| 649 |      return file->getBoloRawMuV(index, imes);
 | 
|---|
| 650 |    case boloRawMuVCN:
 | 
|---|
| 651 |      return file->getBoloRawMuVCN(index, imes);
 | 
|---|
| 652 |    case boloGainAmpli:
 | 
|---|
| 653 |      return file->getGainAmpli(index);
 | 
|---|
| 654 |    case boloDACV:
 | 
|---|
| 655 |      return file->getDACV(index);
 | 
|---|
| 656 |    case boloDACI:
 | 
|---|
| 657 |      return file->getDACI(index);
 | 
|---|
| 658 |    case boloMuV2T:
 | 
|---|
| 659 |      return file->getBoloMuV2T(index, imes);
 | 
|---|
| 660 |    case boloRes:
 | 
|---|
| 661 |      return file->getBoloRes(index, imes);
 | 
|---|
| 662 |    case boloTemp:
 | 
|---|
| 663 |      return file->getBoloTemp(index, imes);
 | 
|---|
| 664 |    case dilDAC:
 | 
|---|
| 665 |      return file->getADCDil(index);
 | 
|---|
| 666 |    case dilSwitch:
 | 
|---|
| 667 |      return file->getSwitchDil();
 | 
|---|
| 668 |    case sstDiode:
 | 
|---|
| 669 |      return file->getSSTSignal(index, imes);
 | 
|---|
| 670 |    case sstChannel:
 | 
|---|
| 671 |      return file->getSSTRawSignal(index, imes);
 | 
|---|
| 672 |    case sstDiodeCN:
 | 
|---|
| 673 |      return file->getSSTSignalCN(index, imes);
 | 
|---|
| 674 |    case sstChannelCN:
 | 
|---|
| 675 |      return file->getSSTRawSignalCN(index, imes);
 | 
|---|
| 676 |    case sstStarCnt:
 | 
|---|
| 677 |      return file->getNumbStar(imes);
 | 
|---|
| 678 |    case sstStarZ:
 | 
|---|
| 679 |      return file->getSSTStarZ(index, imes);
 | 
|---|
| 680 |    case sstStarF:
 | 
|---|
| 681 |      return file->getSSTStarF(index, imes);
 | 
|---|
| 682 |    case sstStarT:
 | 
|---|
| 683 |      return file->getSSTStarT(index, imes);
 | 
|---|
| 684 |    case gyroRaw:
 | 
|---|
| 685 |      return file->getGyroRaw(index, imes);
 | 
|---|
| 686 |    case gyroV:
 | 
|---|
| 687 |      return file->getGyroTens(index, imes);
 | 
|---|
| 688 |    case gyroSpeed:
 | 
|---|
| 689 |      return file->getGyroSpeed(index, imes);
 | 
|---|
| 690 |    case gpsTime:
 | 
|---|
| 691 |      return file->getGPSUTC();
 | 
|---|
| 692 |    case longitude:
 | 
|---|
| 693 |      return file->getGPSLong();
 | 
|---|
| 694 |    case latitude:
 | 
|---|
| 695 |      return file->getGPSLat();
 | 
|---|
| 696 |    case altitude:
 | 
|---|
| 697 |      return file->getGPSAlt();
 | 
|---|
| 698 |    case tsid:
 | 
|---|
| 699 |      tSid.setLongitude(file->getGPSLong());
 | 
|---|
| 700 |      return tSid.getLST(getMJD());
 | 
|---|
| 701 |    case azimuthBolo:
 | 
|---|
| 702 |    case alphaRotAxis:
 | 
|---|
| 703 |    case deltaRotAxis: 
 | 
|---|
| 704 |    case alphaFPAxis:
 | 
|---|
| 705 |    case deltaFPAxis: 
 | 
|---|
| 706 |    case alphaZenith:
 | 
|---|
| 707 |    case deltaZenith: 
 | 
|---|
| 708 |    case alphaBolo:
 | 
|---|
| 709 |    case deltaBolo: {
 | 
|---|
| 710 |         double lat, lon;
 | 
|---|
| 711 |         if (auxGPS) {
 | 
|---|
| 712 |           double alti;
 | 
|---|
| 713 |           auxGPS->getLocation(getMJD(), lat, lon, alti);
 | 
|---|
| 714 |         } else {
 | 
|---|
| 715 |           lon = file->getGPSLong();
 | 
|---|
| 716 |           lat = file->getGPSLat();
 | 
|---|
| 717 |         }
 | 
|---|
| 718 |         tSid.setLongitude(lon);
 | 
|---|
| 719 |         double ts = tSid.getLST(getMJD());
 | 
|---|
| 720 |         tempLocator.setEarthPos(lon, lat);
 | 
|---|
| 721 |         tempLocator.setTSid(ts);
 | 
|---|
| 722 |         if ((kind) == alphaRotAxis) return tempLocator.getAlphaZenith();
 | 
|---|
| 723 |         if ((kind) == deltaRotAxis) return tempLocator.getDeltaZenith();
 | 
|---|
| 724 |         if ((kind) == alphaZenith) return tempLocator.getAlphaZenith();
 | 
|---|
| 725 |         if ((kind) == deltaZenith) return tempLocator.getDeltaZenith();
 | 
|---|
| 726 |         if ((kind) == azimuthBolo) return tempLocator.getAzimutBolo(getSampleIndex(),index);
 | 
|---|
| 727 |         if ((kind) == alphaBolo) return tempLocator.getAlphaBolo(getSampleIndex(),index);
 | 
|---|
| 728 |         if ((kind) == deltaBolo) return tempLocator.getDeltaBolo(getSampleIndex(),index);
 | 
|---|
| 729 |         if ((kind) == alphaFPAxis) return tempLocator.getAlphaCenter(getSampleIndex());
 | 
|---|
| 730 |         if ((kind) == deltaFPAxis) return tempLocator.getDeltaCenter(getSampleIndex());
 | 
|---|
| 731 |         return 0;
 | 
|---|
| 732 |      }
 | 
|---|
| 733 |    case voyantEVO:
 | 
|---|
| 734 |         return voyant_EVO(file->lastDilution());
 | 
|---|
| 735 |    case voyantEVF:
 | 
|---|
| 736 |         return voyant_EVF(file->lastDilution());
 | 
|---|
| 737 |    case commandeEV0:
 | 
|---|
| 738 |         return commande_EVO(file->lastDilution());
 | 
|---|
| 739 |    case commandeEVF:
 | 
|---|
| 740 |         return commande_EVF(file->lastDilution());
 | 
|---|
| 741 |    case commandeEVB:
 | 
|---|
| 742 |         return commande_EVB(file->lastDilution());
 | 
|---|
| 743 |    case commandeEVV:
 | 
|---|
| 744 |         return commande_EVV(file->lastDilution());
 | 
|---|
| 745 |    case pressEnt3He:
 | 
|---|
| 746 |         return pression_entree_3He(file->lastDilution());
 | 
|---|
| 747 |    case debit3He:
 | 
|---|
| 748 |         return debit_3He(file->lastDilution());
 | 
|---|
| 749 |    case pressSor3He:
 | 
|---|
| 750 |         return pression_sortie_3He(file->lastDilution());
 | 
|---|
| 751 |    case pressEnt4He:
 | 
|---|
| 752 |         return pression_entree_4He(file->lastDilution());
 | 
|---|
| 753 |    case debit4He:
 | 
|---|
| 754 |         return debit_4He(file->lastDilution());
 | 
|---|
| 755 |    case pressSor4He:
 | 
|---|
| 756 |         return pression_sortie_4He(file->lastDilution());
 | 
|---|
| 757 |    case pressAirVanne:
 | 
|---|
| 758 |         return pression_air_vanne(file->lastDilution());
 | 
|---|
| 759 |    case pressPompChar:
 | 
|---|
| 760 |         return pression_pompe_charbon(file->lastDilution());
 | 
|---|
| 761 |    case pressMembrane:
 | 
|---|
| 762 |         return pression_membranne(file->lastDilution());
 | 
|---|
| 763 |    case pressExterne:
 | 
|---|
| 764 |         return pression_externe(file->lastDilution());
 | 
|---|
| 765 |    case tensPile10T:
 | 
|---|
| 766 |         return tension_pile_10T(file->lastDilution());
 | 
|---|
| 767 |    case tensPileP18D:
 | 
|---|
| 768 |         return tension_pile_p18D(file->lastDilution());
 | 
|---|
| 769 |    case tensPileM18D:
 | 
|---|
| 770 |         return tension_pile_m18D(file->lastDilution());
 | 
|---|
| 771 |    case tensPile10B:
 | 
|---|
| 772 |         return tension_pile_10B(file->lastDilution());
 | 
|---|
| 773 |    case tensPileP18B:
 | 
|---|
| 774 |         return tension_pile_p18B(file->lastDilution());
 | 
|---|
| 775 |    case tensPileM18B:
 | 
|---|
| 776 |         return tension_pile_m18B(file->lastDilution());
 | 
|---|
| 777 |    case tensPileCh:
 | 
|---|
| 778 |         return tension_pile_Ch(file->lastDilution());
 | 
|---|
| 779 |    case swPile5:
 | 
|---|
| 780 |         return switch_pile_5(file->lastDilution());
 | 
|---|
| 781 |    case swPile15:
 | 
|---|
| 782 |         return switch_pile_15(file->lastDilution());
 | 
|---|
| 783 |    case tempCaissH1:
 | 
|---|
| 784 |         return temperature_caisson_haut1(file->lastDilution());
 | 
|---|
| 785 |    case tempCaissH2:
 | 
|---|
| 786 |         return temperature_caisson_haut2(file->lastDilution());
 | 
|---|
| 787 |    case tempCaissB1:
 | 
|---|
| 788 |         return temperature_caisson_bas1(file->lastDilution());
 | 
|---|
| 789 |    case tempCaissB2:
 | 
|---|
| 790 |         return temperature_caisson_bas2(file->lastDilution());
 | 
|---|
| 791 |    case tempCaissTHe:
 | 
|---|
| 792 |         return temperature_caisson_tube_helium(file->lastDilution());
 | 
|---|
| 793 |    case tempCaissPiles:
 | 
|---|
| 794 |         return temperature_caisson_piles(file->lastDilution());
 | 
|---|
| 795 |    case tempCaissDrv:
 | 
|---|
| 796 |         return temperature_caisson_driver_moteur(file->lastDilution());
 | 
|---|
| 797 |    case pressHeBain:
 | 
|---|
| 798 |         return pression_helium_bain(file->lastDilution());
 | 
|---|
| 799 |    case pressPirani:
 | 
|---|
| 800 |         return pression_pirani(file->lastDilution());
 | 
|---|
| 801 |    }
 | 
|---|
| 802 |    return -1;
 | 
|---|
| 803 | }
 | 
|---|
| 804 |  
 | 
|---|
| 805 | bool   TOIIter::newValue(int column) {
 | 
|---|
| 806 |   if (!initDone) Init();
 | 
|---|
| 807 |    if (column < 0 || column >= infos.size()) return false;
 | 
|---|
| 808 |    TOIKind kind = infos[column].kind;
 | 
|---|
| 809 |    if (auxGPS && 
 | 
|---|
| 810 |        (kind == longitude || kind == latitude || kind == altitude)) {
 | 
|---|
| 811 |       return true;
 | 
|---|
| 812 |    }
 | 
|---|
| 813 |    if (rawIter) {
 | 
|---|
| 814 |        return interp[column].isNewValue(lastSample);
 | 
|---|
| 815 |    }
 | 
|---|
| 816 |    switch (kind) {
 | 
|---|
| 817 |      case sampleNum:
 | 
|---|
| 818 |      case internalTime:
 | 
|---|
| 819 |      case mjd:
 | 
|---|
| 820 |      case mutc:
 | 
|---|
| 821 |      case tsid:
 | 
|---|
| 822 |        return true;
 | 
|---|
| 823 |      case boloMuV:
 | 
|---|
| 824 |      case boloMuV2:
 | 
|---|
| 825 |      case boloMuV2T:
 | 
|---|
| 826 |      case boloRes:
 | 
|---|
| 827 |      case boloTemp:
 | 
|---|
| 828 |        return file->blockNum() == file->getBoloBlockNum();
 | 
|---|
| 829 |      case boloRawMuV:
 | 
|---|
| 830 |      case boloRawMuVCN:
 | 
|---|
| 831 |        return file->blockNum() == file->getBoloBlockNum();
 | 
|---|
| 832 |      case boloGainAmpli:
 | 
|---|
| 833 |        return file->blockNum() == file->getReglageBlockNum() && imes==0;
 | 
|---|
| 834 |      case boloDACI:
 | 
|---|
| 835 |      case boloDACV:
 | 
|---|
| 836 |        return file->blockNum() == file->getReglageBlockNum() && imes==0;
 | 
|---|
| 837 |      case dilDAC:
 | 
|---|
| 838 |      case dilSwitch:
 | 
|---|
| 839 |        return file->blockNum() == file->getDilutionBlockNum() && imes==0;
 | 
|---|
| 840 |      case sstChannel:
 | 
|---|
| 841 |      case sstDiode:
 | 
|---|
| 842 |      case sstStarCnt:
 | 
|---|
| 843 |      case sstStarZ:
 | 
|---|
| 844 |      case sstStarF:
 | 
|---|
| 845 |      case sstStarT:
 | 
|---|
| 846 |        return file->blockNum() == file->getSSTBlockNum();
 | 
|---|
| 847 |      case sstChannelCN:
 | 
|---|
| 848 |      case sstDiodeCN:
 | 
|---|
| 849 |        return file->blockNum() == file->getSSTCompBlockNum();
 | 
|---|
| 850 |      case gyroRaw:
 | 
|---|
| 851 |      case gyroV:
 | 
|---|
| 852 |      case gyroSpeed:
 | 
|---|
| 853 |        return file->blockNum() == file->getGyroBlockNum();
 | 
|---|
| 854 |      case gpsTime:
 | 
|---|
| 855 |        return file->blockNum() == file->getGPSBlockNum() && imes==0;
 | 
|---|
| 856 |      case longitude:
 | 
|---|
| 857 |        return file->blockNum() == file->getGPSBlockNum() && imes==0;
 | 
|---|
| 858 |      case latitude:
 | 
|---|
| 859 |        return file->blockNum() == file->getGPSBlockNum() && imes==0;
 | 
|---|
| 860 |      case altitude:
 | 
|---|
| 861 |        return file->blockNum() == file->getGPSBlockNum() && imes==0;
 | 
|---|
| 862 |      case azimuthBolo:
 | 
|---|
| 863 |      case alphaBolo:
 | 
|---|
| 864 |      case deltaBolo:
 | 
|---|
| 865 |      case alphaZenith:
 | 
|---|
| 866 |      case deltaZenith:
 | 
|---|
| 867 |      case alphaFPAxis:
 | 
|---|
| 868 |      case deltaFPAxis:
 | 
|---|
| 869 |        return true; // $CHECK$ with SSTHandler
 | 
|---|
| 870 |      case alphaRotAxis:
 | 
|---|
| 871 |        return true; // $CHECK$ with SSTHandler
 | 
|---|
| 872 |      case deltaRotAxis:
 | 
|---|
| 873 |        return true; // $CHECK$ with SSTHandler
 | 
|---|
| 874 |      case voyantEVO:
 | 
|---|
| 875 |      case voyantEVF:
 | 
|---|
| 876 |      case commandeEV0:
 | 
|---|
| 877 |      case commandeEVF:
 | 
|---|
| 878 |      case commandeEVB:
 | 
|---|
| 879 |      case commandeEVV:
 | 
|---|
| 880 |      case pressEnt3He:
 | 
|---|
| 881 |      case debit3He:
 | 
|---|
| 882 |      case pressSor3He:
 | 
|---|
| 883 |      case pressEnt4He:
 | 
|---|
| 884 |      case debit4He:
 | 
|---|
| 885 |      case pressSor4He:
 | 
|---|
| 886 |      case pressAirVanne:
 | 
|---|
| 887 |      case pressPompChar:
 | 
|---|
| 888 |      case pressMembrane:
 | 
|---|
| 889 |      case pressExterne:
 | 
|---|
| 890 |      case tensPile10T:
 | 
|---|
| 891 |      case tensPileP18D:
 | 
|---|
| 892 |      case tensPileM18D:
 | 
|---|
| 893 |      case tensPile10B:
 | 
|---|
| 894 |      case tensPileP18B:
 | 
|---|
| 895 |      case tensPileM18B:
 | 
|---|
| 896 |      case tensPileCh:
 | 
|---|
| 897 |      case swPile5:
 | 
|---|
| 898 |      case swPile15:
 | 
|---|
| 899 |      case tempCaissH1:
 | 
|---|
| 900 |      case tempCaissH2:
 | 
|---|
| 901 |      case tempCaissB1:
 | 
|---|
| 902 |      case tempCaissB2:
 | 
|---|
| 903 |      case tempCaissTHe:
 | 
|---|
| 904 |      case tempCaissPiles:
 | 
|---|
| 905 |      case tempCaissDrv:
 | 
|---|
| 906 |      case pressHeBain:
 | 
|---|
| 907 |      case pressPirani:
 | 
|---|
| 908 |        return file->blockNum() == file->getDilutionBlockNum() && imes==0;
 | 
|---|
| 909 |    }
 | 
|---|
| 910 |    return false;
 | 
|---|
| 911 | }
 | 
|---|
| 912 |  
 | 
|---|
| 913 | bool   TOIIter::extendValue(int column) {
 | 
|---|
| 914 |    return (!infos[column].interpolated && !newValue(column));
 | 
|---|
| 915 | }
 | 
|---|
| 916 |  
 | 
|---|
| 917 | bool   TOIIter::interpValue(int column) {
 | 
|---|
| 918 |    return (infos[column].interpolated && !newValue(column));
 | 
|---|
| 919 | }
 | 
|---|
| 920 | 
 | 
|---|
| 921 | bool TOIIter::isTrig(int column) {
 | 
|---|
| 922 |    if (column < 0 || column >= infos.size()) return false;
 | 
|---|
| 923 |    return infos[column].triggering;
 | 
|---|
| 924 | }
 | 
|---|
| 925 | 
 | 
|---|
| 926 |  
 | 
|---|
| 927 | TOIKind TOIIter::getKind(int column) {
 | 
|---|
| 928 |    if (column < 0 || column >= infos.size()) return (TOIKind)-1;
 | 
|---|
| 929 |    return infos[column].kind;
 | 
|---|
| 930 | }
 | 
|---|
| 931 |  
 | 
|---|
| 932 | int TOIIter::getIndex(int column) {
 | 
|---|
| 933 |    if (column < 0 || column >= infos.size()) return (TOIKind)-1;
 | 
|---|
| 934 |    return infos[column].index;
 | 
|---|
| 935 | }
 | 
|---|
| 936 | 
 | 
|---|
| 937 | int TOIIter::getColTOI(TOIKind kind, int index) {
 | 
|---|
| 938 |    for (int i=0; i<infos.size(); i++)
 | 
|---|
| 939 |      if (infos[i].kind == kind && infos[i].index == index)
 | 
|---|
| 940 |        return i;
 | 
|---|
| 941 |    return -1;
 | 
|---|
| 942 | }
 | 
|---|
| 943 | 
 | 
|---|
| 944 | bool TOIIter::canGetTOI(TOIKind kind, int index) {
 | 
|---|
| 945 |    int col = getColTOI(kind, index);
 | 
|---|
| 946 |    if (col<0) return false;
 | 
|---|
| 947 |    return canGetValue(col);
 | 
|---|
| 948 | }
 | 
|---|
| 949 | 
 | 
|---|
| 950 | double TOIIter::getTOI(TOIKind kind, int index) {
 | 
|---|
| 951 |    int col = getColTOI(kind, index);
 | 
|---|
| 952 |    if (col<0) return -9.e99;
 | 
|---|
| 953 |    return getValue(col);
 | 
|---|
| 954 | }
 | 
|---|
| 955 | 
 | 
|---|
| 956 |    
 | 
|---|
| 957 | int TOIIter::getBlockSampleIndex() {
 | 
|---|
| 958 |    return imes;
 | 
|---|
| 959 | }
 | 
|---|
| 960 |  
 | 
|---|
| 961 | int TOIIter::getUnderSampling() {
 | 
|---|
| 962 |   return underSample;
 | 
|---|
| 963 | }
 | 
|---|
| 964 | 
 | 
|---|
| 965 | int TOIIter::getSampleIndex() {
 | 
|---|
| 966 |   if (!initDone) Init();
 | 
|---|
| 967 |    if (file) {
 | 
|---|
| 968 |      return file->blockNum() * file->nEchBlock() + imes;
 | 
|---|
| 969 |    } else {
 | 
|---|
| 970 |      return lastSample;
 | 
|---|
| 971 |    }
 | 
|---|
| 972 | }
 | 
|---|
| 973 | 
 | 
|---|
| 974 | double TOIIter::getMJD() {
 | 
|---|
| 975 |   if (!initDone) Init();
 | 
|---|
| 976 |   int sample = getSampleIndex();
 | 
|---|
| 977 |   return archParam.acq.tBlock0 + sample*archParam.acq.perEch/86400.;
 | 
|---|
| 978 | }
 | 
|---|
| 979 |  
 | 
|---|
| 980 | bool TOIIter::fetchAhead() { // Seulement si delegation
 | 
|---|
| 981 |   if (!rawIter) return false;
 | 
|---|
| 982 |   if (!rawIter->Next()) return false;
 | 
|---|
| 983 |   long sample = rawIter->getSampleIndex();
 | 
|---|
| 984 |   for (int i=0; i<infos.size(); i++) {
 | 
|---|
| 985 |     if (rawIter->canGetValue(i) && rawIter->newValue(i)) {
 | 
|---|
| 986 |       interp[i].enterValue(rawIter->getValue(i), sample);
 | 
|---|
| 987 |     }
 | 
|---|
| 988 |   }
 | 
|---|
| 989 |   return true;
 | 
|---|
| 990 | }
 | 
|---|
| 991 | 
 | 
|---|
| 992 | block_type_param* TOIIter::lastParam() {
 | 
|---|
| 993 |   if (!initDone) Init();
 | 
|---|
| 994 |   if (file) return file->lastParam(); 
 | 
|---|
| 995 |   else return rawIter->lastParam();
 | 
|---|
| 996 | }
 | 
|---|
| 997 | 
 | 
|---|
| 998 | 
 | 
|---|