| 1 | // This may look like C code, but it is really -*- C++ -*- | 
|---|
| 2 |  | 
|---|
| 3 | // ArchTOIPipe           (C)     CEA/DAPNIA/SPP IN2P3/LAL | 
|---|
| 4 | //                               Eric Aubourg | 
|---|
| 5 | //                               Christophe Magneville | 
|---|
| 6 | //                               Reza Ansari | 
|---|
| 7 | // $Id: fitstoirdr.h,v 1.14 2002-10-07 14:23:02 aubourg Exp $ | 
|---|
| 8 |  | 
|---|
| 9 |  | 
|---|
| 10 | #ifndef FITSTOIRDR_H | 
|---|
| 11 | #define FITSTOIRDR_H | 
|---|
| 12 |  | 
|---|
| 13 | #include "config.h" | 
|---|
| 14 | #include "toiprocessor.h" | 
|---|
| 15 | #include <string> | 
|---|
| 16 | #include <vector> | 
|---|
| 17 | #include <map> | 
|---|
| 18 | #include "fitsio.h" | 
|---|
| 19 | #include "flagtoidef.h" | 
|---|
| 20 |  | 
|---|
| 21 | class FITSTOIReader : public TOIProcessor { | 
|---|
| 22 | public: | 
|---|
| 23 | FITSTOIReader(string fn,int buff_sz=1024); | 
|---|
| 24 | ~FITSTOIReader(); | 
|---|
| 25 |  | 
|---|
| 26 | void         setImplicitSN(long snStart=0); | 
|---|
| 27 |  | 
|---|
| 28 | void         setBufferSize(int buffsz=1024); | 
|---|
| 29 | inline int   getBufferSize() { return Buff_Sz; } | 
|---|
| 30 |  | 
|---|
| 31 | virtual void addFile(string fn); | 
|---|
| 32 |  | 
|---|
| 33 | // Methode rajoutee pour gerer les fichiers de flag de LevelS | 
|---|
| 34 | // Reza 18/6/2002 | 
|---|
| 35 | // fn : Nom du fichier FITS, | 
|---|
| 36 | // flags: Indique le nombre de colonne et la correspondence avec les | 
|---|
| 37 | // flags d'ArchTOIPipe flags[0..N-1] ---> 1ere...Neme colonnes | 
|---|
| 38 | virtual void setFlagFile(string fn, vector<FlagToiDef> flags); | 
|---|
| 39 |  | 
|---|
| 40 | virtual void init(); | 
|---|
| 41 | virtual void run(); | 
|---|
| 42 |  | 
|---|
| 43 | inline int_8  ProcessedSampleCount() const { return totnscount; } | 
|---|
| 44 | virtual void printLimits(); | 
|---|
| 45 |  | 
|---|
| 46 | protected: | 
|---|
| 47 | virtual int   calcMinOut(); | 
|---|
| 48 | virtual int   calcMaxOut(); | 
|---|
| 49 |  | 
|---|
| 50 | // ajout vf 31/07/2002 | 
|---|
| 51 | virtual bool checkSampleLimits(long& min, long& max, int pass); | 
|---|
| 52 | virtual void calcSampleLimits(long& min, long& max); | 
|---|
| 53 | virtual bool checkSampleLimits(int pass) {return TOIProcessor::checkSampleLimits(pass);} | 
|---|
| 54 |  | 
|---|
| 55 | virtual void run1(); | 
|---|
| 56 | virtual void run2(); | 
|---|
| 57 | virtual void openFile(string fn); | 
|---|
| 58 |  | 
|---|
| 59 | private: | 
|---|
| 60 | fitsfile* fptr; | 
|---|
| 61 | int       fstatus; | 
|---|
| 62 | string    fname;   // current file | 
|---|
| 63 | long      nrows;   // current file | 
|---|
| 64 | int       firstSn; // current file | 
|---|
| 65 | int       Buff_Sz; // buffer size | 
|---|
| 66 |  | 
|---|
| 67 | int       ncols;   // including flags. getNOut() is # of tois. | 
|---|
| 68 |  | 
|---|
| 69 | // supression de la redefinition vf 23/08/2002 | 
|---|
| 70 | //int       snBegin; // first file | 
|---|
| 71 | //int       snEnd;   // last file | 
|---|
| 72 |  | 
|---|
| 73 | bool      implicitSN; | 
|---|
| 74 | long      implicitSNStart; | 
|---|
| 75 |  | 
|---|
| 76 | vector<string> allfn; | 
|---|
| 77 | map<int,pair<int, bool> > colsinput; // iTOI -> (colonne, hasflag) | 
|---|
| 78 | // le flag est alors en colonne+1 | 
|---|
| 79 |  | 
|---|
| 80 | int_8 totnscount;   // Nombre total d'echantillon processe | 
|---|
| 81 |  | 
|---|
| 82 | // Variables rajoutee pour gerer les fichiers de flag de LevelS (Reza 18/6/2002) | 
|---|
| 83 | bool sepFlagfile; | 
|---|
| 84 | string sepFlagFileName; | 
|---|
| 85 | vector<FlagToiDef> sepFlagCols; | 
|---|
| 86 | fitsfile* fptrflg; | 
|---|
| 87 |  | 
|---|
| 88 | }; | 
|---|
| 89 |  | 
|---|
| 90 | #endif | 
|---|