ROOT logo
// @(#)root/mathcore:$Id: BoostY.h 22516 2008-03-07 15:14:26Z moneta $
// Authors: W. Brown, M. Fischler, L. Moneta    2005  

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

// Header file for BoostY
// 
// Created by: Mark Fischler  Mon Nov 1  2005
// 
// Last update: $Id: BoostY.h 22516 2008-03-07 15:14:26Z moneta $
// 
#ifndef ROOT_Math_GenVector_BoostY
#define ROOT_Math_GenVector_BoostY 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 Y axis, by beta. 
      For efficiency, gamma is held as well. 

      @ingroup GenVector      
   */

class BoostY {

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)
   */
   BoostY();

   /**
      Construct given a Scalar beta_y
   */
   explicit BoostY(Scalar beta_y) { SetComponents(beta_y); }


   // 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_y
   */
   void
   SetComponents (Scalar beta_y);

   /**
      Get components into a Scalar beta_y
   */
   void
   GetComponents (Scalar& beta_y) 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 rotation on a vector
   */
   template <class A4Vector>
   inline
   A4Vector operator* (const A4Vector & v) const
   {
      return operator()(v);
   }

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

   /**
      Return inverse of  a rotation
   */
   BoostY Inverse() const;

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

private:

   Scalar fBeta;    // beta Y of the Boost
   Scalar fGamma;   // gamma of the Boost 

};  // BoostY

// ============ Class BoostY ends here ============

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

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


} //namespace Math
} //namespace ROOT







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