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