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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Wed Oct 1 15:25:43 2008 UTC (16 years, 2 months ago) by mocchiut
Branch: MAIN
CVS Tags: v6r01, v6r00
Changes since 1.5: +0 -2 lines
Orientation infos added to OrbitalInfo, OrbitalInfo class changed, small changes in the Makefile

1 pamelaprod 1.1 /***************************************************************************
2     * Copyright (C) 2006 by pamelaprod *
3     * pamelaprod@P1.pamela *
4     * *
5     * This program is free software; you can redistribute it and/or modify *
6     * it under the terms of the GNU General Public License as published by *
7     * the Free Software Foundation; either version 2 of the License, or *
8     * (at your option) any later version. *
9     * *
10     * This program is distributed in the hope that it will be useful, *
11     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13     * GNU General Public License for more details. *
14     * *
15     * You should have received a copy of the GNU General Public License *
16     * along with this program; if not, write to the *
17     * Free Software Foundation, Inc., *
18     * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19     ***************************************************************************/
20     #include <InclinationInfo.h>
21    
22     using namespace std;
23    
24     // InclinationInfoI()::InclinationInfoI() {
25     // // memset(time,0,6*sizeof(double));
26     // // memset(quad,0,6*4*sizeof(double));
27     // };
28    
29     void InclinationInfoI::fill(TArrayC* data){
30     short extIndex = 0;
31     short innIndex = 0;
32     long tempData = 0;
33     for (int i = 0; i < 6; i++){
34     extIndex = 20*i;
35     time[i] = (((data->At(extIndex) << 24) & 0xFF000000) +
36     ((data->At(extIndex + 1) << 16) & 0x00FF0000) + ((data->At(extIndex + 2) << 8) & 0x0000FF00) +
37     (data->At(extIndex + 3) & 0x000000FF))/128.0;
38     for (int j = 0; j < 4; j++){
39     innIndex = extIndex + 4*j;
40     tempData = ((data->At(innIndex + 4) << 24) & 0xFF000000) + ((data->At(innIndex + 5) << 16) & 0x00FF0000) + ((data->At(innIndex + 6) << 8) & 0x0000FF00) + (data->At(innIndex + 7) & 0x000000FF);
41     if (data->At(innIndex + 4) >> 8) {
42     quat[i][j] = (~tempData * -1.0)/1073741824.0;
43     } else {
44     quat[i][j] = tempData / 1073741824.0;
45     }
46     }
47     }
48     }
49    
50 mocchiut 1.4 void InclinationInfoI::clear() {
51     for(UInt_t i = 0; i < 6; i++){
52     time[i]=0;
53     for(UInt_t j = 0; j < 4; j++) quat[i][j]=0;
54     }
55     return ;
56     }
57 pamelaprod 1.1
58    
59     Quaternions::Quaternions()
60     : InclinationInfoI()
61     {
62     }
63    
64    
65     Quaternions::~Quaternions()
66     {
67     }
68    
69     InclinationInfo::InclinationInfo()
70     : TObject()
71     {
72     }
73    
74     InclinationInfo::~InclinationInfo()
75     {
76     }
77    
78 mocchiut 1.4 short int Sign_1(double_t a, Int_t b){
79 pamelaprod 1.1 if(a>0){b=1;}
80     if(a<0){b=-1;}
81     else{b=0;}
82     return b;
83     }
84    
85    
86     /******************************************************************************************************************/
87     /******************************************************************************************************************/
88     //********************* ***************************************************************/
89     //********************* COORDINATE SYSTEMS ***************************************************************/
90     //********************* ***************************************************************/
91     //*****************************************************************************************************************/
92     //*****************************************************************************************************************/
93     //
94     // ZISK
95     // +
96     // / \ YOSK ZOSK (Directed by Radius)
97     // | _ _.
98     // | |\ /|
99     // | \ /
100     // | \ /
101     // |.__..__ \ /
102     // Orbit _._.***| **.\/_ XOSK (Directed by velocity)
103 mocchiut 1.4 // .* | (X0,Y0,Z0) **--.___|
104 pamelaprod 1.1 // _** | / *. /
105     // .* | * *
106     // * ..****|***.. / R *
107     // .* | .*.
108     // .* | / *.
109     // * EARTH | / * YISK
110 mocchiut 1.4 // * | /_ _ _*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|
111 pamelaprod 1.1 // * / * /
112     // * / .*
113     // *. / .*
114     // **/*******
115     // /
116     // /
117     // /
118     // /
119     // /
120     // /
121     // |/
122     // *--
123     // XISK
124     //
125     //****************************************************************************************************/
126     //****************************************************************************************************/
127    
128    
129 mocchiut 1.4 void InclinationInfo::TransAngle(Double_t x0, Double_t y0, Double_t z0, Double_t Vx0, Double_t Vy0, Double_t Vz0, Double_t q0, Double_t q1, Double_t q2, Double_t q3){
130 pamelaprod 1.1
131 mocchiut 1.4 double_t a = 360/(2*TMath::Pi());
132 pamelaprod 1.1
133 mocchiut 1.4 TMatrixD Xij(3,3);
134     Xij(0,0) = 1; Xij(0,1) = 0; Xij(0,2) = 0;
135     Xij(1,0) = 0; Xij(1,1) = 0; Xij(1,2) = 1;
136     Xij(2,0) = 0; Xij(2,1) = -1; Xij(2,2) = 0;
137    
138     TMatrixD Zij(3,3);
139     Zij(0,0) = 0; Zij(0,1) = 0; Zij(0,2) = -1;
140     Zij(1,0) = -1; Zij(1,1) = 0; Zij(1,2) = 0;
141     Zij(2,0) = 0; Zij(2,1) = 1; Zij(2,2) = 0;
142 pamelaprod 1.1
143     TMatrixD Pij(3,3);
144     Pij(0,0) = pow(q0,2)+pow(q1,2)-pow(q2,2)-pow(q3,2);
145 mocchiut 1.4 Pij(0,1) = /*2*(q1*q2+q0*q3);/*/ 2*(q1*q2-q0*q3);
146     Pij(0,2) = /*2*(q1*q3-q0*q2);/*/ 2*(q1*q3+q0*q2);
147     Pij(1,0) = /*2*(q1*q2-q0*q3);/*/ 2*(q1*q2+q0*q3);
148 pamelaprod 1.1 Pij(1,1) = pow(q0,2)-pow(q1,2)+pow(q2,2)-pow(q3,2);
149 mocchiut 1.4 Pij(1,2) = /*2*(q2*q3+q0*q1);/*/ 2*(q2*q3-q0*q1);
150     Pij(2,0) = /*2*(q1*q3+q0*q2);/*/ 2*(q1*q3-q0*q2);
151     Pij(2,1) = /*2*(q2*q3-q0*q1);/*/ 2*(q2*q3+q0*q1);
152 pamelaprod 1.1 Pij(2,2) = pow(q0,2)-pow(q1,2)-pow(q2,2)+pow(q3,2);
153    
154     TMatrixD Aij(3,3);
155 mocchiut 1.4
156 pamelaprod 1.1 Double_t C1 = y0*Vz0 - z0*Vy0;
157     Double_t C2 = z0*Vx0 - x0*Vz0;
158     Double_t C3 = x0*Vy0 - y0*Vx0;
159     Double_t C = sqrt(pow(C1,2) + pow(C2,2) + pow(C3,2));
160     Double_t V0 = sqrt(pow(Vx0,2)+pow(Vy0,2) + pow(Vz0,2));
161 mocchiut 1.4 // Double_t R0 = sqrt(pow(x0,2)+pow(y0,2) + pow(z0,2));
162 pamelaprod 1.1 Aij(0,0) = /*(C2*z0-C3*y0)/(C*R0);/*/Vx0/V0;
163     Aij(0,1) = C1/C;
164     Aij(0,2) = /*x0/R0;/*/(Vy0*C3-Vz0*C2)/(V0*C);
165     Aij(1,0) = /*(C3*x0-C1*z0)/(C*R0);/*/Vy0/V0;
166     Aij(1,1) = C2/C;
167     Aij(1,2) = /*y0/R0;/*/(Vz0*C1-Vx0*C3)/(V0*C);
168     Aij(2,0) = /*(C1*y0-C2*x0)/(C*R0);/*/Vz0/V0;
169     Aij(2,1) = C3/C;
170     Aij(2,2) = /*x0/R0;/*/(Vx0*C2-Vy0*C1)/(V0*C);
171     Aij.Invert();
172    
173 mocchiut 1.4 TMatrixD Full_(3,3);
174 pamelaprod 1.1
175 mocchiut 1.4 Full_ = Aij*(Pij*Zij);
176    
177     //Double_t u13 = Full_(0,2);
178     //Double_t u23 = Full_(1,2);
179     //Double_t u22 = Full_(1,1);
180     //Double_t u33 = Full_(2,2);
181     //Double_t u21 = Full_(1,0);
182    
183     Double_t u13 = Full_(0,0);
184     Double_t u23 = -Full_(1,0);
185     Double_t u22 = Full_(1,1);
186     Double_t u33 = Full_(2,0);
187     Double_t u21 = Full_(1,2);
188 pamelaprod 1.1
189     Tangazh = a*atan(-u13/u33);
190     Kren = a*atan(-u23/sqrt(1 - pow(u23,2)));
191 mocchiut 1.4 Ryskanie = a*atan(u21/u22);
192 pamelaprod 1.1
193     return ;
194     }
195    
196    
197 mocchiut 1.5 void InclinationInfo::Clear(Option_t *t){
198 mocchiut 1.4 //Int_t gyh = 0;
199     }
200    
201    
202 pamelaprod 1.1 //ClassImp(McmdItem)
203     ClassImp(InclinationInfoI)
204     ClassImp(Quaternions)
205     ClassImp(InclinationInfo)

  ViewVC Help
Powered by ViewVC 1.1.23