# class THelix: public TPolyLine3D

``` THelix has two different constructors.

If a particle with charge q passes through a point (x,y,z)
with momentum (px,py,pz) with magnetic field B along an axis (nx,ny,nz),
this helix can be constrcuted like

THelix p(x,y,z, px,py,pz, q*B, nx,ny,nz);

(nx,ny,nz) defaults to (0,0,1).

A helix in its own frame can be defined with a pivotal point
(x0,y0,z0), the velocity at that point (vx0,vy0,vz0), and
an angular frequency w.  Combining vx0 and vy0 to a transverse
velocity vt0 one can parametrize the helix as

x(t) = x0 - vt0 / w * sin(-w * t + phi0)
y(t) = y0 + vt0 / w * cos(-w * t + phi0)
z(t) = z0 + vz0 * t

The second constructor has 6 parameters,

Example:
THelix pl1(xyz, v, w, range, rtype, axis);

where:
xyz  : array of initial position
v    : array of initial velocity
w    : angular frequency
range: helix range
rtype: kHelixZ specifies allowed drawing range in helix Z direction, i.e., along B field.
kLabZ specifies drawing range in lab frame.
kHelixX, kHelixY, kLabX, kLabY, kUnchanged ... etc can also be specified
axis : helix axis

Example constructing a helix with several default values and drawing it:

This initializes a helix with its axis in Z direction (rtype=kHelixZ).

```

## Function Members (Methods)

public:
protected:
 virtual void TObject::DoError(int level, const char* location, const char* fmt, va_list va) const Double_t FindClosestPhase(Double_t phi0, Double_t cosine) void TObject::MakeZombie() THelix& operator=(const THelix&) void SetRotMatrix()

## Data Members

private:
 enum TObject::EStatusBits { kCanDelete kMustCleanup kObjInCanvas kIsReferenced kHasUUID kCannotPick kNoContextMenu kInvalidObject }; enum TObject::[unnamed] { kIsOnHeap kNotDeleted kZombie kBitMask kSingleKey kOverwrite kWriteDelete };
protected:
 Double_t fAxis[3] Direction unit vector of the helix axis Int_t TPolyLine3D::fLastPoint The index of the last filled point Color_t TAttLine::fLineColor line color Style_t TAttLine::fLineStyle line style Width_t TAttLine::fLineWidth line width Int_t TPolyLine3D::fN Number of points TString TPolyLine3D::fOption options Float_t* TPolyLine3D::fP [3*fN] Array of 3-D coordinates (x,y,z) Double_t fPhi0 Initial phase, so vx0 = fVt*cos(fPhi0) Double_t fRange[2] Range of helix parameter t TRotMatrix* fRotMat Rotation matrix: axis // z --> axis // fAxis Double_t fVt Transverse velocity (constant of motion) Double_t fVz Z velocity (constant of motion) Double_t fW Angular frequency Double_t fX0 Pivot's x position (see parametrization in class doc) Double_t fY0 Pivot's y position (see parametrization in class doc) Double_t fZ0 Pivot's z position (see parametrization in class doc) static Int_t fgMinNSeg minimal number of segments in polyline

## Function documentation

void SetHelix(Double_t* xyz, Double_t* v, Double_t w, Double_t* range = 0, EHelixRangeType type = kUnchanged, Double_t* axis = 0)
``` Set all helix parameters.
```
THelix()
``` Helix default constructor.
```
THelix(Double_t x, Double_t y, Double_t z, Double_t vx, Double_t vy, Double_t vz, Double_t w)
``` Helix normal constructor.
```
THelix(Double_t* xyz, Double_t* v, Double_t w, Double_t* range = 0, EHelixRangeType rtype = kHelixZ, Double_t* axis = 0)
``` Helix normal constructor.
```
THelix(const THelix& helix)
``` Helix copy constructor.
```
THelix& operator=(const THelix& )
```assignement operator
```
~THelix()
``` Helix destructor.
```
void Copy(TObject& helix) const
``` Copy this helix to obj.
```
void Draw(Option_t* option = "")
``` Draw this helix with its current attributes.
```
void Print(Option_t* option = "") const
``` Dump this helix with its attributes.
```
void SavePrimitive(ostream& out, Option_t* option = "")
``` Save primitive as a C++ statement(s) on output stream out.
```
void SetAxis(Double_t* axis)
``` Set a new axis for the helix.  This will make a new rotation matrix.
```
void SetAxis(Double_t x, Double_t y, Double_t z)
``` Set axis.
```
void SetRange(Double_t* range, EHelixRangeType rtype = kHelixZ)
``` Set a new range for the helix.  This will remake the polyline.
```
void SetRange(Double_t r1, Double_t r2, EHelixRangeType rtype = kHelixZ)
``` Set range.
```
void SetRotMatrix()
``` Set the rotational matrix according to the helix axis.
```
Double_t FindClosestPhase(Double_t phi0, Double_t cosine)
``` Finds the closest phase to phi0 that gives cos(phase) = cosine
```
void Streamer(TBuffer& b)
``` Stream an object of class THelix.
```
Option_t * GetOption() const
`{return fOption.Data();}`
void SetOption(Option_t* option = "")
`{fOption = option;}`