# class TGeoHelix: public TObject

```   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
```

## Function Members (Methods)

public:
 virtual ~TGeoHelix() void TObject::AbstractMethod(const char* method) const virtual void TObject::AppendPad(Option_t* option = "") virtual void TObject::Browse(TBrowser* b) static TClass* Class() virtual const char* TObject::ClassName() const virtual void TObject::Clear(Option_t* = "") virtual TObject* TObject::Clone(const char* newname = "") const virtual Int_t TObject::Compare(const TObject* obj) const Double_t ComputeSafeStep(Double_t epsil = 9.9999999999999995E-7) const virtual void TObject::Copy(TObject& object) const virtual void TObject::Delete(Option_t* option = "")MENU virtual Int_t TObject::DistancetoPrimitive(Int_t px, Int_t py) virtual void TObject::Draw(Option_t* option = "") virtual void TObject::DrawClass() constMENU virtual TObject* TObject::DrawClone(Option_t* option = "") constMENU virtual void TObject::Dump() constMENU virtual void TObject::Error(const char* method, const char* msgfmt) const virtual void TObject::Execute(const char* method, const char* params, Int_t* error = 0) virtual void TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) virtual void TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) virtual void TObject::Fatal(const char* method, const char* msgfmt) const virtual TObject* TObject::FindObject(const char* name) const virtual TObject* TObject::FindObject(const TObject* obj) const const Double_t* GetCurrentDirection() const const Double_t* GetCurrentPoint() const virtual Option_t* TObject::GetDrawOption() const static Long_t TObject::GetDtorOnly() virtual const char* TObject::GetIconName() const virtual const char* TObject::GetName() const virtual char* TObject::GetObjectInfo(Int_t px, Int_t py) const static Bool_t TObject::GetObjectStat() virtual Option_t* TObject::GetOption() const Double_t GetStep() const virtual const char* TObject::GetTitle() const Double_t GetTotalCurvature() const virtual UInt_t TObject::GetUniqueID() const Double_t GetXYcurvature() const virtual Bool_t TObject::HandleTimer(TTimer* timer) virtual ULong_t TObject::Hash() const virtual void TObject::Info(const char* method, const char* msgfmt) const virtual Bool_t TObject::InheritsFrom(const char* classname) const virtual Bool_t TObject::InheritsFrom(const TClass* cl) const void InitDirection(Double_t* dir, Bool_t is_normalized = kTRUE) void InitDirection(Double_t dirx, Double_t diry, Double_t dirz, Bool_t is_normalized = kTRUE) void InitPoint(Double_t* point) void InitPoint(Double_t x0, Double_t y0, Double_t z0) virtual void TObject::Inspect() constMENU void TObject::InvertBit(UInt_t f) virtual TClass* IsA() const virtual Bool_t TObject::IsEqual(const TObject* obj) const virtual Bool_t TObject::IsFolder() const Bool_t TObject::IsOnHeap() const Bool_t IsRightHanded() const virtual Bool_t TObject::IsSortable() const Bool_t TObject::IsZombie() const virtual void TObject::ls(Option_t* option = "") const void TObject::MayNotUse(const char* method) const virtual Bool_t TObject::Notify() void TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const void TObject::operator delete(void* ptr) void TObject::operator delete(void* ptr, void* vp) void TObject::operator delete[](void* ptr) void TObject::operator delete[](void* ptr, void* vp) void* TObject::operator new(size_t sz) void* TObject::operator new(size_t sz, void* vp) void* TObject::operator new[](size_t sz) void* TObject::operator new[](size_t sz, void* vp) virtual void TObject::Paint(Option_t* option = "") virtual void TObject::Pop() virtual void TObject::Print(Option_t* option = "") const virtual Int_t TObject::Read(const char* name) virtual void TObject::RecursiveRemove(TObject* obj) void TObject::ResetBit(UInt_t f) void ResetStep() virtual void TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU virtual void TObject::SavePrimitive(ostream& out, Option_t* option = "") void TObject::SetBit(UInt_t f) void TObject::SetBit(UInt_t f, Bool_t set) void SetCharge(Int_t charge) virtual void TObject::SetDrawOption(Option_t* option = "")MENU static void TObject::SetDtorOnly(void* obj) void SetField(Double_t bx, Double_t by, Double_t bz, Bool_t is_normalized = kTRUE) void SetHelixStep(Double_t hstep) static void TObject::SetObjectStat(Bool_t stat) virtual void TObject::SetUniqueID(UInt_t uid) void SetXYcurvature(Double_t curvature) virtual void ShowMembers(TMemberInspector& insp) const void Step(Double_t step) Double_t StepToPlane(Double_t* point, Double_t* norm) virtual void Streamer(TBuffer&) void StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) virtual void TObject::SysError(const char* method, const char* msgfmt) const Bool_t TObject::TestBit(UInt_t f) const Int_t TObject::TestBits(UInt_t f) const TGeoHelix() TGeoHelix(Double_t curvature, Double_t step, Int_t charge = 1) void UpdateHelix() virtual void TObject::UseCurrentStyle() virtual void TObject::Warning(const char* method, const char* msgfmt) const virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
 virtual void TObject::DoError(int level, const char* location, const char* fmt, va_list va) const void TObject::MakeZombie()
private:
 TGeoHelix& operator=(const TGeoHelix&) TGeoHelix(const TGeoHelix&)

## Data Members

public:
 static TObject::(anonymous) TObject::kBitMask static TObject::EStatusBits TObject::kCanDelete static TObject::EStatusBits TObject::kCannotPick static TObject::EStatusBits TObject::kHasUUID static TGeoHelix::EGeoHelixTypes kHelixCircle static TGeoHelix::EGeoHelixTypes kHelixNeedUpdate static TGeoHelix::EGeoHelixTypes kHelixStraigth static TObject::EStatusBits TObject::kInvalidObject static TObject::(anonymous) TObject::kIsOnHeap static TObject::EStatusBits TObject::kIsReferenced static TObject::EStatusBits TObject::kMustCleanup static TObject::EStatusBits TObject::kNoContextMenu static TObject::(anonymous) TObject::kNotDeleted static TObject::EStatusBits TObject::kObjInCanvas static TObject::(anonymous) TObject::kOverwrite static TObject::(anonymous) TObject::kSingleKey static TObject::(anonymous) TObject::kWriteDelete static TObject::(anonymous) TObject::kZombie
private:
 Double_t fB[3] normalized direction for magnetic field Double_t fC curvature in XY plane Double_t fDir[3] direction after a step Double_t fDirInit[3] normalized initial direction TGeoHMatrix* fMatrix transformation of local helix frame to MARS Double_t fPhi phi angle Double_t fPoint[3] point after a step Double_t fPointInit[3] initial point Int_t fQ right/left-handed (+/- 1) - "charge" Double_t fS Z step of the helix / 2*PI Double_t fStep current step

## Function documentation

``` Dummy constructor
```
TGeoHelix(Double_t curvature, Double_t step, Int_t charge = 1)
``` Normal constructor
```

``` Destructor
```
Double_t ComputeSafeStep(Double_t epsil = 9.9999999999999995E-7) 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)
``` Set initial point on the helix.
```
void InitDirection(Double_t dirx, Double_t diry, Double_t dirz, Bool_t is_normalized = kTRUE)
``` Initialize particle direction (tangent on the helix in initial point)
```
void InitDirection(Double_t* dir, Bool_t is_normalized = kTRUE)
``` Initialize particle direction (tangent on the helix in initial point)
```
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 = kTRUE)
``` Initialize particle direction (tangent on the helix in initial point)
```
void SetHelixStep(Double_t hstep)
``` 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.
```
TGeoHelix(const TGeoHelix& )
TGeoHelix & operator=(const TGeoHelix& )
const Double_t * GetCurrentPoint() const
`{return fPoint;}`
const Double_t * GetCurrentDirection() const
`{return fDir;}`
Double_t GetXYcurvature() const
`{return fC;}`
Double_t GetStep() const
`{return fStep;}`
Bool_t IsRightHanded() const
`{return (fQ>0)?kFALSE:kTRUE;}`