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