BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
DifFourVector Class Reference

#include <DifFourVector.h>

Public Member Functions

 DifFourVector ()
 
 DifFourVector (const DifNumber &mass, const DifVector &p)
 
 DifFourVector (const double &mass, const DifVector &p)
 
 DifFourVector (const DifFourVector &v)
 
 ~DifFourVector ()
 
HepSymMatrix errorMatrix (const HepSymMatrix &e) const
 
HepMatrix jacobian () const
 
DifFourVectoroperator+= (const DifFourVector &v)
 
DifFourVectoroperator-= (const DifFourVector &v)
 
DifFourVectoroperator= (const DifFourVector &v)
 
DifFourVector operator- () const
 
int nPar () const
 
DifVector direction () const
 
DifNumber pMag () const
 
DifNumber massSq () const
 
DifNumber mass () const
 
void print () const
 
DifFourVectorzeroDerivatives ()
 
void boostTo (const DifFourVector &)
 
void boostFrom (const DifFourVector &)
 
void boostToMe (std::vector< DifFourVector * > &listToBoost) const
 
void boostFromMe (std::vector< DifFourVector * > &listToBoost) const
 

Public Attributes

DifNumber E
 
DifVector P
 

Friends

DifFourVector operator+ (const DifFourVector &a, const DifFourVector &b)
 
DifFourVector operator- (const DifFourVector &a, const DifFourVector &b)
 
DifNumber operator* (const DifFourVector &a, const DifFourVector &b)
 

Detailed Description

Definition at line 34 of file DifFourVector.h.

Constructor & Destructor Documentation

◆ DifFourVector() [1/4]

DifFourVector::DifFourVector ( )

Definition at line 27 of file DifFourVector.cxx.

28 :E(0.0),P(0.0,0.0,0.0)
29{}

◆ DifFourVector() [2/4]

DifFourVector::DifFourVector ( const DifNumber mass,
const DifVector p 
)

Definition at line 31 of file DifFourVector.cxx.

33 :E(sqrt(m*m+p*p)),P(p)
34{}

◆ DifFourVector() [3/4]

DifFourVector::DifFourVector ( const double &  mass,
const DifVector p 
)

Definition at line 35 of file DifFourVector.cxx.

37 :E(sqrt(m*m+p*p)),P(p)
38{}

◆ DifFourVector() [4/4]

DifFourVector::DifFourVector ( const DifFourVector v)

Definition at line 40 of file DifFourVector.cxx.

41 :E(v.E),P(v.P)
42{}
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35

◆ ~DifFourVector()

DifFourVector::~DifFourVector ( )
inline

Definition at line 48 of file DifFourVector.h.

48{} // destroy

Member Function Documentation

◆ boostFrom()

void DifFourVector::boostFrom ( const DifFourVector pFrom)

Definition at line 166 of file DifFourVector.cxx.

167{
168 const DifVector xHat(1,0,0);
169 const DifVector yHat(0,1,0);
170 const DifVector zHat(0,1,0);
171 DifVector z=pFrom.direction();
172 DifVector y=zHat-z*(zHat*z);
173 if(y.length()<0.01) y=xHat-z*(xHat*z);
174 y.normalize();
175 DifVector x(cross(y,z));
176
177 DifNumber px=P*x;
178 DifNumber py=P*y;
179 DifNumber pz=P*z;
180
181 DifNumber gamma=pFrom.E/pFrom.mass();
182 DifNumber beta=pFrom.pMag()/pFrom.E;
183
184 DifNumber pzP=gamma*(pz+beta*E);
185 DifNumber eP=gamma*(E+beta*pz);
186
187 E=eP;
188 P=px*x+py*y+pzP*z;
189}
Double_t x[10]
EvtVector3R cross(const EvtVector3R &p1, const EvtVector3R &p2)
Definition: EvtVector3R.cc:84
DifNumber mass() const
Definition: DifFourVector.h:77
DifNumber pMag() const
Definition: DifFourVector.h:75
DifVector direction() const
DifVector & normalize()
DifNumber length() const

◆ boostFromMe()

void DifFourVector::boostFromMe ( std::vector< DifFourVector * > &  listToBoost) const

Definition at line 134 of file DifFourVector.cxx.

134 {
135 const DifVector xHat(1,0,0);
136 const DifVector yHat(0,1,0);
137 const DifVector zHat(0,0,1);
138 DifVector z=P;
139 z.normalize();
140 DifVector y(zHat-z*(zHat*z));
141 if(y.lengthSq()<0.0001) y=xHat-z*(xHat*z);
142 y.normalize();
143 DifVector x(cross(y,z));
144
145 DifNumber gamma=E/mass();
146 DifNumber beta=pMag()/E;
147
148 for(int i=0;i<(int)list.size();i++) {
149 DifFourVector& p4i=*list[i];
150 DifNumber px=p4i.P*x;
151 DifNumber py=p4i.P*y;
152 DifNumber pz=p4i.P*z;
153 DifNumber e=p4i.E;
154
155 DifNumber pzP=gamma*(pz+beta*e);
156 DifNumber eP=gamma*(e+beta*pz);
157
158 p4i.E=eP;
159 p4i.P=px*x+py*y+pzP*z;
160
161 }
162
163}

◆ boostTo()

void DifFourVector::boostTo ( const DifFourVector pTo)

Definition at line 72 of file DifFourVector.cxx.

73{
74 const DifVector xHat(1,0,0);
75 const DifVector yHat(0,1,0);
76 const DifVector zHat(0,1,0);
77 DifVector z=pTo.direction();
78 DifVector y=zHat-z*(zHat*z);
79 if(y.length()<0.01) y=xHat-z*(xHat*z);
80 y.normalize();
81 DifVector x(cross(y,z));
82
83 DifNumber px=P*x;
84 DifNumber py=P*y;
85 DifNumber pz=P*z;
86
87 DifNumber gamma=pTo.E/pTo.mass();
88 DifNumber beta=pTo.pMag()/pTo.E;
89
90 DifNumber pzP=gamma*(pz-beta*E);
91 DifNumber eP=gamma*(E-beta*pz);
92
93 E=eP;
94 P=px*x+py*y+pzP*z;
95
96 return;
97
98}

◆ boostToMe()

void DifFourVector::boostToMe ( std::vector< DifFourVector * > &  listToBoost) const

Definition at line 101 of file DifFourVector.cxx.

101 {
102 const DifVector xHat(1,0,0);
103 const DifVector yHat(0,1,0);
104 const DifVector zHat(0,0,1);
105 DifVector z=P;
106 z.normalize();
107 DifVector y(zHat-z*(zHat*z));
108 if(y.lengthSq()<0.0001) y=xHat-z*(xHat*z);
109 y.normalize();
110 DifVector x(cross(y,z));
111
112 DifNumber gamma=E/mass();
113 DifNumber beta=pMag()/E;
114
115 for(int i=0;i<(int)list.size();i++) {
116 DifFourVector& p4i=*list[i];
117 DifNumber px=p4i.P*x;
118 DifNumber py=p4i.P*y;
119 DifNumber pz=p4i.P*z;
120 DifNumber e=p4i.E;
121
122 DifNumber pzP=gamma*(pz-beta*e);
123 DifNumber eP=gamma*(e-beta*pz);
124
125 p4i.E=eP;
126 p4i.P=px*x+py*y+pzP*z;
127
128 }
129
130}

◆ direction()

DifVector DifFourVector::direction ( ) const
inline

Referenced by boostFrom(), and boostTo().

◆ errorMatrix()

HepSymMatrix DifFourVector::errorMatrix ( const HepSymMatrix &  e) const

Definition at line 44 of file DifFourVector.cxx.

44 {
45 HepSymMatrix temp(4);
46 temp(1,1)=correlation(E,E,e);
47 temp(1,2)=correlation(E,P.x,e);
48 temp(1,3)=correlation(E,P.y,e);
49 temp(1,4)=correlation(E,P.z,e);
50 temp(2,2)=correlation(P.x,P.x,e);
51 temp(2,3)=correlation(P.x,P.y,e);
52 temp(2,4)=correlation(P.x,P.z,e);
53 temp(3,3)=correlation(P.y,P.y,e);
54 temp(3,4)=correlation(P.y,P.z,e);
55 temp(4,4)=correlation(P.z,P.z,e);
56 return temp;
57}
double correlation(const DifNumber &a, const DifNumber &b)
Definition: DifNumber.cxx:72
DifNumber y
Definition: DifVector.h:149
DifNumber x
Definition: DifVector.h:148
DifNumber z
Definition: DifVector.h:150

◆ jacobian()

HepMatrix DifFourVector::jacobian ( ) const

Definition at line 59 of file DifFourVector.cxx.

59 {
60 int npar=E.nPar();
61 HepMatrix temp(4,npar);
62 for(int i=1; i<=npar; i++){
63 temp(1,i)=E.derivative(i);
64 temp(2,i)=P.x.derivative(i);
65 temp(3,i)=P.y.derivative(i);
66 temp(4,i)=P.z.derivative(i);
67 } // (int i=1; i<=npar; i++)
68 return temp;
69}
double derivative(int i) const
Definition: DifNumber.h:90
int nPar() const
Definition: DifNumber.h:92

◆ mass()

DifNumber DifFourVector::mass ( ) const
inline

Definition at line 77 of file DifFourVector.h.

77 {
78 DifNumber temp=massSq();
79 if(temp>=0) return sqrt(temp);
80 return -sqrt(-massSq());
81 }
DifNumber massSq() const
Definition: DifFourVector.h:76

Referenced by boostFrom(), boostFromMe(), boostTo(), and boostToMe().

◆ massSq()

DifNumber DifFourVector::massSq ( ) const
inline

Definition at line 76 of file DifFourVector.h.

76{return E*E-P*P;}

Referenced by mass().

◆ nPar()

int DifFourVector::nPar ( ) const
inline

◆ operator+=()

DifFourVector & DifFourVector::operator+= ( const DifFourVector v)
inline

◆ operator-()

DifFourVector DifFourVector::operator- ( ) const
inline

◆ operator-=()

DifFourVector & DifFourVector::operator-= ( const DifFourVector v)
inline

◆ operator=()

DifFourVector & DifFourVector::operator= ( const DifFourVector v)
inline

◆ pMag()

DifNumber DifFourVector::pMag ( ) const
inline

Definition at line 75 of file DifFourVector.h.

75{return P.length();}

Referenced by boostFrom(), boostFromMe(), boostTo(), and boostToMe().

◆ print()

void DifFourVector::print ( ) const

Definition at line 192 of file DifFourVector.cxx.

192 {
193//SKIP cout << "E:" << endl << E;
194//SKIP cout << "P:" << endl << P;
195 cout << "SKIP of DifFourVector::print()" <<endl;//TEMP
196}

◆ zeroDerivatives()

DifFourVector & DifFourVector::zeroDerivatives ( )
inline

Friends And Related Function Documentation

◆ operator*

DifNumber operator* ( const DifFourVector a,
const DifFourVector b 
)
friend

◆ operator+

DifFourVector operator+ ( const DifFourVector a,
const DifFourVector b 
)
friend

◆ operator-

DifFourVector operator- ( const DifFourVector a,
const DifFourVector b 
)
friend

Member Data Documentation

◆ E

DifNumber DifFourVector::E

Definition at line 114 of file DifFourVector.h.

Referenced by boostFrom(), boostFromMe(), boostTo(), boostToMe(), errorMatrix(), jacobian(), and massSq().

◆ P

DifVector DifFourVector::P

The documentation for this class was generated from the following files: