Logo ROOT   6.18/05
Reference Guide
THelix.h
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Ping Yeh 19/12/97
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
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
16//////////////////////////////////////////////////////////////////////////
17// //
18// THelix //
19// //
20// A Helix with axis // z-axis: //
21// //
22// X(t) = X0 - vt / w sin(-wt+phi0) //
23// Y(t) = Y0 + vt / w cos(-wt+phi0) //
24// Z(t) = Z0 + vz t //
25// //
26//////////////////////////////////////////////////////////////////////////
27
28#include "TPolyLine3D.h"
29#include "TRotMatrix.h"
30
33};
34
35
36class THelix : public TPolyLine3D {
37
38protected:
39 Double_t fX0; //Pivot's x position (see parametrization in class doc)
40 Double_t fY0; //Pivot's y position (see parametrization in class doc)
41 Double_t fZ0; //Pivot's z position (see parametrization in class doc)
42 Double_t fVt; //Transverse velocity (constant of motion)
43 Double_t fPhi0; //Initial phase, so vx0 = fVt*cos(fPhi0)
44 Double_t fVz; //Z velocity (constant of motion)
45 Double_t fW; //Angular frequency
46 Double_t fAxis[3]; //Direction unit vector of the helix axis
47 TRotMatrix *fRotMat; //Rotation matrix: axis // z --> axis // fAxis
48 Double_t fRange[2]; //Range of helix parameter t
49
50 THelix& operator=(const THelix&);
51
52 void SetRotMatrix(); //Set rotation matrix
54
55 static Int_t fgMinNSeg; //minimal number of segments in polyline
56
57public:
58 THelix();
60 Double_t vx, Double_t vy, Double_t vz,
61 Double_t w);
62 THelix(Double_t * xyz, Double_t * v, Double_t w,
63 Double_t * range=0, EHelixRangeType rtype=kHelixZ,
64 Double_t * axis=0);
65 THelix(const THelix &helix);
66 virtual ~THelix();
67
68 virtual void Copy(TObject &helix) const;
69 virtual void Draw(Option_t *option="");
70 Option_t *GetOption() const {return fOption.Data();}
71 virtual void Print(Option_t *option="") const;
72 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
73 virtual void SetOption(Option_t *option="") {fOption = option;}
74 virtual void SetAxis(Double_t * axis); //Define new axis
75 virtual void SetAxis(Double_t x, Double_t y, Double_t z);
76 virtual void SetRange(Double_t * range, EHelixRangeType rtype=kHelixZ);
77 virtual void SetRange(Double_t r1, Double_t r2, EHelixRangeType rtype=kHelixZ);
78 void SetHelix(Double_t *xyz, Double_t *v, Double_t w,
80 Double_t *axis=0);
81
82 ClassDef(THelix,2) //A Helix drawn as a PolyLine3D
83};
84
85#endif
SVector< double, 2 > v
Definition: Dict.h:5
int Int_t
Definition: RtypesCore.h:41
double Double_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
int type
Definition: TGX11.cxx:120
EHelixRangeType
Definition: THelix.h:31
@ kHelixY
Definition: THelix.h:32
@ kHelixX
Definition: THelix.h:32
@ kLabZ
Definition: THelix.h:32
@ kHelixT
Definition: THelix.h:32
@ kLabX
Definition: THelix.h:32
@ kHelixZ
Definition: THelix.h:32
@ kLabY
Definition: THelix.h:32
@ kUnchanged
Definition: THelix.h:32
THelix has two different constructors.
Definition: THelix.h:36
Double_t fRange[2]
Definition: THelix.h:48
Double_t fZ0
Definition: THelix.h:41
virtual void Draw(Option_t *option="")
Draw this helix with its current attributes.
Definition: THelix.cxx:280
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.
Definition: THelix.cxx:84
THelix & operator=(const THelix &)
assignment operator
Definition: THelix.cxx:204
virtual void Copy(TObject &helix) const
Copy this helix to obj.
Definition: THelix.cxx:246
Double_t fPhi0
Definition: THelix.h:43
virtual void SetOption(Option_t *option="")
Definition: THelix.h:73
virtual void SetRange(Double_t *range, EHelixRangeType rtype=kHelixZ)
Set a new range for the helix. This will remake the polyline.
Definition: THelix.cxx:357
THelix()
Helix default constructor.
Definition: THelix.cxx:122
Double_t fVz
Definition: THelix.h:44
Double_t fAxis[3]
Definition: THelix.h:46
Double_t fX0
Definition: THelix.h:39
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: THelix.cxx:298
virtual ~THelix()
Helix destructor.
Definition: THelix.cxx:227
Double_t FindClosestPhase(Double_t phi0, Double_t cosine)
Finds the closest phase to phi0 that gives cos(phase) = cosine.
Definition: THelix.cxx:597
void SetRotMatrix()
Set the rotational matrix according to the helix axis.
Definition: THelix.cxx:568
Double_t fY0
Definition: THelix.h:40
Double_t fVt
Definition: THelix.h:42
virtual void Print(Option_t *option="") const
Dump this helix with its attributes.
Definition: THelix.cxx:289
TRotMatrix * fRotMat
Definition: THelix.h:47
Double_t fW
Definition: THelix.h:45
virtual void SetAxis(Double_t *axis)
Set a new axis for the helix. This will make a new rotation matrix.
Definition: THelix.cxx:322
static Int_t fgMinNSeg
Definition: THelix.h:55
Option_t * GetOption() const
Definition: THelix.h:70
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