ROOT logo
// @(#)root/mathcore:$Id$
// Authors: W. Brown, M. Fischler, L. Moneta    2005  

 /**********************************************************************
  *                                                                    *
  * Copyright (c) 2005 ROOT FNAL MathLib Team                          *
  *                                                                    *
  *                                                                    *
  **********************************************************************/

// Header file for BoostZ
// 
// Created by: Mark Fischler  Mon Nov 1  2005
// 
// Last update: $Id$
// 
#ifndef ROOT_Math_GenVector_BoostZ
#define ROOT_Math_GenVector_BoostZ 1

#include "Math/GenVector/LorentzVector.h"
#include "Math/GenVector/PxPyPzE4D.h"
#include "Math/GenVector/DisplacementVector3D.h"
#include "Math/GenVector/Cartesian3D.h"

namespace ROOT {

  namespace Math {

//__________________________________________________________________________________________
   /**
      Class representing a Lorentz Boost along the Z axis, by beta. 
      For efficiency, gamma is held as well. 

      @ingroup GenVector      
   */

class BoostZ {

public:

   typedef double Scalar;

   enum ELorentzRotationMatrixIndex {
      kLXX =  0, kLXY =  1, kLXZ =  2, kLXT =  3
    , kLYX =  4, kLYY =  5, kLYZ =  6, kLYT =  7
    , kLZX =  8, kLZY =  9, kLZZ = 10, kLZT = 11
    , kLTX = 12, kLTY = 13, kLTZ = 14, kLTT = 15
   };

   enum EBoostMatrixIndex {
      kXX =  0, kXY =  1, kXZ =  2, kXT =  3
      , kYY =  4, kYZ =  5, kYT =  6
      , kZZ =  7, kZT =  8
      , kTT =  9
   };

   // ========== Constructors and Assignment =====================

   /**
      Default constructor (identity transformation)
   */
   BoostZ();

   /**
      Construct given a Scalar beta_z
   */
   explicit BoostZ(Scalar beta_z) { SetComponents(beta_z); }


   // The compiler-generated copy ctor, copy assignment, and dtor are OK.

   /**
      Re-adjust components to eliminate small deviations from a perfect
      orthosyplectic matrix.
   */
   void Rectify();

   // ======== Components ==============

   /**
      Set components from a Scalar beta_z
   */
   void
   SetComponents (Scalar beta_z);

   /**
      Get components into a Scalar beta_z
   */
   void
   GetComponents (Scalar& beta_z) const;


   /** 
       Retrieve the beta of the Boost 
   */ 
   Scalar Beta() const { return fBeta; }

   /** 
       Retrieve the gamma of the Boost 
   */ 
   Scalar Gamma() const { return fGamma; }

   /** 
       Set the given beta of the Boost 
   */ 
   void  SetBeta(Scalar beta) { SetComponents(beta); }
   
   /**
      The beta vector for this boost
   */
   typedef  DisplacementVector3D<Cartesian3D<double>, DefaultCoordinateSystemTag > XYZVector; 
   XYZVector BetaVector() const;

   /**
      Get elements of internal 4x4 symmetric representation, into a data
      array suitable for direct use as the components of a LorentzRotation
      Note -- 16 Scalars will be written into the array; if the array is not
      that large, then this will lead to undefined behavior.
   */
   void 
   GetLorentzRotation (Scalar r[]) const; 
  
   // =========== operations ==============

   /**
      Lorentz transformation operation on a Minkowski ('Cartesian') 
      LorentzVector
   */
   LorentzVector< ROOT::Math::PxPyPzE4D<double> >
   operator() (const LorentzVector< ROOT::Math::PxPyPzE4D<double> > & v) const;
  
   /**
      Lorentz transformation operation on a LorentzVector in any 
      coordinate system
   */
   template <class CoordSystem>
   LorentzVector<CoordSystem>
   operator() (const LorentzVector<CoordSystem> & v) const {
      LorentzVector< PxPyPzE4D<double> > xyzt(v);
      LorentzVector< PxPyPzE4D<double> > r_xyzt = operator()(xyzt);
      return LorentzVector<CoordSystem> ( r_xyzt );
   }

   /**
      Lorentz transformation operation on an arbitrary 4-vector v.
      Preconditions:  v must implement methods x(), y(), z(), and t()
      and the arbitrary vector type must have a constructor taking (x,y,z,t)
   */
   template <class Foreign4Vector>
   Foreign4Vector
   operator() (const Foreign4Vector & v) const {
      LorentzVector< PxPyPzE4D<double> > xyzt(v);
      LorentzVector< PxPyPzE4D<double> > r_xyzt = operator()(xyzt);
      return Foreign4Vector ( r_xyzt.X(), r_xyzt.Y(), r_xyzt.Z(), r_xyzt.T() );
   }

   /**
      Overload operator * for boost on a vector
   */
   template <class A4Vector>
   inline
   A4Vector operator* (const A4Vector & v) const
   {
      return operator()(v);
   }

   /**
      Invert a BoostZ in place
   */
   void Invert();

   /**
      Return inverse of  a BoostZ
   */
   BoostZ Inverse() const;

   /**
      Equality/inequality operators
   */
   bool operator == (const BoostZ & rhs) const {
      if( fBeta  != rhs.fBeta  ) return false;
      if( fGamma != rhs.fGamma ) return false;
      return true;
   }
   bool operator != (const BoostZ & rhs) const {
      return ! operator==(rhs);
   }

private:

   Scalar fBeta;    // boost beta z
   Scalar fGamma;   // boost gamma

};  // BoostZ

// ============ Class BoostZ ends here ============

/**
   Stream Output and Input
 */
  // TODO - I/O should be put in the manipulator form 

std::ostream & operator<< (std::ostream & os, const BoostZ & b);


} //namespace Math
} //namespace ROOT







#endif /* ROOT_Math_GenVector_BoostZ  */
 BoostZ.h:1
 BoostZ.h:2
 BoostZ.h:3
 BoostZ.h:4
 BoostZ.h:5
 BoostZ.h:6
 BoostZ.h:7
 BoostZ.h:8
 BoostZ.h:9
 BoostZ.h:10
 BoostZ.h:11
 BoostZ.h:12
 BoostZ.h:13
 BoostZ.h:14
 BoostZ.h:15
 BoostZ.h:16
 BoostZ.h:17
 BoostZ.h:18
 BoostZ.h:19
 BoostZ.h:20
 BoostZ.h:21
 BoostZ.h:22
 BoostZ.h:23
 BoostZ.h:24
 BoostZ.h:25
 BoostZ.h:26
 BoostZ.h:27
 BoostZ.h:28
 BoostZ.h:29
 BoostZ.h:30
 BoostZ.h:31
 BoostZ.h:32
 BoostZ.h:33
 BoostZ.h:34
 BoostZ.h:35
 BoostZ.h:36
 BoostZ.h:37
 BoostZ.h:38
 BoostZ.h:39
 BoostZ.h:40
 BoostZ.h:41
 BoostZ.h:42
 BoostZ.h:43
 BoostZ.h:44
 BoostZ.h:45
 BoostZ.h:46
 BoostZ.h:47
 BoostZ.h:48
 BoostZ.h:49
 BoostZ.h:50
 BoostZ.h:51
 BoostZ.h:52
 BoostZ.h:53
 BoostZ.h:54
 BoostZ.h:55
 BoostZ.h:56
 BoostZ.h:57
 BoostZ.h:58
 BoostZ.h:59
 BoostZ.h:60
 BoostZ.h:61
 BoostZ.h:62
 BoostZ.h:63
 BoostZ.h:64
 BoostZ.h:65
 BoostZ.h:66
 BoostZ.h:67
 BoostZ.h:68
 BoostZ.h:69
 BoostZ.h:70
 BoostZ.h:71
 BoostZ.h:72
 BoostZ.h:73
 BoostZ.h:74
 BoostZ.h:75
 BoostZ.h:76
 BoostZ.h:77
 BoostZ.h:78
 BoostZ.h:79
 BoostZ.h:80
 BoostZ.h:81
 BoostZ.h:82
 BoostZ.h:83
 BoostZ.h:84
 BoostZ.h:85
 BoostZ.h:86
 BoostZ.h:87
 BoostZ.h:88
 BoostZ.h:89
 BoostZ.h:90
 BoostZ.h:91
 BoostZ.h:92
 BoostZ.h:93
 BoostZ.h:94
 BoostZ.h:95
 BoostZ.h:96
 BoostZ.h:97
 BoostZ.h:98
 BoostZ.h:99
 BoostZ.h:100
 BoostZ.h:101
 BoostZ.h:102
 BoostZ.h:103
 BoostZ.h:104
 BoostZ.h:105
 BoostZ.h:106
 BoostZ.h:107
 BoostZ.h:108
 BoostZ.h:109
 BoostZ.h:110
 BoostZ.h:111
 BoostZ.h:112
 BoostZ.h:113
 BoostZ.h:114
 BoostZ.h:115
 BoostZ.h:116
 BoostZ.h:117
 BoostZ.h:118
 BoostZ.h:119
 BoostZ.h:120
 BoostZ.h:121
 BoostZ.h:122
 BoostZ.h:123
 BoostZ.h:124
 BoostZ.h:125
 BoostZ.h:126
 BoostZ.h:127
 BoostZ.h:128
 BoostZ.h:129
 BoostZ.h:130
 BoostZ.h:131
 BoostZ.h:132
 BoostZ.h:133
 BoostZ.h:134
 BoostZ.h:135
 BoostZ.h:136
 BoostZ.h:137
 BoostZ.h:138
 BoostZ.h:139
 BoostZ.h:140
 BoostZ.h:141
 BoostZ.h:142
 BoostZ.h:143
 BoostZ.h:144
 BoostZ.h:145
 BoostZ.h:146
 BoostZ.h:147
 BoostZ.h:148
 BoostZ.h:149
 BoostZ.h:150
 BoostZ.h:151
 BoostZ.h:152
 BoostZ.h:153
 BoostZ.h:154
 BoostZ.h:155
 BoostZ.h:156
 BoostZ.h:157
 BoostZ.h:158
 BoostZ.h:159
 BoostZ.h:160
 BoostZ.h:161
 BoostZ.h:162
 BoostZ.h:163
 BoostZ.h:164
 BoostZ.h:165
 BoostZ.h:166
 BoostZ.h:167
 BoostZ.h:168
 BoostZ.h:169
 BoostZ.h:170
 BoostZ.h:171
 BoostZ.h:172
 BoostZ.h:173
 BoostZ.h:174
 BoostZ.h:175
 BoostZ.h:176
 BoostZ.h:177
 BoostZ.h:178
 BoostZ.h:179
 BoostZ.h:180
 BoostZ.h:181
 BoostZ.h:182
 BoostZ.h:183
 BoostZ.h:184
 BoostZ.h:185
 BoostZ.h:186
 BoostZ.h:187
 BoostZ.h:188
 BoostZ.h:189
 BoostZ.h:190
 BoostZ.h:191
 BoostZ.h:192
 BoostZ.h:193
 BoostZ.h:194
 BoostZ.h:195
 BoostZ.h:196
 BoostZ.h:197
 BoostZ.h:198
 BoostZ.h:199
 BoostZ.h:200
 BoostZ.h:201
 BoostZ.h:202
 BoostZ.h:203
 BoostZ.h:204
 BoostZ.h:205
 BoostZ.h:206
 BoostZ.h:207
 BoostZ.h:208
 BoostZ.h:209
 BoostZ.h:210
 BoostZ.h:211
 BoostZ.h:212
 BoostZ.h:213
 BoostZ.h:214
 BoostZ.h:215