File indexing completed on 2025-01-18 10:10:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef ROOT_Math_GenVector_Boost
0018 #define ROOT_Math_GenVector_Boost 1
0019
0020 #include "Math/GenVector/LorentzVector.h"
0021 #include "Math/GenVector/PxPyPzE4D.h"
0022 #include "Math/GenVector/DisplacementVector3D.h"
0023 #include "Math/GenVector/Cartesian3D.h"
0024
0025 #include "Math/GenVector/BoostX.h"
0026 #include "Math/GenVector/BoostY.h"
0027 #include "Math/GenVector/BoostZ.h"
0028
0029 namespace ROOT {
0030
0031 namespace Math {
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 class Boost {
0048
0049 public:
0050
0051 typedef double Scalar;
0052
0053 enum ELorentzRotationMatrixIndex {
0054 kLXX = 0, kLXY = 1, kLXZ = 2, kLXT = 3
0055 , kLYX = 4, kLYY = 5, kLYZ = 6, kLYT = 7
0056 , kLZX = 8, kLZY = 9, kLZZ = 10, kLZT = 11
0057 , kLTX = 12, kLTY = 13, kLTZ = 14, kLTT = 15
0058 };
0059
0060 enum EBoostMatrixIndex {
0061 kXX = 0, kXY = 1, kXZ = 2, kXT = 3
0062 , kYY = 4, kYZ = 5, kYT = 6
0063 , kZZ = 7, kZT = 8
0064 , kTT = 9
0065 };
0066
0067
0068
0069
0070
0071
0072 Boost() { SetIdentity(); }
0073
0074
0075
0076
0077 Boost(Scalar beta_x, Scalar beta_y, Scalar beta_z)
0078 { SetComponents(beta_x, beta_y, beta_z); }
0079
0080
0081
0082
0083 template <class Avector>
0084 explicit
0085 Boost(const Avector & beta) { SetComponents(beta); }
0086
0087
0088
0089
0090
0091 template<class IT>
0092 Boost(IT begin, IT end) { SetComponents(begin,end); }
0093
0094
0095
0096
0097 Boost(Boost const & b) {
0098 *this = b;
0099 }
0100
0101
0102
0103
0104
0105 explicit Boost( BoostX const & bx ) {SetComponents(bx.BetaVector());}
0106 explicit Boost( BoostY const & by ) {SetComponents(by.BetaVector());}
0107 explicit Boost( BoostZ const & bz ) {SetComponents(bz.BetaVector());}
0108
0109
0110
0111
0112
0113
0114 Boost &
0115 operator=(Boost const & rhs ) {
0116 for (unsigned int i=0; i < 10; ++i) {
0117 fM[i] = rhs.fM[i];
0118 }
0119 return *this;
0120 }
0121
0122
0123
0124
0125 Boost &
0126 operator=( BoostX const & bx ) { return operator=(Boost(bx)); }
0127 Boost &
0128 operator=( BoostY const & by ) { return operator=(Boost(by)); }
0129 Boost &
0130 operator=( BoostZ const & bz ) { return operator=(Boost(bz)); }
0131
0132
0133
0134
0135
0136 void Rectify();
0137
0138
0139
0140
0141
0142
0143 void
0144 SetComponents (Scalar beta_x, Scalar beta_y, Scalar beta_z);
0145
0146
0147
0148
0149 void
0150 GetComponents (Scalar& beta_x, Scalar& beta_y, Scalar& beta_z) const;
0151
0152
0153
0154
0155 template <class Avector>
0156 void
0157 SetComponents (const Avector & beta)
0158 { SetComponents(beta.x(), beta.y(), beta.z()); }
0159
0160
0161
0162
0163
0164 template<class IT>
0165 void SetComponents(IT begin, IT end) {
0166 IT a = begin; IT b = ++begin; IT c = ++begin;
0167 (void)end;
0168 assert (++begin==end);
0169 SetComponents (*a, *b, *c);
0170 }
0171
0172
0173
0174
0175
0176 template<class IT>
0177 void GetComponents(IT begin, IT end) const {
0178 IT a = begin; IT b = ++begin; IT c = ++begin;
0179 (void)end;
0180 assert (++begin==end);
0181 GetComponents (*a, *b, *c);
0182 }
0183
0184
0185
0186
0187
0188 template<class IT>
0189 void GetComponents(IT begin ) const {
0190 double bx,by,bz = 0;
0191 GetComponents (bx,by,bz);
0192 *begin++ = bx;
0193 *begin++ = by;
0194 *begin = bz;
0195 }
0196
0197
0198
0199
0200 typedef DisplacementVector3D<Cartesian3D<double>, DefaultCoordinateSystemTag > XYZVector;
0201 XYZVector BetaVector() const;
0202
0203
0204
0205
0206
0207
0208
0209 void
0210 GetLorentzRotation (Scalar r[]) const;
0211
0212
0213
0214
0215
0216
0217
0218 LorentzVector< ROOT::Math::PxPyPzE4D<double> >
0219 operator() (const LorentzVector< ROOT::Math::PxPyPzE4D<double> > & v) const;
0220
0221
0222
0223
0224
0225 template <class CoordSystem>
0226 LorentzVector<CoordSystem>
0227 operator() (const LorentzVector<CoordSystem> & v) const {
0228 LorentzVector< PxPyPzE4D<double> > xyzt(v);
0229 LorentzVector< PxPyPzE4D<double> > r_xyzt = operator()(xyzt);
0230 return LorentzVector<CoordSystem> ( r_xyzt );
0231 }
0232
0233
0234
0235
0236
0237
0238 template <class Foreign4Vector>
0239 Foreign4Vector
0240 operator() (const Foreign4Vector & v) const {
0241 LorentzVector< PxPyPzE4D<double> > xyzt(v);
0242 LorentzVector< PxPyPzE4D<double> > r_xyzt = operator()(xyzt);
0243 return Foreign4Vector ( r_xyzt.X(), r_xyzt.Y(), r_xyzt.Z(), r_xyzt.T() );
0244 }
0245
0246
0247
0248
0249 template <class A4Vector>
0250 inline
0251 A4Vector operator* (const A4Vector & v) const
0252 {
0253 return operator()(v);
0254 }
0255
0256
0257
0258
0259 void Invert();
0260
0261
0262
0263
0264 Boost Inverse() const;
0265
0266
0267
0268
0269 bool operator == (const Boost & rhs) const {
0270 for (unsigned int i=0; i < 10; ++i) {
0271 if( fM[i] != rhs.fM[i] ) return false;
0272 }
0273 return true;
0274 }
0275 bool operator != (const Boost & rhs) const {
0276 return ! operator==(rhs);
0277 }
0278
0279 protected:
0280
0281 void SetIdentity();
0282
0283 private:
0284
0285 Scalar fM[10];
0286
0287 };
0288
0289
0290
0291
0292
0293
0294
0295
0296 std::ostream & operator<< (std::ostream & os, const Boost & b);
0297
0298
0299 }
0300 }
0301
0302
0303
0304
0305
0306
0307
0308 #endif