| 1 | #ifndef AbsCalTool_H
 | 
|---|
| 2 | #define AbsCalTool_H
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #include <fstream>
 | 
|---|
| 5 | #include "unitvector.h"
 | 
|---|
| 6 | #include "pixelmap.h" 
 | 
|---|
| 7 | #include "specresp.h"
 | 
|---|
| 8 | #include "abslobenopolar.h"
 | 
|---|
| 9 | 
 | 
|---|
| 10 | class AbsCalcTool
 | 
|---|
| 11 | {
 | 
|---|
| 12 |  public:
 | 
|---|
| 13 |         AbsCalcTool(double CompResol=0.,double freqMin=0.,double freqMax=-1.) 
 | 
|---|
| 14 |                 :FreqMax(freqMax), FreqMin(freqMin), RAngComp(CompResol) {      }
 | 
|---|
| 15 |         //      Dummy values. Have to be initialised in offspring classes
 | 
|---|
| 16 |         
 | 
|---|
| 17 |         ~AbsCalcTool() {        }
 | 
|---|
| 18 |         
 | 
|---|
| 19 |         virtual double compPixel(UnitVector& VP, UnitVector& VY)=0;
 | 
|---|
| 20 |          // Return power on detector (Watt/m2) for this Lobe and filter
 | 
|---|
| 21 |     // Pointing at these ccordinates and orientation. Exact
 | 
|---|
| 22 |     
 | 
|---|
| 23 |    virtual void print(ostream& ReadMe)=0;
 | 
|---|
| 24 |    //   Main infos about calcTool
 | 
|---|
| 25 |     
 | 
|---|
| 26 |    virtual double CalcLobeSize(double frequency= -10.)=0;
 | 
|---|
| 27 |         // Calcule l'extension spatiale du lobe de cet outil
 | 
|---|
| 28 |         // par integration numerique, calquee sur 
 | 
|---|
| 29 |         // L'integration spatiale ddu signal physique;
 | 
|---|
| 30 |         // VALEUR RETOUR EN STERADIAN
 | 
|---|
| 31 |         // Doit EVOLUER SI l'integration spatiale du signal physique CHANGE;
 | 
|---|
| 32 |         
 | 
|---|
| 33 |         double compPixelQD(double theta, double phi);
 | 
|---|
| 34 |     // Return power on detector (Watt/m2) for this Lobe and filter
 | 
|---|
| 35 |     // Pointing at these ccordinates.
 | 
|---|
| 36 |     // Exact if lobes are symmetrical by rotation around pointed axe
 | 
|---|
| 37 |    
 | 
|---|
| 38 |   // Normalisation tools
 | 
|---|
| 39 |         double NormKelvinRayleighJeans();
 | 
|---|
| 40 |         // Compute te normalisation factor to go from Watt/m2 to KelvinRaleighJeans
 | 
|---|
| 41 |         // same computation option than the map options
 | 
|---|
| 42 |         // KelvinRJ/(Watt/m2)
 | 
|---|
| 43 |         
 | 
|---|
| 44 |         double NormKelvinCMB();
 | 
|---|
| 45 |         // Compute te normalisation factor to go from Watt/m2 to KelvinCMB
 | 
|---|
| 46 |         // same computation option than the map options
 | 
|---|
| 47 |         // KelvinCMB/(Watt/m2)
 | 
|---|
| 48 |         
 | 
|---|
| 49 |  protected:
 | 
|---|
| 50 |         double RAngComp;                // angular resolution of computations
 | 
|---|
| 51 |         double FreqMax;         // Hz
 | 
|---|
| 52 |         double FreqMin;
 | 
|---|
| 53 |  
 | 
|---|
| 54 |         AbsLobeNoPolar* pLobe;
 | 
|---|
| 55 |         SpectralResponse* pFilter;              // Hz
 | 
|---|
| 56 |         
 | 
|---|
| 57 |          // Computation tools       
 | 
|---|
| 58 |     // Math tools !!!!!!!-------------------------------------------------------
 | 
|---|
| 59 |         inline double max(double a, double b)const
 | 
|---|
| 60 |         {       if(a>b) return a;
 | 
|---|
| 61 |                 else return b;
 | 
|---|
| 62 |         }
 | 
|---|
| 63 |         inline double min(double a, double b)const
 | 
|---|
| 64 |         {       if(a<b) return a;
 | 
|---|
| 65 |                 else return b;
 | 
|---|
| 66 |         }
 | 
|---|
| 67 |             //compute solid angle between cones of aperture angles ang1 and ang2
 | 
|---|
| 68 |  
 | 
|---|
| 69 |         double diffSolidAng(double ang1,double ang2) const
 | 
|---|
| 70 |         {       return fabs(2*M_PI*(cos(ang1)-cos(ang2)));              // Steradians
 | 
|---|
| 71 |         }
 | 
|---|
| 72 | 
 | 
|---|
| 73 | };
 | 
|---|
| 74 |         
 | 
|---|
| 75 | // Tools for computing Maps
 | 
|---|
| 76 | template <class T> void addToSkyMap(PixelMap<T>& Map, AbsCalcTool& Tool);
 | 
|---|
| 77 | template <class T> void compSkyMap(PixelMap<T>& Map, AbsCalcTool& Tool);
 | 
|---|
| 78 | template <class T> void addInInBandPowerMap(PixelMap<T>& Map, AbsCalcTool& tool);
 | 
|---|
| 79 |         // Exact if lobes are symmetrical by rotation around pointed axe
 | 
|---|
| 80 |         // Return a map at the requested resolution and frequency
 | 
|---|
| 81 | 
 | 
|---|
| 82 | // Tools for manipulating maps  
 | 
|---|
| 83 | template <class T1, class T2> void addMap(PixelMap<T1>& Map, PixelMap<T2>& Map2);
 | 
|---|
| 84 | template <class T1, class T2> void substractMap(PixelMap<T1>& Map, PixelMap<T2>& Map2);
 | 
|---|
| 85 | template <class T1, class T2> void divMap1WithMap2(PixelMap<T1>& Map, PixelMap<T2>& Map2);
 | 
|---|
| 86 | template <class T> void scaleMap(double scalefactor, PixelMap<T>& Map);
 | 
|---|
| 87 | template <class T> int MinMaxSigMap(PixelMap<T>& Map, double& Min, 
 | 
|---|
| 88 |         double& Max, double& Moy, double& Var);
 | 
|---|
| 89 |         
 | 
|---|
| 90 | // Tool for changing ccordinates
 | 
|---|
| 91 | // All coordinates are in Radian.
 | 
|---|
| 92 |   /* kmg_euler.c
 | 
|---|
| 93 |    *
 | 
|---|
| 94 |    * Converts between different coordinate systems. 
 | 
|---|
| 95 |    *
 | 
|---|
| 96 |    * SELECT   From           To         |   SELECT    From          To
 | 
|---|
| 97 |    *    1     RA-Dec (2000)  Galactic   |     4       Ecliptic      RA-Dec    
 | 
|---|
| 98 |    *    2     Galactic       RA-DEC     |     5       Ecliptic
 | 
|---|
| 99 | Galactic  
 | 
|---|
| 100 |    *    3     RA-Dec         Ecliptic   |     6       Galactic
 | 
|---|
| 101 | Ecliptic  
 | 
|---|
| 102 |    *
 | 
|---|
| 103 |    *    Date     Programmer Remarks
 | 
|---|
| 104 |    * ----------- ---------- -------
 | 
|---|
| 105 |    * 08-Aug-1999 K. Ganga   First version. Copied and modified EULER from 
 | 
|---|
| 106 |    *                        the IDL Astrolib. 
 | 
|---|
| 107 |    * May 2000, D. Yvon           Change coordinates units to Radians
 | 
|---|
| 108 |    */
 | 
|---|
| 109 | int kmg_eulerRad(double ai, double bi, int select, double *ao, double *bo);
 | 
|---|
| 110 | 
 | 
|---|
| 111 | #endif | 
|---|