Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
DisplacementVector3D.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Authors: W. Brown, M. Fischler, L. Moneta 2005
3
4 /**********************************************************************
5 * *
6 * Copyright (c) 2005 , LCG ROOT MathLib Team and *
7 * FNAL LCG ROOT MathLib Team *
8 * *
9 * *
10 **********************************************************************/
11
12// Header source file for class DisplacementVector3D
13//
14// Created by: Lorenzo Moneta at Mon May 30 12:21:43 2005
15// Major rewrite: M. FIschler at Wed Jun 8 2005
16//
17// Last update: $Id$
18//
19
20#ifndef ROOT_Math_GenVector_DisplacementVector3D
21#define ROOT_Math_GenVector_DisplacementVector3D 1
22
24
26
28
30
32
33#include <cassert>
34
35
36namespace ROOT {
37
38 namespace Math {
39
40
41//__________________________________________________________________________________________
42 /**
43 Class describing a generic displacement vector in 3 dimensions.
44 This class is templated on the type of Coordinate system.
45 One example is the XYZVector which is a vector based on
46 double precision x,y,z data members by using the
47 ROOT::Math::Cartesian3D<double> Coordinate system.
48 The class is having also an extra template parameter, the coordinate system tag,
49 to be able to identify (tag) vector described in different reference coordinate system,
50 like global or local coordinate systems.
51
52 @ingroup GenVector
53
54 @sa Overview of the @ref GenVector "physics vector library"
55 */
56
57 template <class CoordSystem, class Tag = DefaultCoordinateSystemTag >
59
60 public:
61
62 typedef typename CoordSystem::Scalar Scalar;
63 typedef CoordSystem CoordinateType;
65
66 // ------ ctors ------
67
68 /**
69 Default constructor. Construct an empty object with zero values
70 */
71 constexpr DisplacementVector3D ( ) : fCoordinates() { }
72
73
74 /**
75 Construct from three values of type <em>Scalar</em>.
76 In the case of a XYZVector the values are x,y,z
77 In the case of a polar vector they are r,theta, phi
78 */
80 fCoordinates ( a , b, c ) { }
81
82 /**
83 Construct from a displacement vector expressed in different
84 coordinates, or using a different Scalar type, but with same coordinate system tag
85 */
86 template <class OtherCoords>
88 fCoordinates ( v.Coordinates() ) { }
89
90
91 /**
92 Construct from a position vector expressed in different coordinates
93 but with the same coordinate system tag
94 */
95 template <class OtherCoords>
97 fCoordinates ( p.Coordinates() ) { }
98
99
100 /**
101 Construct from a foreign 3D vector type, for example, Hep3Vector
102 Precondition: v must implement methods x(), y() and z()
103 */
104 template <class ForeignVector>
105 explicit constexpr DisplacementVector3D( const ForeignVector & v) :
106 fCoordinates ( Cartesian3D<Scalar>( v.x(), v.y(), v.z() ) ) { }
107
108
109#ifdef LATER
110 /**
111 construct from a generic linear algebra vector of at least size 3
112 implementing operator [].
113 \par v LAVector
114 \par index0 index where coordinates starts (typically zero)
115 It works for all Coordinates types,
116 ( x= v[index0] for Cartesian and r=v[index0] for Polar )
117 */
118 template <class LAVector>
119 constexpr DisplacementVector3D(const LAVector & v, size_t index0 ) {
120 fCoordinates = CoordSystem ( v[index0], v[index0+1], v[index0+2] );
121 }
122#endif
123
124 // compiler-generated copy ctor and dtor are fine.
125
126 // ------ assignment ------
127
128 /**
129 Assignment operator from a displacement vector of arbitrary type
130 */
131 template <class OtherCoords>
135 return *this;
136 }
137
138 /**
139 Assignment operator from a position vector
140 (not necessarily efficient unless one or the other is Cartesian)
141 */
142 template <class OtherCoords>
144 ( const PositionVector3D<OtherCoords,Tag> & rhs) {
145 SetXYZ(rhs.x(), rhs.y(), rhs.z());
146 return *this;
147 }
148
149
150 /**
151 Assignment from a foreign 3D vector type, for example, Hep3Vector
152 Precondition: v must implement methods x(), y() and z()
153 */
154 template <class ForeignVector>
155 DisplacementVector3D & operator= ( const ForeignVector & v) {
156 SetXYZ( v.x(), v.y(), v.z() );
157 return *this;
158 }
159
160
161#ifdef LATER
162 /**
163 assign from a generic linear algebra vector of at least size 3
164 implementing operator []. This could be also a C array
165 \par v LAVector
166 \par index0 index where coordinates starts (typically zero)
167 It works for all Coordinates types,
168 ( x= v[index0] for Cartesian and r=v[index0] for Polar )
169 */
170 template <class LAVector>
171 DisplacementVector3D & assignFrom(const LAVector & v, size_t index0 = 0) {
172 fCoordinates = CoordSystem ( v[index0], v[index0+1], v[index0+2] );
173 return *this;
174 }
175#endif
176
177 // ------ Set, Get, and access coordinate data ------
178
179 /**
180 Retrieve a copy of the coordinates object
181 */
182 CoordSystem Coordinates() const {
183 return fCoordinates;
184 }
185
186 /**
187 Set internal data based on a C-style array of 3 Scalar numbers
188 */
190 { fCoordinates.SetCoordinates(src); return *this; }
191
192 /**
193 Set internal data based on 3 Scalar numbers
194 */
196 { fCoordinates.SetCoordinates(a, b, c); return *this; }
197
198 /**
199 Set internal data based on 3 Scalars at *begin to *end
200 */
201 template <class IT>
203 { IT a = begin; IT b = ++begin; IT c = ++begin;
204 (void)end;
205 assert (++begin==end);
206 SetCoordinates (*a,*b,*c);
207 return *this;
208 }
209
210 /**
211 get internal data into 3 Scalar numbers
212 */
213 void GetCoordinates( Scalar& a, Scalar& b, Scalar& c ) const
214 { fCoordinates.GetCoordinates(a, b, c); }
215
216 /**
217 get internal data into a C-style array of 3 Scalar numbers
218 */
219 void GetCoordinates( Scalar dest[] ) const
220 { fCoordinates.GetCoordinates(dest); }
221
222 /**
223 get internal data into 3 Scalars at *begin to *end (3 past begin)
224 */
225 template <class IT>
226 void GetCoordinates( IT begin, IT end ) const
227 { IT a = begin; IT b = ++begin; IT c = ++begin;
228 (void)end;
229 assert (++begin==end);
230 GetCoordinates (*a,*b,*c);
231 }
232 /**
233 get internal data into 3 Scalars starting at *begin
234 */
235 template <class IT>
236 void GetCoordinates( IT begin) const {
237 Scalar a = Scalar(0);
238 Scalar b = Scalar(0);
239 Scalar c = Scalar(0);
240 GetCoordinates(a, b, c);
241 *begin++ = a;
242 *begin++ = b;
243 *begin = c;
244 }
245
246 /**
247 set the values of the vector from the cartesian components (x,y,z)
248 (if the vector is held in polar or cylindrical eta coordinates,
249 then (x, y, z) are converted to that form)
250 */
252 fCoordinates.SetXYZ(a, b, c);
253 return *this;
254 }
255
256 // ------------------- Equality -----------------
257
258 /**
259 Exact equality
260 */
261 bool operator==(const DisplacementVector3D & rhs) const {
262 return fCoordinates==rhs.fCoordinates;
263 }
264 bool operator!= (const DisplacementVector3D & rhs) const {
265 return !(operator==(rhs));
266 }
267
268 // ------ Individual element access, in various coordinate systems ------
269
270 /**
271 Dimension
272 */
273 unsigned int Dimension() const
274 {
275 return fDimension;
276 };
277
278 /**
279 Cartesian X, converting if necessary from internal coordinate system.
280 */
281 Scalar X() const { return fCoordinates.X(); }
282
283 /**
284 Cartesian Y, converting if necessary from internal coordinate system.
285 */
286 Scalar Y() const { return fCoordinates.Y(); }
287
288 /**
289 Cartesian Z, converting if necessary from internal coordinate system.
290 */
291 Scalar Z() const { return fCoordinates.Z(); }
292
293 /**
294 Polar R, converting if necessary from internal coordinate system.
295 */
296 Scalar R() const { return fCoordinates.R(); }
297
298 /**
299 Polar theta, converting if necessary from internal coordinate system.
300 */
301 Scalar Theta() const { return fCoordinates.Theta(); }
302
303 /**
304 Polar phi, converting if necessary from internal coordinate system.
305 */
306 Scalar Phi() const { return fCoordinates.Phi(); }
307
308 /**
309 Polar eta, converting if necessary from internal coordinate system.
310 */
311 Scalar Eta() const { return fCoordinates.Eta(); }
312
313 /**
314 Cylindrical transverse component rho
315 */
316 Scalar Rho() const { return fCoordinates.Rho(); }
317
318 // ----- Other fundamental properties -----
319
320 /**
321 Magnitute squared ( r^2 in spherical coordinate)
322 */
323 Scalar Mag2() const { return fCoordinates.Mag2();}
324
325 /**
326 Transverse component squared (rho^2 in cylindrical coordinates.
327 */
328 Scalar Perp2() const { return fCoordinates.Perp2();}
329
330 /**
331 return unit vector parallel to this (scalar)
332 */
333 template <typename SCALAR = Scalar, typename std::enable_if<std::is_arithmetic<SCALAR>::value>::type * = nullptr>
335 {
336 const auto tot = R();
337 return tot == 0 ? *this : DisplacementVector3D(*this) / tot;
338 }
339
340 /**
341 return unit vector parallel to this (vector)
342 */
343 template <typename SCALAR = Scalar, typename std::enable_if<!std::is_arithmetic<SCALAR>::value>::type * = nullptr>
345 {
346 SCALAR tot = R();
347 tot(tot == SCALAR(0)) = SCALAR(1);
348 return DisplacementVector3D(*this) / tot;
349 }
350
351 // ------ Setting of individual elements present in coordinate system ------
352
353 /**
354 Change X - Cartesian3D coordinates only
355 */
357
358 /**
359 Change Y - Cartesian3D coordinates only
360 */
362
363 /**
364 Change Z - Cartesian3D coordinates only
365 */
367
368 /**
369 Change R - Polar3D coordinates only
370 */
372
373 /**
374 Change Theta - Polar3D coordinates only
375 */
377
378 /**
379 Change Phi - Polar3D or CylindricalEta3D coordinates
380 */
382
383 /**
384 Change Rho - CylindricalEta3D coordinates only
385 */
387
388 /**
389 Change Eta - CylindricalEta3D coordinates only
390 */
391 DisplacementVector3D<CoordSystem, Tag>& SetEta (Scalar etaval) { fCoordinates.SetEta(etaval); return *this;}
392
393
394 // ------ Operations combining two vectors ------
395 // -- need to have the specialized version in order to avoid
396
397 /**
398 Return the scalar (dot) product of two displacement vectors.
399 It is possible to perform the product for any type of vector coordinates,
400 but they must have the same coordinate system tag
401 */
402 template< class OtherCoords >
404 return X()*v.X() + Y()*v.Y() + Z()*v.Z();
405 }
406 /**
407 Return the scalar (dot) product of two vectors.
408 It is possible to perform the product for any classes
409 implementing x(), y() and z() member functions
410 */
411 template< class OtherVector >
412 Scalar Dot( const OtherVector & v) const {
413 return X()*v.x() + Y()*v.y() + Z()*v.z();
414 }
415
416 /**
417 Return vector (cross) product of two displacement vectors,
418 as a vector in the coordinate system of this class.
419 It is possible to perform the product for any type of vector coordinates,
420 but they must have the same coordinate system tag
421 */
422 template <class OtherCoords>
425 result.SetXYZ ( Y()*v.Z() - v.Y()*Z(),
426 Z()*v.X() - v.Z()*X(),
427 X()*v.Y() - v.X()*Y() );
428 return result;
429 }
430 /**
431 Return vector (cross) product of two vectors,
432 as a vector in the coordinate system of this class.
433 It is possible to perform the product for any classes
434 implementing X(), Y() and Z() member functions
435 */
436 template <class OtherVector>
437 DisplacementVector3D Cross( const OtherVector & v) const {
439 result.SetXYZ ( Y()*v.z() - v.y()*Z(),
440 Z()*v.x() - v.z()*X(),
441 X()*v.y() - v.x()*Y() );
442 return result;
443 }
444
445
446
447 /**
448 Self Addition with a displacement vector.
449 */
450 template <class OtherCoords>
453 SetXYZ( X() + v.X(), Y() + v.Y(), Z() + v.Z() );
454 return *this;
455 }
456
457 /**
458 Self Difference with a displacement vector.
459 */
460 template <class OtherCoords>
463 SetXYZ( x() - v.x(), y() - v.y(), z() - v.z() );
464 return *this;
465 }
466
467
468 /**
469 multiply this vector by a scalar quantity
470 */
472 fCoordinates.Scale(a);
473 return *this;
474 }
475
476 /**
477 divide this vector by a scalar quantity
478 */
480 fCoordinates.Scale(1/a);
481 return *this;
482 }
483
484 // The following methods (v*a and v/a) could instead be free functions.
485 // They were moved into the class to solve a problem on AIX.
486
487 /**
488 Multiply a vector by a real number
489 */
491 DisplacementVector3D tmp(*this);
492 tmp *= a;
493 return tmp;
494 }
495
496 /**
497 Negative of the vector
498 */
500 return operator*( Scalar(-1) );
501 }
502
503 /**
504 Positive of the vector, return itself
505 */
506 DisplacementVector3D operator + ( ) const {return *this;}
507
508 /**
509 Division of a vector with a real number
510 */
512 DisplacementVector3D tmp(*this);
513 tmp /= a;
514 return tmp;
515 }
516
517
518 // Methods providing limited backward name compatibility with CLHEP
519
520 Scalar x() const { return fCoordinates.X(); }
521 Scalar y() const { return fCoordinates.Y(); }
522 Scalar z() const { return fCoordinates.Z(); }
523 Scalar r() const { return fCoordinates.R(); }
524 Scalar theta() const { return fCoordinates.Theta(); }
525 Scalar phi() const { return fCoordinates.Phi(); }
526 Scalar eta() const { return fCoordinates.Eta(); }
527 Scalar rho() const { return fCoordinates.Rho(); }
528 Scalar mag2() const { return fCoordinates.Mag2(); }
529 Scalar perp2() const { return fCoordinates.Perp2(); }
530 DisplacementVector3D unit() const {return Unit();}
531
532
533 private:
534
535 CoordSystem fCoordinates; // internal coordinate system
536 static constexpr unsigned int fDimension = CoordinateType::Dimension;
537
538#ifdef NOT_SURE_THIS_SHOULD_BE_FORBIDDEN
539 /**
540 Cross product involving a position vector is inappropriate
541 */
542 template <class T2>
544#endif
545
546 // the following methods should not compile
547
548 // this should not compile (if from a vector or points with different tag
549 template <class OtherCoords, class OtherTag>
551
552 template <class OtherCoords, class OtherTag>
554
555 template <class OtherCoords, class OtherTag>
557
558
559 template <class OtherCoords, class OtherTag>
561
562 template <class OtherCoords, class OtherTag>
564
565 template <class OtherCoords, class OtherTag>
567
568 template<class OtherCoords, class OtherTag >
570
571 template<class OtherCoords, class OtherTag >
573
574
575 };
576
577// ---------- DisplacementVector3D class template ends here ------------
578// ---------------------------------------------------------------------
579
580
581
582 /**
583 Addition of DisplacementVector3D vectors.
584 The (coordinate system) type of the returned vector is defined to
585 be identical to that of the first vector, which is passed by value
586 */
587 template <class CoordSystem1, class CoordSystem2, class U>
588 inline
592 return v1 += v2;
593 }
594
595 /**
596 Difference between two DisplacementVector3D vectors.
597 The (coordinate system) type of the returned vector is defined to
598 be identical to that of the first vector.
599 */
600 template <class CoordSystem1, class CoordSystem2, class U>
601 inline
602 DisplacementVector3D<CoordSystem1,U>
605 return v1 -= v2;
606 }
607
608 //#endif // not __CINT__
609
610 /**
611 Multiplication of a displacement vector by real number a*v
612 */
613 template <class CoordSystem, class U>
614 inline
615 DisplacementVector3D<CoordSystem,U>
618 return v *= a;
619 // Note - passing v by value and using operator *= may save one
620 // copy relative to passing v by const ref and creating a temporary.
621 }
622
623
624 // v1*v2 notation for Cross product of two vectors is omitted,
625 // since it is always confusing as to whether dot product is meant.
626
627
628
629 // ------------- I/O to/from streams -------------
630
631 template <class char_t, class traits_t, class T, class U,
632 typename std::enable_if<std::is_arithmetic<typename DisplacementVector3D<T, U>::Scalar>::value>::type * =
633 nullptr>
634 std::basic_ostream<char_t, traits_t> &operator<<(std::basic_ostream<char_t, traits_t> &os,
635 DisplacementVector3D<T, U> const &v)
636 {
637 if (os) {
638
639 typename T::Scalar a, b, c;
640 v.GetCoordinates(a, b, c);
641
644 typedef GenVector_detail::BitReproducible BR;
645 BR::Output(os, a);
646 BR::Output(os, b);
647 BR::Output(os, c);
648 } else {
651 }
652 }
653 return os;
654 } // op<< <>()
655
656 template <class char_t, class traits_t, class T, class U,
657 typename std::enable_if<!std::is_arithmetic<typename DisplacementVector3D<T, U>::Scalar>::value>::type * =
658 nullptr>
659 std::basic_ostream<char_t, traits_t> &operator<<(std::basic_ostream<char_t, traits_t> &os,
660 DisplacementVector3D<T, U> const &v)
661 {
662 if (os) {
663 os << "{ ";
664 for (std::size_t i = 0; i < PositionVector3D<T, U>::Scalar::Size; ++i) {
665 os << "(" << v.x()[i] << "," << v.y()[i] << "," << v.z()[i] << ") ";
666 }
667 os << "}";
668 }
669 return os;
670 } // op<< <>()
671
672 template< class char_t, class traits_t, class T, class U >
673 inline
674 std::basic_istream<char_t,traits_t> &
675 operator >> ( std::basic_istream<char_t,traits_t> & is
677 )
678 {
679 if( !is ) return is;
680
681 typename T::Scalar a, b, c;
682
686 BR::Input(is, a);
687 BR::Input(is, b);
688 BR::Input(is, c);
689 }
690 else {
692 detail::require_delim( is, detail::sep ); is >> b;
693 detail::require_delim( is, detail::sep ); is >> c;
695 }
696
697 if( is )
698 v.SetCoordinates(a, b, c);
699 return is;
700
701 } // op>> <>()
702
703
704
705 } // namespace Math
706
707} // namespace ROOT
708
709
710#endif /* ROOT_Math_GenVector_DisplacementVector3D */
711
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
Definition TBuffer.h:399
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
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 result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
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 type
Class describing a 3D cartesian coordinate system (x, y, z coordinates)
Definition Cartesian3D.h:46
Class describing a generic displacement vector in 3 dimensions.
constexpr DisplacementVector3D(const DisplacementVector3D< OtherCoords, OtherTag > &)
DisplacementVector3D< CoordSystem, Tag > & SetCoordinates(IT begin, IT end)
Set internal data based on 3 Scalars at *begin to *end.
Scalar Theta() const
Polar theta, converting if necessary from internal coordinate system.
constexpr DisplacementVector3D(Scalar a, Scalar b, Scalar c)
Construct from three values of type Scalar.
DisplacementVector3D & operator-=(const DisplacementVector3D< OtherCoords, OtherTag > &)
CoordSystem Coordinates() const
Retrieve a copy of the coordinates object.
DisplacementVector3D< CoordSystem, Tag > & SetRho(Scalar rr)
Change Rho - CylindricalEta3D coordinates only.
constexpr DisplacementVector3D(const PositionVector3D< OtherCoords, Tag > &p)
Construct from a position vector expressed in different coordinates but with the same coordinate syst...
DisplacementVector3D & operator=(const DisplacementVector3D< OtherCoords, Tag > &v)
Assignment operator from a displacement vector of arbitrary type.
DisplacementVector3D & operator+=(const DisplacementVector3D< OtherCoords, OtherTag > &)
DisplacementVector3D< CoordSystem, Tag > & SetEta(Scalar etaval)
Change Eta - CylindricalEta3D coordinates only.
Scalar R() const
Polar R, converting if necessary from internal coordinate system.
DisplacementVector3D & operator/=(Scalar a)
divide this vector by a scalar quantity
DisplacementVector3D< CoordSystem, Tag > & SetPhi(Scalar ang)
Change Phi - Polar3D or CylindricalEta3D coordinates.
DisplacementVector3D< CoordSystem, Tag > & SetR(Scalar rr)
Change R - Polar3D coordinates only.
constexpr DisplacementVector3D(const PositionVector3D< OtherCoords, OtherTag > &)
DisplacementVector3D Cross(const OtherVector &v) const
Return vector (cross) product of two vectors, as a vector in the coordinate system of this class.
DisplacementVector3D Unit() const
return unit vector parallel to this (scalar)
DisplacementVector3D operator+() const
Positive of the vector, return itself.
DisplacementVector3D operator-() const
Negative of the vector.
DisplacementVector3D< CoordSystem, Tag > & SetCoordinates(Scalar a, Scalar b, Scalar c)
Set internal data based on 3 Scalar numbers.
DisplacementVector3D< CoordSystem, Tag > & SetY(Scalar yy)
Change Y - Cartesian3D coordinates only.
constexpr DisplacementVector3D(const ForeignVector &v)
Construct from a foreign 3D vector type, for example, Hep3Vector Precondition: v must implement metho...
Scalar X() const
Cartesian X, converting if necessary from internal coordinate system.
DisplacementVector3D< CoordSystem, Tag > & SetZ(Scalar zz)
Change Z - Cartesian3D coordinates only.
void GetCoordinates(Scalar dest[]) const
get internal data into a C-style array of 3 Scalar numbers
static constexpr unsigned int fDimension
void GetCoordinates(Scalar &a, Scalar &b, Scalar &c) const
get internal data into 3 Scalar numbers
void GetCoordinates(IT begin) const
get internal data into 3 Scalars starting at *begin
Scalar Y() const
Cartesian Y, converting if necessary from internal coordinate system.
Scalar Dot(const OtherVector &v) const
Return the scalar (dot) product of two vectors.
DisplacementVector3D Cross(const DisplacementVector3D< OtherCoords, Tag > &v) const
Return vector (cross) product of two displacement vectors, as a vector in the coordinate system of th...
DisplacementVector3D< CoordSystem, Tag > & SetTheta(Scalar ang)
Change Theta - Polar3D coordinates only.
DisplacementVector3D operator*(Scalar a) const
Multiply a vector by a real number.
constexpr DisplacementVector3D(const DisplacementVector3D< OtherCoords, Tag > &v)
Construct from a displacement vector expressed in different coordinates, or using a different Scalar ...
bool operator==(const DisplacementVector3D &rhs) const
Exact equality.
Scalar Rho() const
Cylindrical transverse component rho.
DisplacementVector3D Cross(const DisplacementVector3D< OtherCoords, OtherTag > &) const
bool operator!=(const DisplacementVector3D &rhs) const
DisplacementVector3D unit() const
DisplacementVector3D< CoordSystem, Tag > & SetCoordinates(const Scalar src[])
Set internal data based on a C-style array of 3 Scalar numbers.
DisplacementVector3D & operator=(const PositionVector3D< OtherCoords, OtherTag > &)
Scalar Dot(const DisplacementVector3D< OtherCoords, OtherTag > &) const
Scalar Phi() const
Polar phi, converting if necessary from internal coordinate system.
unsigned int Dimension() const
Dimension.
DisplacementVector3D< CoordSystem, Tag > & SetX(Scalar xx)
Change X - Cartesian3D coordinates only.
Scalar Mag2() const
Magnitute squared ( r^2 in spherical coordinate)
DisplacementVector3D< CoordSystem, Tag > & SetXYZ(Scalar a, Scalar b, Scalar c)
set the values of the vector from the cartesian components (x,y,z) (if the vector is held in polar or...
Scalar Perp2() const
Transverse component squared (rho^2 in cylindrical coordinates.
DisplacementVector3D & operator*=(Scalar a)
multiply this vector by a scalar quantity
DisplacementVector3D operator/(Scalar a) const
Division of a vector with a real number.
Scalar Eta() const
Polar eta, converting if necessary from internal coordinate system.
constexpr DisplacementVector3D()
Default constructor.
Scalar Z() const
Cartesian Z, converting if necessary from internal coordinate system.
void GetCoordinates(IT begin, IT end) const
get internal data into 3 Scalars at *begin to *end (3 past begin)
Scalar Dot(const DisplacementVector3D< OtherCoords, Tag > &v) const
Return the scalar (dot) product of two displacement vectors.
DisplacementVector3D & operator=(const DisplacementVector3D< OtherCoords, OtherTag > &)
Class describing a generic position vector (point) in 3 dimensions.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Namespace for new Math classes and functions.
double T(double x)
char_t get_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m)
Definition GenVectorIO.h:54
std::basic_istream< char_t, traits_t > & require_delim(std::basic_istream< char_t, traits_t > &is, manip_t m)
void set_manip(std::basic_ios< char_t, traits_t > &ios, manip_t m, char_t ch)
Definition GenVectorIO.h:74
std::basic_istream< char_t, traits_t > & operator>>(std::basic_istream< char_t, traits_t > &is, DisplacementVector2D< T, U > &v)
DisplacementVector2D< CoordSystem1, U > operator+(DisplacementVector2D< CoordSystem1, U > v1, const DisplacementVector2D< CoordSystem2, U > &v2)
Addition of DisplacementVector2D vectors.
DisplacementVector2D< CoordSystem1, U > operator-(DisplacementVector2D< CoordSystem1, U > v1, DisplacementVector2D< CoordSystem2, U > const &v2)
Difference between two DisplacementVector2D vectors.
AxisAngle operator*(RotationX const &r1, AxisAngle const &r2)
Multiplication of an axial rotation by an AxisAngle.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.