Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
31 enum EHelixRangeType {
32  kHelixT, kHelixX, kHelixY, kHelixZ, kLabX, kLabY, kLabZ, kUnchanged
33 };
34 
35 
36 class THelix : public TPolyLine3D {
37 
38 protected:
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
53  Double_t FindClosestPhase(Double_t phi0, Double_t cosine);
54 
55  static Int_t fgMinNSeg; //minimal number of segments in polyline
56 
57 public:
58  THelix();
59  THelix(Double_t x, Double_t y, Double_t z,
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,
79  Double_t *range=0, EHelixRangeType type=kUnchanged,
80  Double_t *axis=0);
81 
82  ClassDef(THelix,2) //A Helix drawn as a PolyLine3D
83 };
84 
85 #endif