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

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

* empty log message *

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