/[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.7 by mocchiut, Thu Mar 15 12:42:47 2007 UTC revision 1.17 by pam-fi, Wed Oct 15 12:06:49 2014 UTC
# Line 1  Line 1 
1  #include <OrbitalInfo.h>  #include <OrbitalInfo.h>
2    
3  OrbitalInfo::OrbitalInfo(){  using namespace std;
   absTime = 0;  
   OBT = 0;  
   pkt_num = 0;  
4    
5    lon = 0.;  ClassImp(OrbitalInfoTrkVar);
6    lat = 0.;  ClassImp(OrbitalInfo);
   alt = 0.;  
   
   Bnorth = 0.;  
   Beast = 0.;  
   Bdown = 0.;  
   Babs = 0.;  
   BB0 = 0.;  
   L = 0.;  
   
   londip = -1000.;  
   latdip = -1000.;  
   altdip = -1000.;  
   
   loncgm = -1000.;  
   latcgm = -1000.;  
   altcgm = -1000.;  
   
   loncbm = -1000.;  
   latcbm = -1000.;  
   altcbm = -1000.;  
7    
8    std::fill_n(cutoff, 20, 0.);  OrbitalInfoTrkVar::OrbitalInfoTrkVar(){
9      this->Clear();
10      //  Eij = new TMatrixD(3,3);
11      //  Sij = new TMatrixD(3,3);
12    }
13    
14    // Quaternions  void OrbitalInfoTrkVar::Clear(Option_t *t){
15    q0 = -1000.;    trkseqno = 0;
16    q1 = -1000.;    pitch = -1000.;
17    q2 = -1000.;    sunangle = -1000;
18    q3 = -1000.;    sunmagangle = -1000;
19      cutoff = -1000.;
20      Eij.Zero();
21      Sij.Zero();
22    }
23    
24    // Euler angles (nadir reference frame)  void OrbitalInfoTrkVar::Delete(Option_t *t){
25  //  theta = -1000.;    //  if ( Eij ) Eij->Delete();
26  //  phi = -1000.;    //  if ( Sij ) Sij->Delete();
27  //  etha = -1000.;  }
28    
29    // Euler angles (local field reference frame)  OrbitalInfo::OrbitalInfo(){
30  //  thetamag = -1000.;    OrbitalInfoTrk = 0; //ELENA
31  //  phimag = -1000.;    this->Clear();
32  //  ethamag = -1000.;  }
33    
34    std::fill_n(goodAttitude, 5, 0);  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    //
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    
75    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    /**
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    
115  void OrbitalInfo::Clear(){  void OrbitalInfo::Clear(Option_t *t){
116      //
117      if ( OrbitalInfoTrk ) OrbitalInfoTrk->Delete();
118      //
119    absTime = 0;    absTime = 0;
120    OBT = 0;    OBT = 0;
121    pkt_num = 0;    pkt_num = 0;
# Line 58  void OrbitalInfo::Clear(){ Line 123  void OrbitalInfo::Clear(){
123    lon = -1000.;    lon = -1000.;
124    lat = -1000.;    lat = -1000.;
125    alt = -1000.;    alt = -1000.;
126      V.SetXYZ(-1000.,-1000.,-1000.);
127    
128    Bnorth = -1000.;    Bnorth = -1000.;
129    Beast = -1000.;    Beast = -1000.;
130    Bdown = -1000.;    Bdown = -1000.;
131    Babs = -1000.;    Babs = -1000.;
132      M = -1000;
133    BB0 = -1000.;    BB0 = -1000.;
134    L = -1000.;    L = -1000.;
135    
136    londip = -1000.;     londip = -1000.;
137    latdip = -1000.;     latdip = -1000.;
   altdip = -1000.;  
   
   loncgm = -1000.;  
   latcgm = -1000.;  
   altcgm = -1000.;  
   
   loncbm = -1000.;  
   latcbm = -1000.;  
   altcbm = -1000.;  
138    
139    std::fill_n(cutoff, 20, 0.);    //  std::fill_n(cutoff, 20, 0.);
140      //  std::fill_n(cutoff, 2, 0.);
141      cutoffsvl = 0.;
142    
143    // Quaternions    // Quaternions
144    q0 = -1000.;    q0 = -1000.;
# Line 87  void OrbitalInfo::Clear(){ Line 147  void OrbitalInfo::Clear(){
147    q3 = -1000.;    q3 = -1000.;
148    
149    // Euler angles (nadir reference frame)    // Euler angles (nadir reference frame)
150   // theta = -1000.;    theta = -1000.;
151   // phi = -1000.;    phi = -1000.;
152   // etha = -1000.;    etha = -1000.;
153    
154    // Euler angles (local field reference frame)    Iij.Zero();
155    //thetamag = -1000.;  
156   // phimag = -1000.;    mode = 0;
157    //ethamag = -1000.;    qkind = -1000;
158      errq =  -1000;
159    std::fill_n(goodAttitude, 5, 0);    azim =  -1000;
160      //  std::fill_n(goodAttitude, 5, 0);
161  }  }
162    
163  /**  /**
# Line 110  void OrbitalInfo::GetLevel2Struct(cOrbit Line 171  void OrbitalInfo::GetLevel2Struct(cOrbit
171    l2->lon = lon;    l2->lon = lon;
172    l2->lat = lat;    l2->lat = lat;
173    l2->alt = alt;    l2->alt = alt;
174      l2->V = V;
175    
176    l2->Bnorth = Bnorth;    l2->Bnorth = Bnorth;
177    l2->Beast = Beast;    l2->Beast = Beast;
178    l2->Bdown = Bdown;    l2->Bdown = Bdown;
179    l2->Babs = Babs;    l2->Babs = Babs;
180      l2->M = M;
181    l2->BB0 = BB0;    l2->BB0 = BB0;
182    l2->L = L;    l2->L = L;
183    
184    l2->londip = londip;     l2->londip = londip;
185    l2->latdip = latdip;     l2->latdip = latdip;
   l2->altdip = altdip;  
   
   l2->loncgm = loncgm;  
   l2->latcgm = latcgm;  
   l2->altcgm = altcgm;  
   
   l2->loncbm = loncbm;  
   l2->latcbm = latcbm;  
   l2->altcbm = altcbm;  
186    
187    memcpy(l2->cutoff, cutoff, sizeof(cutoff));    l2->cutoffsvl = cutoffsvl;
188    //  memcpy(l2->cutoffsvl, cutoffsvl, sizeof(cutoffsvl));
189    
190    // Quaternions    // Quaternions
191    l2->q0 = q0;    l2->q0 = q0;
# Line 139  void OrbitalInfo::GetLevel2Struct(cOrbit Line 194  void OrbitalInfo::GetLevel2Struct(cOrbit
194    l2->q3 = q3;    l2->q3 = q3;
195    
196    // Euler angles (nadir reference frame)    // Euler angles (nadir reference frame)
197   // l2->theta = theta;    l2->theta = theta;
198   // l2->phi = phi;    l2->phi = phi;
199   // l2->etha = etha;    l2->etha = etha;
200    
201    // Euler angles (local field reference frame)    l2->mode = mode;
202   // l2->thetamag = thetamag;    l2->qkind = qkind;
203   // l2->phimag = phimag;    l2->errq = errq;
204   // l2->ethamag = ethamag;    l2->azim = azim;
205    
206    memcpy(l2->goodAttitude, goodAttitude, sizeof(goodAttitude));  //   memcpy(l2->goodAttitude, goodAttitude, sizeof(goodAttitude));
207  }  }
208    
209  void OrbitalInfo::SetFromLevel2Struct(cOrbitalInfo *l2){  void OrbitalInfo::SetFromLevel2Struct(cOrbitalInfo *l2){
# Line 159  void OrbitalInfo::SetFromLevel2Struct(cO Line 214  void OrbitalInfo::SetFromLevel2Struct(cO
214    lon = l2->lon;    lon = l2->lon;
215    lat = l2->lat;    lat = l2->lat;
216    alt = l2->alt;    alt = l2->alt;
217      V = l2->V;
218    
219    l2->Bnorth = Bnorth;    l2->Bnorth = Bnorth;
220    l2->Beast = Beast;    l2->Beast = Beast;
221    l2->Bdown = Bdown;    l2->Bdown = Bdown;
222    l2->Babs = Babs;    l2->Babs = Babs;
223      M = l2->M;
224    BB0 = l2->BB0;    BB0 = l2->BB0;
225    L = l2->L;    L = l2->L;
226    
227    londip = l2->londip;     londip = l2->londip;
228    latdip = l2->latdip;     latdip = l2->latdip;
   altdip = l2->altdip;  
   
   loncgm = l2->loncgm;  
   latcgm = l2->latcgm;  
   altcgm = l2->altcgm;  
   
   loncbm = l2->loncbm;  
   latcbm = l2->latcbm;  
   altcbm = l2->altcbm;  
229    
230    memcpy(cutoff, l2->cutoff, sizeof(l2->cutoff));  //  memcpy(cutoff, l2->cutoff, sizeof(l2->cutoff));
231      l2->cutoffsvl = cutoffsvl;
232    
233    // Quaternions    // Quaternions
234    q0 = l2->q0;    q0 = l2->q0;
# Line 188  void OrbitalInfo::SetFromLevel2Struct(cO Line 237  void OrbitalInfo::SetFromLevel2Struct(cO
237    q3 = l2->q3;    q3 = l2->q3;
238    
239    // Euler angles (nadir reference frame)    // Euler angles (nadir reference frame)
240    //theta = l2->theta;    theta = l2->theta;
241    //phi = l2->phi;    phi = l2->phi;
242    //etha = l2->etha;    etha = l2->etha;
243    
244    // Euler angles (local field reference frame)    mode = l2->mode;
245    //thetamag = l2->thetamag;    qkind = l2->qkind;
246    //phimag = l2->phimag;    errq = l2->errq;
247    //ethamag = l2->ethamag;    azim = l2->azim;
248    
249    memcpy(goodAttitude, l2->goodAttitude, sizeof(l2->goodAttitude));  //   memcpy(goodAttitude, l2->goodAttitude, sizeof(l2->goodAttitude));
250  }  }
251    
 ClassImp(OrbitalInfo)  

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.23