Logo ROOT  
Reference Guide
THelix.cxx
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/** \class THelix
13\ingroup g3d
14THelix has two different constructors.
15
16If a particle with charge q passes through a point (x,y,z)
17with momentum (px,py,pz) with magnetic field B along an axis (nx,ny,nz),
18this helix can be constructed like:
19
20~~~ {.cpp}
21 THelix p(x,y,z, px,py,pz, q*B, nx,ny,nz);
22 (nx,ny,nz) defaults to (0,0,1).
23~~~
24
25A helix in its own frame can be defined with a pivotal point
26(x0,y0,z0), the velocity at that point (vx0,vy0,vz0), and
27an angular frequency w. Combining vx0 and vy0 to a transverse
28velocity vt0 one can parametrize the helix as:
29
30~~~ {.cpp}
31 x(t) = x0 - vt0 / w * sin(-w * t + phi0)
32 y(t) = y0 + vt0 / w * cos(-w * t + phi0)
33 z(t) = z0 + vz0 * t
34~~~
35
36The second constructor has 6 parameters,
37
38Example:
39
40~~~ {.cpp}
41 THelix pl1(xyz, v, w, range, rtype, axis);
42~~~
43
44where:
45
46 - xyz : array of initial position
47 - v : array of initial velocity
48 - w : angular frequency
49 - range: helix range
50 - rtype: kHelixZ specifies allowed drawing range in helix Z direction, i.e., along B field.
51 kLabZ specifies drawing range in lab frame.
52 kHelixX, kHelixY, kLabX, kLabY, kUnchanged ... etc can also be specified
53 - axis : helix axis
54
55Example constructing a helix with several default values and drawing it:
56
57Begin_Macro(source)
58{
59 TCanvas* helix_example_c1 = new TCanvas("helix_example_c1");
60 TView *view = TView::CreateView(1);
61 view->SetRange(-1,-1,-1,1,1,1);
62 THelix *helix = new THelix(0., 0., 0., 1., 0., 0.3, 10.);
63 helix->Draw();
64}
65End_Macro
66
67This initializes a helix with its axis in Z direction (rtype=kHelixZ).
68*/
69
70#include <iostream>
71#include "TBuffer.h"
72#include "TROOT.h"
73#include "THelix.h"
74#include "TMath.h"
75
76Int_t THelix::fgMinNSeg=5; // at least 5 line segments in TPolyLine3D
77
79
80////////////////////////////////////////////////////////////////////////////////
81/// Set all helix parameters.
82
83void THelix::SetHelix(Double_t const* xyz, Double_t const* v, Double_t w,
84 Double_t const* range, EHelixRangeType rType,
85 Double_t const* axis )
86{
87 // Define the helix frame by setting the helix axis and rotation matrix
88 SetAxis(axis);
89
90 // Calculate initial position and velocity in helix frame
91 fW = w;
93 Double_t vx0, vy0, vz0;
94 vx0 = v[0] * m[0] + v[1] * m[1] + v[2] * m[2];
95 vy0 = v[0] * m[3] + v[1] * m[4] + v[2] * m[5];
96 vz0 = v[0] * m[6] + v[1] * m[7] + v[2] * m[8];
97 fVt = TMath::Sqrt(vx0*vx0 + vy0*vy0);
98 fPhi0 = TMath::ATan2(vy0,vx0);
99 fVz = vz0;
100 fX0 = xyz[0] * m[0] + xyz[1] * m[1] + xyz[2] * m[2];
101 fY0 = xyz[0] * m[3] + xyz[1] * m[4] + xyz[2] * m[5];
102 fZ0 = xyz[0] * m[6] + xyz[1] * m[7] + xyz[2] * m[8];
103 if (fW != 0) {
104 fX0 += fVt / fW * TMath::Sin(fPhi0);
105 fY0 -= fVt / fW * TMath::Cos(fPhi0);
106 }
107
108 // Then calculate the range in t and set the polyline representation
109 Double_t r1 = 0;
110 Double_t r2 = 1;
111 if (range) {r1 = range[0]; r2 = range[1];}
112 if (rType != kUnchanged) {
113 fRange[0] = 0.0; fRange[1] = TMath::Pi(); // initialize to half round
114 SetRange(r1,r2,rType);
115 }
116}
117
118////////////////////////////////////////////////////////////////////////////////
119/// Helix default constructor.
120
122{
123 fX0 = fY0 = fZ0 = fVt = fPhi0 = fVz = fAxis[0] = fAxis[1] = 0.0;
124 fAxis[2] = 1.0;
125 fW = 1.5E7; // roughly the cyclon frequency of proton in AMS
126 fRange[0] = 0.0;
127 fRange[1] = 1.0;
128 fRotMat = nullptr;
129}
130
131////////////////////////////////////////////////////////////////////////////////
132/// Helix normal constructor.
133
135 Double_t vx, Double_t vy, Double_t vz,
136 Double_t w)
137 : TPolyLine3D()
138{
139 Double_t p[3], v[3];
140 p[0] = x;
141 p[1] = y;
142 p[2] = z;
143 v[0] = vx;
144 v[1] = vy;
145 v[2] = vz;
146 Double_t *range = nullptr;
147 fRotMat = nullptr;
148
149 SetHelix(p, v, w, range, kHelixZ);
150 fOption = "";
151}
152
153////////////////////////////////////////////////////////////////////////////////
154/// Helix normal constructor.
155
157 Double_t const* range, EHelixRangeType rType, Double_t const* axis)
158 : TPolyLine3D()
159{
160 Double_t r[2];
161 if ( range ) {
162 r[0] = range[0]; r[1] = range[1];
163 } else {
164 r[0] = 0.0; r[1] = 1.0;
165 }
166
167 fRotMat = nullptr;
168 if ( axis ) { // specify axis
169 SetHelix(xyz, v, w, r, rType, axis);
170 } else { // default axis
171 SetHelix(xyz, v, w, r, rType);
172 }
173
174 fOption = "";
175}
176
177
178#if 0
179////////////////////////////////////////////////////////////////////////////////
180/// Helix copy constructor.
181
183{
184 fX0 = h.fX0;
185 fY0 = h.fY0;
186 fZ0 = h.fZ0;
187 fVt = h.fVt;
188 fPhi0 = h.fPhi0;
189 fVz = h.fVz;
190 fW = h.fW;
191 for (Int_t i=0; i<3; i++) fAxis[i] = h.fAxis[i];
192 fRotMat = new TRotMatrix(*(h.fRotMat));
193 fRange[0] = h.fRange[0];
194 fRange[1] = h.fRange[1];
195
196 fOption = h.fOption;
197}
198#endif
199
200////////////////////////////////////////////////////////////////////////////////
201/// assignment operator
202
204{
205 if(this!=&hx) {
207 fX0=hx.fX0;
208 fY0=hx.fY0;
209 fZ0=hx.fZ0;
210 fVt=hx.fVt;
211 fPhi0=hx.fPhi0;
212 fVz=hx.fVz;
213 fW=hx.fW;
214 for(Int_t i=0; i<3; i++)
215 fAxis[i]=hx.fAxis[i];
216 delete fRotMat;
217 fRotMat = hx.fRotMat ? new TRotMatrix(*hx.fRotMat) : nullptr;
218 for(Int_t i=0; i<2; i++)
219 fRange[i]=hx.fRange[i];
220 }
221 return *this;
222}
223
224////////////////////////////////////////////////////////////////////////////////
225/// Helix destructor.
226
228{
229 if (fRotMat) delete fRotMat;
230}
231
232
233////////////////////////////////////////////////////////////////////////////////
234/// Helix copy constructor.
235
236THelix::THelix(const THelix &helix) : TPolyLine3D(helix)
237{
238 fRotMat = nullptr;
239 ((THelix&)helix).THelix::Copy(*this);
240}
241
242
243////////////////////////////////////////////////////////////////////////////////
244/// Copy this helix to obj.
245
246void THelix::Copy(TObject &obj) const
247{
248 TObject::Copy(obj);
249 TAttLine::Copy(((THelix&)obj));
250
251 ((THelix&)obj).fX0 = fX0;
252 ((THelix&)obj).fY0 = fY0;
253 ((THelix&)obj).fZ0 = fZ0;
254 ((THelix&)obj).fVt = fVt;
255 ((THelix&)obj).fPhi0 = fPhi0;
256 ((THelix&)obj).fVz = fVz;
257 ((THelix&)obj).fW = fW;
258 for (Int_t i=0; i<3; i++)
259 ((THelix&)obj).fAxis[i] = fAxis[i];
260
261 if (((THelix&)obj).fRotMat)
262 delete ((THelix&)obj).fRotMat;
263
264 ((THelix&)obj).fRotMat = fRotMat ? new TRotMatrix(*fRotMat) : nullptr;
265
266 ((THelix&)obj).fRange[0] = fRange[0];
267 ((THelix&)obj).fRange[1] = fRange[1];
268
269 ((THelix&)obj).fOption = fOption;
270
271 //
272 // Set range and make the graphic representation
273 //
274 ((THelix&)obj).SetRange(fRange[0], fRange[1], kHelixT);
275}
276
277
278////////////////////////////////////////////////////////////////////////////////
279/// Draw this helix with its current attributes.
280
282{
284}
285
286
287////////////////////////////////////////////////////////////////////////////////
288/// Dump this helix with its attributes.
289
291{
292 std::cout <<" THelix Printing N=" <<fN<<" Option="<<option<<std::endl;
293}
294
295
296////////////////////////////////////////////////////////////////////////////////
297/// Save primitive as a C++ statement(s) on output stream out.
298
299void THelix::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
300{
301 char quote = '"';
302 out<<" "<<std::endl;
303 if (gROOT->ClassSaved(THelix::Class())) {
304 out<<" ";
305 } else {
306 out<<" THelix *";
307 }
308 out<<"helix = new THelix("<<fX0<<","<<fY0<<","<<fZ0<<","
309 <<fVt*TMath::Cos(fPhi0)<<","<<fVt*TMath::Sin(fPhi0)<<","<<fVz<<","
310 <<fW<<","<<fRange[0]<<","<<fRange[1]<<","<<(Int_t)kHelixT<<","
311 <<fAxis[0]<<","<<fAxis[1]<<","<<fAxis[2]<<","
312 <<quote<<fOption<<quote<<");"<<std::endl;
313
314 SaveLineAttributes(out,"helix",1,1,1);
315
316 out<<" helix->Draw();"<<std::endl;
317}
318
319
320////////////////////////////////////////////////////////////////////////////////
321/// Set a new axis for the helix. This will make a new rotation matrix.
322
323void THelix::SetAxis(Double_t const* axis)
324{
325 if (axis) {
326 Double_t len = TMath::Sqrt(axis[0]*axis[0] + axis[1]*axis[1] + axis[2]*axis[2]);
327 if (len <= 0) {
328 Error("SetAxis()", "Impossible! axis length %lf <= 0!", len);
329 return;
330 }
331 fAxis[0] = axis[0]/len;
332 fAxis[1] = axis[1]/len;
333 fAxis[2] = axis[2]/len;
334 } else {
335 fAxis[0] = 0;
336 fAxis[1] = 0;
337 fAxis[2] = 1;
338 }
339
340 // Construct the rotational matrix from the axis
341 SetRotMatrix();
342}
343
344
345////////////////////////////////////////////////////////////////////////////////
346/// Set axis.
347
349{
350 Double_t axis[3]; axis[0] = x; axis[1] = y; axis[2] = z;
351 SetAxis(axis);
352}
353
354
355////////////////////////////////////////////////////////////////////////////////
356/// Set a new range for the helix. This will remake the polyline.
357
359{
360 Double_t a[2];
361 Double_t halfpi = TMath::Pi()/2.0;
362 Int_t i;
365 Double_t phase;
366
367 if ( fW != 0 && fVz != 0 ) { // general case
368 switch ( rType ) {
369 case kHelixT :
370 fRange[0] = range[0]; fRange[1] = range[1]; break;
371
372 case kHelixX :
373 for (i=0; i<2; i++ ) {
374 a[i] = fW / fVt * (range[i] - fX0);
375 if ( a[i] < -1 || a[i] > 1 ) {
376 Error("SetRange()",
377 "range out of bound (%lf:%lf): %lf. Default used: %lf",
378 fX0-fVt/fW, fX0+fVt/fW, range[i], fRange[i]);
379 return;
380 }
381 phase = FindClosestPhase(fPhi0+halfpi, a[i]);
382 fRange[i] = ( fPhi0 + halfpi - phase ) / fW;
383 }
384 break;
385
386 case kHelixY :
387 for (i=0; i<2; i++ ) {
388 a[i] = fW / fVt * (range[i] - fY0);
389 if ( a[i] < -1 || a[i] > 1 ) {
390 Error("SetRange()",
391 "range out of bound (%lf:%lf): %lf. Default used: %lf",
392 fY0-fVt/fW, fY0+fVt/fW, range[i], fRange[i]);
393 return;
394 }
395 phase = FindClosestPhase(fPhi0, a[i]);
396 fRange[i] = ( fPhi0 - phase ) / fW;
397 }
398 break;
399
400 case kHelixZ :
401 if ( fVz != 0 ) {
402 for (i=0; i<2; i++ ) {
403 fRange[i] = (range[i] - fZ0) / fVz;
404 }
405 } else { // fVz = 0, z = constant = fZ0
406 Error("SetRange()",
407 "Vz = 0 and attempts to set range along helix axis!");
408 return;
409 }
410 break;
411
412 case kLabX :
413 case kLabY :
414 case kLabZ :
415 printf("setting range in lab axes is not implemented yet\n");
416 break;
417 default:
418 Error("SetRange()","unknown range type %d", rType);
419 break;
420 }
421 } else if ( fW == 0 ) { // straight line: x = x0 + vx * t
422 switch ( rType ) {
423 case kHelixT :
424 fRange[0] = range[0]; fRange[1] = range[1];
425 break;
426 case kHelixX :
427 if ( vx != 0 ) {
428 fRange[0] = (range[0] - fX0) / vx;
429 fRange[1] = (range[1] - fX0) / vx;
430 } else {
431 Error("SetRange()",
432 "Vx = 0 and attempts to set range on helix x axis!");
433 return;
434 }
435 break;
436 case kHelixY :
437 if ( vy != 0 ) {
438 fRange[0] = (range[0] - fY0) / vy;
439 fRange[1] = (range[1] - fY0) / vy;
440 } else {
441 Error("SetRange()",
442 "Vy = 0 and attempts to set range on helix y axis!");
443 return;
444 }
445 break;
446 case kHelixZ :
447 if ( fVz != 0 ) {
448 fRange[0] = (range[0] - fZ0) / fVz;
449 fRange[1] = (range[1] - fZ0) / fVz;
450 } else {
451 Error("SetRange()",
452 "Vz = 0 and attempts to set range on helix z axis!");
453 return;
454 }
455 break;
456 case kLabX :
457 case kLabY :
458 case kLabZ :
459 printf("setting range in lab axes is not implemented yet\n");
460 break;
461 default :
462 Error("SetRange()","unknown range type %d", rType);
463 break;
464 }
465 } else if ( fVz == 0 ) { // a circle, not fully implemented yet
466 switch ( rType ) {
467 case kHelixT :
468 fRange[0] = range[0]; fRange[1] = range[1]; break;
469 case kHelixX :
470 if ( vx != 0 ) {
471 fRange[0] = (range[0] - fX0) / vx;
472 fRange[1] = (range[1] - fX0) / vx;
473 } else {
474 Error("SetRange()",
475 "Vx = 0 and attempts to set range on helix x axis!");
476 return;
477 }
478 break;
479 case kHelixY :
480 if ( vy != 0 ) {
481 fRange[0] = (range[0] - fY0) / vy;
482 fRange[1] = (range[1] - fY0) / vy;
483 } else {
484 Error("SetRange()",
485 "Vy = 0 and attempts to set range on helix y axis!");
486 return;
487 }
488 break;
489 case kHelixZ :
490 Error("SetRange()",
491 "Vz = 0 and attempts to set range on helix z axis!");
492 return;
493 case kLabX :
494 case kLabY :
495 case kLabZ :
496 printf("setting range in lab axes is not implemented yet\n");
497 break;
498 default :
499 Error("SetRange()","unknown range type %d", rType);
500 break;
501 }
502 }
503
504 if ( fRange[0] > fRange[1] ) {
505 Double_t temp = fRange[1]; fRange[1] = fRange[0]; fRange[0] = temp;
506 }
507
508 // Set the polylines in global coordinates
509 Double_t degrad = TMath::Pi() / 180.0;
510 Double_t segment = 5.0 * degrad; // 5 degree segments
511 Double_t dt = segment / TMath::Abs(fW); // parameter span on each segm.
512
513 Int_t nSeg = Int_t((fRange[1]-fRange[0]) / dt) + 1;
514 if (nSeg < THelix::fgMinNSeg) {
515 nSeg = THelix::fgMinNSeg;
516 dt = (fRange[1]-fRange[0])/nSeg;
517 }
518
519 Double_t * xl = new Double_t[nSeg+1]; // polyline in local coordinates
520 Double_t * yl = new Double_t[nSeg+1];
521 Double_t * zl = new Double_t[nSeg+1];
522
523 for (i=0; i<=nSeg; i++) { // calculate xl[], yl[], zl[];
524 Double_t t, phase2;
525 if (i==nSeg) t = fRange[1]; // the last point
526 else t = fRange[0] + dt * i;
527 phase2 = -fW * t + fPhi0;
528 xl[i] = fX0 - fVt/fW * TMath::Sin(phase2);
529 yl[i] = fY0 + fVt/fW * TMath::Cos(phase2);
530 zl[i] = fZ0 + fVz * t;
531 }
532
533 Float_t xg, yg,zg; // global coordinates
534 // must be Float_t to call TPolyLine3D::SetPoint()
537 for (i=0; i<=nSeg; i++) { // m^{-1} = transpose of m
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] ;
541 TPolyLine3D::SetPoint(i,xg,yg,zg);
542 }
543
544 delete[] xl; delete[] yl; delete[] zl;
545}
546
547
548////////////////////////////////////////////////////////////////////////////////
549/// Set range.
550
552{
553 Double_t range[2];
554 range[0] = r1; range[1] = r2;
555 SetRange(range, rType);
556}
557
558
559////////////////////////////////////////////////////////////////////////////////
560// //
561// Protected Member Functions //
562// //
563////////////////////////////////////////////////////////////////////////////////
564
565
566////////////////////////////////////////////////////////////////////////////////
567/// Set the rotational matrix according to the helix axis.
568
570{
571 // Calculate all 6 angles.
572 // Note that TRotMatrix::TRotMatrix() expects angles in degrees.
573 Double_t raddeg = 180.0 / TMath::Pi();
574 Double_t halfpi = TMath::Pi()/2.0 * raddeg;
575 // (theta3,phi3) is the helix axis
576 Double_t theta3 = TMath::ACos(fAxis[2]) * raddeg;
577 Double_t phi3 = TMath::ATan2(fAxis[1], fAxis[0]) * raddeg;
578 // (theta1,phi1) is the x-axis in helix frame
579 Double_t theta1 = theta3 + halfpi;
580 Double_t phi1 = phi3;
581 // (theta2,phi2) is the y-axis in helix frame
582 Double_t theta2 = halfpi;
583 Double_t phi2 = phi1 + halfpi;
584
585 // Delete the old rotation matrix
586 if (fRotMat) delete fRotMat;
587
588 // Make a new rotation matrix
589 fRotMat = new TRotMatrix("HelixRotMat", "Master frame -> Helix frame",
590 theta1, phi1, theta2, phi2, theta3, phi3 );
591 return;
592}
593
594
595////////////////////////////////////////////////////////////////////////////////
596/// Finds the closest phase to phi0 that gives cos(phase) = cosine
597
599{
600 const Double_t pi = TMath::Pi();
601 const Double_t twopi = TMath::Pi() * 2.0;
602 Double_t phi1 = TMath::ACos(cosine);
603 Double_t phi2 = - phi1;
604
605 while ( phi1 - phi0 > pi ) phi1 -= twopi;
606 while ( phi1 - phi0 < -pi ) phi1 += twopi;
607
608 while ( phi2 - phi0 > pi ) phi2 -= twopi;
609 while ( phi2 - phi0 < -pi ) phi2 += twopi;
610
611 // Now phi1, phi2 and phi0 are within the same 2pi range
612 // and cos(phi1) = cos(phi2) = cosine
613 if ( TMath::Abs(phi1-phi0) < TMath::Abs(phi2-phi0) ) return phi1;
614 else return phi2;
615}
616
617
618////////////////////////////////////////////////////////////////////////////////
619/// Stream an object of class THelix.
620
622{
623 if (R__b.IsReading()) {
624 UInt_t R__s, R__c;
625 Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
626 if (R__v > 1) {
627 R__b.ReadClassBuffer(THelix::Class(), this, R__v, R__s, R__c);
628 return;
629 }
630 //====process old versions before automatic schema evolution
632 R__b >> fX0;
633 R__b >> fY0;
634 R__b >> fZ0;
635 R__b >> fVt;
636 R__b >> fPhi0;
637 R__b >> fVz;
638 R__b >> fW;
640 R__b >> fRotMat;
642 R__b.CheckByteCount(R__s, R__c, THelix::IsA());
643 //====end of old versions
644
645 } else {
646 R__b.WriteClassBuffer(THelix::Class(),this);
647 }
648}
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:45
short Version_t
Definition: RtypesCore.h:65
float Float_t
Definition: RtypesCore.h:57
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:375
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
EHelixRangeType
Definition: THelix.h:18
@ kHelixY
Definition: THelix.h:19
@ kHelixX
Definition: THelix.h:19
@ kLabZ
Definition: THelix.h:19
@ kHelixT
Definition: THelix.h:19
@ kLabX
Definition: THelix.h:19
@ kHelixZ
Definition: THelix.h:19
@ kLabY
Definition: THelix.h:19
@ kUnchanged
Definition: THelix.h:19
#define gROOT
Definition: TROOT.h:404
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition: TAttLine.cxx:175
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.
Definition: TAttLine.cxx:273
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
Bool_t IsReading() const
Definition: TBuffer.h:86
virtual Int_t ReadStaticArray(Bool_t *b)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
THelix has two different constructors.
Definition: THelix.h:23
Double_t fRange[2]
Definition: THelix.h:35
Double_t fZ0
Definition: THelix.h:28
virtual void Draw(Option_t *option="")
Draw this helix with its current attributes.
Definition: THelix.cxx:281
static TClass * Class()
void SetHelix(Double_t const *xyz, Double_t const *v, Double_t w, Double_t const *range=nullptr, EHelixRangeType type=kUnchanged, Double_t const *axis=nullptr)
Set all helix parameters.
Definition: THelix.cxx:83
THelix & operator=(const THelix &)
assignment operator
Definition: THelix.cxx:203
virtual void SetAxis(Double_t const *axis)
Set a new axis for the helix. This will make a new rotation matrix.
Definition: THelix.cxx:323
virtual void Copy(TObject &helix) const
Copy this helix to obj.
Definition: THelix.cxx:246
Double_t fPhi0
Definition: THelix.h:30
virtual void SetRange(Double_t *range, EHelixRangeType rtype=kHelixZ)
Set a new range for the helix. This will remake the polyline.
Definition: THelix.cxx:358
THelix()
Helix default constructor.
Definition: THelix.cxx:121
Double_t fVz
Definition: THelix.h:31
Double_t fAxis[3]
Definition: THelix.h:33
Double_t fX0
Definition: THelix.h:26
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: THelix.cxx:299
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:598
virtual void Streamer(TBuffer &)
Stream an object of class THelix.
Definition: THelix.cxx:621
void SetRotMatrix()
Set the rotational matrix according to the helix axis.
Definition: THelix.cxx:569
virtual TClass * IsA() const
Definition: THelix.h:69
Double_t fY0
Definition: THelix.h:27
Double_t fVt
Definition: THelix.h:29
virtual void Print(Option_t *option="") const
Dump this helix with its attributes.
Definition: THelix.cxx:290
TRotMatrix * fRotMat
Definition: THelix.h:34
Double_t fW
Definition: THelix.h:32
static Int_t fgMinNSeg
Definition: THelix.h:42
Mother of all ROOT objects.
Definition: TObject.h:41
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:177
virtual void Copy(TObject &object) const
Copy this to obj.
Definition: TObject.cxx:133
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:963
A 3-dimensional polyline.
Definition: TPolyLine3D.h:33
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.
Definition: TPolyLine3D.h:35
TString fOption
options
Definition: TPolyLine3D.h:37
virtual void SetPolyLine(Int_t n, Option_t *option="")
Re-initialize polyline with n points (0,0,0).
void Streamer(TBuffer &) override
Stream a 3-D polyline object.
Manages a detector rotation matrix.
Definition: TRotMatrix.h:28
virtual Double_t * GetMatrix()
Definition: TRotMatrix.h:54
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double halfpi
static constexpr double pi
static constexpr double twopi
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Definition: TMath.h:630
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Definition: TMath.h:644
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition: TMath.h:660
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition: TMath.h:592
constexpr Double_t Pi()
Definition: TMath.h:37
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition: TMath.h:586
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition: TMathBase.h:123
TMarker m
Definition: textangle.C:8
TArc a
Definition: textangle.C:12