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