StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
helixTest3.cc
1 /***************************************************************************
2  *
3  * $Id: helixTest3.cc,v 1.1 1999/02/17 12:43:59 ullrich Exp $
4  *
5  * Author: Thomas Ullrich, July 1998
6  ***************************************************************************
7  *
8  * Description:
9  * Program to test new StHelix methods/features.
10  *
11  ***************************************************************************
12  *
13  * $Log: helixTest3.cc,v $
14  * Revision 1.1 1999/02/17 12:43:59 ullrich
15  * New Revision
16  *
17  * Revision 1.1 1999/01/23 00:26:46 ullrich
18  * Initial Revision
19  *
20  **************************************************************************/
21 #include "StGlobals.hh"
22 #include "StHelix.hh"
23 #include "SystemOfUnits.h"
24 #include "PhysicalConstants.h"
25 
26 #ifndef ST_NO_NAMESPACES
27 using namespace units;
28 #endif
29 
30 int main()
31 {
32  double radius = 2*meter;
33  double dipAngle = 7*degree;
34  double phase = 124*degree;
35  int H = -1;
36 
37  StThreeVector<double> origin;
38 
39  StHelix helix(1/(radius),
40  dipAngle,
41  phase,
42  origin,
43  H);
44 
45  cout << "helix = " << helix << endl;
46 
47  double s = 0;
48  for (int i=0; i<20; i++) {
49  cout << s << '\t' << helix.at(s) << endl;
50  s += 20*centimeter;
51  }
52 
53  //
54  // Intersection with a plane
55  //
56 
57  // r is the position of the center of the plane
58  double sprime = 1.2*meter;
59  StThreeVector<double> r = helix.at(sprime);
60  // n is the normal vector
61  StThreeVector<double> n(0,1,1);
62 
63  double ss = helix.pathLength(r, n.unit());
64 
65  cout << "path length at intersection s = " << ss << endl;
66  cout << "precision = " << (sprime-ss)/micrometer << " um" << endl;
67 
68  return 0;
69 }