1 |
#include <OrbitalInfo.h> |
2 |
|
3 |
using namespace std; |
4 |
|
5 |
ClassImp(OrbitalInfoTrkVar); |
6 |
ClassImp(OrbitalInfo); |
7 |
|
8 |
OrbitalInfoTrkVar::OrbitalInfoTrkVar(){ |
9 |
this->Clear(); |
10 |
// Eij = new TMatrixD(3,3); |
11 |
// Sij = new TMatrixD(3,3); |
12 |
} |
13 |
|
14 |
void OrbitalInfoTrkVar::Clear(Option_t *t){ |
15 |
trkseqno = 0; |
16 |
pitch = -1000.; |
17 |
sunangle = -1000; |
18 |
sunmagangle = -1000; |
19 |
cutoff = -1000.; |
20 |
Eij.Zero(); |
21 |
Sij.Zero(); |
22 |
} |
23 |
|
24 |
void OrbitalInfoTrkVar::Delete(Option_t *t){ |
25 |
// if ( Eij ) Eij->Delete(); |
26 |
// if ( Sij ) Sij->Delete(); |
27 |
} |
28 |
|
29 |
OrbitalInfo::OrbitalInfo(){ |
30 |
OrbitalInfoTrk = 0; //ELENA |
31 |
this->Clear(); |
32 |
} |
33 |
|
34 |
OrbitalInfoTrkVar::OrbitalInfoTrkVar(const OrbitalInfoTrkVar &t){ |
35 |
// |
36 |
trkseqno = t.trkseqno; |
37 |
// |
38 |
pitch = t.pitch; |
39 |
cutoff = t.cutoff; |
40 |
sunangle=t.sunangle; |
41 |
sunmagangle=t.sunmagangle; |
42 |
// |
43 |
Eij.ResizeTo(t.Eij); |
44 |
Eij = t.Eij; |
45 |
Sij.ResizeTo(t.Sij); |
46 |
Sij = t.Sij; |
47 |
// |
48 |
}; |
49 |
|
50 |
void OrbitalInfo::Delete(Option_t *t){ //ELENA |
51 |
// |
52 |
// if ( Iij ) Iij->Delete(); |
53 |
if(OrbitalInfoTrk){ |
54 |
OrbitalInfoTrk->Delete(); //ELENA |
55 |
delete OrbitalInfoTrk; //ELENA |
56 |
} |
57 |
// |
58 |
}; //ELENA |
59 |
|
60 |
void OrbitalInfo::Set(){//ELENA |
61 |
if ( !OrbitalInfoTrk ) OrbitalInfoTrk = new TClonesArray("OrbitalInfoTrkVar",2); //ELENA} |
62 |
// if ( !Iij ) Iij = new TMatrixD(3,3); |
63 |
}//ELENA |
64 |
|
65 |
OrbitalInfoTrkVar *OrbitalInfo::GetOrbitalInfoTrkVar(Int_t itrk){ |
66 |
// |
67 |
if(itrk >= ntrk()){ |
68 |
printf(" OrbitalInfo ERROR: track related variables set %i does not exists! \n",itrk); |
69 |
printf(" stored track related variables = %i \n",ntrk()); |
70 |
return(NULL); |
71 |
} |
72 |
// |
73 |
if(!OrbitalInfoTrk)return 0; //ELENA |
74 |
TClonesArray &t = *(OrbitalInfoTrk); |
75 |
OrbitalInfoTrkVar *orbtrack = (OrbitalInfoTrkVar*)t[itrk]; |
76 |
return orbtrack; |
77 |
} |
78 |
|
79 |
void OrbitalInfo::Clear(Option_t *t){ |
80 |
// |
81 |
if ( OrbitalInfoTrk ) OrbitalInfoTrk->Delete(); |
82 |
// |
83 |
absTime = 0; |
84 |
OBT = 0; |
85 |
pkt_num = 0; |
86 |
|
87 |
lon = -1000.; |
88 |
lat = -1000.; |
89 |
alt = -1000.; |
90 |
V.SetXYZ(-1000.,-1000.,-1000.); |
91 |
|
92 |
Bnorth = -1000.; |
93 |
Beast = -1000.; |
94 |
Bdown = -1000.; |
95 |
Babs = -1000.; |
96 |
M = -1000; |
97 |
BB0 = -1000.; |
98 |
L = -1000.; |
99 |
|
100 |
londip = -1000.; |
101 |
latdip = -1000.; |
102 |
|
103 |
// std::fill_n(cutoff, 20, 0.); |
104 |
// std::fill_n(cutoff, 2, 0.); |
105 |
cutoffsvl = 0.; |
106 |
|
107 |
// Quaternions |
108 |
q0 = -1000.; |
109 |
q1 = -1000.; |
110 |
q2 = -1000.; |
111 |
q3 = -1000.; |
112 |
|
113 |
// Euler angles (nadir reference frame) |
114 |
theta = -1000.; |
115 |
phi = -1000.; |
116 |
etha = -1000.; |
117 |
|
118 |
Iij.Zero(); |
119 |
|
120 |
mode = 0; |
121 |
qkind = -1000; |
122 |
errq = -1000; |
123 |
azim = -1000; |
124 |
// std::fill_n(goodAttitude, 5, 0); |
125 |
} |
126 |
|
127 |
/** |
128 |
* Fills a struct cOrbitalInfo with values from a OrbitalInfo object (to put data into a F77 common). |
129 |
*/ |
130 |
void OrbitalInfo::GetLevel2Struct(cOrbitalInfo *l2) const{ |
131 |
l2->abstime = absTime; |
132 |
l2->obt = OBT; |
133 |
l2->pkt_num = pkt_num; |
134 |
|
135 |
l2->lon = lon; |
136 |
l2->lat = lat; |
137 |
l2->alt = alt; |
138 |
l2->V = V; |
139 |
|
140 |
l2->Bnorth = Bnorth; |
141 |
l2->Beast = Beast; |
142 |
l2->Bdown = Bdown; |
143 |
l2->Babs = Babs; |
144 |
l2->M = M; |
145 |
l2->BB0 = BB0; |
146 |
l2->L = L; |
147 |
|
148 |
l2->londip = londip; |
149 |
l2->latdip = latdip; |
150 |
|
151 |
l2->cutoffsvl = cutoffsvl; |
152 |
// memcpy(l2->cutoffsvl, cutoffsvl, sizeof(cutoffsvl)); |
153 |
|
154 |
// Quaternions |
155 |
l2->q0 = q0; |
156 |
l2->q1 = q1; |
157 |
l2->q2 = q2; |
158 |
l2->q3 = q3; |
159 |
|
160 |
// Euler angles (nadir reference frame) |
161 |
l2->theta = theta; |
162 |
l2->phi = phi; |
163 |
l2->etha = etha; |
164 |
|
165 |
l2->mode = mode; |
166 |
l2->qkind = qkind; |
167 |
l2->errq = errq; |
168 |
l2->azim = azim; |
169 |
|
170 |
// memcpy(l2->goodAttitude, goodAttitude, sizeof(goodAttitude)); |
171 |
} |
172 |
|
173 |
void OrbitalInfo::SetFromLevel2Struct(cOrbitalInfo *l2){ |
174 |
absTime = l2->abstime; |
175 |
OBT = l2->obt; |
176 |
pkt_num = l2->pkt_num; |
177 |
|
178 |
lon = l2->lon; |
179 |
lat = l2->lat; |
180 |
alt = l2->alt; |
181 |
V = l2->V; |
182 |
|
183 |
l2->Bnorth = Bnorth; |
184 |
l2->Beast = Beast; |
185 |
l2->Bdown = Bdown; |
186 |
l2->Babs = Babs; |
187 |
M = l2->M; |
188 |
BB0 = l2->BB0; |
189 |
L = l2->L; |
190 |
|
191 |
londip = l2->londip; |
192 |
latdip = l2->latdip; |
193 |
|
194 |
// memcpy(cutoff, l2->cutoff, sizeof(l2->cutoff)); |
195 |
l2->cutoffsvl = cutoffsvl; |
196 |
|
197 |
// Quaternions |
198 |
q0 = l2->q0; |
199 |
q1 = l2->q1; |
200 |
q2 = l2->q2; |
201 |
q3 = l2->q3; |
202 |
|
203 |
// Euler angles (nadir reference frame) |
204 |
theta = l2->theta; |
205 |
phi = l2->phi; |
206 |
etha = l2->etha; |
207 |
|
208 |
mode = l2->mode; |
209 |
qkind = l2->qkind; |
210 |
errq = l2->errq; |
211 |
azim = l2->azim; |
212 |
|
213 |
// memcpy(goodAttitude, l2->goodAttitude, sizeof(l2->goodAttitude)); |
214 |
} |
215 |
|