source: Sophya/trunk/AddOn/TAcq/brfitsrd.h@ 3684

Last change on this file since 3684 was 3683, checked in by ansari, 16 years ago

Mise a jour et ajout de fichier pour taritement multifibres apres

prise de donnees de Nov2009 a Pittsburgh

  • Introduction des classes BRMultiFitsReader et BRBaseProcessor Reza, 27/11/2009
File size: 3.3 KB
RevLine 
[3635]1#ifndef RARDFITS_H_SEEN
2#define RARDFITS_H_SEEN
3
4//----------------------------------------------------------------
[3683]5// Projet BAORadio - (C) LAL/IRFU 2008-2010
6// Classes de threads pour lecture fichiers fits BAORadio
[3635]7//----------------------------------------------------------------
8
9#include "racqumem.h"
10#include <string>
11#include <vector>
12#include <iostream>
13
14#include "brpaqu.h"
[3683]15#include "minifits.h"
[3635]16
17using namespace std;
18
[3683]19#ifndef MAXANAFIB
20#define MAXANAFIB 32
21#endif
[3635]22
23//-------------------------------------------------------
[3683]24// Classe thread de lecture des fichiers data BAORadio
25// BRMultiFitsReader : Lecture multi-fibres
26//-------------------------------------------------------
27
28class BRMultiFitsReader : public SOPHYA::ZThread {
29public:
30 BRMultiFitsReader(RAcqMemZoneMgr& mem, vector<string>& dirs,
31 bool rdsamefc=true, uint_4 imin=0, uint_4 imax=0, uint_4 istep=1);
32
33 virtual void run();
34 inline void Stop() { stop_ = true; }
35 inline void STOP() { stop_ = true; }
36
37 inline int SetPrintLevel(int lev=0) { prtlev_=lev; }
38protected:
39 bool ReadNextAllFibers(); // Renvoie true si probleme
40 bool ReadNext(int fib); // Renvoie true si probleme
41 // Permet d'avancer d'un paquet dans la zone - renvoie true si probleme
42 inline bool MoveToNextTarget() {
43 if ((mmbuf_ == NULL )||(targ_npaq_ >= max_targ_npaq))
44 if (MZoneManage()) return true;
45 targ_npaq_++;
46 return false;
47 }
48 inline Byte* GetPaquetTarget(int numfib) {
49 if ((mmbufib_[numfib] == NULL )||(targ_npaq_ > max_targ_npaq)||(targ_npaq_ == 0)) return NULL;
50 Byte* rb=mmbufib_[numfib]+(targ_npaq_-1)*packsize_;
51 return rb;
52 }
53 bool MZoneManage(bool clean=false); // Renvoie true si probleme
54
55 RAcqMemZoneMgr& memgr_;
56 vector<string> dirs_; // repertoires donnees chaque fibre
57 bool stop_;
58 bool rdsamefc_; // if true, read paquets with same value of FrameCounter on different fibers
59 uint_4 imin_, imax_, istep_;
60 size_t totnbytesrd_;
61 uint_8 totsamefc_; // nombre total de paquets avec meme framecounter
62 MiniFITSFile mff_[MAXANAFIB];
63 vector<uint_4> vfilenum_;
64 vector<uint_4> vfpos_;
65 vector<BRPaquet> vpaq_;
66 vector<BRPaqChecker> vpchk_;
67 vector<uint_8> curfc_; // Numeros des FrameCounter des paquets courants
68 vector<uint_8> totnpqrd_; // nombre total de paquets lus / fibre
69 vector<uint_8> totnpqok_; // nombre total de paquets OK / fibre
70
71 uint_4 packsize_;
72 int mid_; // Identificateur zone memoire
73 uint_4 targ_npaq_; // Numero de paquet dans une seule zone memoire
74 uint_4 max_targ_npaq; // = mmgr.NbPaquets() = Max de targ_npaq_
75 Byte* mmbuf_; // Pointeur zone memoire rendu par RAcqMemZoneMgr
76 Byte* mmbufib_[MAXANAFIB]; // Pointeurs zone memoire de chaque fibre rendu par RAcqMemZoneMgr
77
78 int prtlev_;
79};
80
81//-------------------------------------------------------
[3635]82// Classe thread de lecture des fichiers (mini)fits
83//-------------------------------------------------------
84
[3683]85class BRFitsReader : public SOPHYA::ZThread {
[3635]86public:
87 BRFitsReader(RAcqMemZoneMgr& mem, vector<string>& infiles, bool fgnotrl=false);
88
89 virtual void run();
[3683]90 inline void Stop() { stop_ = true; }
[3635]91 inline void STOP() { stop_ = true; }
92
93protected:
94 RAcqMemZoneMgr& memgr;
95 vector<string> infiles_;
96 bool fgnotrl_;
97 bool stop_;
98};
99
[3646]100#endif
Note: See TracBrowser for help on using the repository browser.