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