| 1 | #ifndef PisteEtoileSeen | 
|---|
| 2 | #define PisteEtoileSeen | 
|---|
| 3 | #include "sstetoile.h" | 
|---|
| 4 | #include "transfelec.h" | 
|---|
| 5 | #include "formepulse.h" | 
|---|
| 6 |  | 
|---|
| 7 | /*      // D. Yvon, CE Saclay, DAPNIA/SPP, 08/99 | 
|---|
| 8 |  | 
|---|
| 9 | // Analyse the Photodiode track to find star pulse. | 
|---|
| 10 | // Caracterise the time and amplitude of the star Pulse | 
|---|
| 11 |  | 
|---|
| 12 | We analyse a set of 48 samples. The 32 first are considered as prepulse sample. | 
|---|
| 13 | On the prepulse: | 
|---|
| 14 | We compute baseline and substract it. | 
|---|
| 15 | Then compute slope due to pile up and substract it | 
|---|
| 16 | Then compute Vrms. | 
|---|
| 17 | Look for trigger | 
|---|
| 18 | If triggered : | 
|---|
| 19 | Look for maximum. | 
|---|
| 20 | Compute Full width half maximum | 
|---|
| 21 | Fit a paroabole on max of the pulse | 
|---|
| 22 | return max fitte and time of max fitte | 
|---|
| 23 | if analfine | 
|---|
| 24 | Iterate time fit on pulse area and compute amplitude and X2 | 
|---|
| 25 | Find best X2. | 
|---|
| 26 | Fit parabole arond the minimum of X2 to get the true minimum. | 
|---|
| 27 | Build SSTStar. | 
|---|
| 28 |  | 
|---|
| 29 | That's it. | 
|---|
| 30 | When  done push the track eigth samples forward and iterate analysis. | 
|---|
| 31 | */ | 
|---|
| 32 |  | 
|---|
| 33 | class FormePulse; | 
|---|
| 34 |  | 
|---|
| 35 | #define PEtoileDebug | 
|---|
| 36 |  | 
|---|
| 37 |  | 
|---|
| 38 | #define PhDiodTabLong (48) | 
|---|
| 39 | #define Prepulselong (32) | 
|---|
| 40 | #define Pousslong (8) | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 | //      Parametrisation du Trigger | 
|---|
| 44 | #define SeuilGachette (6.)                              // On déclenche à SeuilGachette sigmas | 
|---|
| 45 | #define SSTLsbVal (10./4096.) | 
|---|
| 46 |  | 
|---|
| 47 | //      Parametrisation Analyse Fine | 
|---|
| 48 | #define TFExcursion (15.e-3)                    // Secondes: Excursion du fit autour de MaxIndex | 
|---|
| 49 | #define TPasTFit (1.5e-3)                               // Secondes: | 
|---|
| 50 | // Secondes: | 
|---|
| 51 |  | 
|---|
| 52 | class PisteEtoile { | 
|---|
| 53 | public: | 
|---|
| 54 | PisteEtoile(short NoPhotDiod=0); | 
|---|
| 55 | PisteEtoile (PisteEtoile const & x); | 
|---|
| 56 | ~PisteEtoile(); | 
|---|
| 57 | PisteEtoile& operator = (PisteEtoile const & x); | 
|---|
| 58 | void fill(int* pData, int inDebutPiste=0, int nData=PhDiodTabLong); | 
|---|
| 59 | void push(int* pData, int nbdata=Pousslong); | 
|---|
| 60 | //"Pousse" les données dans PhDiodArray de nbdata | 
|---|
| 61 | bool traque() ; | 
|---|
| 62 | // Traque l'etoile. | 
|---|
| 63 | bool trig(); | 
|---|
| 64 | //Trig sur les donnees? Si Oui declenche une analyse complète | 
|---|
| 65 | void demasque(); | 
|---|
| 66 | // Met en Oeuvre un fit de forme pour determiner le temps et l'amplitude. | 
|---|
| 67 |  | 
|---|
| 68 | bool isAlive()  {       return  DiodVivante;} | 
|---|
| 69 | void kill()             {       DiodVivante=false;} | 
|---|
| 70 | void restore()  {       DiodVivante=true;} | 
|---|
| 71 |  | 
|---|
| 72 | SSTEtoile DonneEtoile() {return LastEtoile;} | 
|---|
| 73 | //Retourne la dernière Etoile détectee | 
|---|
| 74 | inline int SSTLargEvtIndex(); | 
|---|
| 75 | inline int SSTLongIndexEvt(); | 
|---|
| 76 | static TransFuncElec Trapani; | 
|---|
| 77 | static FormePulse FPulse; | 
|---|
| 78 |  | 
|---|
| 79 | protected: | 
|---|
| 80 | double PasTempsEch;     //Secondes | 
|---|
| 81 | // Idendificateur, repères et gestion | 
|---|
| 82 | short NoPhDiod; | 
|---|
| 83 | long indexDebutPiste;   // A actualiser dans push() et Fill() | 
|---|
| 84 | bool DiodVivante;               // Si false, On ne fait rien | 
|---|
| 85 |  | 
|---|
| 86 | // Stocke donnees brutes et traitees | 
|---|
| 87 | int* PhDiodArray; | 
|---|
| 88 | double* PhDiodPiste; | 
|---|
| 89 |  | 
|---|
| 90 | // Derniere Etoile Vue | 
|---|
| 91 | SSTEtoile LastEtoile; | 
|---|
| 92 |  | 
|---|
| 93 | // Variables d'analyse | 
|---|
| 94 | bool gachette; | 
|---|
| 95 | double Vrms; | 
|---|
| 96 | short MaxIndex;                 // Index de l'amplitude Max en analyse Trig() | 
|---|
| 97 | double TIndex; | 
|---|
| 98 | double AmplMax; | 
|---|
| 99 | double AmplRes; | 
|---|
| 100 | int widthHalfMax; | 
|---|
| 101 | int SSTnbPasFit; | 
|---|
| 102 | //      double integ; | 
|---|
| 103 | // Variables Resultat d'analyse fine | 
|---|
| 104 | double AmplFin; | 
|---|
| 105 | double Tfin; | 
|---|
| 106 | double X2Min; | 
|---|
| 107 | bool SuccesAFine; | 
|---|
| 108 |  | 
|---|
| 109 | // Utilitaires de calcul analyse fine | 
|---|
| 110 | double AmplNorm; | 
|---|
| 111 | // Normalisation d'amplitude sur FPulse dans l'ajustement iteratif | 
|---|
| 112 | double *pFitArray0; | 
|---|
| 113 | // Pointeur origine du tableau d'echantillon sur lequel sera calculé le fit | 
|---|
| 114 | double *pFitArray; | 
|---|
| 115 | // Pointeur courant du tableau d'echantillon | 
|---|
| 116 | double* Ampl;   //Tableau des amplitudes calculées | 
|---|
| 117 |  | 
|---|
| 118 | double* X2;             //Tableau des X2 calculés | 
|---|
| 119 |  | 
|---|
| 120 |  | 
|---|
| 121 |  | 
|---|
| 122 | }; | 
|---|
| 123 |  | 
|---|
| 124 | #endif | 
|---|