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