| 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: toi2map.h,v 1.18 2002-10-24 10:30:50 aubourg Exp $ | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef TOI2MAP_H | 
|---|
| 10 | #define TOI2MAP_H | 
|---|
| 11 |  | 
|---|
| 12 | #include "toiprocessor.h" | 
|---|
| 13 | #include "toiprocessor.h" | 
|---|
| 14 | #include "spherehealpix.h" | 
|---|
| 15 | #include "localmap.h" | 
|---|
| 16 | #include "flagtoidef.h" | 
|---|
| 17 | #include "xastropack.h" | 
|---|
| 18 |  | 
|---|
| 19 | //-- Un projecteur de TOI sur une carte quelconque | 
|---|
| 20 | // Lecture de 3 TOI coord1,coord2,boloMuV | 
|---|
| 21 | // Sortie pas de TOI, une (2) cartes | 
|---|
| 22 | // | 
|---|
| 23 | // Structure generale : | 
|---|
| 24 | //                          |---->Carte | 
|---|
| 25 | //                          | | 
|---|
| 26 | //                     ----------- | 
|---|
| 27 | //   toi Coord1In ---> |         | | 
|---|
| 28 | //   toi Coord2In ---> | TOI2Map | | 
|---|
| 29 | //   toi BoloIn   ---> |         | | 
|---|
| 30 | //                     ----------- | 
|---|
| 31 | // Gestion du type de coordonnees : | 
|---|
| 32 | // Coord1In,Coord2In : soit Equatoriales (Alpha,Delta) | 
|---|
| 33 | //                     soit Galactiques  (GLong,GLat) | 
|---|
| 34 | // Sortie sur une sphere en coordonnees Equatoriales ou Galactiques | 
|---|
| 35 | // Si les CoordIn et les CoordMap sont equatoriales -> meme equinoxe! | 
|---|
| 36 |  | 
|---|
| 37 | class TOI2Map : public TOIProcessor { | 
|---|
| 38 | public: | 
|---|
| 39 | TOI2Map(PixelMap<r_8>* map,PixelMap<r_8>* wmap=NULL); | 
|---|
| 40 | TOI2Map(string mapFName, string wmapFName, int nside); | 
|---|
| 41 | //TOI2Map(SphereHEALPix<r_8>* map,SphereHEALPix<r_8>* wmap=NULL); | 
|---|
| 42 | virtual       ~TOI2Map(); | 
|---|
| 43 |  | 
|---|
| 44 | virtual void  init(void); | 
|---|
| 45 | virtual void  run(void); | 
|---|
| 46 |  | 
|---|
| 47 | // Coordonnees donnees en entree et en sortie | 
|---|
| 48 | inline void SetEquinox(double actualyear=2000.) | 
|---|
| 49 | {mActualYear = actualyear;} | 
|---|
| 50 |  | 
|---|
| 51 | inline void SetCoorIn(unsigned long mfg=TypCoordGalStd) | 
|---|
| 52 | {mTypCoorIn = mfg;} | 
|---|
| 53 | inline void SetCoorIn(const char *ctype) | 
|---|
| 54 | {mTypCoorIn = DecodeTypAstro(ctype);} | 
|---|
| 55 |  | 
|---|
| 56 | inline void SetCoorMap(unsigned long mfg=TypCoordGal) | 
|---|
| 57 | {mTypCoorMap = mfg;} | 
|---|
| 58 | inline void SetCoorMap(const char *ctype) | 
|---|
| 59 | {mTypCoorMap = DecodeTypAstro(ctype);} | 
|---|
| 60 |  | 
|---|
| 61 | // Facteur de calibration | 
|---|
| 62 | inline void SetCalibrationFactor(double fac = 1.) | 
|---|
| 63 | { mCalibFactor = fac; } | 
|---|
| 64 | inline double GetCalibrationFactor() | 
|---|
| 65 | { return  mCalibFactor; } | 
|---|
| 66 |  | 
|---|
| 67 | // Test on flag value ? if yes, BAD sample have flag matching mBadFlag | 
|---|
| 68 | inline void SetTestFlag(bool tflg=false, uint_8 badflg=FlgToiAll) | 
|---|
| 69 | {mTFlag = tflg; mBadFlag = badflg;} | 
|---|
| 70 | // Test on min value ? if yes, GOOD sample have value >= mValMin | 
|---|
| 71 | // Test on max value ? if yes, GOOD sample have value <= mValMax | 
|---|
| 72 | // Good values are (mValMin <= sample value <= mValMax) | 
|---|
| 73 | //                      bounds are included | 
|---|
| 74 | inline void SetTestMin(bool tmin=false, r_8 vmin=-1.e30) | 
|---|
| 75 | {mTMin = tmin; mValMin = vmin;} | 
|---|
| 76 | inline void SetTestMax(bool tmax=false, r_8 vmax=+1.e30) | 
|---|
| 77 | {mTMax = tmax; mValMax = vmax;} | 
|---|
| 78 | // Print | 
|---|
| 79 | void Print(::ostream & os); | 
|---|
| 80 | inline int_8  ProcessedSampleCount() const { return totnscount; } | 
|---|
| 81 | inline int_8  UsedSampleCount() const { return usednscount; } | 
|---|
| 82 |  | 
|---|
| 83 | protected: | 
|---|
| 84 | void commonConst(); | 
|---|
| 85 |  | 
|---|
| 86 | PixelMap<r_8>* mMap; | 
|---|
| 87 | PixelMap<r_8>* mWMap; | 
|---|
| 88 | bool mWMapInternal; | 
|---|
| 89 |  | 
|---|
| 90 | string mMapFName, mWMapFName; | 
|---|
| 91 |  | 
|---|
| 92 | unsigned long mTypCoorIn, mTypCoorMap; | 
|---|
| 93 | double mActualYear; | 
|---|
| 94 |  | 
|---|
| 95 | double mCalibFactor; | 
|---|
| 96 | bool mTFlag,mTMin,mTMax; | 
|---|
| 97 | uint_8 mBadFlag; | 
|---|
| 98 | r_8 mValMin,mValMax; | 
|---|
| 99 | int_8 totnscount;   // Nombre total d'echantillon processe | 
|---|
| 100 | int_8 usednscount;   // Nombre d'echantillons utilises ds la projection | 
|---|
| 101 |  | 
|---|
| 102 | }; | 
|---|
| 103 |  | 
|---|
| 104 | #endif | 
|---|