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

Diff of /DarthVader/OrbitalInfo/src/OrbitalInfo.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.23