library: libGraf3d #include "THelix.h"

# THelix

class description - source file - inheritance tree (.pdf)

## class THelix : public TPolyLine3D

| Inheritance Chart:

`TObject`

`TAttLine`

`TAtt3D`

<-

`TPolyLine3D`

<-

`THelix`

        protected:

          Double_t FindClosestPhase(Double_t phi0, Double_t cosine)
              void SetRotMatrix()

        public:

                            THelix()
                            THelix(Double_t x, Double_t y, Double_t z, Double_t vx, Double_t vy, Double_t vz, Double_t w)
                            THelix(Double_t* xyz, Double_t* v, Double_t w, Double_t* range = 0, EHelixRangeType rtype = kHelixZ, Double_t* axis = 0)
                            THelix(const THelix& helix)
                    virtual ~THelix()
             static TClass* Class()
               virtual void Copy(TObject& helix) const
               virtual void Draw(Option_t* option = "")
          virtual Option_t* GetOption() const
            virtual TClass* IsA() const
                    THelix& operator=(const THelix&)
               virtual void Print(Option_t* option = "") const
               virtual void SavePrimitive(ofstream& out, Option_t* option)
               virtual void SetAxis(Double_t* axis)
               virtual void SetAxis(Double_t x, Double_t y, Double_t z)
                       void SetHelix(Double_t* xyz, Double_t* v, Double_t w, Double_t* range = 0, EHelixRangeType type = kUnchanged, Double_t* axis = 0)
               virtual void SetOption(Option_t* option = "")
               virtual void SetRange(Double_t* range, EHelixRangeType rtype = kHelixZ)
               virtual void SetRange(Double_t r1, Double_t r2, EHelixRangeType rtype = kHelixZ)
               virtual void ShowMembers(TMemberInspector& insp, char* parent)
               virtual void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

              Double_t fX0        Initial X position
              Double_t fY0        Initial Y position
              Double_t fZ0        Initial Z position
              Double_t fVt        Transverse velocity (constant of motion)
              Double_t fPhi0      Initial phase, so vx0 = fVt*cos(fPhi0)
              Double_t fVz        Z velocity (constant of motion)
              Double_t fW         Angular frequency
              Double_t fAxis[3]   Direction unit vector of the helix axis
           TRotMatrix* fRotMat    Rotation matrix: axis // z  -->  axis // fAxis
              Double_t fRange[2]  Range of helix parameter t
          static Int_t fgMinNSeg  minimal number of segments in polyline

## Class Description

     Helix is, hmmm, well, a helix.  It has 3 different constructors.

     Comments/suggestions/etc on this class should be sent to the author:
                 pyeh@cdfsga.fnal.gov (Ping Yeh)

       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(x0,y0,z0, 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 initial position
       (x0,y0,z0) and "velocity" (vx0,vy0,vz0), both 3-vectors, and
       an angular frequency w.  The parametric equation of the helix is

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

       The 'normal constructor' has 6 parameters,

           Example:
                     THelix pl1(xyz0, v0, w, range, rtype, axis);

             where:
                 xyz0  : array of initial position
                 v0    : 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

     A Third constructor uses several default values:

           Example:
       c1 = new TCanvas("c1");
       TView *view = new TView(1);
       view->SetRange(-1,-1,-1,1,1,1);
       THelix *helix = new THelix(0.0, 0.0, 0.0, 1.0, 0.0, 0.3, 10.0);
       helix->Draw();

     will initializes a helix with its axis in Z direction (rtype=kHelixZ).
     range[0] = 0 and range[1] = 1
    ______________________________________________________________________________

void SetHelix(Double_t *p, Double_t *v, Double_t w, Double_t *range, EHelixRangeType rType, Double_t *axis )

     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) : TPolyLine3D()

     Helix normal constructor.

THelix(Double_t * p, Double_t * v, Double_t w, Double_t * range, EHelixRangeType rType, Double_t * axis) : TPolyLine3D()

     Helix normal constructor.

THelix(const THelix &h) : TPolyLine3D()

     Helix copy constructor.

~THelix()

     Helix destructor.

THelix(const THelix &helix) : TPolyLine3D(helix)

void Copy(TObject &obj) 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(ofstream &out, Option_t *)

     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)

void SetRange(Double_t * range, EHelixRangeType rType)

     set a new range for the helix.  This will remake the polyline.

void SetRange(Double_t r1, Double_t r2, EHelixRangeType rType)

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 &R__b)

     Stream an object of class THelix.

### Inline Functions

              Option_t* GetOption() const
                   void SetOption(Option_t* option = "")
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void StreamerNVirtual(TBuffer& b)
                THelix& operator=(const THelix&)

Author: Ping Yeh 19/12/97
Last update: root/g3d:$Name: $:$Id: THelix.cxx,v 1.10 2004/08/03 16:01:18 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *