source: Sophya/trunk/ArchTOIPipe/ProcWSophya/map2toi.cc@ 1463

Last change on this file since 1463 was 1463, checked in by cmv, 24 years ago

map2toi et toi2map rz+cecile+cmv 11/4/2001

File size: 2.4 KB
Line 
1#include "toimanager.h"
2#include "pexceptions.h"
3#include "ctimer.h"
4#include "map2toi.h"
5
6////////////////////////////////////////////////////////////////////////
7Map2TOI::Map2TOI(SphereHEALPix<r_8>& sph)
8: mSph(sph)
9{
10}
11
12Map2TOI::~Map2TOI()
13{
14}
15
16////////////////////////////////////////////////////////////////////////
17void Map2TOI::init() {
18 cout << "Map2TOI::init" << endl;
19 declareInput("AlphaIn"); // input index 0
20 declareInput("DeltaIn"); // input index 1
21 declareOutput("AlphaOut"); // output index 0
22 declareOutput("DeltaOut"); // output index 1
23 declareOutput("BoloOut"); // output index 2
24}
25
26////////////////////////////////////////////////////////////////////////
27void Map2TOI::run() {
28
29if(mSph.NbPixels()<1) {
30 cout<<"Map2TOI::Map2TOI() Bad number of pixels in sphere "<<mSph.NbPixels()<<endl;
31 throw ParmError("Map2TOI::Map2TOI() - Bad number of pixels in sphere");
32}
33
34long snb = getMinIn();
35long sne = getMaxIn();
36if(snb>sne) {
37 cout<<"Map2TOI::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
38 throw ParmError("Map2TOI::run() - Bad sample interval");
39}
40if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1)) {
41 cout<<"Map2TOI::run() - Input TOI (AlphaIn or DeltaIn) not connected! "<<endl;
42 throw ParmError("Map2TOI::run() Output TOI (AlphaIn or DeltaIn) not connected!");
43}
44bool connected_AlphaOut = checkOutputTOIIndex(0);
45bool connected_DeltaOut = checkOutputTOIIndex(1);
46if(!checkOutputTOIIndex(2)) {
47 cout<<"Map2TOI::run() - Output TOI (BoloOut) not connected! "<<endl;
48 throw ParmError("Map2TOI::run() Output TOI (BoloOut) not connected!");
49}
50
51//---------------------------------------------------------
52try {
53
54for(int k=snb;k<=sne;k++) {
55
56 double alpha = getData(0,k); // alpha entre [0,24[ en heures
57 if(alpha<0. || alpha>=24.) continue;
58 double delta = getData(1,k); // delta entre [-90,90] en degres
59 if(delta<-90. || delta>90.) continue;
60
61 double phi = alpha *M_PI/12.; // sphere phi entre [0,2*Pi] en radian
62 double teta = (90.-delta) *M_PI/180.; // sphere teta entre [0,Pi] en radian
63
64 double bolo = mSph(teta,phi);
65
66 if(connected_AlphaOut) putData(0,k,alpha,0);
67 if(connected_DeltaOut) putData(1,k,delta,0);
68 putData(2,k,bolo,0);
69}
70
71//---------------------------------------------------------
72} catch (PException & exc) {
73 cout<<"Map2TOI: Catched Exception "<<(string)typeid(exc).name()
74 <<"\n .... Msg= "<<exc.Msg()<<endl;
75}
76
77return;
78}
Note: See TracBrowser for help on using the repository browser.