File indexing completed on 2025-08-05 08:18:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "HMatrixPhi.h"
0021
0022 #include "IO.h"
0023
0024 #include <TBuffer.h>
0025
0026 #include <cassert>
0027 #include <alloca.h>
0028 #include <math.h>
0029 #include <TBuffer.h>
0030
0031 namespace genfit {
0032
0033
0034
0035
0036
0037 HMatrixPhi::HMatrixPhi(double phi) :
0038 phi_(phi),
0039 cosPhi_(cos(phi)),
0040 sinPhi_(sin(phi))
0041 {
0042 ;
0043 }
0044
0045 const TMatrixD& HMatrixPhi::getMatrix() const {
0046 static const double HMatrixContent[5] = {0, 0, 0, cosPhi_, sinPhi_};
0047
0048 static const TMatrixD HMatrix(1,5, HMatrixContent);
0049
0050 return HMatrix;
0051 }
0052
0053
0054 TVectorD HMatrixPhi::Hv(const TVectorD& v) const {
0055 assert (v.GetNrows() == 5);
0056
0057 double* retValArray =(double *)alloca(sizeof(double) * 1);
0058
0059 retValArray[0] = cosPhi_*v(3) + sinPhi_*v(4);
0060
0061 return TVectorD(1, retValArray);
0062 }
0063
0064
0065 TMatrixD HMatrixPhi::MHt(const TMatrixDSym& M) const {
0066 assert (M.GetNcols() == 5);
0067
0068 double* retValArray =(double *)alloca(sizeof(double) * 5);
0069 const double* MatArray = M.GetMatrixArray();
0070
0071 for (unsigned int i=0; i<5; ++i) {
0072 retValArray[i] = cosPhi_*MatArray[i*5 + 3] + sinPhi_*MatArray[i*5 + 4];
0073 }
0074
0075 return TMatrixD(5,1, retValArray);
0076 }
0077
0078
0079 TMatrixD HMatrixPhi::MHt(const TMatrixD& M) const {
0080 assert (M.GetNcols() == 5);
0081
0082 double* retValArray =(double *)alloca(sizeof(double) * M.GetNrows());
0083 const double* MatArray = M.GetMatrixArray();
0084
0085 for (int i = 0; i < M.GetNrows(); ++i) {
0086 retValArray[i] = cosPhi_*MatArray[i*5 + 3] + sinPhi_*MatArray[i*5 + 4];
0087 }
0088
0089 return TMatrixD(M.GetNrows(),1, retValArray);
0090 }
0091
0092
0093 void HMatrixPhi::HMHt(TMatrixDSym& M) const {
0094 assert (M.GetNrows() == 5);
0095
0096 M(0,0) = cosPhi_ * (cosPhi_*M(3,3) + sinPhi_*M(3,4))
0097 + sinPhi_ * (cosPhi_*M(4,3) + sinPhi_*M(4,4));
0098
0099 M.ResizeTo(1,1);
0100 }
0101
0102
0103 bool HMatrixPhi::isEqual(const AbsHMatrix& other) const {
0104 if (dynamic_cast<const HMatrixPhi*>(&other) == nullptr)
0105 return false;
0106
0107 return (phi_ == static_cast<const HMatrixPhi*>(&other)->phi_);
0108 }
0109
0110 void HMatrixPhi::Print(const Option_t*) const
0111 {
0112 printOut << "phi = " << phi_ << std::endl;
0113 }
0114
0115 void HMatrixPhi::Streamer(TBuffer &R__b) {
0116
0117
0118
0119
0120 if (R__b.IsReading()) {
0121 R__b.ReadClassBuffer(genfit::HMatrixPhi::Class(),this);
0122 cosPhi_ = cos(phi_);
0123 sinPhi_ = sin(phi_);
0124 } else {
0125 R__b.WriteClassBuffer(genfit::HMatrixPhi::Class(),this);
0126 }
0127 }
0128
0129
0130 }