96 vx0 =
v[0] *
m[0] +
v[1] *
m[1] +
v[2] *
m[2];
97 vy0 =
v[0] *
m[3] +
v[1] *
m[4] +
v[2] *
m[5];
98 vz0 =
v[0] *
m[6] +
v[1] *
m[7] +
v[2] *
m[8];
102 fX0 = xyz[0] *
m[0] + xyz[1] *
m[1] + xyz[2] *
m[2];
103 fY0 = xyz[0] *
m[3] + xyz[1] *
m[4] + xyz[2] *
m[5];
104 fZ0 = xyz[0] *
m[6] + xyz[1] *
m[7] + xyz[2] *
m[8];
113 if (range) {r1 = range[0]; r2 = range[1];}
164 r[0] = range[0];
r[1] = range[1];
166 r[0] = 0.0;
r[1] = 1.0;
216 for(
Int_t i=0; i<3; i++)
219 for(
Int_t i=0; i<2; i++)
240 ((
THelix&)helix).THelix::Copy(*
this);
259 for (
Int_t i=0; i<3; i++)
263 delete ((
THelix&)obj).fRotMat;
292 std::cout <<
" THelix Printing N=" <<
fN<<
" Option="<<option<<std::endl;
308 out<<
"helix = new THelix("<<
fX0<<
","<<
fY0<<
","<<
fZ0<<
","
312 <<quote<<
fOption<<quote<<
");"<<std::endl;
316 out<<
" helix->Draw();"<<std::endl;
328 Error(
"SetAxis()",
"Impossible! axis length %lf <= 0!", len);
331 fAxis[0] = axis[0]/len;
332 fAxis[1] = axis[1]/len;
333 fAxis[2] = axis[2]/len;
350 Double_t axis[3]; axis[0] =
x; axis[1] =
y; axis[2] = z;
367 if (
fW != 0 &&
fVz != 0 ) {
373 for (i=0; i<2; i++ ) {
375 if (
a[i] < -1 ||
a[i] > 1 ) {
377 "range out of bound (%lf:%lf): %lf. Default used: %lf",
387 for (i=0; i<2; i++ ) {
389 if (
a[i] < -1 ||
a[i] > 1 ) {
391 "range out of bound (%lf:%lf): %lf. Default used: %lf",
402 for (i=0; i<2; i++ ) {
407 "Vz = 0 and attempts to set range along helix axis!");
415 printf(
"setting range in lab axes is not implemented yet\n");
418 Error(
"SetRange()",
"unknown range type %d", rType);
421 }
else if (
fW == 0 ) {
432 "Vx = 0 and attempts to set range on helix x axis!");
442 "Vy = 0 and attempts to set range on helix y axis!");
452 "Vz = 0 and attempts to set range on helix z axis!");
459 printf(
"setting range in lab axes is not implemented yet\n");
462 Error(
"SetRange()",
"unknown range type %d", rType);
465 }
else if (
fVz == 0 ) {
475 "Vx = 0 and attempts to set range on helix x axis!");
485 "Vy = 0 and attempts to set range on helix y axis!");
491 "Vz = 0 and attempts to set range on helix z axis!");
496 printf(
"setting range in lab axes is not implemented yet\n");
499 Error(
"SetRange()",
"unknown range type %d", rType);
523 for (i=0; i<=nSeg; i++) {
525 if (i==nSeg) t =
fRange[1];
526 else t =
fRange[0] + dt * i;
537 for (i=0; i<=nSeg; i++) {
538 xg = xl[i] *
m[0] + yl[i] *
m[3] + zl[i] *
m[6] ;
539 yg = xl[i] *
m[1] + yl[i] *
m[4] + zl[i] *
m[7] ;
540 zg = xl[i] *
m[2] + yl[i] *
m[5] + zl[i] *
m[8] ;
544 delete[] xl;
delete[] yl;
delete[] zl;
554 range[0] = r1; range[1] = r2;
590 theta1, phi1, theta2, phi2, theta3, phi3 );
605 while ( phi1 - phi0 >
pi ) phi1 -=
twopi;
606 while ( phi1 - phi0 < -
pi ) phi1 +=
twopi;
608 while ( phi2 - phi0 >
pi ) phi2 -=
twopi;
609 while ( phi2 - phi0 < -
pi ) phi2 +=
twopi;
621void THelix::Streamer(
TBuffer &R__b)
631 TPolyLine3D::Streamer(R__b);
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadStaticArray(Bool_t *b)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
THelix has two different constructors.
virtual void Draw(Option_t *option="")
Draw this helix with its current attributes.
THelix & operator=(const THelix &)
assignment operator
virtual void SetAxis(Double_t const *axis)
Set a new axis for the helix. This will make a new rotation matrix.
virtual void Copy(TObject &helix) const
Copy this helix to obj.
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.
virtual void SetRange(Double_t *range, EHelixRangeType rtype=kHelixZ)
Set a new range for the helix. This will remake the polyline.
THelix()
Helix default constructor.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual ~THelix()
Helix destructor.
Double_t FindClosestPhase(Double_t phi0, Double_t cosine)
Finds the closest phase to phi0 that gives cos(phase) = cosine.
void SetRotMatrix()
Set the rotational matrix according to the helix axis.
virtual void Print(Option_t *option="") const
Dump this helix with its attributes.
Mother of all ROOT objects.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual void Copy(TObject &object) const
Copy this to obj.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
A 3-dimensional polyline.
TPolyLine3D & operator=(const TPolyLine3D &polylin)
assignment operator
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Set point n to x, y, z.
Int_t fN
Number of points.
virtual void SetPolyLine(Int_t n, Option_t *option="")
Re-initialize polyline with n points (0,0,0).
Manages a detector rotation matrix.
virtual Double_t * GetMatrix()
static constexpr double halfpi
static constexpr double pi
static constexpr double twopi
Double_t ATan2(Double_t y, Double_t x)
Double_t Sqrt(Double_t x)