source: Sophya/trunk/ArchTOIPipe/ProcWSophya/toi2toi_addsp.cc@ 2095

Last change on this file since 2095 was 2095, checked in by cecile, 23 years ago

* empty log message *

File size: 4.2 KB
Line 
1// ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
2// Eric Aubourg
3// Christophe Magneville
4// Reza Ansari
5// $Id: toi2toi_addsp.cc,v 1.1 2002-07-16 08:48:06 cecile Exp $
6
7#include "machdefs.h"
8#include "toimanager.h"
9#include "pexceptions.h"
10#include "ctimer.h"
11#include "toi2map.h"
12// La valeur "Pi" doit etre celle de smathconst.h a cause du test sur theta
13#include "smathconst.h"
14
15////////////////////////////////////////////////////////////////////////
16TOI2Map::TOI2Map()
17 : totnscount(0)
18{
19 SetEquinox();
20 SetCoorIn();
21 SetCoorMap();
22 SetTestFlag();
23 SetTestMin();
24 SetTestMax();
25
26}
27
28TOI2Map::~TOI2Map()
29{
30}
31
32////////////////////////////////////////////////////////////////////////
33void TOI2Map::Print(::ostream & os)
34{
35}
36
37////////////////////////////////////////////////////////////////////////
38void TOI2Map::init() {
39 cout << "TOI2Map::init" << endl;
40 declareInput("Coord1In");
41 declareInput("Coord2In");
42 declareInput("BoloIn");
43 declareInput("utc");
44 declareInput("lon");
45 declareInput("lat");
46
47 declareOutput("BoloOut");
48}
49
50////////////////////////////////////////////////////////////////////////
51// define SANS_BUFFER
52void TOI2Map::run()
53{
54long snb = getMinIn();
55long sne = getMaxIn();
56
57if(snb>sne) {
58 cout<<"TOI2Map::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
59 throw ParmError("TOI2Map::run() - Bad sample interval");
60}
61if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1) || !checkInputTOIIndex(2)) {
62 cout<<"TOI2Map::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl;
63 throw ParmError("TOI2Map::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!");
64}
65if( !(mTypCoorIn&TypCoordEq || mTypCoorIn&TypCoordGal) ) {
66 cout<<"TOI2Map::run() - Input Coordinates not Eq or Gal! "<<endl;
67 throw ParmError("TOI2Map::run() - Input Coordinates not Eq or Gal!");
68}
69if( !(mTypCoorMap&TypCoordEq || mTypCoorMap&TypCoordGal) ) {
70 cout<<"TOI2Map::run() - Output Coordinates not Eq or Gal! "<<endl;
71 throw ParmError("TOI2Map::run() - Output Coordinates not Eq or Gal!");
72}
73
74//---------------------------------------------------------
75#define NFILL 25
76try {
77
78int ii;
79uint_4 mNSnFill=0, mNpixFill=0, NFill[NFILL], BadCoorRange=0;
80for(ii=0;ii<NFILL;ii++) NFill[ii]=0;
81double mjd = MJDfrYear(mActualYear);
82
83cout<<"TOI2Map::run() from "<<snb<<" to "<<sne;
84#ifndef SANS_BUFFER
85int bufsz = 100;
86uint_8* bfgbolo = new uint_8[bufsz];
87double* bbolo = new double[bufsz];
88double* bc1 = new double[bufsz];
89double* bc2 = new double[bufsz];
90int i0 = -1;
91cout<<" (getData() bufferized)"<<endl;
92#else
93cout<<" (getData() not bufferized)"<<endl;
94#endif
95
96for(int s=snb;s<=sne;s++) {
97 uint_8 fgbolo = 0;
98 double bolo,coord1,coord2;
99 // Equatoriales / Galactiques
100 // coord1,2 = alpha,delta / gLon,gLat
101
102 getData(2,s,bolo,fgbolo);
103 coord1 = getData(0,s);
104 coord2 = getData(1,s);
105 totnscount++;
106
107 // Comme il n'y a pas de toi en sortie, il faut dire
108 // aux processeur/toi que l'on a plus besoin des donnees.
109 if (s%100 == 0) wontNeedBefore(s-1);
110 if(mTFlag && fgbolo&mBadFlag) continue;
111 if(mTMin && bolo<mValMin) continue;
112 if(mTMax && bolo>mValMax) continue;
113
114 // sphere phi entre [0,2*Pi] en radians
115 // sphere theta entre [0,Pi] en radians
116 double phi=-1.;
117 CoordConvertToStd(mTypCoorIn,&coord1,&coord2);
118
119 if(mTypCoorIn&TypCoordEq && mTypCoorMap&TypCoordGal) { // Eq -> Gal
120 EqtoGal(mjd,coord1,coord2,&coord1,&coord2);
121 phi = coord1 * Pi/180.;
122 } else if(mTypCoorIn&TypCoordGal && mTypCoorMap&TypCoordEq) { // Gal -> Eq
123 GaltoEq(mjd,coord1,coord2,&coord1,&coord2);
124 phi = coord1 * Pi/12.;
125 } else if(mTypCoorMap&TypCoordGal) { // Gal -> Gal
126 phi = coord1 * Pi/180.;
127 } else if(mTypCoorMap&TypCoordEq) { // Eq -> Eq
128 phi = coord1 * Pi/12.;
129 }
130 ToCoLat(&coord2,TypUniteD);
131
132 putData(0,s,bolo_sp,fgbolo);
133
134}
135
136
137 cout<<"TOI2Map::run(): Fin de boucle sur les sampleNum"<<endl;
138
139
140//---------------------------------------------------------
141} catch (PException & exc) {
142 cout<<"TOI2Map: Catched Exception "<<(string)typeid(exc).name()
143 <<"\n .... Msg= "<<exc.Msg()<<endl;
144}
145
146return;
147}
Note: See TracBrowser for help on using the repository browser.