ROOT   Reference Guide
THelix.h
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Ping Yeh 19/12/97
3
4/*************************************************************************
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. * 9 * For the list of contributors see$ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_THelix
13#define ROOT_THelix
14
15#include "TPolyLine3D.h"
16#include "TRotMatrix.h"
17
20};
21
22
23class THelix : public TPolyLine3D {
24
25protected:
26 Double_t fX0; //Pivot's x position (see parametrization in class doc)
27 Double_t fY0; //Pivot's y position (see parametrization in class doc)
28 Double_t fZ0; //Pivot's z position (see parametrization in class doc)
29 Double_t fVt; //Transverse velocity (constant of motion)
30 Double_t fPhi0; //Initial phase, so vx0 = fVt*cos(fPhi0)
31 Double_t fVz; //Z velocity (constant of motion)
32 Double_t fW; //Angular frequency
33 Double_t fAxis[3]; //Direction unit vector of the helix axis
34 TRotMatrix *fRotMat; //Rotation matrix: axis // z --> axis // fAxis
35 Double_t fRange[2]; //Range of helix parameter t
36
37 THelix& operator=(const THelix&);
38
39 void SetRotMatrix(); //Set rotation matrix
41
42 static Int_t fgMinNSeg; //minimal number of segments in polyline
43
44public:
45 THelix();
47 Double_t vx, Double_t vy, Double_t vz,
48 Double_t w);
49 THelix(Double_t const* xyz, Double_t const* v, Double_t w,
50 Double_t const* range=0, EHelixRangeType rtype=kHelixZ,
51 Double_t const* axis=0);
52 THelix(const THelix &helix);
53 virtual ~THelix();
54
55 virtual void Copy(TObject &helix) const;
56 virtual void Draw(Option_t *option="");
57 Option_t *GetOption() const {return fOption.Data();}
58 virtual void Print(Option_t *option="") const;
59 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
60 virtual void SetOption(Option_t *option="") {fOption = option;}
61 virtual void SetAxis(Double_t const* axis); //Define new axis
62 virtual void SetAxis(Double_t x, Double_t y, Double_t z);
63 virtual void SetRange(Double_t * range, EHelixRangeType rtype=kHelixZ);
64 virtual void SetRange(Double_t r1, Double_t r2, EHelixRangeType rtype=kHelixZ);
65 void SetHelix(Double_t const* xyz, Double_t const* v, Double_t w,
67 Double_t const* axis=0);
68
69 ClassDef(THelix,2) //A Helix drawn as a PolyLine3D
70};
71
72#endif
double Double_t
Definition: RtypesCore.h:57
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
int type
Definition: TGX11.cxx:120
EHelixRangeType
Definition: THelix.h:18
@ kHelixY
Definition: THelix.h:19
@ kHelixX
Definition: THelix.h:19
@ kLabZ
Definition: THelix.h:19
@ kHelixT
Definition: THelix.h:19
@ kLabX
Definition: THelix.h:19
@ kHelixZ
Definition: THelix.h:19
@ kLabY
Definition: THelix.h:19
@ kUnchanged
Definition: THelix.h:19
THelix has two different constructors.
Definition: THelix.h:23
Double_t fRange[2]
Definition: THelix.h:35
Double_t fZ0
Definition: THelix.h:28
virtual void Draw(Option_t *option="")
Draw this helix with its current attributes.
Definition: THelix.cxx:281
THelix & operator=(const THelix &)
assignment operator
Definition: THelix.cxx:205
virtual void SetAxis(Double_t const *axis)
Set a new axis for the helix. This will make a new rotation matrix.
Definition: THelix.cxx:323
virtual void Copy(TObject &helix) const
Copy this helix to obj.
Definition: THelix.cxx:247
Double_t fPhi0
Definition: THelix.h:30
virtual void SetOption(Option_t *option="")
Definition: THelix.h:60
void SetHelix(Double_t const *xyz, Double_t const *v, Double_t w, Double_t const *range=0, EHelixRangeType type=kUnchanged, Double_t const *axis=0)
Set all helix parameters.
Definition: THelix.cxx:85
virtual void SetRange(Double_t *range, EHelixRangeType rtype=kHelixZ)
Set a new range for the helix. This will remake the polyline.
Definition: THelix.cxx:358
THelix()
Helix default constructor.
Definition: THelix.cxx:123
Double_t fVz
Definition: THelix.h:31
Double_t fAxis[3]
Definition: THelix.h:33
Double_t fX0
Definition: THelix.h:26
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: THelix.cxx:299
virtual ~THelix()
Helix destructor.
Definition: THelix.cxx:228
Double_t FindClosestPhase(Double_t phi0, Double_t cosine)
Finds the closest phase to phi0 that gives cos(phase) = cosine.
Definition: THelix.cxx:598
void SetRotMatrix()
Set the rotational matrix according to the helix axis.
Definition: THelix.cxx:569
Double_t fY0
Definition: THelix.h:27
Double_t fVt
Definition: THelix.h:29
virtual void Print(Option_t *option="") const
Dump this helix with its attributes.
Definition: THelix.cxx:290
TRotMatrix * fRotMat
Definition: THelix.h:34
Double_t fW
Definition: THelix.h:32
static Int_t fgMinNSeg
Definition: THelix.h:42
Option_t * GetOption() const
Definition: THelix.h:57
Mother of all ROOT objects.
Definition: TObject.h:37
A 3-dimensional polyline.
Definition: TPolyLine3D.h:32
TString fOption
options
Definition: TPolyLine3D.h:36
Manages a detector rotation matrix.
Definition: TRotMatrix.h:28
const char * Data() const
Definition: TString.h:364
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17