00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "StDcaGeometry.h"
00033 #if ROOT_VERSION_CODE < 331013
00034 #include "TCL.h"
00035 #else
00036 #include "TCernLib.h"
00037 #endif
00038 #include "TRMatrix.h"
00039 #include "TRSymMatrix.h"
00040 #include "TMath.h"
00041 ClassImp(StDcaGeometry)
00042
00043 static const char rcsid[] = "$Id: StDcaGeometry.cxx,v 2.6 2010/08/31 20:14:50 fisyak Exp $";
00044
00045 StDcaGeometry::StDcaGeometry()
00046 {
00047 memset(mBeg,0,mEnd-mBeg+1);
00048 }
00049
00050 StDcaGeometry::~StDcaGeometry() {}
00051
00052 StThreeVectorF StDcaGeometry::origin() const
00053 {
00054 float x = -mImp*sin(mPsi);
00055 float y = mImp*cos(mPsi);
00056 return StThreeVectorF(x,y,mZ);
00057 }
00058
00059 StThreeVectorF StDcaGeometry::momentum() const
00060 {
00061 float ptt = pt();
00062 float x = ptt*cos(mPsi);
00063 float y = ptt*sin(mPsi);
00064 float z = ptt*mTan;
00065 return StThreeVectorF(x,y,z);
00066 }
00067
00068 void StDcaGeometry::set(const float pars[7],const float errs[15])
00069 {
00070 if (pars) memcpy(&mImp ,pars,sizeof(float)*6 );
00071 if (errs) memcpy(&mImpImp,errs,sizeof(float)*15);
00072 }
00073 void StDcaGeometry::set(const double pars[7],const double errs[15])
00074 {
00075 if (pars) TCL::ucopy(pars, &mImp, 6);
00076 if (errs) TCL::ucopy(errs, &mImpImp, 15);
00077 }
00078
00079 StPhysicalHelixD StDcaGeometry::helix() const
00080 {
00081
00082 int h = (mCurv>=0) ? 1:-1;
00083
00084 double phase = mPsi-h*M_PI/2;
00085
00086 return StPhysicalHelixD(fabs(mCurv),
00087 atan(mTan),
00088 phase,
00089 origin(),
00090 h);
00091 }
00092
00093 THelixTrack StDcaGeometry::thelix() const
00094 {
00095 enum {kImp,kZ,kPsi,kPti,kTan};
00096
00097 StThreeVectorD pos = origin();
00098 StThreeVectorD dir = momentum().unit();
00099 THelixTrack myHelx(&(pos.x()),&(dir.x()),mCurv);
00100 double errXY[6],errSZ[6];
00101 const float *myErr = &mImpImp;
00102 int jjx=0,jjz=0;
00103 for (int i=0,li=0;i<5; li+=++i) {
00104 for (int j=0;j<=i;j++) {
00105 do {
00106 if(i==kZ || i==kTan) break;
00107 if(j==kZ || j==kTan) break;
00108 errXY[jjx++]=myErr[li+j];
00109 }
00110 while(0);
00111 do {
00112 if(i!=kZ && i!=kTan) break;
00113 if(j!=kZ && j!=kTan) break;
00114 errSZ[jjz++]=myErr[li+j];
00115 }
00116 while(0);
00117 } }
00118 errXY[3]*=hz();errXY[4]*=hz();errXY[5]*=hz()*hz();
00119 myHelx.SetEmx(errXY,errSZ);
00120 return myHelx;
00121 }
00122
00123 ostream& operator<<(ostream& os, const StDcaGeometry& dca) {
00124 const Float_t *errMx = dca.errMatrix();
00125 return os << Form("\tDca: imp %7.2f +/-%7.2f,Z %7.2f +/-%7.2f,psi %7.2f +/-%7.2f, q/pT %7.2f +/-%6.1f,TanL %8.3f +/-%8.3f",
00126 dca.impact(), (errMx[0] >= 0) ? TMath::Sqrt(errMx[0]) : -13,
00127 dca.z(), (errMx[2] >= 0) ? TMath::Sqrt(errMx[2]) : -13,
00128 dca.psi(), (errMx[5] >= 0) ? TMath::Sqrt(errMx[5]) : -13,
00129 dca.charge()*dca.pt(), (errMx[9] >= 0 && dca.pt() > 0) ? 100*TMath::Sqrt(errMx[9])*dca.pt() : -13,
00130 dca.tanDip(), (errMx[14] >= 0) ? TMath::Sqrt(errMx[14]): -13);
00131 }
00132
00133 void StDcaGeometry::Print(Option_t *option) const {cout << *this << endl;}
00134
00135 void StDcaGeometry::GetXYZ(Double_t xyzp[6], Double_t CovXyzp[21]) const {
00136 static const Float_t one = 1;
00137 Double_t sinP = TMath::Sin(mPsi);
00138 Double_t cosP = TMath::Cos(mPsi);
00139 Double_t pT = pt();
00140 xyzp[0] = - mImp*sinP;
00141 xyzp[1] = mImp*cosP;
00142 xyzp[2] = mZ;
00143 xyzp[3] = pT*cosP;
00144 xyzp[4] = pT*sinP;
00145 xyzp[5] = pT*mTan;
00146 Double_t dpTdPti = -pT*pT*TMath::Sign(one,mPti);
00147 Double_t f[30] = {
00148
00149 -sinP, 0, -mImp*cosP, 0, 0
00150 ,cosP, 0, -mImp*sinP, 0, 0
00151 , 0, 1, 0, 0, 0
00152 , 0, 0, -pT*sinP, dpTdPti*cosP, 0
00153 , 0, 0, pT*cosP, dpTdPti*sinP, 0
00154 , 0, 0, 0, dpTdPti*mTan, pT
00155 };
00156 TRMatrix F(6,5,f);
00157 TRSymMatrix C(5,errMatrix());
00158 TRSymMatrix Cov(F,TRArray::kAxSxAT,C);
00159 TCL::ucopy(Cov.GetArray(),CovXyzp,21);
00160 }