StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
helixTest2.cc
1 /***************************************************************************
2  *
3  * $Id: helixTest2.cc,v 1.2 1999/12/21 15:14:51 ullrich Exp $
4  *
5  * Author: Thomas Ullrich, April 1998
6  ***************************************************************************
7  *
8  * Description:
9  * Program to test StHelix
10  *
11  ***************************************************************************
12  *
13  * $Log: helixTest2.cc,v $
14  * Revision 1.2 1999/12/21 15:14:51 ullrich
15  * Modified to cope with new compiler version on Sun (CC5.0).
16  *
17  * Revision 1.1 1999/02/17 12:43:59 ullrich
18  * New Revision
19  *
20  * Revision 1.1 1999/01/23 00:26:45 ullrich
21  * Initial Revision
22  *
23  **************************************************************************/
24 #include "StHelix.hh"
25 #include "SystemOfUnits.h"
26 
27 #ifndef ST_NO_NAMESPACES
28 using namespace units;
29 #endif
30 
31 int main()
32 {
33  double radius = 2;
34  double dipAngle = 10;
35  double phase = 10;
36  double x0 = 0;
37  double y0 = 0;
38  double z0 = 0;
39  int H = -1;
40  pair<double, double> s;
41 
42  StHelix *helix = 0;
43  double r = 0.1;
44 
45  double slow, sup, ds, ss;
46  StThreeVector<double> origin, point, mmpoint;
47 
48  delete helix;
49  helix = new StHelix(1/(radius*meter),
50  dipAngle*degree,
51  phase*degree,
52  origin*millimeter,
53  H);
54 
55  if (!helix->valid()) {
56  cerr << "Error: parametrization is not valid" << endl;
57  }
58  else {
59  cout << "The helix parameter are:" << endl;
60  cout << *helix << endl;
61  cout << "The period of the helix is: " << helix->period() << endl;
62  }
63 
64  ds=100*centimeter;
65  cout << "ds = " << ds << " -> " << helix->at(ds) << endl;
66 
67  r=1*meter;
68  s = helix->pathLength(r);
69  cout << "The helix reaches r=1 m at s1 = " << s.first
70  << " and s2 = " << s.second << endl;
71 
72  mmpoint = StThreeVector<double>(100, 100, 100);
73  ss = helix->pathLength(mmpoint*millimeter);
74  cout << "The helix reaches r at s = " << ss << endl;
75  cout << "Crosscheck point = " << helix->at(ss)
76  << ", delta = " << abs(mmpoint-helix->at(ss)) << endl;
77 
78  cout << "end of example" << endl;
79  return 0;
80 }
bool valid(double world=1.e+5) const
checks for valid parametrization
Definition: StHelix.hh:128
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
Definition: StHelix.cc:351
double period() const
returns period length of helix
Definition: StHelix.cc:339