/[PAMELA software]/DarthVader/OrbitalInfo/src/OrbitalInfo.cpp
ViewVC logotype

Annotation of /DarthVader/OrbitalInfo/src/OrbitalInfo.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (hide annotations) (download)
Fri Mar 28 20:47:15 2014 UTC (10 years, 8 months ago) by pam-mep
Branch: MAIN
Changes since 1.15: +22 -48 lines
new OrbitalInfo code

1 mocchiut 1.1 #include <OrbitalInfo.h>
2    
3 mocchiut 1.11 using namespace std;
4 pam-rm2 1.6
5 mocchiut 1.11 ClassImp(OrbitalInfoTrkVar);
6     ClassImp(OrbitalInfo);
7 pam-rm2 1.6
8 mocchiut 1.11 OrbitalInfoTrkVar::OrbitalInfoTrkVar(){
9     this->Clear();
10 mocchiut 1.13 // Eij = new TMatrixD(3,3);
11     // Sij = new TMatrixD(3,3);
12 mocchiut 1.11 }
13 pam-rm2 1.6
14 mocchiut 1.11 void OrbitalInfoTrkVar::Clear(Option_t *t){
15     trkseqno = 0;
16     pitch = -1000.;
17 pam-mep 1.16 sunangle = -1000;
18     sunmagangle = -1000;
19 mocchiut 1.14 cutoff = -1000.;
20 mocchiut 1.13 Eij.Zero();
21     Sij.Zero();
22 mocchiut 1.11 }
23 pam-rm2 1.6
24 mocchiut 1.13 void OrbitalInfoTrkVar::Delete(Option_t *t){
25     // if ( Eij ) Eij->Delete();
26     // if ( Sij ) Sij->Delete();
27     }
28 pam-rm2 1.6
29 mocchiut 1.11 OrbitalInfo::OrbitalInfo(){
30     OrbitalInfoTrk = 0; //ELENA
31     this->Clear();
32     }
33 pam-rm2 1.6
34 mocchiut 1.14 OrbitalInfoTrkVar::OrbitalInfoTrkVar(const OrbitalInfoTrkVar &t){
35     //
36     trkseqno = t.trkseqno;
37     //
38     pitch = t.pitch;
39     cutoff = t.cutoff;
40 pam-mep 1.16 sunangle=t.sunangle;
41     sunmagangle=t.sunmagangle;
42 mocchiut 1.14 //
43     Eij.ResizeTo(t.Eij);
44     Eij = t.Eij;
45     Sij.ResizeTo(t.Sij);
46     Sij = t.Sij;
47     //
48     };
49    
50 mocchiut 1.11 void OrbitalInfo::Delete(Option_t *t){ //ELENA
51     //
52 mocchiut 1.13 // if ( Iij ) Iij->Delete();
53 mocchiut 1.11 if(OrbitalInfoTrk){
54     OrbitalInfoTrk->Delete(); //ELENA
55     delete OrbitalInfoTrk; //ELENA
56     }
57     //
58     }; //ELENA
59    
60     void OrbitalInfo::Set(){//ELENA
61 mocchiut 1.13 if ( !OrbitalInfoTrk ) OrbitalInfoTrk = new TClonesArray("OrbitalInfoTrkVar",2); //ELENA}
62     // if ( !Iij ) Iij = new TMatrixD(3,3);
63 mocchiut 1.11 }//ELENA
64 mocchiut 1.1
65 mocchiut 1.12 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 mocchiut 1.1
79 mocchiut 1.10 void OrbitalInfo::Clear(Option_t *t){
80 mocchiut 1.11 //
81     if ( OrbitalInfoTrk ) OrbitalInfoTrk->Delete();
82     //
83 mocchiut 1.5 absTime = 0;
84     OBT = 0;
85     pkt_num = 0;
86 pam-rm2 1.6
87     lon = -1000.;
88     lat = -1000.;
89     alt = -1000.;
90 pam-mep 1.16 V.SetXYZ(-1000.,-1000.,-1000.);
91 pam-rm2 1.6
92     Bnorth = -1000.;
93     Beast = -1000.;
94     Bdown = -1000.;
95     Babs = -1000.;
96 pam-mep 1.15 M = -1000;
97 pam-rm2 1.6 BB0 = -1000.;
98     L = -1000.;
99    
100 pam-mep 1.16 londip = -1000.;
101     latdip = -1000.;
102 mocchiut 1.13
103     // std::fill_n(cutoff, 20, 0.);
104     // std::fill_n(cutoff, 2, 0.);
105     cutoffsvl = 0.;
106 pam-rm2 1.6
107     // Quaternions
108     q0 = -1000.;
109     q1 = -1000.;
110     q2 = -1000.;
111     q3 = -1000.;
112    
113     // Euler angles (nadir reference frame)
114 mocchiut 1.8 theta = -1000.;
115     phi = -1000.;
116     etha = -1000.;
117 pam-rm2 1.6
118 mocchiut 1.13 Iij.Zero();
119 mocchiut 1.11
120 mocchiut 1.9 mode = 0;
121 pam-mep 1.16 qkind = -1000;
122     errq = -1000;
123     azim = -1000;
124 mocchiut 1.9 // std::fill_n(goodAttitude, 5, 0);
125 mocchiut 1.3 }
126    
127 pam-fi 1.4 /**
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 pam-rm2 1.6
135     l2->lon = lon;
136     l2->lat = lat;
137     l2->alt = alt;
138 pam-mep 1.16 l2->V = V;
139 pam-rm2 1.6
140     l2->Bnorth = Bnorth;
141     l2->Beast = Beast;
142     l2->Bdown = Bdown;
143     l2->Babs = Babs;
144 pam-mep 1.15 l2->M = M;
145 pam-rm2 1.6 l2->BB0 = BB0;
146     l2->L = L;
147    
148 pam-mep 1.16 l2->londip = londip;
149     l2->latdip = latdip;
150 pam-rm2 1.6
151 mocchiut 1.13 l2->cutoffsvl = cutoffsvl;
152     // memcpy(l2->cutoffsvl, cutoffsvl, sizeof(cutoffsvl));
153 pam-rm2 1.6
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 mocchiut 1.8 l2->theta = theta;
162     l2->phi = phi;
163     l2->etha = etha;
164 pam-rm2 1.6
165 mocchiut 1.9 l2->mode = mode;
166 pam-mep 1.16 l2->qkind = qkind;
167     l2->errq = errq;
168     l2->azim = azim;
169 pam-rm2 1.6
170 mocchiut 1.9 // memcpy(l2->goodAttitude, goodAttitude, sizeof(goodAttitude));
171 pam-fi 1.4 }
172    
173     void OrbitalInfo::SetFromLevel2Struct(cOrbitalInfo *l2){
174     absTime = l2->abstime;
175     OBT = l2->obt;
176     pkt_num = l2->pkt_num;
177 pam-rm2 1.6
178     lon = l2->lon;
179     lat = l2->lat;
180     alt = l2->alt;
181 pam-mep 1.16 V = l2->V;
182 pam-rm2 1.6
183     l2->Bnorth = Bnorth;
184     l2->Beast = Beast;
185     l2->Bdown = Bdown;
186     l2->Babs = Babs;
187 pam-mep 1.15 M = l2->M;
188 pam-rm2 1.6 BB0 = l2->BB0;
189     L = l2->L;
190    
191 pam-mep 1.16 londip = l2->londip;
192     latdip = l2->latdip;
193 pam-rm2 1.6
194 mocchiut 1.13 // memcpy(cutoff, l2->cutoff, sizeof(l2->cutoff));
195     l2->cutoffsvl = cutoffsvl;
196 pam-rm2 1.6
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 mocchiut 1.8 theta = l2->theta;
205     phi = l2->phi;
206     etha = l2->etha;
207 pam-rm2 1.6
208 mocchiut 1.9 mode = l2->mode;
209 pam-mep 1.16 qkind = l2->qkind;
210     errq = l2->errq;
211     azim = l2->azim;
212 pam-rm2 1.6
213 mocchiut 1.9 // memcpy(goodAttitude, l2->goodAttitude, sizeof(l2->goodAttitude));
214 pam-fi 1.4 }
215    

  ViewVC Help
Powered by ViewVC 1.1.23