13 #include "StEStructTrack.h"
14 #include "StPhysicalHelix.hh"
15 #include "SystemOfUnits.h"
17 #ifndef ST_NO_NAMESPACES
18 using namespace units;
41 mBxPrimary =
track->BxPrimary();
42 mByPrimary =
track->ByPrimary();
43 mBzPrimary =
track->BzPrimary();
45 mBxGlobal =
track->BxGlobal();
46 mByGlobal =
track->ByGlobal();
47 mBzGlobal =
track->BzGlobal();
49 mPIDe_dEdx =
track->PIDe_dEdx();
50 mPIDpi_dEdx =
track->PIDpi_dEdx();
51 mPIDp_dEdx =
track->PIDp_dEdx();
52 mPIDk_dEdx =
track->PIDk_dEdx();
53 mPIDd_dEdx =
track->PIDd_dEdx();
55 mPIDe_ToF =
track->PIDe_ToF();
56 mPIDpi_ToF =
track->PIDpi_ToF();
57 mPIDp_ToF =
track->PIDp_ToF();
58 mPIDk_ToF =
track->PIDk_ToF();
59 mPIDd_ToF =
track->PIDd_ToF();
61 mChi2 =
track->Chi2();
62 mBeta =
track->beta();
63 mDedx =
track->Dedx();
64 mAssignedMass=
track->AssignedMass();
66 mNFitPoints =
track->NFitPoints();
67 mNFoundPoints =
track->NFoundPoints();
68 mNMaxPoints =
track->NMaxPoints();
70 mDetectorID =
track->DetectorID();
71 mFlag =
track->Flag();
73 mCharge =
track->Charge();
75 mMap[0] =
track->TopologyMapData(0);
76 mMap[1] =
track->TopologyMapData(1);
77 mTPCNHits =
track->TopologyMapTPCNHits();
79 mHelix =
track->Helix();
84 if(
track->isComplete()){
86 mStartPos=
track->StartPos();
87 FillTpcReferencePoints();
95 void StEStructTrack::FillTransientData(){
97 if (0 != StEStructTrack::BField) {
98 StThreeVectorD momentum(mPx,mPy,mPz);
99 StThreeVectorD origin(mBxPrimary,mByPrimary,mBzPrimary);
100 origin += StEStructTrack::PrimVertex;
101 mHelix =
StPhysicalHelixD(momentum,origin,StEStructTrack::BField*kilogauss,mCharge);
116 void StEStructTrack::evalYt(){
117 float _r=mPt/0.13957;
118 mYt = log(sqrt(1+_r*_r)+_r);
120 mytbin=(int) floor((mYt-1.0)/0.5);
121 if(mytbin>6)mytbin=6;
122 if(mytbin<0)mytbin=0;
126 void StEStructTrack::evalXt(){
137 float PionMass = 0.139;
138 float mt = Mt(PionMass);
139 mXt = 1 - exp( -1*(mt-PionMass)/0.4 );
145 void StEStructTrack::evalPID(){
154 float pi = fabs(mPIDpi_dEdx);
155 float k = fabs(mPIDk_dEdx);
156 float p = fabs(mPIDp_dEdx);
165 if (fabs(k)>2 && fabs(p)>2) {
172 if (fabs(pi)>2 && fabs(p)>2) {
179 if (fabs(pi)>2 && fabs(k)>2) {
190 double tnpi = mPIDpi_ToF;
191 double tnK = mPIDk_ToF;
192 double tnp = mPIDp_ToF;
199 if (0.05 < mMass && mMass <= 0.25) {
202 }
else if (0.4 < mMass && mMass <= 0.65) {
205 }
else if (0.8 < mMass && mMass <= 1.15) {
211 if (mPID_dEdx==2 && mPID_ToF==2) {
213 if (dpi==2 && tpi==2) {
215 }
else if (dK==2 && tK==2) {
217 }
else if (dp==2 && tp==2) {
222 }
else if (mPID_dEdx==2) {
225 if (dpi==2 && tpi==1) {
227 }
else if (dK==2 && tK==1) {
229 }
else if (dp==2 && tp==1) {
245 }
else if (mPID_ToF==2) {
248 if (tpi==2 && dpi==1) {
250 }
else if (tK==2 && dK==1) {
252 }
else if (tp==2 && dp==1) {
268 }
else if (0 == mDedx && 0 == mBeta) {
269 if (pi < 0.1 && tnpi < 0.1) {
271 }
else if (k < 0.1 && tnK < 0.1) {
273 }
else if (p < 0.1 && tnp < 0.1) {
284 void StEStructTrack::evalCurvature(){
289 double b = mHelix.h();
290 double c = mHelix.curvature();
291 mCurvature = -mHelix.h()*fabs(mHelix.curvature());
296 void StEStructTrack::evalFourMomentum(
const float mass){
299 if(lMass<=0)lMass=0.13957;
301 mFourMomentum.setPx(mPx);
302 mFourMomentum.setPy(mPy);
303 mFourMomentum.setPz(mPz);
304 mFourMomentum.setE(sqrt(mPt*mPt+mPz*mPz+lMass*lMass));
309 void StEStructTrack::FillTpcReferencePoints() {
321 pairD candidates = mHelix.pathLength(200.0);
322 double sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
323 double endLength = mHelix.pathLength(WestEnd,EndCapNormal);
325 if (endLength < 0.0) {
327 endLength = mHelix.pathLength(EastEnd,EndCapNormal);
331 double firstExitLength = endLength;
332 if (endLength > sideLength) {
334 firstExitLength = sideLength;
336 mEndCapOuter = endcap;
338 mNominalTpcExitPoint = mHelix.at(firstExitLength);
340 candidates = mHelix.pathLength(50.0);
341 sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
342 mNominalTpcEntrancePoint = mHelix.at(sideLength);
346 mMidTPCRadius = 127.0;
347 candidates = mHelix.pathLength(mMidTPCRadius);
348 sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
349 mMidTpcPoint = mHelix.at(sideLength);
353 mOuterMidTPCRadius = 163.5;
354 candidates = mHelix.pathLength(mOuterMidTPCRadius);
355 sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
356 firstExitLength = endLength;
357 if (endLength > sideLength) {
359 firstExitLength = sideLength;
361 mEndCapOuterMid = endcap;
363 mOuterMidTpcPoint = mHelix.at(firstExitLength);
366 double curve = mHelix.curvature();
367 if (curve > 0.000001) {
368 mMaxRadius = 2/curve;
370 mMaxRadius = 99999.0;
374 mEndCapRadius = sqrt(vendcap.x()*vendcap.x() + vendcap.y()*vendcap.y());
385 Float_t StEStructTrack::Pt()
const {
return mPt; };
386 Float_t StEStructTrack::Ptot()
const {
return mPtot; };
388 Float_t StEStructTrack::Mt(Float_t mass)
const {
389 return sqrt((mPt*mPt)+(mass*mass));
392 Float_t StEStructTrack::E(Float_t mass)
const {
393 return sqrt((mPt*mPt)+(mPz*mPz)+(mass*mass));
396 Float_t StEStructTrack::Yt(Float_t mass)
const {
400 Float_t E = this->E(mass);
401 return 0.5*log((E+mPt)/(E-mPt));
405 Float_t StEStructTrack::Eta(Float_t mass)
const {
409 return this->Rapidity(mass);
413 Float_t StEStructTrack::Rapidity(Float_t mass)
const {
414 Float_t E = this->E(mass);
415 return 0.5*log((E+mPz)/(E-mPz));
418 Float_t StEStructTrack::Dca()
const {
419 return (sqrt((mBxPrimary*mBxPrimary)+(mByPrimary*mByPrimary)+(mBzPrimary*mBzPrimary)));
422 Float_t StEStructTrack::DcaPrimary()
const {
423 return (sqrt((mBxPrimary*mBxPrimary)+(mByPrimary*mByPrimary)+(mBzPrimary*mBzPrimary)));
426 Float_t StEStructTrack::DcaGlobal()
const {
427 return (sqrt((mBxGlobal*mBxGlobal)+(mByGlobal*mByGlobal)+(mBzGlobal*mBzGlobal)));