File indexing completed on 2024-11-16 09:56:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TLorentzRotation
0013 #define ROOT_TLorentzRotation
0014
0015
0016 #include "TRotation.h"
0017 #include "TLorentzVector.h"
0018
0019
0020 class TLorentzRotation : public TObject {
0021
0022
0023 public:
0024
0025 class TLorentzRotationRow {
0026 public:
0027 inline TLorentzRotationRow(const TLorentzRotation &, int);
0028 inline Double_t operator [] (int) const;
0029 private:
0030 const TLorentzRotation * fRR;
0031 int fII;
0032 };
0033
0034
0035 TLorentzRotation();
0036
0037
0038 TLorentzRotation(const TRotation &);
0039
0040
0041 TLorentzRotation(const TLorentzRotation &);
0042
0043
0044 TLorentzRotation(Double_t, Double_t, Double_t);
0045 TLorentzRotation(const TVector3 &);
0046
0047
0048 inline Double_t XX() const;
0049 inline Double_t XY() const;
0050 inline Double_t XZ() const;
0051 inline Double_t XT() const;
0052 inline Double_t YX() const;
0053 inline Double_t YY() const;
0054 inline Double_t YZ() const;
0055 inline Double_t YT() const;
0056 inline Double_t ZX() const;
0057 inline Double_t ZY() const;
0058 inline Double_t ZZ() const;
0059 inline Double_t ZT() const;
0060 inline Double_t TX() const;
0061 inline Double_t TY() const;
0062 inline Double_t TZ() const;
0063 inline Double_t TT() const;
0064
0065
0066 inline TLorentzRotationRow operator [] (int) const;
0067
0068
0069
0070 Double_t operator () (int, int) const;
0071
0072
0073
0074 inline TLorentzRotation & operator = (const TLorentzRotation &);
0075 inline TLorentzRotation & operator = (const TRotation &);
0076
0077
0078 inline Bool_t operator == (const TLorentzRotation &) const;
0079 inline Bool_t operator != (const TLorentzRotation &) const;
0080
0081
0082 inline Bool_t IsIdentity() const;
0083
0084
0085 inline TLorentzVector VectorMultiplication(const TLorentzVector&) const;
0086 inline TLorentzVector operator * (const TLorentzVector &) const;
0087
0088
0089 TLorentzRotation MatrixMultiplication(const TLorentzRotation &) const;
0090 inline TLorentzRotation operator * (const TLorentzRotation &) const;
0091 inline TLorentzRotation & operator *= (const TLorentzRotation &);
0092 inline TLorentzRotation & Transform(const TLorentzRotation &);
0093 inline TLorentzRotation & Transform(const TRotation &);
0094
0095
0096
0097 inline TLorentzRotation Inverse() const;
0098
0099
0100 inline TLorentzRotation & Invert();
0101
0102
0103 inline TLorentzRotation & Boost(Double_t, Double_t, Double_t);
0104 inline TLorentzRotation & Boost(const TVector3 &);
0105
0106
0107 inline TLorentzRotation & RotateX(Double_t);
0108
0109
0110 inline TLorentzRotation & RotateY(Double_t);
0111
0112
0113 inline TLorentzRotation & RotateZ(Double_t);
0114
0115
0116 inline TLorentzRotation & Rotate(Double_t, const TVector3 &);
0117 inline TLorentzRotation & Rotate(Double_t, const TVector3 *);
0118
0119
0120 protected:
0121
0122 Double_t fxx, fxy, fxz, fxt,
0123 fyx, fyy, fyz, fyt,
0124 fzx, fzy, fzz, fzt,
0125 ftx, fty, ftz, ftt;
0126
0127
0128 void SetBoost(Double_t, Double_t, Double_t);
0129
0130
0131 TLorentzRotation(Double_t, Double_t, Double_t, Double_t,
0132 Double_t, Double_t, Double_t, Double_t,
0133 Double_t, Double_t, Double_t, Double_t,
0134 Double_t, Double_t, Double_t, Double_t);
0135
0136
0137 ClassDefOverride(TLorentzRotation,1)
0138
0139 };
0140
0141
0142
0143 inline Double_t TLorentzRotation::XX() const { return fxx; }
0144 inline Double_t TLorentzRotation::XY() const { return fxy; }
0145 inline Double_t TLorentzRotation::XZ() const { return fxz; }
0146 inline Double_t TLorentzRotation::XT() const { return fxt; }
0147 inline Double_t TLorentzRotation::YX() const { return fyx; }
0148 inline Double_t TLorentzRotation::YY() const { return fyy; }
0149 inline Double_t TLorentzRotation::YZ() const { return fyz; }
0150 inline Double_t TLorentzRotation::YT() const { return fyt; }
0151 inline Double_t TLorentzRotation::ZX() const { return fzx; }
0152 inline Double_t TLorentzRotation::ZY() const { return fzy; }
0153 inline Double_t TLorentzRotation::ZZ() const { return fzz; }
0154 inline Double_t TLorentzRotation::ZT() const { return fzt; }
0155 inline Double_t TLorentzRotation::TX() const { return ftx; }
0156 inline Double_t TLorentzRotation::TY() const { return fty; }
0157 inline Double_t TLorentzRotation::TZ() const { return ftz; }
0158 inline Double_t TLorentzRotation::TT() const { return ftt; }
0159
0160 inline TLorentzRotation::TLorentzRotationRow::TLorentzRotationRow
0161 (const TLorentzRotation & r, int i) : fRR(&r), fII(i) {}
0162
0163 inline Double_t TLorentzRotation::TLorentzRotationRow::operator [] (int jj) const {
0164 return fRR->operator()(fII,jj);
0165 }
0166
0167 inline TLorentzRotation::TLorentzRotationRow TLorentzRotation::operator [] (int i) const {
0168 return TLorentzRotationRow(*this, i);
0169 }
0170
0171 inline TLorentzRotation & TLorentzRotation::operator = (const TLorentzRotation & r) {
0172 fxx = r.fxx; fxy = r.fxy; fxz = r.fxz; fxt = r.fxt;
0173 fyx = r.fyx; fyy = r.fyy; fyz = r.fyz; fyt = r.fyt;
0174 fzx = r.fzx; fzy = r.fzy; fzz = r.fzz; fzt = r.fzt;
0175 ftx = r.ftx; fty = r.fty; ftz = r.ftz; ftt = r.ftt;
0176 return *this;
0177 }
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188 inline TLorentzRotation & TLorentzRotation::operator = (const TRotation & r) {
0189 fxx = r.XX(); fxy = r.XY(); fxz = r.XZ(); fxt = 0.0;
0190 fyx = r.YX(); fyy = r.YY(); fyz = r.YZ(); fyt = 0.0;
0191 fzx = r.ZX(); fzy = r.ZY(); fzz = r.ZZ(); fzt = 0.0;
0192 ftx = 0.0; fty = 0.0; ftz = 0.0; ftt = 1.0;
0193 return *this;
0194 }
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206 inline Bool_t TLorentzRotation::operator == (const TLorentzRotation & r) const {
0207 return (fxx == r.fxx && fxy == r.fxy && fxz == r.fxz && fxt == r.fxt &&
0208 fyx == r.fyx && fyy == r.fyy && fyz == r.fyz && fyt == r.fyt &&
0209 fzx == r.fzx && fzy == r.fzy && fzz == r.fzz && fzt == r.fzt &&
0210 ftx == r.ftx && fty == r.fty && ftz == r.ftz && ftt == r.ftt)
0211 ? kTRUE : kFALSE;
0212 }
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223 inline Bool_t TLorentzRotation::operator != (const TLorentzRotation & r) const {
0224 return (fxx != r.fxx || fxy != r.fxy || fxz != r.fxz || fxt != r.fxt ||
0225 fyx != r.fyx || fyy != r.fyy || fyz != r.fyz || fyt != r.fyt ||
0226 fzx != r.fzx || fzy != r.fzy || fzz != r.fzz || fzt != r.fzt ||
0227 ftx != r.ftx || fty != r.fty || ftz != r.ftz || ftt != r.ftt)
0228 ? kTRUE : kFALSE;
0229 }
0230
0231 inline Bool_t TLorentzRotation::IsIdentity() const {
0232 return (fxx == 1.0 && fxy == 0.0 && fxz == 0.0 && fxt == 0.0 &&
0233 fyx == 0.0 && fyy == 1.0 && fyz == 0.0 && fyt == 0.0 &&
0234 fzx == 0.0 && fzy == 0.0 && fzz == 1.0 && fzt == 0.0 &&
0235 ftx == 0.0 && fty == 0.0 && ftz == 0.0 && ftt == 1.0)
0236 ? kTRUE : kFALSE;
0237 }
0238
0239
0240 inline TLorentzVector TLorentzRotation::VectorMultiplication(const TLorentzVector & p) const {
0241 return TLorentzVector(fxx*p.X()+fxy*p.Y()+fxz*p.Z()+fxt*p.T(),
0242 fyx*p.X()+fyy*p.Y()+fyz*p.Z()+fyt*p.T(),
0243 fzx*p.X()+fzy*p.Y()+fzz*p.Z()+fzt*p.T(),
0244 ftx*p.X()+fty*p.Y()+ftz*p.Z()+ftt*p.T());
0245 }
0246
0247 inline TLorentzVector TLorentzRotation::operator * (const TLorentzVector & p) const {
0248 return VectorMultiplication(p);
0249 }
0250
0251 inline TLorentzRotation TLorentzRotation::operator * (const TLorentzRotation & m) const {
0252 return MatrixMultiplication(m);
0253 }
0254
0255 inline TLorentzRotation & TLorentzRotation::operator *= (const TLorentzRotation & m) {
0256 return *this = MatrixMultiplication(m);
0257 }
0258
0259 inline TLorentzRotation & TLorentzRotation::Transform(const TLorentzRotation & m) {
0260 return *this = m.MatrixMultiplication(*this);
0261 }
0262
0263 inline TLorentzRotation & TLorentzRotation::Transform(const TRotation & m){
0264 return Transform(TLorentzRotation(m));
0265 }
0266
0267 inline TLorentzRotation TLorentzRotation::Inverse() const {
0268 return TLorentzRotation( fxx, fyx, fzx, -ftx,
0269 fxy, fyy, fzy, -fty,
0270 fxz, fyz, fzz, -ftz,
0271 -fxt, -fyt, -fzt, ftt);
0272 }
0273
0274 inline TLorentzRotation & TLorentzRotation::Invert() {
0275 return *this = Inverse();
0276 }
0277
0278 inline TLorentzRotation & TLorentzRotation::Boost(Double_t bx, Double_t by, Double_t bz) {
0279 return Transform(TLorentzRotation(bx, by, bz));
0280 }
0281
0282 inline TLorentzRotation & TLorentzRotation::Boost(const TVector3 & b) {
0283 return Transform(TLorentzRotation(b));
0284 }
0285
0286 inline TLorentzRotation & TLorentzRotation::RotateX(Double_t angle) {
0287 return Transform(TRotation().RotateX(angle));
0288 }
0289
0290 inline TLorentzRotation & TLorentzRotation::RotateY(Double_t angle) {
0291 return Transform(TRotation().RotateY(angle));
0292 }
0293
0294 inline TLorentzRotation & TLorentzRotation::RotateZ(Double_t angle) {
0295 return Transform(TRotation().RotateZ(angle));
0296 }
0297
0298 inline TLorentzRotation & TLorentzRotation::Rotate(Double_t angle, const TVector3 & axis) {
0299 return Transform(TRotation().Rotate(angle, axis));
0300 }
0301
0302 inline TLorentzRotation & TLorentzRotation::Rotate(Double_t angle, const TVector3 * axis) {
0303 return Transform(TRotation().Rotate(angle, axis));
0304 }
0305
0306 #endif