| 1 | // sststarfinder.h
 | 
|---|
| 2 | // Eric Aubourg & Dominique Yvon        CEA/DAPNIA/SPP   octobre 1999
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #ifndef SSTSTARFINDER_H
 | 
|---|
| 5 | #define SSTSTARFINDER_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 | #include "sstetoile.h"
 | 
|---|
| 20 | #include "pisteetoile.h"
 | 
|---|
| 21 | #include "pisteetoile.h"
 | 
|---|
| 22 | 
 | 
|---|
| 23 | 
 | 
|---|
| 24 | //#define SST_DEBUG
 | 
|---|
| 25 | //#define SSTDUMP
 | 
|---|
| 26 | #define SSTChassLog
 | 
|---|
| 27 | //#define SSTStatLog
 | 
|---|
| 28 | 
 | 
|---|
| 29 | #define NbChanDump (3)
 | 
|---|
| 30 | #define NbPhotDiodBarette (46)
 | 
|---|
| 31 | #define NbEtInMapMax    (100)
 | 
|---|
| 32 | #define NbSampleBlock (2*nb_per_block)
 | 
|---|
| 33 | 
 | 
|---|
| 34 | #include "toillsstproducer.h"
 | 
|---|
| 35 | 
 | 
|---|
| 36 | class SSTStarProcessor {
 | 
|---|
| 37 | public:
 | 
|---|
| 38 |    virtual void dataFeed(SSTEtoile const&)=0; 
 | 
|---|
| 39 | };
 | 
|---|
| 40 | 
 | 
|---|
| 41 | class SSTStarFinder : public SSTDataProcessor, public TOIProducer {
 | 
|---|
| 42 | public:
 | 
|---|
| 43 |   SSTStarFinder();
 | 
|---|
| 44 |   ~SSTStarFinder();
 | 
|---|
| 45 |   
 | 
|---|
| 46 |   virtual void dataFeed(long sampleNum, int* diodeSignal); // signal for 46 diodes...
 | 
|---|
| 47 | 
 | 
|---|
| 48 |   static void Has2Bars(bool, int elecOffset=0); // elecOffset : which wired together
 | 
|---|
| 49 |   string getName();
 | 
|---|
| 50 | 
 | 
|---|
| 51 |   int  getNumbStar(int iSampl); 
 | 
|---|
| 52 |                         // return number of star found in sample number iSampl  
 | 
|---|
| 53 |   int  getStarZ(int iSampl, int istar); 
 | 
|---|
| 54 |                         // return diode number of the star     
 | 
|---|
| 55 |   double getStarF(int iSampl, int istar);  
 | 
|---|
| 56 |                         // return star flux in Ampère
 | 
|---|
| 57 |   double getStarTime(int iSampl, int istar); 
 | 
|---|
| 58 |                         // return star time in this sample
 | 
|---|
| 59 | 
 | 
|---|
| 60 |   virtual long   firstSampleNum(TOI const&);
 | 
|---|
| 61 |   virtual long   lastSampleNum(TOI const&);
 | 
|---|
| 62 |   
 | 
|---|
| 63 |   virtual bool   canGetValue(long sampleNum, TOI const& toi); // for this samplenum
 | 
|---|
| 64 |   virtual bool   canGetPrevValue(long sampleNum, TOI const& toi); 
 | 
|---|
| 65 |   virtual bool   canGetNextValue(long sampleNum, TOI const& toi); 
 | 
|---|
| 66 |   virtual bool   canGetValueLater(long sampleNum, TOI const& toi);  // Might, later but not now
 | 
|---|
| 67 |   
 | 
|---|
| 68 |   virtual double getPrevValue(long& sampleNum, TOI const& toi);
 | 
|---|
| 69 |   virtual double getNextValue(long& sampleNum, TOI const& toi);
 | 
|---|
| 70 |   virtual double getValue(long sampleNum, TOI const& toi);
 | 
|---|
| 71 |   virtual long   wontNeedEarlier(TOI const&, TOIAbsorber* client, long);
 | 
|---|
| 72 | 
 | 
|---|
| 73 |   void registerProcessor(SSTStarProcessor*);
 | 
|---|
| 74 |   void addTOI(TOI& toi, TOIAbsorber* client);
 | 
|---|
| 75 | 
 | 
|---|
| 76 | protected:
 | 
|---|
| 77 |   vector<SSTStarProcessor*> processors;
 | 
|---|
| 78 |   void gotStar(SSTEtoile const& star);
 | 
|---|
| 79 | 
 | 
|---|
| 80 |   long lastFedSample; // dernier samplenum vu
 | 
|---|
| 81 |   long lastAnaSample; // dernier samplenum utilise par traque
 | 
|---|
| 82 |   long lastContSample; // dernier samplenum utilise en mode fill
 | 
|---|
| 83 |   
 | 
|---|
| 84 |   PisteEtoile** PisteBar; 
 | 
|---|
| 85 |   
 | 
|---|
| 86 |         // Are there two photoDiod Arrays and how are they connected?
 | 
|---|
| 87 |   static bool  has2bars;
 | 
|---|
| 88 |   static int   elecOffset;
 | 
|---|
| 89 | 
 | 
|---|
| 90 |   map<double,SSTEtoile> StarHistoryMap; // On stocke les étoiles de manière ordonnée en temps
 | 
|---|
| 91 |   typedef  map<double,SSTEtoile>::iterator StarHistIter;
 | 
|---|
| 92 |   typedef  map<double,SSTEtoile>::const_iterator StarConstHistIter;
 | 
|---|
| 93 |   long lastKeptSample;
 | 
|---|
| 94 |   
 | 
|---|
| 95 |   
 | 
|---|
| 96 |   static ofstream sstchass;
 | 
|---|
| 97 |   static bool     sstchassinit;
 | 
|---|
| 98 |   
 | 
|---|
| 99 |   void findStarConstruct();
 | 
|---|
| 100 |   void findStarDestruct();
 | 
|---|
| 101 |   
 | 
|---|
| 102 |   TOILLSSTProducer* sstprod;
 | 
|---|
| 103 | };
 | 
|---|
| 104 | 
 | 
|---|
| 105 | 
 | 
|---|
| 106 | #endif
 | 
|---|