Logo ROOT   6.12/07
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 
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
54 
55  static Int_t fgMinNSeg; //minimal number of segments in polyline
56 
57 public:
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
Definition: THelix.h:32
virtual void SetOption(Option_t *option="")
Definition: THelix.h:73
virtual void Copy(TObject &helix) const
Copy this helix to obj.
Definition: THelix.cxx:246
void SetRotMatrix()
Set the rotational matrix according to the helix axis.
Definition: THelix.cxx:568
const char Option_t
Definition: RtypesCore.h:62
Definition: THelix.h:32
virtual void SetAxis(Double_t *axis)
Set a new axis for the helix. This will make a new rotation matrix.
Definition: THelix.cxx:322
int Int_t
Definition: RtypesCore.h:41
A 3-dimensional polyline.
Definition: TPolyLine3D.h:31
TRotMatrix * fRotMat
Definition: THelix.h:47
Definition: THelix.h:32
Double_t fW
Definition: THelix.h:45
EHelixRangeType
Definition: THelix.h:31
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
Double_t fVt
Definition: THelix.h:42
virtual ~THelix()
Helix destructor.
Definition: THelix.cxx:227
Definition: THelix.h:32
THelix & operator=(const THelix &)
assignment operator
Definition: THelix.cxx:204
THelix()
Helix default constructor.
Definition: THelix.cxx:122
TString fOption
options
Definition: TPolyLine3D.h:36
Double_t fPhi0
Definition: THelix.h:43
Manages a detector rotation matrix.
Definition: TRotMatrix.h:28
SVector< double, 2 > v
Definition: Dict.h:5
Definition: THelix.h:32
Double_t fVz
Definition: THelix.h:44
static Int_t fgMinNSeg
Definition: THelix.h:55
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
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
virtual void Print(Option_t *option="") const
Dump this helix with its attributes.
Definition: THelix.cxx:289
double Double_t
Definition: RtypesCore.h:55
Double_t fY0
Definition: THelix.h:40
int type
Definition: TGX11.cxx:120
Option_t * GetOption() const
Definition: THelix.h:70
Double_t y[n]
Definition: legend1.C:17
THelix has two different constructors.
Definition: THelix.h:36
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
Double_t fRange[2]
Definition: THelix.h:48
virtual void Draw(Option_t *option="")
Draw this helix with its current attributes.
Definition: THelix.cxx:280
Double_t fZ0
Definition: THelix.h:41
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: THelix.cxx:298
Definition: THelix.h:32
Double_t fAxis[3]
Definition: THelix.h:46
Double_t fX0
Definition: THelix.h:39
Double_t FindClosestPhase(Double_t phi0, Double_t cosine)
Finds the closest phase to phi0 that gives cos(phase) = cosine.
Definition: THelix.cxx:597
Definition: THelix.h:32
const char * Data() const
Definition: TString.h:345