| 1 | // ssthandler.h | 
|---|
| 2 | // Eric Aubourg         CEA/DAPNIA/SPP   juillet 1999 | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef SSTHANDLER_H | 
|---|
| 5 | #define SSTHANDLER_H | 
|---|
| 6 |  | 
|---|
| 7 | #include <math.h> | 
|---|
| 8 | #include <vector> | 
|---|
| 9 | #include <map> | 
|---|
| 10 |  | 
|---|
| 11 | #ifndef nb_max_bolo | 
|---|
| 12 | #define _archeops               //  Acquisition Archeops (avec transputer) | 
|---|
| 13 | #define programme | 
|---|
| 14 | extern "C" { | 
|---|
| 15 | #include "archeops.h" | 
|---|
| 16 | } | 
|---|
| 17 | #endif | 
|---|
| 18 |  | 
|---|
| 19 | class ArcheopsFile; | 
|---|
| 20 |  | 
|---|
| 21 | // Zone findStar | 
|---|
| 22 | #include "sstetoile.h" | 
|---|
| 23 | #include "pisteetoile.h" | 
|---|
| 24 |  | 
|---|
| 25 | //#define SST_DEBUG | 
|---|
| 26 | //#define SST_DUMPLOG | 
|---|
| 27 | #define NbChanDump (10) | 
|---|
| 28 | #define NbPhotDiodBarette (46) | 
|---|
| 29 | #define NbEtInMapMax    (100) | 
|---|
| 30 | #define SSTChassLog (true) | 
|---|
| 31 | #define NbSampleBlock (2*nb_per_block) | 
|---|
| 32 | // Fin Zone findStar | 
|---|
| 33 |  | 
|---|
| 34 | class SSTHandler { | 
|---|
| 35 | public: | 
|---|
| 36 | SSTHandler(); | 
|---|
| 37 | SSTHandler(SSTHandler const&); | 
|---|
| 38 | SSTHandler& operator = (SSTHandler const&); | 
|---|
| 39 | virtual ~SSTHandler(); | 
|---|
| 40 |  | 
|---|
| 41 | enum process { permDiode = 1, | 
|---|
| 42 | findStars  = 2, | 
|---|
| 43 | findPeriod = 4, | 
|---|
| 44 | findAxis   = 8 }; | 
|---|
| 45 |  | 
|---|
| 46 | void NeedProcess(int prcMask); | 
|---|
| 47 | void ProcessBlock(block_type_sst*); | 
|---|
| 48 | bool NeedBlocks() {return prcTodo != 0;} | 
|---|
| 49 |  | 
|---|
| 50 | static void Has2Bars(bool, int elecOffset=0); // elecOffset : which wired together | 
|---|
| 51 |  | 
|---|
| 52 | long getLastBlkNum() {return lastBlkNum;} | 
|---|
| 53 | int  getRawSignal(int imesure, int idiode); // for last block | 
|---|
| 54 | int  getSignal(int imesure, int idiode);    // for last block, imesure<0 -> history | 
|---|
| 55 |  | 
|---|
| 56 | //      Zone findStar | 
|---|
| 57 | int  getNumbStar(int iSampl); | 
|---|
| 58 | // return number of star found in sample number iSampl | 
|---|
| 59 | int  getStarZ(int iSampl, int istar); | 
|---|
| 60 | // return diode number of the star | 
|---|
| 61 | double getStarF(int iSampl, int istar); | 
|---|
| 62 | // return star flux in Ampère | 
|---|
| 63 | double getStarTime(int iSampl, int istar); | 
|---|
| 64 | // return star time in this sample | 
|---|
| 65 |  | 
|---|
| 66 | static int getDiodPermut(int i) {return diodpermut[i];} | 
|---|
| 67 |  | 
|---|
| 68 | protected: | 
|---|
| 69 | int   diodeRaw[nb_per_block*2][48]; | 
|---|
| 70 | int   diodeHistLength; | 
|---|
| 71 | int*  diodeT;       //[>nb_per_block*2]*[nb_photo_diodes]; | 
|---|
| 72 | int   prcTodo; | 
|---|
| 73 | int   starHistLength; | 
|---|
| 74 | long  lastBlkNum; | 
|---|
| 75 |  | 
|---|
| 76 | // Is there two photoDiod Arrays and how are they connected? | 
|---|
| 77 | static bool  has2bars; | 
|---|
| 78 | static int   elecOffset; | 
|---|
| 79 |  | 
|---|
| 80 | inline int& diode(int iSamp, int iDiod) {return diodeT[iSamp*nb_photo_diodes+iDiod];} | 
|---|
| 81 |  | 
|---|
| 82 | static int  diodpermut[46]; // diodpermut[i] = channel de la diode i | 
|---|
| 83 |  | 
|---|
| 84 | void DecodeTMBlock(block_type_sst*, int i, int* diodes); // mesure i -> diodes | 
|---|
| 85 | void PermutDiode(); // diodeRaw -> diode, avec decalage, 1 echantillon. | 
|---|
| 86 | int FindStars(block_type_sst* blk);           // sur les 72 derniers echantillons dans diode. | 
|---|
| 87 | // return nmber of star found in last block | 
|---|
| 88 |  | 
|---|
| 89 | //      Zone findStar | 
|---|
| 90 | int NbStarInBlock; | 
|---|
| 91 |  | 
|---|
| 92 | PisteEtoile** PisteBar; | 
|---|
| 93 |  | 
|---|
| 94 | #ifdef SST_DEBUG | 
|---|
| 95 | ofstream** pPisteDump; | 
|---|
| 96 | #endif | 
|---|
| 97 |  | 
|---|
| 98 | map<double,SSTEtoile> StarHistoryMap; | 
|---|
| 99 | // On stocke les etoiles de manière ordonnée en temps | 
|---|
| 100 | typedef  map<double,SSTEtoile>::iterator StarHistIter; | 
|---|
| 101 | typedef  map<double,SSTEtoile>::const_iterator StarConstHistIter; | 
|---|
| 102 |  | 
|---|
| 103 | vector<SSTEtoile> LastBlockStarVec; | 
|---|
| 104 | // Vecteur des SSTEtoile du block classees en ordre de temps decroissant. | 
|---|
| 105 | //vector<SSTEtoile> reverse_iterator StarVecRevIter LastBlockStarVec.rbegin(); | 
|---|
| 106 | SSTEtoile LastStar; | 
|---|
| 107 | PisteEtoile* pPiste;          // Piste courante d'analyse | 
|---|
| 108 | int Diodedata[NbSampleBlock]; | 
|---|
| 109 | int offseDataDiod; | 
|---|
| 110 | int LastBlockSSTNb; // Gère la disparition des blocs défectueux | 
|---|
| 111 | int noStarDet; | 
|---|
| 112 | int FirstSplNb(block_type_sst* blk); // Calcule l'index du premier echantillon du block analysé | 
|---|
| 113 | static ofstream sstchass; | 
|---|
| 114 | static bool     sstchassinit; | 
|---|
| 115 |  | 
|---|
| 116 | void findStarConstruct(); | 
|---|
| 117 | void findStarDestruct(); | 
|---|
| 118 | }; | 
|---|
| 119 |  | 
|---|
| 120 | #endif | 
|---|