32 #include "StPrompt.hh"
33 #include "SystemOfUnits.h"
35 #ifndef ST_NO_NAMESPACES
36 using namespace units;
38 int main(
int,
char* argc[])
47 pair<double, double> s;
50 bool moreHelices =
true;
51 bool moreTests =
true;
55 double slow = 0, sup = 0, ds = 0, ss = 0;
58 cout <<
"This is test program " << argc[0] << endl << endl;
62 cout <<
"Enter helix parameter:" << endl;
63 StPrompt(
"Angles in radians (else degrees)", radunits);
64 StPrompt(
"Enter curvature", curvature);
66 StPrompt(
"dipAngle in rad", dipAngle);
67 StPrompt(
"phase in rad", phase);
70 StPrompt(
"dipAngle in degree", dipAngle);
71 StPrompt(
"phase in degree", phase);
73 StPrompt(
"-sign(q*B)", H);
74 StPrompt(
"xyz of origin", origin);
78 (radunits ? dipAngle : dipAngle*degree),
79 (radunits ? phase : phase*degree),
82 if (!helix->
valid()) {
83 cerr <<
"Error: parametrization is not valid" << endl;
90 cout <<
"The helix parameter are:" << endl;
91 cout << *helix << endl;
92 cout <<
"The period of the helix is: " << helix->
period() << endl;
99 cout <<
"Select one of the following:" << endl;
100 cout <<
"Print helix points along its path ..... v" << endl;
101 cout <<
"Test pathLength(r) method ............. r" << endl;
102 cout <<
"Test pathLength(point) method ......... p" << endl;
103 cout <<
"Test pathLength(plane) method ......... e" << endl;
104 cout <<
"Test distance(point) method ........... d" << endl;
105 StPrompt(
"Enter your selection", selection);
109 StPrompt(
"vector r to a point in the plane", rv);
110 StPrompt(
"normal vector n for plane", nv);
112 cout <<
"s = " << ss <<
" -> " << helix->at(ss) << endl;
115 StPrompt(
"lower s", slow);
116 StPrompt(
"upper s", sup);
117 StPrompt(
"step size", ds);
118 for (ss = slow; ss < sup; ss+= ds)
119 cout <<
"s = " << ss <<
" -> " << helix->at(ss) << endl;
122 StPrompt(
"Enter a radius", r);
124 cout <<
"The helix reaches r at s1 = " << s.first
125 <<
" and s2 = " << s.second << endl;
126 cout <<
"Crosscheck radius1 = " << helix->at(s.first).perp()
127 <<
", delta_r = " << r*meter-helix->at(s.first).perp() << endl;
128 cout <<
"Crosscheck radius2 = " << helix->at(s.second).perp()
129 <<
", delta_r = " << r*meter-helix->at(s.second).perp() << endl;
132 StPrompt(
"xyz of point", point);
135 cout <<
"The helix reaches r at s = " << ss << endl;
136 cout <<
"Crosscheck point = " << helix->at(ss)
137 <<
", delta = " << abs(mmpoint-helix->at(ss)) << endl;
140 StPrompt(
"xyz of point", point);
142 cout <<
"The closest distance from the helix to the point is: "
143 << helix->
distance(mmpoint) << endl;
149 #if defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500
150 StBoolPrompt(
"another test", moreTests);
152 StPrompt(
"another test", moreTests);
156 #if defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500
157 StBoolPrompt(
"define another helix", moreHelices);
159 StPrompt(
"define another helix", moreHelices);
163 cout <<
"end of example" << endl;
bool valid(double world=1.e+5) const
checks for valid parametrization
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
double period() const
returns period length of helix