/[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.19 - (hide annotations) (download)
Tue Nov 17 10:10:04 2015 UTC (9 years ago) by pamela
Branch: MAIN
CVS Tags: HEAD
Changes since 1.18: +8 -4 lines
Bug related to events before first quaternions packet fixed

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 pam-fi 1.17 //--------------------------------------
65     //
66     //
67     //--------------------------------------
68     void OrbitalInfo::SetTrackArray(TClonesArray *track){//ELENA
69     // if(track && strcmp(track->GetClass()->GetName(),"OrbitalInfoTrkVar")==0){
70     if(OrbitalInfoTrk)OrbitalInfoTrk->Clear("C");
71     OrbitalInfoTrk = track;
72     // }
73     }
74 mocchiut 1.1
75 mocchiut 1.12 OrbitalInfoTrkVar *OrbitalInfo::GetOrbitalInfoTrkVar(Int_t itrk){
76     //
77     if(itrk >= ntrk()){
78     printf(" OrbitalInfo ERROR: track related variables set %i does not exists! \n",itrk);
79     printf(" stored track related variables = %i \n",ntrk());
80     return(NULL);
81     }
82     //
83     if(!OrbitalInfoTrk)return 0; //ELENA
84     TClonesArray &t = *(OrbitalInfoTrk);
85     OrbitalInfoTrkVar *orbtrack = (OrbitalInfoTrkVar*)t[itrk];
86     return orbtrack;
87     }
88 pam-fi 1.17 /**
89     * Retrieves the tof track matching the seqno-th tracker stored track.
90     *
91     */
92     OrbitalInfoTrkVar *OrbitalInfo::GetOrbitalInfoStoredTrack(int seqno){
93    
94     if( ntrk()==0 ){
95     printf("OrbitalInfo::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo %i but no OrbitalInforimeter tracks are stored\n",seqno);
96     return NULL;
97     };
98    
99     OrbitalInfoTrkVar *c = 0;
100     Int_t it_tof=0;
101    
102     do {
103     c = GetOrbitalInfoTrkVar(it_tof);
104     it_tof++;
105     } while( c && seqno != c->trkseqno && it_tof < ntrk());
106    
107     if(!c || seqno != c->trkseqno){
108     c = 0;
109     if(seqno!=-1 ) printf("OrbitalInfo::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo %i does not match OrbitalInfo stored tracks\n",seqno);
110     };
111     return c;
112    
113     }
114 mocchiut 1.1
115 mocchiut 1.10 void OrbitalInfo::Clear(Option_t *t){
116 mocchiut 1.11 //
117     if ( OrbitalInfoTrk ) OrbitalInfoTrk->Delete();
118     //
119 mocchiut 1.5 absTime = 0;
120     OBT = 0;
121     pkt_num = 0;
122 pam-rm2 1.6
123     lon = -1000.;
124     lat = -1000.;
125     alt = -1000.;
126 pam-mep 1.16 V.SetXYZ(-1000.,-1000.,-1000.);
127 pam-rm2 1.6
128     Bnorth = -1000.;
129     Beast = -1000.;
130     Bdown = -1000.;
131     Babs = -1000.;
132 pam-mep 1.15 M = -1000;
133 pam-rm2 1.6 BB0 = -1000.;
134     L = -1000.;
135    
136 pam-mep 1.16 londip = -1000.;
137     latdip = -1000.;
138 mocchiut 1.13
139     // std::fill_n(cutoff, 20, 0.);
140     // std::fill_n(cutoff, 2, 0.);
141     cutoffsvl = 0.;
142 pam-rm2 1.6
143     // Quaternions
144     q0 = -1000.;
145     q1 = -1000.;
146     q2 = -1000.;
147     q3 = -1000.;
148    
149     // Euler angles (nadir reference frame)
150 mocchiut 1.8 theta = -1000.;
151     phi = -1000.;
152     etha = -1000.;
153 pam-rm2 1.6
154 mocchiut 1.13 Iij.Zero();
155 mocchiut 1.11
156 mocchiut 1.9 mode = 0;
157 pam-mep 1.16 qkind = -1000;
158     errq = -1000;
159     azim = -1000;
160 malakhov 1.18 rtqual =-1000;
161 mocchiut 1.9 // std::fill_n(goodAttitude, 5, 0);
162 mocchiut 1.3 }
163    
164 pam-fi 1.4 /**
165     * Fills a struct cOrbitalInfo with values from a OrbitalInfo object (to put data into a F77 common).
166     */
167     void OrbitalInfo::GetLevel2Struct(cOrbitalInfo *l2) const{
168     l2->abstime = absTime;
169     l2->obt = OBT;
170     l2->pkt_num = pkt_num;
171 pam-rm2 1.6
172     l2->lon = lon;
173     l2->lat = lat;
174     l2->alt = alt;
175 pam-mep 1.16 l2->V = V;
176 pam-rm2 1.6
177     l2->Bnorth = Bnorth;
178     l2->Beast = Beast;
179     l2->Bdown = Bdown;
180     l2->Babs = Babs;
181 pam-mep 1.15 l2->M = M;
182 pam-rm2 1.6 l2->BB0 = BB0;
183     l2->L = L;
184    
185 pam-mep 1.16 l2->londip = londip;
186     l2->latdip = latdip;
187 pam-rm2 1.6
188 mocchiut 1.13 l2->cutoffsvl = cutoffsvl;
189     // memcpy(l2->cutoffsvl, cutoffsvl, sizeof(cutoffsvl));
190 pam-rm2 1.6
191     // Quaternions
192     l2->q0 = q0;
193     l2->q1 = q1;
194     l2->q2 = q2;
195     l2->q3 = q3;
196    
197     // Euler angles (nadir reference frame)
198 mocchiut 1.8 l2->theta = theta;
199     l2->phi = phi;
200     l2->etha = etha;
201 pam-rm2 1.6
202 mocchiut 1.9 l2->mode = mode;
203 pam-mep 1.16 l2->qkind = qkind;
204     l2->errq = errq;
205     l2->azim = azim;
206 malakhov 1.18 l2->rtqual=rtqual;
207 pam-rm2 1.6
208 pamela 1.19 l2->Iij=Iij;
209    
210 mocchiut 1.9 // memcpy(l2->goodAttitude, goodAttitude, sizeof(goodAttitude));
211 pam-fi 1.4 }
212    
213     void OrbitalInfo::SetFromLevel2Struct(cOrbitalInfo *l2){
214     absTime = l2->abstime;
215     OBT = l2->obt;
216     pkt_num = l2->pkt_num;
217 pam-rm2 1.6
218     lon = l2->lon;
219     lat = l2->lat;
220     alt = l2->alt;
221 pam-mep 1.16 V = l2->V;
222 pam-rm2 1.6
223 pamela 1.19 Bnorth = l2->Bnorth;
224     Beast = l2->Beast;
225     Bdown = l2->Bdown;
226     Babs = l2->Babs;
227 pam-mep 1.15 M = l2->M;
228 pam-rm2 1.6 BB0 = l2->BB0;
229     L = l2->L;
230    
231 pam-mep 1.16 londip = l2->londip;
232     latdip = l2->latdip;
233 pam-rm2 1.6
234 mocchiut 1.13 // memcpy(cutoff, l2->cutoff, sizeof(l2->cutoff));
235     l2->cutoffsvl = cutoffsvl;
236 pam-rm2 1.6
237     // Quaternions
238     q0 = l2->q0;
239     q1 = l2->q1;
240     q2 = l2->q2;
241     q3 = l2->q3;
242    
243     // Euler angles (nadir reference frame)
244 mocchiut 1.8 theta = l2->theta;
245     phi = l2->phi;
246     etha = l2->etha;
247 pam-rm2 1.6
248 mocchiut 1.9 mode = l2->mode;
249 pam-mep 1.16 qkind = l2->qkind;
250     errq = l2->errq;
251     azim = l2->azim;
252 malakhov 1.18 rtqual=l2->rtqual;
253 pam-rm2 1.6
254 pamela 1.19 Iij=l2->Iij;
255    
256 mocchiut 1.9 // memcpy(goodAttitude, l2->goodAttitude, sizeof(l2->goodAttitude));
257 pam-fi 1.4 }
258    

  ViewVC Help
Powered by ViewVC 1.1.23