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