19 sHelix::sHelix(
float x0,
float y0,
float z0,
float px,
float py,
float pz,
float q,
float b) {
25 fPhi = TMath::Pi()+TMath::ATan2(-py,-px);
26 float pt = TMath::Sqrt(px*px+py*py);
27 float p = TMath::Sqrt(px*px+py*py+pz*pz);;
36 float dt = (t2-
t1)/101;
37 for(
int n=0;
n!=100; ++
n) {
38 float ti = t1+(
n+1)*dt;
48 std::cout <<
"***** findFirstInterceptTo r:" << rd <<
" z:" << hz << std::endl;
50 float t_1, t_2, t_3, t_4;
65 if( a*a + b*b < c*c ) {
67 std::cout <<
"FAIL: solution is not a real number\n";
68 std::cout <<
"a*a =" << a*a << std::endl;
69 std::cout <<
"b*b =" << b*b << std::endl;
70 std::cout <<
"c*c =" << c*c << std::endl;
74 float sinx_1 = ( -b*c + TMath::Sqrt(a*a*(a*a+b*b-c*c)) ) / ( a*a + b*b );
75 float sinx_2 = ( -b*c - TMath::Sqrt(a*a*(a*a+b*b-c*c)) ) / ( a*a + b*b );
77 std::cout <<
"Sinx_1 " << sinx_1 << std::endl;
78 std::cout <<
"Sinx_2 " << sinx_2 << std::endl;
82 t_1=t_2=t_3=t_4=99999;
84 float asinx_1, asinx_2, asinx_3, asinx_4;
85 asinx_1 = TMath::ASin(sinx_1);
86 asinx_2 = TMath::ASin(sinx_2);
88 asinx_3 = TMath::Pi() - asinx_1;
91 asinx_3 = TMath::Pi() - asinx_1;
94 asinx_4 = TMath::Pi() - asinx_2;
97 asinx_4 = TMath::Pi() - asinx_2;
102 std::cout <<
"PHI0 " <<
fPhi << std::endl;
103 std::cout <<
"ASinx_1 " << asinx_1 << std::endl;
104 std::cout <<
"ASinx_2 " << asinx_2 << std::endl;
105 std::cout <<
"ASinx_3 " << asinx_3 << std::endl;
106 std::cout <<
"ASinx_4 " << asinx_4 << std::endl;
109 t_1 = (
fPhi - asinx_1)/
fW;
110 t_2 = (
fPhi - asinx_2)/
fW;
111 t_3 = (
fPhi - asinx_3)/
fW;
112 t_4 = (
fPhi - asinx_4)/
fW;
115 std::cout <<
"IN R: | x(t) | y(t) || r(t) z(t)" << std::endl;
116 std::cout <<
"t_1 " << t_1 <<
" | " <<
x(t_1) <<
" " <<
y(t_1) <<
" || " <<
r(t_1) <<
" " <<
z(t_1) << std::endl;
117 std::cout <<
"t_2 " << t_2 <<
" | " <<
x(t_2) <<
" " <<
y(t_2) <<
" || " <<
r(t_2) <<
" " <<
z(t_2) << std::endl;
118 std::cout <<
"t_3 " << t_3 <<
" | " <<
x(t_3) <<
" " <<
y(t_3) <<
" || " <<
r(t_3) <<
" " <<
z(t_3) << std::endl;
119 std::cout <<
"t_4 " << t_4 <<
" | " <<
x(t_4) <<
" " <<
y(t_4) <<
" || " <<
r(t_4) <<
" " <<
z(t_4) << std::endl;
121 if(t_1<0||!TMath::AreEqualAbs(rd,
r(t_1),0.1)) t_1 = 99999;
122 if(t_2<0||!TMath::AreEqualAbs(rd,
r(t_2),0.1)) t_2 = 99999;
123 if(t_3<0||!TMath::AreEqualAbs(rd,
r(t_3),0.1)) t_3 = 99999;
124 if(t_4<0||!TMath::AreEqualAbs(rd,
r(t_4),0.1)) t_4 = 99999;
126 float t1 = TMath::Min( t_1, t_2 );
127 t1 = TMath::Min( t1, t_3 );
128 t1 = TMath::Min( t1, t_4 );
131 t_1 = ( hz -
fZ0)/
fC;
132 t_2 = (-hz -
fZ0)/
fC;
134 std::cout <<
"IN Z: | x(t) | y(t) || r(t) z(t)" << std::endl;
135 std::cout <<
"t_1 " << t_1 <<
" | " <<
x(t_1) <<
" " <<
y(t_1) <<
" || " <<
r(t_1) <<
" " <<
z(t_1) << std::endl;
136 std::cout <<
"t_2 " << t_2 <<
" | " <<
x(t_2) <<
" " <<
y(t_2) <<
" || " <<
r(t_2) <<
" " <<
z(t_2) << std::endl;
138 if(t_1<0||!TMath::AreEqualAbs(hz,
z(t_1),0.1)) t_1 = 99999;
139 if(t_2<0||!TMath::AreEqualAbs(hz,
z(t_2),0.1)) t_2 = 99999;
140 float t2 = TMath::Min( t_1, t_2 );
141 float tt = TMath::Min(t1,t2);
142 if(
fDebug) std::cout <<
" chosen time " << tt << std::endl;
150 float xx[100],yy[100],zz[100], xt[100],yt[100],zt[100];
151 for(
int t=0;
t!=100; ++
t) {
152 float ti =
t/float(100);
156 float tt = t1 +
t/100.0*(t2-
t1);
161 std::ofstream
out(filec);
163 out <<
"float x[100] = {";
164 for(
int t=0;
t!=100; ++
t) out << (
t==0?
"":
",") << xx[
t];
166 out <<
"float y[100] = {";
167 for(
int t=0;
t!=100; ++
t) out << (
t==0?
"":
",") << yy[
t];
169 out <<
"float z[100] = {";
170 for(
int t=0;
t!=100; ++
t) out << (
t==0?
"":
",") << zz[
t];
172 out <<
"float xt[100] = {";
173 for(
int t=0;
t!=100; ++
t) out << (
t==0?
"":
",") << xt[
t];
175 out <<
"float yt[100] = {";
176 for(
int t=0;
t!=100; ++
t) out << (
t==0?
"":
",") << yt[
t];
178 out <<
"float zt[100] = {";
179 for(
int t=0;
t!=100; ++
t) out << (
t==0?
"":
",") << zt[
t];
181 out <<
"TPolyLine3D *pol1 = new TPolyLine3D(100,x,y,z);\n";
182 out <<
"TPolyLine3D *pol2 = new TPolyLine3D(100,xt,yt,zt);\n";
183 out <<
"pol2->SetLineColor(kRed);\n";
184 out <<
"pol2->SetLineWidth(3);\n";
185 out <<
"pol1->Draw();\n";
186 out <<
"pol2->Draw();\n";