Changeset 3872 in Sophya for trunk/AddOn/TAcq/brproc.h
- Timestamp:
- Aug 28, 2010, 12:43:04 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/brproc.h
r3777 r3872 5 5 // Projet BAORadio - (C) LAL/IRFU 2008-2010 6 6 // Classes de threads de traitememt donnees BAORadio 7 // Principales classes utilisables 8 // - BRMeanSpecCalculator (donnees FFT) 9 // - BRFFTCalculator (donnees RAW) 7 10 //---------------------------------------------------------------- 8 11 … … 19 22 #include "ntuple.h" 20 23 #include "datatable.h" 24 #include "FFTW/fftw3.h" 21 25 22 26 using namespace std; 23 27 24 28 25 //---------------------------------------------------------------------26 // Classe de traitement - calcul de visibilite pour n fibres27 //---------------------------------------------------------------------28 class BRVisibilityCalculator : public BRBaseProcessor, ParallelTaskInterface {29 public:30 BRVisibilityCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean=1000, size_t nthr=1);31 virtual ~BRVisibilityCalculator(); // Fait le nettoyage final , sauvegarde des objets ...32 33 // Pour definir le rang de l'objet lors d'un traitement avec plusieurs BRVisibilityCalculator en //34 void DefineRank(uint_4 nbc, uint_4 cid);35 36 // Pour limiter le calcul des visibilites a certaines fibres37 uint_4 SelectPairs(uint_4 pair1=0, uint_4 nbpairs=99999999);38 // pour definir le binning en frequence pour la VisibDataTable39 int SelectFreqBinning(uint_4 freq1=0, uint_4 freq2=0, uint_4 nbfreq=1);40 41 // Pour activer la verification des timetag42 // Creation / sauvegarde d'une matrice de TimeTag / FrameCounter avec NCols=maxnpaq (nb de paquets/trigger)43 int ActivateTimeTagCheck(uint_8 maxnpaq);44 45 // Methode d'execution standard du thread (on redefinit la methode de BRBaseProcessor)46 virtual void run();47 // Methode de la classe ParallelTaskInterface48 virtual int execute(int tid);49 50 // Le nombre total d'operations effectuees51 inline r_8 TotNbFLOP() { return nb_flop_; }52 53 protected:54 virtual int Process();55 virtual int FillVisibTable(double fcm, double ttm);56 virtual int CheckTimeTag();57 58 ParallelExecutor paralex_; // Pour l'execution en parallele59 size_t nparthr_;60 61 uint_4 nmean_; // Nombre de spectres pour le calcul des moyennes62 string outpath_; // directory pour fichiers de sortie63 uint_4 nbcalc_, calcid_; // Nombre total de threads/objets BRVisibilityCalculator parallèles, l'identificateur de l'objet64 65 uint_4 pairst_, nbpairs_; // Numero de la premiere paire, nombre de paires66 uint_4 jf1_,jf2_,djf_; // binning en frequence pour la datatable67 68 vector<TwoByteComplex*> vpdata_;69 bool* fgallfibok;70 71 double moyfc_, moytt_;72 TMatrix< complex<r_4> > vismtx_;73 TVector< uint_4 > chanum_;74 // FitsInOutFile dtfos_;75 DataTable visdt_;76 77 uint_4 numfile_;78 uint_8 totnbpaq_;79 80 r_8 nb_flop_; // Nombre total d'operations effectuees81 82 // Variables/objets pour la verifications des timetag83 bool fgcktt_; // true -> checktimetag84 int_8 mindeltatt_; // difference minimum de deux timetag successifs85 TMatrix< uint_8 > fcmtx_; // matrices des framecounters86 TMatrix< uint_8 > ttmtx_; // matrices des timetag87 vector< uint_8 > vlasttt_; // dernieres valeurs de TimeTag / fibre88 vector< uint_8 > vbadtt_; // Number of bad TimeTag paquets per fiber89 vector< uint_8 > vnsamett_; // Number of paquets having TimeTag <> TT_Fiber1 per fiber90 vector< uint_8 > vndiff5tt_; // Number of paquets having |TimeTag-TT_Fiber1|>5 per fiber91 92 };93 94 95 //-------------------------------------------------------------------------------96 // Classe Groupe (ensemble) de Calculateur de Visibilites, tourant en parallele97 //-------------------------------------------------------------------------------98 99 class BRVisCalcGroup {100 public:101 BRVisCalcGroup(size_t nbcalc, RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean=1000, size_t nthr=1);102 ~BRVisCalcGroup();103 int SelectFreqBinning(uint_4 freq1=0, uint_4 freq2=0, uint_4 nbfreq=1);104 inline int ActivateTimeTagCheck(uint_8 maxnpaq)105 { return viscalcp_[0]->ActivateTimeTagCheck(maxnpaq); }106 107 void start();108 void join();109 protected:110 vector<BRVisibilityCalculator *> viscalcp_;111 Timer tm_;112 };113 29 114 30 //--------------------------------------------------------------------- 115 31 // Classe de traitement simple - calcul de spectres moyennes / voie 32 // a partir de donnees de type FFT (firmware FFT) 116 33 //--------------------------------------------------------------------- 117 34 class BRMeanSpecCalculator : public BRBaseProcessor 118 35 { 119 36 public: 120 BRMeanSpecCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean=1000); 37 BRMeanSpecCalculator(RAcqMemZoneMgr& memgr, string outpath, uint_4 nmean=1000, 38 bool fgdatafft=true, bool fgsinglechan=false); 121 39 virtual ~BRMeanSpecCalculator(); // Fait le nettoyage final , sauvegarde des objets ... 122 40 123 41 protected: 124 42 virtual int Process(); 43 virtual void SaveSpectra(); 125 44 126 45 uint_4 nmean_; // Nombre de spectres pour le calcul des moyennes 127 46 string outpath_; // directory pour fichiers de sortie 47 bool fgdatafft_; 48 bool fgsinglechannel_; 128 49 uint_4 numfile_; 50 uint_8 nbpaq4mean_; 129 51 130 52 uint_8 totnbpaq_; 131 53 TMatrix< r_4 > mspecmtx_; // Matrice des spectres moyennees 132 54 }; 55 56 //------------------------------------------------------------------------- 57 // Classe WBRFFT : Calcul de TF sur donnees brutes (firmware RAW) 58 // en utilisant FFTW et en effectuant une copie ds tableau local 59 //------------------------------------------------------------------------- 60 typedef unsigned char IDT ; // definition type de donnees en entree de WBRFFT 61 typedef int_2 IIDT ; // definition type de donnees intermediaire 62 typedef float ODT; // type de donnees en sortie (complex < ODT > ) 63 //----Classe WBRFFT---- 64 class WBRFFT { 65 public: 66 WBRFFT(uint_4 sz=0); 67 virtual ~WBRFFT(); 68 69 void SetInDataSize(uint_4 sz); 70 void DoFFT(IDT *indata, complex<ODT> * ofc); 71 static void PrintData(IDT *indata, complex<ODT> * ofc, uint_4 sz); 72 73 uint_4 sz_; // Taille tableau d'entree 74 TVector< ODT > inp; 75 TVector< complex<ODT> > outfc; 76 fftwf_plan myplan_; 77 static ZMutex* mtx_fftwp_; // Mutex de protection pour la creation du plan fftw 78 }; 79 //-------------------- 80 81 //--------------------------------------------------------------------- 82 // Classe de thread de calcul de FFT sur donnees RAW 83 //--------------------------------------------------------------------- 84 class BRFFTCalculator : public BRBaseProcessor 85 { 86 public: 87 BRFFTCalculator(RAcqMemZoneMgr& memgr, bool fgsinglechannel=false); 88 virtual ~BRFFTCalculator(); // Fait le nettoyage final , sauvegarde des objets ... 89 90 protected: 91 virtual int Process(); 92 93 bool fgsinglechannel_; 94 uint_8 totnbfftpaq_; 95 WBRFFT ffts_; 96 }; 97 133 98 134 99 //------------------------------------------------------------------------- … … 151 116 o card : numero de carte , juste pour les impressions 152 117 */ 153 class BRProcA2C : public ZThread { 118 class BRProcA2C : public ZThread { // !!!! OBSOLETE !!!! 154 119 public: 155 120 BRProcA2C(RAcqMemZoneMgr& mem, string& path, bool fgraw, … … 174 139 //--------------------------------------------------------------------- 175 140 // Classe thread de traitement 2 x 2 voies/paquet (Apres BRProcA2C) 141 // !!!! OBSOLETE !!!! 176 142 //--------------------------------------------------------------------- 177 143 /*-- Arguments du constructeur : … … 184 150 */ 185 151 186 class BRProcB4C : public ZThread { 152 class BRProcB4C : public ZThread { // !!!! OBSOLETE !!!! 153 187 154 public: 188 155 BRProcB4C(RAcqMemZoneMgr& mem1, RAcqMemZoneMgr& mem2, string& path,
Note:
See TracChangeset
for help on using the changeset viewer.