library: libGeom #include "TGeoHelix.h"

# TGeoHelix

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

## class TGeoHelix : public TObject

| Inheritance Chart:
`TObject`
| <- | `TGeoHelix` |

        public:

                          TGeoHelix()
                          TGeoHelix(Double_t curvature, Double_t step, Int_t charge = 1)
                          TGeoHelix(const TGeoHelix&)
                  virtual ~TGeoHelix()
           static TClass* Class()
                 Double_t ComputeSafeStep(Double_t epsil = 1E-6) const
          const Double_t* GetCurrentDirection() const
          const Double_t* GetCurrentPoint() const
                 Double_t GetStep() const
                 Double_t GetTotalCurvature() const
                 Double_t GetXYcurvature() const
                     void InitDirection(Double_t dirx, Double_t diry, Double_t dirz, Bool_t is_normalized = kTRUE)
                     void InitDirection(Double_t* dir, Bool_t is_normalized = kTRUE)
                     void InitPoint(Double_t x0, Double_t y0, Double_t z0)
                     void InitPoint(Double_t* point)
          virtual TClass* IsA() const
                   Bool_t IsRightHanded() const
               TGeoHelix& operator=(const TGeoHelix&)
                     void ResetStep()
                     void SetCharge(Int_t charge)
                     void SetField(Double_t bx, Double_t by, Double_t bz, Bool_t is_normalized = kTRUE)
                     void SetHelixStep(Double_t hstep)
                     void SetXYcurvature(Double_t curvature)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
                     void Step(Double_t step)
                 Double_t StepToPlane(Double_t* point, Double_t* norm)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                     void UpdateHelix()

### Data Members

        private:

              Double_t fC             curvature in XY plane
              Double_t fS             Z step of the helix / 2*PI
              Double_t fStep          current step
              Double_t fPhi           phi angle
              Double_t fPointInit[3]  initial point
              Double_t fDirInit[3]    normalized initial direction
              Double_t fPoint[3]      point after a step
              Double_t fDir[3]        direction after a step
              Double_t fB[3]          normalized direction for magnetic field
                 Int_t fQ             right/left-handed (+/- 1) - "charge"
          TGeoHMatrix* fMatrix        transformation of local helix frame to MARS

        public:

          static const TGeoHelix::EGeoHelixTypes kHelixNeedUpdate
          static const TGeoHelix::EGeoHelixTypes kHelixStraigth
          static const TGeoHelix::EGeoHelixTypes kHelixCircle

## Class Description

       TGeoHelix - class representing a helix curve

      A helix is a curve defined by the following equations:
         x = (1/c) * COS(q*phi)
         y = (1/c) * SIN(q*phi)
         z = s * alfa
     where:
         c = 1/Rxy  - curvature in XY plane
         phi        - phi angle
         S = 2*PI*s - vertical separation between helix loops
         q = +/- 1  - (+)=left-handed, (-)=right-handed

       In particular, a helix describes the trajectory of a charged particle in magnetic
     field. In such case, the helix is right-handed for negative particle charge.
     To define a helix, one must define:
       - the curvature - positive defined
       - the Z step made after one full turn of the helix
       - the particle charge sign
       - the initial particle position and direction (force normalization to unit)
       - the magnetic field direction

     A helix provides:
       - propagation to a given Z position (in global frame)
       Double_t *point = TGeoHelix::PropagateToZ(Double_t z);
       - propagation to an arbitrary plane, returning also the new point
       - propagation in a geometry until the next crossed surface
       - computation of the total track length along a helix

TGeoHelix()

     Dummy constructor

TGeoHelix(Double_t curvature, Double_t hstep, Int_t charge)

     Normal constructor

~TGeoHelix()

     Destructor

Double_t ComputeSafeStep(Double_t epsil) const

     Compute safe linear step that can be made such that the error
     between linear-helix extrapolation is less than EPSIL.

void InitPoint(Double_t x0, Double_t y0, Double_t z0)

     Initialize coordinates of a point on the helix

void InitPoint (Double_t *point)

void InitDirection(Double_t dirx, Double_t diry, Double_t dirz, Bool_t is_normalized)

     Initialize particle direction (tangent on the helix in initial point)

void InitDirection(Double_t *dir, Bool_t is_normalized)

Double_t GetTotalCurvature() const

     Compute helix total curvature

void SetXYcurvature(Double_t curvature)

     Set XY curvature: c = 1/Rxy

void SetCharge(Int_t charge)

     Positive charge means left-handed helix.

void SetField(Double_t bx, Double_t by, Double_t bz, Bool_t is_normalized)

     Initialize particle direction (tangent on the helix in initial point)

void SetHelixStep(Double_t step)

     Set Z step of the helix on a complete turn. Positive or null.

void ResetStep()

     Reset current point/direction to initial values

void Step(Double_t step)

     Make a step from current point along the helix and compute new point, direction and angle
     To reach a plane/ shape boundary, one has to:
      1. Compute the safety to the plane/boundary
      2. Define / update a helix according local field and particle state (position, direction, charge)
      3. Compute the magnetic safety (maximum distance for which the field can be considered constant)
      4. Call TGeoHelix::Step() having as argument the minimum between 1. and 3.
      5. Repeat from 1. until the step to be made is small enough.
      6. Add to the total step the distance along a straigth line from the last point
         to the plane/shape boundary

Double_t StepToPlane(Double_t *point, Double_t *norm)

     Propagate initial point up to a given Z position in MARS.

void UpdateHelix()

     Update the local helix matrix.

### Inline Functions

            const Double_t* GetCurrentPoint() const
            const Double_t* GetCurrentDirection() const
                   Double_t GetXYcurvature() const
                   Double_t GetStep() const
                     Bool_t IsRightHanded() const
                    TClass* Class()
                    TClass* IsA() const
                       void ShowMembers(TMemberInspector& insp, char* parent)
                       void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)
                  TGeoHelix TGeoHelix(const TGeoHelix&)
                 TGeoHelix& operator=(const TGeoHelix&)

Author: Andrei Gheata 28/04/04
Last update: root/geom:$Name: $:$Id: TGeoHelix.cxx,v 1.1 2004/05/26 15:11:13 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *