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

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

adapt getData cmv 11/4/01

File size: 2.5 KB
RevLine 
[1463]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
[1466]56 int_8 flg = 0;
[1463]57 double alpha = getData(0,k); // alpha entre [0,24[ en heures
[1466]58 if(alpha<0. || alpha>=24.) flg=1;
[1463]59 double delta = getData(1,k); // delta entre [-90,90] en degres
[1466]60 if(delta<-90. || delta>90.) flg=1;
61 double bolo = -99999.;
[1463]62
[1466]63 if(!flg) {
64 double phi = alpha *M_PI/12.; // sphere phi entre [0,2*Pi] en radian
65 double teta = (90.-delta) *M_PI/180.; // sphere teta entre [0,Pi] en radian
66 bolo = mSph(teta,phi);
67 }
[1463]68
69 if(connected_AlphaOut) putData(0,k,alpha,0);
70 if(connected_DeltaOut) putData(1,k,delta,0);
[1466]71 putData(2,k,bolo,flg);
[1463]72}
73
74//---------------------------------------------------------
75} catch (PException & exc) {
76 cout<<"Map2TOI: Catched Exception "<<(string)typeid(exc).name()
77 <<"\n .... Msg= "<<exc.Msg()<<endl;
78}
79
80return;
81}
Note: See TracBrowser for help on using the repository browser.