Logo ROOT   6.08/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 #ifndef ROOT_TPolyLine3D
29 #include "TPolyLine3D.h"
30 #endif
31 #ifndef ROOT_TRotMatrix
32 #include "TRotMatrix.h"
33 #endif
34 
37 };
38 
39 
40 class THelix : public TPolyLine3D {
41 
42 protected:
43  Double_t fX0; //Pivot's x position (see parametrization in class doc)
44  Double_t fY0; //Pivot's y position (see parametrization in class doc)
45  Double_t fZ0; //Pivot's z position (see parametrization in class doc)
46  Double_t fVt; //Transverse velocity (constant of motion)
47  Double_t fPhi0; //Initial phase, so vx0 = fVt*cos(fPhi0)
48  Double_t fVz; //Z velocity (constant of motion)
49  Double_t fW; //Angular frequency
50  Double_t fAxis[3]; //Direction unit vector of the helix axis
51  TRotMatrix *fRotMat; //Rotation matrix: axis // z --> axis // fAxis
52  Double_t fRange[2]; //Range of helix parameter t
53 
54  THelix& operator=(const THelix&);
55 
56  void SetRotMatrix(); //Set rotation matrix
58 
59  static Int_t fgMinNSeg; //minimal number of segments in polyline
60 
61 public:
62  THelix();
64  Double_t vx, Double_t vy, Double_t vz,
65  Double_t w);
66  THelix(Double_t * xyz, Double_t * v, Double_t w,
67  Double_t * range=0, EHelixRangeType rtype=kHelixZ,
68  Double_t * axis=0);
69  THelix(const THelix &helix);
70  virtual ~THelix();
71 
72  virtual void Copy(TObject &helix) const;
73  virtual void Draw(Option_t *option="");
74  Option_t *GetOption() const {return fOption.Data();}
75  virtual void Print(Option_t *option="") const;
76  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
77  virtual void SetOption(Option_t *option="") {fOption = option;}
78  virtual void SetAxis(Double_t * axis); //Define new axis
79  virtual void SetAxis(Double_t x, Double_t y, Double_t z);
80  virtual void SetRange(Double_t * range, EHelixRangeType rtype=kHelixZ);
81  virtual void SetRange(Double_t r1, Double_t r2, EHelixRangeType rtype=kHelixZ);
82  void SetHelix(Double_t *xyz, Double_t *v, Double_t w,
84  Double_t *axis=0);
85 
86  ClassDef(THelix,2) //A Helix drawn as a PolyLine3D
87 };
88 
89 #endif
Definition: THelix.h:36
virtual void SetOption(Option_t *option="")
Definition: THelix.h:77
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:36
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:41
TRotMatrix * fRotMat
Definition: THelix.h:51
Definition: THelix.h:36
Double_t fW
Definition: THelix.h:49
EHelixRangeType
Definition: THelix.h:35
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t fVt
Definition: THelix.h:46
virtual ~THelix()
Helix destructor.
Definition: THelix.cxx:227
Definition: THelix.h:36
THelix & operator=(const THelix &)
assignment operator
Definition: THelix.cxx:204
THelix()
Helix default constructor.
Definition: THelix.cxx:122
TString fOption
options
Definition: TPolyLine3D.h:46
Double_t fPhi0
Definition: THelix.h:47
Manages a detector rotation matrix.
Definition: TRotMatrix.h:30
SVector< double, 2 > v
Definition: Dict.h:5
unsigned int r1[N_CITIES]
Definition: simanTSP.cxx:321
Definition: THelix.h:36
Double_t fVz
Definition: THelix.h:48
static Int_t fgMinNSeg
Definition: THelix.h:59
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:44
int type
Definition: TGX11.cxx:120
Option_t * GetOption() const
Definition: THelix.h:74
Double_t y[n]
Definition: legend1.C:17
THelix has two different constructors.
Definition: THelix.h:40
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:52
virtual void Draw(Option_t *option="")
Draw this helix with its current attributes.
Definition: THelix.cxx:280
Double_t fZ0
Definition: THelix.h:45
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:36
Double_t fAxis[3]
Definition: THelix.h:50
Double_t fX0
Definition: THelix.h:43
unsigned int r2[N_CITIES]
Definition: simanTSP.cxx:322
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:36
const char * Data() const
Definition: TString.h:349