1 | #include <stdlib.h>
|
---|
2 | #include <iostream>
|
---|
3 | #include "lobelevshealpix.h"
|
---|
4 | #include "lightptsrclevsinband.h"
|
---|
5 |
|
---|
6 | LobeLevSHealpix::LobeLevSHealpix(char FileOflobeMap[],double angMax_degre, double MeanFreq_Hz)
|
---|
7 | :MeanFreqLobe(MeanFreq_Hz*0.85,MeanFreq_Hz*1.15)
|
---|
8 |
|
---|
9 | { angleMax=angMax_degre/180.*M_PI; // Radian
|
---|
10 | cosanglemax=cos(angleMax);
|
---|
11 |
|
---|
12 | sprintf(Name,"Lobe_LevelS_Healpix");
|
---|
13 |
|
---|
14 | // Version 4
|
---|
15 | // On lit la Sphere Healpix
|
---|
16 | FitsInFile File(FileOflobeMap);
|
---|
17 | FITS_SphereHEALPix <r_4> FSphere;
|
---|
18 | FSphere.Read(File);
|
---|
19 | cerr<<"Lecture des donnes du lobe LevelSHealpix"<<endl;
|
---|
20 |
|
---|
21 | // On stocke les donnees
|
---|
22 | pSphere=new SphereHEALPix<r_4> ((SphereHEALPix<r_4>) FSphere );
|
---|
23 |
|
---|
24 | /* // Version 1
|
---|
25 | pSphere=new SphereHEALPix<r_4>;
|
---|
26 | cerr<<"Lecture des donnes du lobe LevelSHealpix"<<endl;
|
---|
27 | FITS_SphereHEALPix<float> FSphere(*pSphere);
|
---|
28 | FSphere.Read(FileOflobeMap);
|
---|
29 |
|
---|
30 | // Version 2
|
---|
31 | FITS_SphereHEALPix<float> FSphere(FileOflobeMap);
|
---|
32 | cerr<<"Lecture des donnes du lobe LevelSHealpix"<<endl;
|
---|
33 | pSphere=new SphereHEALPix<r_4>;
|
---|
34 | *pSphere= (SphereHEALPix<r_4>) FSphere;
|
---|
35 |
|
---|
36 | // Version 3
|
---|
37 | FITS_SphereHEALPix<float> FSphere(FileOflobeMap);
|
---|
38 | cerr<<"Lecture des donnes du lobe LevelSHealpix"<<endl;
|
---|
39 | SphereHEALPix<r_4> & Sphere= (SphereHEALPix<r_4>) FSphere;
|
---|
40 | pSphere=&Sphere;
|
---|
41 | */
|
---|
42 |
|
---|
43 |
|
---|
44 | /* pSphere= new SphereHEALPix<float>;
|
---|
45 | *pSphere= ( SphereHEALPix<float> ) FSphere;
|
---|
46 | */
|
---|
47 | /*
|
---|
48 | SphereHEALPix <float>* pUNSphere=pFSphere->getObj();
|
---|
49 | long Nlat=pUNSphere->SizeIndex();
|
---|
50 | pSphere=new SphereHEALPix <float>(Nlat);
|
---|
51 | *pSphere=(SphereHEALPix <float>) (*pFSphere);
|
---|
52 | delete pFSphere;
|
---|
53 | */
|
---|
54 | }
|
---|
55 |
|
---|
56 | LobeLevSHealpix::~LobeLevSHealpix()
|
---|
57 | { delete pSphere;
|
---|
58 |
|
---|
59 | }
|
---|
60 |
|
---|
61 | double LobeLevSHealpix::weigthAmpl(const UnitVector& VInteg, const UnitVector& VP,
|
---|
62 | const UnitVector& VY) const
|
---|
63 | { double cosinusZ=VP*VInteg;
|
---|
64 | if(cosinusZ<cosanglemax) return 0.;
|
---|
65 | if(cosinusZ==1.) return (*pSphere)(pSphere->PixIndexSph(0.,0.));
|
---|
66 | else
|
---|
67 | { UnitVector VX=VP^VY;
|
---|
68 | double theta = acos (cosinusZ);
|
---|
69 |
|
---|
70 | Vector3d Vproj=VInteg-cosinusZ*VP;
|
---|
71 | double phi;
|
---|
72 |
|
---|
73 | double norm=Vproj.Norm();
|
---|
74 | Vproj/=norm;
|
---|
75 | phi = scangle(VY*Vproj,VX*Vproj); // Fonction de geometry.h
|
---|
76 | // double scangle(double sinus, double cosinus)
|
---|
77 | // double PixNumb = pSphere->PixIndexSph(theta,phi);
|
---|
78 | double weigthVal= (*pSphere)(pSphere->PixIndexSph(theta,phi));
|
---|
79 | return weigthVal;
|
---|
80 | }
|
---|
81 | } |
---|