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

Last change on this file since 2389 was 2104, checked in by cmv, 23 years ago

gestion Info_src en vector<> cmv 16/7/2002

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