/[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.1 - (hide annotations) (download)
Thu Mar 15 12:20:06 2007 UTC (17 years, 9 months ago) by pamelaprod
Branch: MAIN
Added inclination classes

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     #include <TMath.h>
22     #include <TMatrixD.h>
23    
24     using namespace std;
25    
26     // InclinationInfoI()::InclinationInfoI() {
27     // // memset(time,0,6*sizeof(double));
28     // // memset(quad,0,6*4*sizeof(double));
29     // };
30    
31     void InclinationInfoI::fill(TArrayC* data){
32     short extIndex = 0;
33     short innIndex = 0;
34     long tempData = 0;
35     for (int i = 0; i < 6; i++){
36     extIndex = 20*i;
37     time[i] = (((data->At(extIndex) << 24) & 0xFF000000) +
38     ((data->At(extIndex + 1) << 16) & 0x00FF0000) + ((data->At(extIndex + 2) << 8) & 0x0000FF00) +
39     (data->At(extIndex + 3) & 0x000000FF))/128.0;
40    
41     for (int j = 0; j < 4; j++){
42     innIndex = extIndex + 4*j;
43     tempData = ((data->At(innIndex + 4) << 24) & 0xFF000000) + ((data->At(innIndex + 5) << 16) & 0x00FF0000) + ((data->At(innIndex + 6) << 8) & 0x0000FF00) + (data->At(innIndex + 7) & 0x000000FF);
44     if (data->At(innIndex + 4) >> 8) {
45     quat[i][j] = (~tempData * -1.0)/1073741824.0;
46     } else {
47     quat[i][j] = tempData / 1073741824.0;
48     }
49     }
50     }
51     }
52    
53     // const char* InclinationInfoItem::toXML(char* tab = ""){
54     // stringstream oss;
55     // oss.str("");
56     // for (int i = 0; i < 6; i++){
57     // oss << tab << "<QUATERNION>\n";
58     // oss << tab << "\t <param name = 'time'>" << time[i] << "</param>\n";
59     // oss << tab << "\t <param name = 'L0'>" << quat[i][0] << "</param>\n";
60     // oss << tab << "\t <param name = 'L1'>" << quat[i][1] << "</param>\n";
61     // oss << tab << "\t <param name = 'L2'>" << quat[i][2] << "</param>\n";
62     // oss << tab << "\t <param name = 'L3'>" << quat[i][3] << "</param>\n";
63     // oss << tab << "</QUATERNION>\n";
64     // }
65     // return oss.str().c_str();
66     // }
67    
68    
69     Quaternions::Quaternions()
70     : InclinationInfoI()
71     {
72     }
73    
74    
75     Quaternions::~Quaternions()
76     {
77     }
78    
79     InclinationInfo::InclinationInfo()
80     : TObject()
81     {
82     }
83    
84     InclinationInfo::~InclinationInfo()
85     {
86     }
87    
88     short int Sign_1(double_t a, Int_t b){
89     if(a>0){b=1;}
90     if(a<0){b=-1;}
91     else{b=0;}
92     return b;
93     }
94    
95     void InclinationInfo::QuaternionstoAngle(Quaternions Qua){
96    
97     double_t a11 = pow(Qua.quat[0][0],2.)+pow(Qua.quat[0][1],2.)-pow(Qua.quat[0][2],2.)-pow(Qua.quat[0][3],2.);
98     double_t a12 = 2*(Qua.quat[0][1]*Qua.quat[0][2]+Qua.quat[0][0]*Qua.quat[0][3]);
99     double_t a13 = 2*(Qua.quat[0][1]*Qua.quat[0][3]-Qua.quat[0][0]*Qua.quat[0][2]);
100     double_t a21 = 2*(Qua.quat[0][1]*Qua.quat[0][2]-Qua.quat[0][0]*Qua.quat[0][3]);
101     double_t a22 = pow(Qua.quat[0][0],2.)+pow(Qua.quat[0][2],2.)-pow(Qua.quat[0][1],2.)-pow(Qua.quat[0][3],2.);
102     double_t a23 = 2*(Qua.quat[0][2]*Qua.quat[0][3]+Qua.quat[0][0]*Qua.quat[0][1]);
103     double_t a31 = 2*(Qua.quat[0][1]*Qua.quat[0][3]+Qua.quat[0][0]*Qua.quat[0][2]);
104     double_t a32 = 2*(Qua.quat[0][2]*Qua.quat[0][3]-Qua.quat[0][0]*Qua.quat[0][1]);
105     double_t a33 = pow(Qua.quat[0][0],2.)+pow(Qua.quat[0][3],2.)-pow(Qua.quat[0][1],2.)-pow(Qua.quat[0][2],2.);
106     double_t a = 360/(2*TMath::Pi());
107     double_t eksi = 0.0000001;
108     double_t eteta = 0.0000001;
109     double_t ksteta = a22*a22/(a12*a12+a22*a22);
110     double_t ksksi = a33*a33/(a33*a33+a31*a31);
111    
112     Int_t kj1;
113     if (a33<0){kj1=1;
114     } else {kj1=0;};
115     Int_t kj2;
116     if (ksksi>eksi){kj2=1;
117     } else {kj2=0;};
118     Int_t kj3;
119     if (ksksi<=eksi){kj3=1;
120     } else {kj3=0;};
121     Int_t kj4;
122     if (a22<0){kj4=1;
123     } else {kj4=0;};
124     Int_t kj5;
125     if (ksteta>eteta){kj5=1;
126     } else {kj5=0;};
127     Int_t kj6;
128     if (ksteta<=eteta){kj6=1;
129     } else {kj6=0;};
130     if (abs((int)a32)>1){exit(1);};
131     Int_t fr;
132    
133     Double_t gamar = -atan(a32/sqrt(1-pow(a32,2.)));
134     Double_t ksir = (-atan(a31/a33)-TMath::Pi()*kj1*Sign_1(a31, fr))*kj2-0.5*TMath::Pi()*kj3*Sign_1(a31, fr);
135     Double_t tetar = -(-atan(a12/a22)-TMath::Pi()*kj4*Sign_1(a12, fr))*kj5+0.5*TMath::Pi()*kj6*Sign_1(a12, fr);
136     // if (gamar<0){A11=gamar*a+360;}else{A11=gamar*a;};
137     // if (ksir<0){A11=ksir*a+360;}else{A11=ksir*a;};
138     // if (tetar<0){A13=tetar*a+360;}else{A13=tetar*a;};
139    
140     // gamar = acos(pow(Qua.quat[0][0],2.)+pow(Qua.quat[0][3],2.)-pow(Qua.quat[0][1],2.)-pow(Qua.quat[0][2],2.));
141     // tetar = atan((Qua.quat[0][2]*Qua.quat[0][3]+Qua.quat[0][0]*Qua.quat[0][2])/(Qua.quat[0][2]*Qua.quat[0][3]+Qua.quat[0][1]*Qua.quat[0][0]));
142     // ksir = atan((Qua.quat[0][1]*Qua.quat[0][3]-Qua.quat[0][0]*Qua.quat[0][2])/(Qua.quat[0][2]*Qua.quat[0][3]-Qua.quat[0][1]*Qua.quat[0][0]));
143    
144    
145     A13=tetar*a;
146     A12=ksir*a;
147     A11=gamar*a;
148    
149     return ;
150     }
151    
152     /******************************************************************************************************************/
153     /******************************************************************************************************************/
154     //********************* ***************************************************************/
155     //********************* COORDINATE SYSTEMS ***************************************************************/
156     //********************* ***************************************************************/
157     //*****************************************************************************************************************/
158     //*****************************************************************************************************************/
159     //
160     // ZISK
161     // +
162     // / \ YOSK ZOSK (Directed by Radius)
163     // | _ _.
164     // | |\ /|
165     // | \ /
166     // | \ /
167     // |.__..__ \ /
168     // Orbit _._.***| **.\/_ XOSK (Directed by velocity)
169     // .* | (X0,Y0,Z0) **--.___\
170     // _** | / *. /
171     // .* | * *
172     // * ..****|***.. / R *
173     // .* | .*.
174     // .* | / *.
175     // * EARTH | / * YISK
176     // * | /_ _ _*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\
177     // * / * /
178     // * / .*
179     // *. / .*
180     // **/*******
181     // /
182     // /
183     // /
184     // /
185     // /
186     // /
187     // |/
188     // *--
189     // XISK
190     //
191     //****************************************************************************************************/
192     //****************************************************************************************************/
193    
194     //void OrbitalInfo::coefplane(Double_t x1,Double_t y1,Double_t z1,Double_t x2, Double_t y2, Double_t z2){
195     // k1 = ((z1/y1)*((x2*y1 - x1*y2)/(z2*y1 - z1*y2)) - x1/y1);
196     // k2 = (x1*y2 - x2*y1)/(z2*y1 - z1*y2);
197     // }
198    
199     //Double_t OrbitalInfo::AngBetAxes(Double_t x1,Double_t y1,Double_t z1,Double_t x2, Double_t y2, Double_t z2){
200     // return acos((x1*x2+y1*y2+z1*z2)/sqrt(pow(x1,2)+pow(y1,2)+pow(z1,2))/sqrt(pow(x2,2)+pow(y2,2)+pow(z2,2)));
201     // }
202    
203     //Double_t OrbitalInfo::ValueT(Double_t x1, Double_t y1, Double_t z1, Double_t n1, Double_t n2){
204     // return -(x1+n1*y1+n2*z1)/(1+pow(n1,2)+pow(n2,2));
205     // }
206    
207     //Double_t OrbitalInfo::AngBetPlan(Double_t x1, Double_t y1, Double_t z1, Double_t n1, Double_t n2){
208     // return asin((x1+n1*y1+n2*z1)/(sqrt(pow(x1,2)+pow(y1,2)+pow(z1,2))*sqrt(1+pow(n1,2)+pow(n2,2))));
209     // }
210    
211     void InclinationInfo::TransAngle(Double_t x0, Double_t y0, Double_t z0, Double_t Vx0, Double_t Vy0, Double_t Vz0, Double_t gamar, Double_t ksir, Double_t tetar, Double_t q0, Double_t q1, Double_t q2, Double_t q3){
212    
213     double_t a = 360/(2*TMath::Pi());
214    
215     // Points on three axes of Resurs' coordinate system (RCS)
216     Int_t XRCS[3]; Int_t YRCS[3]; Int_t ZRCS[3];
217    
218     // Angles between our Axes(RCS) and planes of Orbital Coordinate System (OCS);
219     // Double_t AboAa0ZX[3];
220     // Double_t AboAa0XY[3];
221     // Double_t AboAa0YZ[3];
222    
223     // Angles between our Axes(RCS) and Axes of OCS
224     // Double_t AboA0X[3];
225     // Double_t AboA0Y[3];
226     // Double_t AboA0Z[3];
227    
228     //Angles between Proection of our axes on every plane of OCS and axes of it plane.
229     // Double_t AbPoAaAoP0ZX[3];
230     // Double_t AbPoAaAoP0XY[3];
231     // Double_t AbPoAaAoP0YZ[3];
232    
233     XRCS[0] = 1; YRCS[0] = 0; ZRCS[0] = 0; // Points on X-axis RCS.
234     XRCS[1] = 0; YRCS[1] = 1; ZRCS[1] = 0; // Points on Y-axis RCS.
235     XRCS[2] = 0; YRCS[2] = 0; ZRCS[2] = 1; // Points on Z-axis
236    
237     // Transition matrix RCS -> Inertial Coordinate System (ICS)
238     TMatrixD Bij(3,3);
239     Bij(0,0) = cos(tetar)*cos(ksir)-sin(tetar)*sin(gamar)*sin(ksir);
240     Bij(0,1) = -sin(tetar)*cos(gamar);
241     Bij(0,2) = cos(tetar)*sin(ksir)+sin(tetar)*sin(gamar)*cos(ksir);
242     Bij(1,0) = sin(tetar)*cos(ksir)+cos(tetar)*sin(gamar)*sin(ksir);
243     Bij(1,1) = cos(tetar)*cos(gamar);
244     Bij(1,2) = sin(tetar)*sin(ksir)-cos(tetar)*sin(gamar)*cos(ksir);
245     Bij(2,0) = -sin(ksir)*cos(gamar);
246     Bij(2,1) = sin(gamar);
247     Bij(2,2) = cos(ksir)*cos(gamar);
248    
249     //********************************************************************************************/
250     //*********************** OTHER METHOD OF GETING COORDINATE IN OCS****************************/
251     //********************************************************************************************/
252    
253     TMatrixD Pij(3,3);
254     Pij(0,0) = pow(q0,2)+pow(q1,2)-pow(q2,2)-pow(q3,2);
255     Pij(0,1) = 2*(q1*q2+q0*q3);
256     Pij(0,2) = 2*(q1*q3-q0*q2);
257     Pij(1,0) = 2*(q1*q2-q0*q3);
258     Pij(1,1) = pow(q0,2)-pow(q1,2)+pow(q2,2)-pow(q3,2);
259     Pij(1,2) = 2*(q2*q3+q0*q1);
260     Pij(2,0) = 2*(q1*q3+q0*q2);
261     Pij(2,1) = 2*(q2*q3-q0*q1);
262     Pij(2,2) = pow(q0,2)-pow(q1,2)-pow(q2,2)+pow(q3,2);
263    
264     TMatrixD Aij(3,3);
265     // Double_t AbPoAaAoP0ZX_2m[3]; Double_t AboAa0ZX_2m[3];
266     // Double_t AbPoAaAoP0XY_2m[3]; Double_t AboAa0XY_2m[3];
267     // Double_t AbPoAaAoP0YZ_2m[3]; Double_t AboAa0YZ_2m[3];
268    
269     Double_t C1 = y0*Vz0 - z0*Vy0;
270     Double_t C2 = z0*Vx0 - x0*Vz0;
271     Double_t C3 = x0*Vy0 - y0*Vx0;
272     Double_t C = sqrt(pow(C1,2) + pow(C2,2) + pow(C3,2));
273     Double_t V0 = sqrt(pow(Vx0,2)+pow(Vy0,2) + pow(Vz0,2));
274     //cout<<"C1= "<<(Vy0*C3-Vz0*C2)/(V0*C)<<", C2= "<<(Vz0*C1-Vx0*C3)/(V0*C)<<", C3="<<(Vx0*C2-Vy0*C1)/(V0*C)<<"\n";
275     Double_t R0 = sqrt(pow(x0,2)+pow(y0,2) + pow(z0,2));
276     Aij(0,0) = /*(C2*z0-C3*y0)/(C*R0);/*/Vx0/V0;
277     Aij(0,1) = C1/C;
278     Aij(0,2) = /*x0/R0;/*/(Vy0*C3-Vz0*C2)/(V0*C);
279     Aij(1,0) = /*(C3*x0-C1*z0)/(C*R0);/*/Vy0/V0;
280     Aij(1,1) = C2/C;
281     Aij(1,2) = /*y0/R0;/*/(Vz0*C1-Vx0*C3)/(V0*C);
282     Aij(2,0) = /*(C1*y0-C2*x0)/(C*R0);/*/Vz0/V0;
283     Aij(2,1) = C3/C;
284     Aij(2,2) = /*x0/R0;/*/(Vx0*C2-Vy0*C1)/(V0*C);
285     Aij.Invert();
286     // Double_t Xnew = Aij(0,0)*(X-x0)+Aij(0,1)*(Y-y0)+Aij(0,2)*(Z-z0);
287     // Double_t Ynew = Aij(1,0)*(X-x0)+Aij(1,1)*(Y-y0)+Aij(1,2)*(Z-z0);
288     // Double_t Znew = Aij(2,0)*(X-x0)+Aij(2,1)*(Y-y0)+Aij(2,2)*(Z-z0);
289    
290     /*********************************************************************************************/
291    
292     Double_t Azim = atan(R0*C3/(y0*C1-x0*C2));
293     Double_t Sa = sin(Azim); Double_t Ca = cos(Azim);
294     Double_t R1 = sqrt(pow(x0,2)+pow(y0,2));
295     Double_t Sb = z0/R0; Double_t Cb = R1/R0;
296     Double_t Sl = y0/R1; Double_t Cl = x0/R1;
297    
298     TMatrixD Tij(3,3);
299     Tij(0,0) = -Cl*Sb*Ca-Sa*Sl;
300     Tij(0,1) = Sa*Cl-Ca*Sl*Sb;
301     Tij(0,2) = Ca*Cb;
302     Tij(1,0) = Ca*Sl-Sa*Sb*Cl;
303     Tij(1,1) = -Sa*Sl*Sb-Ca*Cl;
304     Tij(1,2) = Sa*Cb;
305     Tij(2,0) = Cb*Cl;
306     Tij(2,1) = Cb*Sl;
307     Tij(2,2) = Sb;
308     //cout<<"Tij\n";
309     //cout<<Tij(0,0)<<" "<<Tij(0,1)<<" "<<Tij(0,2)<<"\n";
310     //cout<<Tij(1,0)<<" "<<Tij(1,1)<<" "<<Tij(1,2)<<"\n";
311     //cout<<Tij(2,0)<<" "<<Tij(2,1)<<" "<<Tij(2,2)<<"\n";
312     //cout<<"Aij\n";
313    
314    
315     //TMatrixD Mij = new TMatrixD(Otestij,TMatrixD::kMult,Oij);
316     //Mij=Pij*Bij;
317     //Mij=Otestij*Oij;
318     //Mij*=Tij;
319    
320     //cout<<Mij(0,0)<<" "<<Mij(0,1)<<" "<<Mij(0,2)<<"\n";
321     //cout<<Mij(1,0)<<" "<<Mij(1,1)<<" "<<Mij(1,2)<<"\n";
322     //cout<<Mij(2,0)<<" "<<Mij(2,1)<<" "<<Mij(2,2)<<"\n";
323     // Generaly idea is to Get orientation of Satellite as angles between RCS axes and all axes and planes of OCS
324     // We will get equations of RCS axes in ICS
325    
326     // equation of line in space is (X-X0)/(X1-X0)=(Y-Y0)/(Y1-Y0)=(Z-Z0)/(Z1-Z0), where
327     // (X0,Y0,Z0)=(0,0,0) and (X1,Y1,Z1)=(XRCS[i],YRCS[i],ZRCS[i]) here i is may be x, y or z
328     // for us this equation is X/X1=Y/Y1=Z/Z1;
329    
330     // We need in equation of line in spase for OCS also. For it take next points (Vx0,Vy0,Vz0) on X-axis
331     // and (x0,y0,z0) on Z-axis.
332     // Double_t XonX = Vx0; Double_t YonX = Vy0; Double_t ZonX = Vz0;
333     // Double_t XonZ = x0; Double_t YonZ = y0; Double_t ZonZ = z0;
334     //after this we have equations for Z- and X axis OCS it's
335     // X/XonX=Y/YonX=Z/ZonX for X-axis and X/XonZ=Y/YonZ=Z/ZonZ for Z-axis
336    
337     // Next we need in equation of plane 0xz of OCS: Generaly equation is Ax+By+Cz+D=0;
338     // But all our plan pass through (0,0,0) and D=0 then we can write equation in naxt kind:
339     // x+(B/A)y+(C/A)z=0; => x+k1*y+k2*z=0;
340     // Double_t k1y;
341     // Double_t k2y;
342     //cout<<YonX<<" "<<ZonX*YonZ<<" "<<ZonZ*YonX<<"\n";
343     // if ((YonZ != 0) && (ZonX*YonZ != ZonZ*YonX)){
344     // coefplane(XonX,YonX,ZonX,XonZ,YonZ,ZonZ);
345     //coefplane(1,0.00001,0.00001,0,0,1);
346     // k1y = k1; k2y = k2;
347     // } else {k1y = 1; k2y = YonX/ZonX; cout<<"ELSE";}
348     //cout<<"P1= "<<(Vx0+k1y*Vy0+k2y*Vz0)<<"\n";
349     //cout<<"P2= "<<(x0+k1y*y0+k2y*z0)<<"\n";
350     //cout<<"P3= "<<(Vx0+k1y*Vy0+k2y*Vz0)<<"\n";
351     //cout<<"k1y= "<<k1y<<", k2y= "<<k2y<<"\n";
352     // int uchu;
353     // cin>>uchu;
354    
355     // Next we must find equation of Y-axis of OCS. For it we must find equation of line passing through
356     // point (0,0,0) perpendicularly by 0ZX plane of OCS
357     // generaly equation is:
358     // x = x0 + At;
359     // y = y0 + Bt;
360     // z = z0 + Ct;
361     // But we have point (x0,y0,z0) is (0,0,0) and other plane equation. For us it's:
362     // x = t;
363     // y = (B/A)*t => y = (B/A)*x; or x/x1=y/y1=z/z1 where
364     // z = (C/A)*t z = (C/A)*x; y1=B/A,z1=C/A and x1 we must find
365    
366     // if ((YonX<0 && ZonZ>0)||(YonX>0 && ZonZ<0)) XonY = 1;
367     // if ((YonX>0 && ZonZ>0)||(YonX>0 && ZonZ<0)) XonY = 1;
368     // Double_t XonY = 1; Double_t YonY = -k1; Double_t ZonY = k2;
369    
370     // coefficients for equations of 0XY plane of OCS.
371     // coefplane(XonX,YonX,ZonX,XonY,YonY,ZonY);
372     // Double_t k1XY = k1; Double_t k2XY = k2;
373     //cout<<"P3= "<<(XonY+k1XY*YonY+k2XY*ZonY)<<"\n";
374     //cout<<"P3= "<<(XonX+k1XY*YonX+k2XY*ZonX)<<"\n";
375     //cout<<"k1XY= "<<k1XY<<", k2XY= "<<k2XY<<"\n";
376     // coefficients for equations of 0XY plane of OCS.
377     // coefplane(XonY,YonY,ZonY,XonZ,YonZ,ZonZ);
378     // Double_t k1YZ = k1; Double_t k2YZ = k2;
379     //cout<<"P4= "<<(XonY+k1YZ*YonY+k2YZ*ZonY)<<"\n";
380     //cout<<"P4= "<<(XonZ+k1YZ*YonZ+k2YZ*ZonZ)<<"\n";
381     //cout<<"k1YZ= "<<k1YZ<<", k2YZ= "<<k2YZ<<"\n";
382    
383     // TMatrixD Gij(3,3);
384     Pij.Invert();
385     // Gij=Pij*Aij;
386     //Gij.Invert();
387     //XXRCS = Gij(0,0); XYRCS = Gij(0,1); XZRCS = Gij(2,0);
388     //YXRCS = Gij(1,0); YYRCS = Gij(1,1); YZRCS = Gij(2,1);
389     //ZXRCS = Gij(2,0); ZYRCS = Gij(1,2); ZZRCS = Gij(2,2);
390    
391     //cout<<"XXRCS= "<<XXRCS<<", YXRCS= "<<YXRCS<<", ZXRCS= "<<ZXRCS<<"\n";
392     //cout<<"XYRCS= "<<XYRCS<<", YYRCS= "<<YYRCS<<", ZYRCS= "<<ZYRCS<<"\n";
393     //cout<<"XZRCS= "<<XZRCS<<", YZRCS= "<<YZRCS<<", ZZRCS= "<<ZZRCS<<"\n";
394     //int yuip;
395     //cin>>yuip;
396    
397     for (Int_t i = 0; i<3; i++) {
398     // Values of points on axes of RCS in ICS
399     Double_t XICS = Pij(0,0)*XRCS[i] + Pij(0,1)*YRCS[i] + Pij(0,2)*ZRCS[i];// + x0;
400     Double_t YICS = Pij(1,0)*XRCS[i] + Pij(1,1)*YRCS[i] + Pij(1,2)*ZRCS[i];// + y0;
401     Double_t ZICS = Pij(2,0)*XRCS[i] + Pij(2,1)*YRCS[i] + Pij(2,2)*ZRCS[i];// + z0;
402     //cout<<"XICS= "<<XICS<<", YICS= "<<YICS<<", ZICS= "<<ZICS<<"\n";
403     //cout<<"XICS= "<<XICS<<", YICS= "<<YICS<<", ZICS= "<<ZICS<<"\n";
404     //int oiu;
405     //cin>>oiu;
406    
407     // Angles between our Axis and Z,Y,X-axes of OCS
408     // AboA0Z[i] = AngBetAxes(XICS,YICS,ZICS,XonZ,YonZ,ZonZ);
409     // AboA0Y[i] = AngBetAxes(XICS,YICS,ZICS,XonY,YonY,ZonY);
410     // AboA0X[i] = AngBetAxes(XICS,YICS,ZICS,XonX,YonX,ZonX);
411    
412     //Find coordinate of our point in OCS
413     // Double_t XOCS;
414     // Double_t YOCS;
415     // Double_t ZOCS;
416     // Double_t T = ValueT(XICS,YICS,ZICS,k1y,k2y);
417     // Double_t XonXZ = XICS + T;
418     // Double_t YonXZ = YICS + k1y*T;
419     // Double_t ZonXZ = ZICS + k2y*T;
420     // Double_t R = T*sqrt(1+pow(k1y,2)+pow(k2y,2));
421     // YOCS = R;
422     //cout<<"CHECK= "<<XonXZ+k1y*YonXZ+k2y*ZonXZ<<"\n";
423     // T = ValueT(XICS,YICS,ZICS,k1XY,k2XY);
424     // Double_t XonXY = XICS + T;
425     // Double_t YonXY = YICS + k1XY*T;
426     // Double_t ZonXY = ZICS + k2XY*T;
427     // R = T*sqrt(1+pow(k1XY,2)+pow(k2XY,2));
428     // ZOCS = R;
429     //cout<<"CHECK= "<<XonXY+k1XY*YonXY+k2XY*ZonXY<<"\n";
430     // T = ValueT(XICS,YICS,ZICS,k1YZ,k2YZ);
431     // Double_t XonYZ = XICS + T;
432     // Double_t YonYZ = YICS + k1YZ*T;
433     // Double_t ZonYZ = ZICS + k2YZ*T;
434     // R = T*sqrt(1+pow(k1YZ,2)+pow(k2YZ,2));
435     // XOCS = R;
436     //cout<<"CHECK= "<<XonYZ+k1YZ*YonYZ+k2YZ*ZonYZ<<"\n";
437     //cout<<"XOCS= "<<XOCS<<", YOCS= "<<YOCS<<", ZOCS="<<ZOCS<<"\n";
438    
439     //Double_t AbPoAaAoP0ZX_2m[3]; Double_t AboAa0ZX_2m[3];
440     //Double_t AbPoAaAoP0XY_2m[3]; Double_t AboAa0XY_2m[3];
441     //Double_t AbPoAaAoP0YZ_2m[3]; Double_t AboAa0YZ_2m[3];
442    
443     /* C1 = YICS*Vz0 - ZICS*Vy0;
444     C2 = ZICS*Vx0 - XICS*Vz0;
445     C3 = XICS*Vy0 - YICS*Vx0;
446     C = sqrt(pow(C1,2) + pow(C2,2) + pow(C3,2));
447     V0 = sqrt(pow(Vx0,2)+pow(Vy0,2) + pow(Vz0,2));
448     Aij(0,0) = Vx0/V0;
449     Aij(0,1) = C1/C;
450     Aij(0,2) = (Vy0*C3-Vz0*C2)/(V0*C);
451     Aij(1,0) = Vy0/V0;
452     Aij(1,1) = C2/C;
453     Aij(1,2) = (Vz0*C1-Vx0*C3)/(V0*C);
454     Aij(2,0) = Vz0/V0;
455     Aij(2,1) = C3/C;
456     Aij(2,2) = (Vx0*C2-Vy0*C1)/(V0*C);
457     Aij.Invert();
458     */
459     //2th method of getting XOCS,YOCS,ZOCS
460     Double_t XOCS_2m = Aij(0,0)*(XICS)+Aij(0,1)*(YICS)+Aij(0,2)*(ZICS);
461     Double_t YOCS_2m = Aij(1,0)*(XICS)+Aij(1,1)*(YICS)+Aij(1,2)*(ZICS);
462     Double_t ZOCS_2m = Aij(2,0)*(XICS)+Aij(2,1)*(YICS)+Aij(2,2)*(ZICS);
463    
464     if (i == 0) {XXRCS = XOCS_2m; YXRCS = YOCS_2m; ZXRCS = ZOCS_2m;}
465     if (i == 1) {XYRCS = XOCS_2m; YYRCS = YOCS_2m; ZYRCS = ZOCS_2m;}
466     if (i == 2) {XZRCS = XOCS_2m; YZRCS = YOCS_2m; ZZRCS = ZOCS_2m;}
467    
468     //cout<<"XOCS_2m= "<<XOCS_2m<<", YOCS_2m= "<<YOCS_2m<<", ZOCS= "<<ZOCS_2m<<"\n";
469     //int alsdj;
470     //cin>>alsdj;
471    
472     //Find Angles between RCS-axes and OCS-planes;
473     // AboAa0ZX[i] = AngBetPlan(XICS,YICS,ZICS,k1y,k2y);
474     // AboAa0XY[i] = AngBetPlan(XICS,YICS,ZICS,k1XY,k2XY);
475     // AboAa0YZ[i] = AngBetPlan(XICS,YICS,ZICS,k1YZ,k2YZ);
476     //AbPoAaAoP0ZX[i] = atan(ZOCS/XOCS); AbPoAaAoP0ZX_2m[i] = atan(ZOCS_2m/XOCS_2m);
477     //AbPoAaAoP0XY[i] = atan(XOCS/YOCS); AbPoAaAoP0XY_2m[i] = atan(YOCS_2m/XOCS_2m);
478     //AbPoAaAoP0YZ[i] = atan(ZOCS/YOCS); AbPoAaAoP0YZ_2m[i] = atan(ZOCS_2m/YOCS_2m);
479    
480     // if (XOCS_2m>0) AbPoAaAoP0ZX_2m[i] = atan(ZOCS_2m/XOCS_2m);
481     // if ((XOCS_2m<0)&&(ZOCS_2m>=0)) AbPoAaAoP0ZX_2m[i] = 180/a + atan(ZOCS_2m/XOCS_2m);
482     // if ((XOCS_2m<0)&&(ZOCS_2m<0)) AbPoAaAoP0ZX_2m[i] = atan(ZOCS_2m/XOCS_2m) - 180/a;
483     // if ((XOCS_2m=0)&&(ZOCS_2m>0)) AbPoAaAoP0ZX_2m[i] = 90/a;
484     // if ((XOCS_2m=0)&&(ZOCS_2m<0)) AbPoAaAoP0ZX_2m[i] = -90/a;
485     // if ((XOCS_2m=0)&&(ZOCS_2m=0)) AbPoAaAoP0ZX_2m[i] = 0;
486    
487     // if (XOCS_2m>0) AbPoAaAoP0XY_2m[i] = atan(YOCS_2m/XOCS_2m);
488     // if ((XOCS_2m<0)&&(YOCS_2m>=0)) AbPoAaAoP0XY_2m[i] = 180/a + atan(YOCS_2m/XOCS_2m);
489     // if ((XOCS_2m<0)&&(YOCS_2m<0)) AbPoAaAoP0XY_2m[i] = atan(YOCS_2m/XOCS_2m) - 180/a;
490     // if ((XOCS_2m=0)&&(YOCS_2m>0)) AbPoAaAoP0XY_2m[i] = 90/a;
491     // if ((XOCS_2m=0)&&(YOCS_2m<0)) AbPoAaAoP0XY_2m[i] = -90/a;
492     // if ((XOCS_2m=0)&&(YOCS_2m=0)) AbPoAaAoP0XY_2m[i] = 0;
493    
494     // if (YOCS_2m>0) AbPoAaAoP0YZ_2m[i] = atan(ZOCS_2m/YOCS_2m);
495     // if ((YOCS_2m<0)&&(ZOCS_2m>=0)) AbPoAaAoP0YZ_2m[i] = 180/a + atan(ZOCS_2m/YOCS_2m);
496     // if ((YOCS_2m<0)&&(ZOCS_2m<0)) AbPoAaAoP0YZ_2m[i] = atan(ZOCS_2m/YOCS_2m) - 180/a;
497     // if ((YOCS_2m=0)&&(ZOCS_2m>0)) AbPoAaAoP0YZ_2m[i] = 90/a;
498     // if ((YOCS_2m=0)&&(ZOCS_2m<0)) AbPoAaAoP0YZ_2m[i] = -90/a;
499     // if ((YOCS_2m=0)&&(ZOCS_2m=0)) AbPoAaAoP0YZ_2m[i] = 0;
500    
501     //if (i==0) cout<<"AbPoAaAoP0ZX_2m[i]"<<AbPoAaAoP0ZX_2m[i]<<"\n";
502     //cout<<"XOCS/ZOCS= "<<XOCS_2m/ZOCS_2m<<"\n";
503     //cout<<"Atan= "<<AbPoAaAoP0ZX_2m[i]<<"\n";
504     //cout<<"atan= "<<a*atan(0.2);
505     //int GJH;
506     //cin>>GJH;
507    
508     }
509     Double_t u13 = XYRCS/*Gij(0,2)*/; Double_t u33 = ZYRCS/*Gij(2,2)*/;
510     Double_t u23 = YYRCS/*Gij(1,2)*/; Double_t u21 = YZRCS/*Gij(1,0)*/;
511     Double_t u22 = YXRCS/*Gij(1,1)*/;
512     Tangazh = a*atan(-u13/u33);
513     //cout<<"u13= "<<u13<<", u33= "<<u33<<"\n";
514     Kren = a*atan(-u23/sqrt(1 - pow(u23,2)));
515     //Ryskanie = a*atan(u21/u22);
516    
517     if (u22>0) Ryskanie = a*atan(u21/u22);
518     //cout<<Ryskanie<<"\n";
519     if ((u22<0)&&(u21>=0)) Ryskanie = 180 + a*atan(u21/u22);
520     if ((u22<0)&&(u21<0)) Ryskanie = a*atan(u21/u22) - 180;
521     if ((u22=0)&&(u21>0)) Ryskanie = 90;
522     if ((u22=0)&&(u21<0)) Ryskanie = -90;
523     if ((u22=0)&&(u21=0)) Ryskanie = 0;
524    
525     // AXrXo = AboA0X[0]*a; AXrZXo = AboAa0ZX[0]*a; ApXrZXoZ = AbPoAaAoP0ZX[0]*a;
526     // AXrYo = AboA0Y[0]*a; AXrXYo = AboAa0XY[0]*a; ApXrXYoZ = AbPoAaAoP0XY[0]*a;
527     // AXrZo = AboA0Z[0]*a; AXrYZo = AboAa0YZ[0]*a; ApXrYZoZ = AbPoAaAoP0YZ[0]*a;
528     // AYrXo = AboA0X[1]*a; AYrZXo = AboAa0ZX[1]*a; ApYrZXoZ = AbPoAaAoP0ZX[1]*a;
529     // AYrYo = AboA0Y[1]*a; AYrXYo = AboAa0XY[1]*a; ApYrXYoZ = AbPoAaAoP0XY[1]*a;
530     // AYrZo = AboA0Z[1]*a; AYrYZo = AboAa0YZ[1]*a; ApYrYZoZ = AbPoAaAoP0YZ[1]*a;
531     // AZrXo = AboA0X[2]*a; AZrZXo = AboAa0ZX[2]*a; ApZrZXoZ = AbPoAaAoP0ZX[2]*a;
532     // AZrYo = AboA0Y[2]*a; AZrXYo = AboAa0XY[2]*a; ApZrXYoZ = AbPoAaAoP0XY[2]*a;
533     // AZrZo = AboA0Z[2]*a; AZrYZo = AboAa0YZ[2]*a; ApZrYZoZ = AbPoAaAoP0YZ[2]*a;
534    
535     // AXrZXo_2m = AboAa0ZX_2m[0]*a; ApXrZXoZ_2m = AbPoAaAoP0ZX_2m[0]*a;
536     // AXrXYo_2m = AboAa0XY_2m[0]*a; ApXrXYoZ_2m = AbPoAaAoP0XY_2m[0]*a;
537     // AXrYZo_2m = AboAa0YZ_2m[0]*a; ApXrYZoZ_2m = AbPoAaAoP0YZ_2m[0]*a;
538     // AYrZXo_2m = AboAa0ZX_2m[1]*a; ApYrZXoZ_2m = AbPoAaAoP0ZX_2m[1]*a;
539     // AYrXYo_2m = AboAa0XY_2m[1]*a; ApYrXYoZ_2m = AbPoAaAoP0XY_2m[1]*a;
540     // AYrYZo_2m = AboAa0YZ_2m[1]*a; ApYrYZoZ_2m = AbPoAaAoP0YZ_2m[1]*a;
541     // AZrZXo_2m = AboAa0ZX_2m[2]*a; ApZrZXoZ_2m = AbPoAaAoP0ZX_2m[2]*a;
542     // AZrXYo_2m = AboAa0XY_2m[2]*a; ApZrXYoZ_2m = AbPoAaAoP0XY_2m[2]*a;
543     // AZrYZo_2m = AboAa0YZ_2m[2]*a; ApZrYZoZ_2m = AbPoAaAoP0YZ_2m[2]*a;
544    
545     /*
546     //Int_t Y=2;Int_t X=2;Int_t Z=4;Int_t Vx=5;Int_t Vz=9;Int_t Vy=5;
547    
548     Double_t X[2]; Double_t Y[2]; Double_t Z[2]; Double_t Vx[2]; Double_t Vy[2]; Double_t Vz[2];
549    
550     TMatrixD Aij(3,3);
551     TMatrixD Bij(3,3);
552    
553     Bij(0,0) = cos(tetar)*cos(ksir)-sin(tetar)*sin(gamar)*sin(ksir);
554     Bij(0,1) = -sin(tetar)*cos(gamar);
555     Bij(0,2) = cos(tetar)*sin(ksir)+sin(tetar)*sin(gamar)*cos(ksir);
556     Bij(1,0) = sin(tetar)*cos(ksir)+cos(tetar)*sin(gamar)*sin(ksir);
557     Bij(1,1) = cos(tetar)*cos(gamar);
558     Bij(1,2) = sin(tetar)*sin(ksir)-cos(tetar)*sin(gamar)*cos(ksir);
559     Bij(2,0) = -sin(ksir)*cos(gamar);
560     Bij(2,1) = sin(gamar);
561     Bij(2,2) = cos(ksir)*cos(gamar);
562    
563     Double_t C1 = Y[0]*Vz[0] - Z[0]*Vy[0];
564     Double_t C2 = Z[0]*Vx[0] - X[0]*Vz[0];
565     Double_t C3 = X[0]*Vy[0] - Y[0]*Vx[0];
566     Double_t C = sqrt(pow(C1,2) + pow(C2,2) + pow(C3,2));
567     Double_t V0 = sqrt(pow(Vx0,2)+pow(Vy0,2) + pow(Vz0,2));
568     Aij(0,0) = Vx0/V0;
569     Aij(0,1) = C1/C;
570     Aij(0,2) = (Vy0*C3-Vz0*C2)/(V0*C);
571     Aij(1,0) = Vy0/V0;
572     Aij(1,1) = C2/C;
573     Aij(1,2) = (Vz0*C1-Vx0*C3)/(V0*C);
574     Aij(2,0) = Vz0/V0;
575     Aij(2,1) = C3/C;
576     Aij(2,2) = (Vx0*C2-Vy0*C1)/(V0*C);
577     Aij.Invert();
578     Double_t Xnew = Aij(0,0)*(X-x0)+Aij(0,1)*(Y-y0)+Aij(0,2)*(Z-z0);
579     Double_t Ynew = Aij(1,0)*(X-x0)+Aij(1,1)*(Y-y0)+Aij(1,2)*(Z-z0);
580     Double_t Znew = Aij(2,0)*(X-x0)+Aij(2,1)*(Y-y0)+Aij(2,2)*(Z-z0);
581     */
582     //A21 = NewTetar;
583     //A22 = NewGamar;
584     //A23 = NewKsir;
585    
586     return ;
587     }
588    
589    
590     //ClassImp(McmdItem)
591     ClassImp(InclinationInfoI)
592     ClassImp(Quaternions)
593     ClassImp(InclinationInfo)

  ViewVC Help
Powered by ViewVC 1.1.23