558 #include "RVersion.h"
559 #if ROOT_VERSION_CODE < 331013
562 #include "TCernLib.h"
571 #include "StPhysicalHelix.hh"
572 #include "StThreeVector.hh"
573 #include "StThreeVectorF.hh"
574 #include "PhysicalConstants.h"
575 #include "SystemOfUnits.h"
576 #include "StTrackDefinitions.h"
577 #include "StTrackMethod.h"
578 #include "StDedxMethod.h"
581 #include "StPrimaryVertex.h"
582 #include "StEventTypes.h"
583 #include "StDetectorId.h"
584 #include "StHelix.hh"
585 #include "StDcaGeometry.h"
589 #include "StEventUtilities/StEventHelper.h"
590 #include "StEventUtilities/StuFixTopoMap.cxx"
592 #include "Sti/StiTrackContainer.h"
594 #include "StDetectorDbMaker/StiKalmanTrackFitterParameters.h"
597 #include "StiUtilities/StiPullEvent.h"
600 #include "StiMaker/StiStEventFiller.h"
602 #include "StTrack2FastDetectorMatcher.h"
603 #include "Sti/StiHitTest.h"
604 #define NICE(angle) StiKalmanTrackNode::nice((angle))
605 map<StiKalmanTrack*, StTrackNode*> StiStEventFiller::mTrkNodeMap;
606 map<StTrackNode*, StiKalmanTrack*> StiStEventFiller::mNodeTrkMap;
610 StiStEventFiller::StiStEventFiller() : mEvent(0), mTrackStore(0), mFastDetectorMatcher(0)
612 fgStiStEventFiller =
this;
635 unsigned short bit = 1 << tpcOther;
636 mStiEncoded = kITKalmanFitId + bit;
640 StiStEventFiller::~StiStEventFiller()
642 delete physicalHelix; physicalHelix=0;
643 delete originD; originD =0;
644 SafeDelete(mFastDetectorMatcher);
645 cout <<
"StiStEventFiller::~StiStEventFiller()"<<endl;
702 mFastDetectorMatcher->Clear();
703 mFastDetectorMatcher->fillArrays(e);
708 cout <<
"StiStEventFiller::fillEvent(). ERROR:\t"
709 <<
"Null StEvent ("<<e<<
") || StiTrackContainer ("<<t<<
"). Exit"<<endl;
713 StEventHelper::Remove(mEvent,
"StSPtrVecTrackNode");
714 StEventHelper::Remove(mEvent,
"StSPtrVecPrimaryVertex");
716 if (mUseAux) { mAux =
new StiAux; e->Add(mAux);}
718 memset(mUsedHits,0,
sizeof(mUsedHits));
719 memset(mUsedGits,0,
sizeof(mUsedGits));
722 StSPtrVecTrackNode& trNodeVec = mEvent->trackNodes();
723 StSPtrVecTrackDetectorInfo& detInfoVec = mEvent->trackDetectorInfo();
726 int fillTrackCount1=0;
727 int fillTrackCount2=0;
728 int fillTrackCountG=0;
731 for (
int trackIt = 0;trackIt <(int)mTrackStore->size(); trackIt++)
734 if (!accept(kTrack))
continue;
745 fillTrack(gTrack,kTrack,detInfo);
747 detInfoVec.push_back(detInfo);
749 gTrack->setKey(kTrack->getId());
750 gTrack->setIdTruth();
751 trackNode->addTrack(gTrack);
752 trNodeVec.push_back(trackNode);
759 mTrkNodeMap.insert(pair<StiKalmanTrack*,StTrackNode*> (kTrack,node) );
760 mNodeTrkMap.insert(pair<StTrackNode*,StiKalmanTrack*> (node,kTrack) );
761 if (trackNode->entries(global)<1)
762 cout <<
"StiStEventFiller::fillEvent() -E- Track Node has no entries!! -------------------------" << endl;
763 int ibad = gTrack->bad();
766 if (errh.Say(ibad).Contains(
"Negative"))
continue;
767 printf(
"GTrack error: %s\n",errh.Say(ibad).Data());
773 fillPulls(kTrack,gTrack,0);
778 catch (runtime_error & rte )
780 cout <<
"StiStEventFiller::fillEvent() -W- runtime-e filling track"<<rte.what() << endl;
787 cout <<
"StiStEventFiller::fillEvent() -W- Unknown exception filling track."<<endl;
794 cout <<
"There were "<<errorCount<<
"runtime_error while filling StEvent"<<endl;
796 cout <<
"StiStEventFiller::fillEvent() -I- Number of filled as global(1):"<< fillTrackCount1<<endl;
797 cout <<
"StiStEventFiller::fillEvent() -I- Number of filled as global(2):"<< fillTrackCount2<<endl;
798 cout <<
"StiStEventFiller::fillEvent() -I- Number of filled GOOD globals:"<< fillTrackCountG<<endl;
800 for (
int ij=1; ij<=mUsedHits[0]; ij++) {
801 if (!mUsedHits[ij])
continue;
802 const char *det = detectorNameById((StDetectorId)ij);
803 cout <<
"StiStEventFiller::fillEvent() -I- Number of used hits:"<< det <<
"(" << ij <<
") :"<<mUsedHits[ij]
804 <<
" per track:"<<double(mUsedHits[ij])/fillTrackCount2 <<endl;
806 for (
int ij=1; ij<=mUsedGits[0]; ij++) {
807 if (!mUsedGits[ij])
continue;
808 const char *det = detectorNameById((StDetectorId)ij);
809 cout <<
"StiStEventFiller::fillEvent() -I- Number of GOOD hits:"<< det <<
"(" << ij <<
") :"<<mUsedGits[ij]
810 <<
" per track:"<<double(mUsedHits[ij])/fillTrackCountG <<endl;
817 void StiStEventFiller::fillEventPrimaries()
821 if (!mTrkNodeMap.size())
823 cout <<
"StiStEventFiller::fillEventPrimaries(). ERROR:\t"
824 <<
"Mapping between the StTrackNodes and the StiKalmanTracks is empty. Exit." << endl;
829 StSPtrVecTrackDetectorInfo& detInfoVec = mEvent->trackDetectorInfo();
830 cout <<
"StiStEventFiller::fillEventPrimaries() -I- Tracks in container:" << mTrackStore->size() << endl;
831 int mTrackN=0,mVertN=0;
832 int fillTrackCount1=0;
833 int fillTrackCount2=0;
834 int fillTrackCountG=0;
836 int nTracks = mTrackStore->size();
842 for (mTrackN=0; mTrackN<nTracks;++mTrackN) {
844 if (!accept(kTrack))
continue;
845 map<StiKalmanTrack*, StTrackNode*>::iterator itKtrack = mTrkNodeMap.find(kTrack);
846 if (itKtrack == mTrkNodeMap.end())
continue;
849 nTRack = (*itKtrack).second;
850 assert(nTRack->entries()<=10);
851 assert(nTRack->entries(global));
859 assert(gTrack->key()==kTrack->getId());
863 for (mVertN=0; (vertex = mEvent->primaryVertex(mVertN));mVertN++) {
865 double zPrim = vertexPosition.z();
867 float globalDca = impactParameter(gTrack,vertexPosition);
868 if (fabs(minDca) > fabs(globalDca)) minDca = globalDca;
872 StiHit *pHit = lastNode->getHit();
874 if (fabs(pHit->z_g()-zPrim)>0.1)
continue;
882 auto myDif = (detInfo->firstPoint()-vertexPosition);
886 pTrack->setKey( gTrack->key());
887 nTRack->addTrack(pTrack);
888 fillTrack(pTrack,kTrack, detInfo);
890 detInfoVec.push_back(detInfo);
892 vertex->addDaughter(pTrack);
893 fillPulls(kTrack,gTrack,1);
894 int ibad = pTrack->bad();
905 if (pTrack->geometry()->momentum().mag()<0.1)
break;
909 kTrack->setDca(minDca);
910 gTrack->setImpactParameter(minDca);
911 if (pTrack) pTrack->setImpactParameter(minDca);
914 for (mVertN=0; (vertex = mEvent->primaryVertex(mVertN));mVertN++) {vertex->setTrackNumbers();}
917 cout <<
"StiStEventFiller::fillEventPrimaries() -I- Primaries (1):"<< fillTrackCount1 <<endl;
918 cout <<
"StiStEventFiller::fillEventPrimaries() -I- Primaries (2):"<< fillTrackCount2 <<endl;
919 cout <<
"StiStEventFiller::fillEventPrimaries() -I- GOOD:"<< fillTrackCountG <<endl;
932 int dets[kMaxDetectorId][3];
934 int nTotHits = dets[0][2];
935 int nTpcHits = dets[kTpcId][2];
936 for (
int i=1;i<kMaxDetectorId;i++) {
937 if (!dets[i][1])
continue;
938 detInfo->setNumberOfPoints(dets[i][1],static_cast<StDetectorId>(i));
943 for (;tNode!=eNode;++tNode)
946 if(!node->isValid())
continue;
948 StiHit *stiHit = node->getHit();
949 if (!stiHit)
continue;
951 if (node->getChi2()>1000)
continue;
952 if (!node->isFitted())
continue;
955 assert(detector == stiHit->
detector());
956 assert(!detector || stiHit->
timesUsed());
957 if (!fistNode) fistNode = node;
959 if (!detector)
continue;
963 int gid = detector->getGroupId();
964 if (mUsedHits[0]<gid) mUsedHits[0]=gid;
967 if (mUsedGits[0]<gid) mUsedGits[0]=gid;
973 assert(detector->getGroupId()==hh->detector());
976 FillStHitErr(hh,node);
978 detInfo->addHit(hh,refCountIncr);
979 if (!refCountIncr)
continue;
982 fillResHack(hh,stiHit,node);
984 assert(lastNode && fistNode && (lastNode != fistNode));
986 StThreeVectorF posL(lastNode->x_g(),lastNode->y_g(),lastNode->z_g());
987 detInfo->setLastPoint (posL);
988 StThreeVectorF posF(fistNode->x_g(),fistNode->y_g(),fistNode->z_g());
989 detInfo->setFirstPoint(posF);
1003 StiHit *ihit = node->getHit();
1006 if (node->getDetector()) {
1007 double dif = (hitpos-origin).mag();
1010 dif = node->z_g()-ihit->z_g();
1012 printf(
"***Track(%d) DIFF TOO BIG %g chi2 = %g %g\n",track->getId(),dif,node->getChi2(),nowChi2);
1013 printf(
"H=%g %g %g N =%g %g %g\n",ihit->
x() ,ihit->y() ,ihit->z()
1014 ,node->getX(),node->getY(),node->getZ());
1016 printf(
"H=%g %g %g N =%g %g %g\n",mp->position().x(),mp->position().y(),mp->position().z()
1017 ,origin.x(),origin.y(),origin.z());
1019 assert(fabs(dif)<50.);
1025 int ibad = origin.bad();
1027 cout <<
"StiStEventFiller::fillGeometry() Encountered non-finite numbers!!!! Bail out completely!!! " << endl;
1028 cout <<
"StThreeVectorF::bad() = " << ibad << endl;
1029 cout <<
"Last node had:" << endl;
1030 cout <<
"Ref Position " << node->getRefPosition() << endl;
1031 cout <<
"node->getY() " << node->getY() << endl;
1032 cout <<
"node->getZ() " << node->getZ() << endl;
1033 cout <<
"Ref Angle " << node->getAlpha() << endl;
1034 cout <<
"origin " << origin << endl;
1041 node->getDipAngle(),
1044 node->getHelicity());
1047 gTrack->setOuterGeometry(geometry);
1049 gTrack->setGeometry(geometry);
1071 unsigned short geantIdPidHyp = 9999;
1077 float x[6],covMFloat[15];
1082 assert(chi2[0]<100);
1086 if (gTrack->type()==primary) {
1087 assert(node->getDetector()==0);
1088 chi2[1]=node->getChi2();
1098 int dets[kMaxDetectorId][3];
1101 for (
int i=1;i<kMaxDetectorId;i++) {
1102 if (!dets[i][2])
continue;
1103 fitTraits.setNumberOfFitPoints((
unsigned char)dets[i][2],(StDetectorId)i);
1105 if (gTrack->type()==primary) {
1106 fitTraits.setPrimaryVertexUsedInFit(
true);
1108 gTrack->setFitTraits(fitTraits);
1148 if (gTrack->type()==global) {
1151 else if (gTrack->type()==primary) {
1156 int svtFitPoints = fitTrait.numberOfFitPoints(kSvtId);
1157 int ssdFitPoints = fitTrait.numberOfFitPoints(kSsdId);
1158 int pxlFitPoints = fitTrait.numberOfFitPoints(kPxlId);
1159 int istFitPoints = fitTrait.numberOfFitPoints(kIstId);
1170 if (svtFitPoints+ssdFitPoints+pxlFitPoints+istFitPoints>0) {
1171 if (gTrack->type()==global) {
1174 else if (gTrack->type()==primary) {
1180 Int_t NoTpcFitPoints = dinfo->numberOfPoints(kTpcId);
1181 Int_t NoFtpcWestId = dinfo->numberOfPoints(kFtpcWestId);
1182 Int_t NoFtpcEastId = dinfo->numberOfPoints(kFtpcEastId);
1185 if (NoTpcFitPoints >= 11) {
1186 const StPtrVecHit& hits = dinfo->hits(kTpcId);
1187 Int_t Nhits = hits.size();
1188 Int_t NoWrongSignZ = 0;
1189 Int_t NoPositiveSignZ = 0;
1190 Int_t NoNegativeSignZ = 0;
1191 Int_t NoPromptHits = 0;
1192 Double_t zE = -200, zW = 200;
1193 Int_t rE = 0, rW = 0;
1194 Int_t nW = 0, nE = 0;
1195 for (Int_t i = 0; i < Nhits; i++) {
1197 Double_t z = hit->position().z();
1198 Int_t sector = hit->sector();
1199 if (sector <= 12) nW++;
1201 Int_t row = hit->padrow();
1202 if ((z < -1.0 && sector <= 12) ||
1203 (z > 1.0 && sector > 12)) NoWrongSignZ++;
1205 if (z < -1.0) {NoNegativeSignZ++;
if (z > zE) {zE = z; rE = row;}}
1206 if (z > 1.0) {NoPositiveSignZ++;
if (z < zW) {zW = z; rW = row;}}
1208 if (TMath::Abs(209.4 - TMath::Abs(z)) < 3.0) NoPromptHits++;
1210 if (NoWrongSignZ >= 2) gTrack->setPostCrossingTrack();
1212 if (NoPromptHits == 1) gTrack->setPromptTrack();
1213 if (NoPositiveSignZ >= 2 && NoNegativeSignZ >=2) {
1215 TMath::Abs(rW - rE) < 3)
1216 gTrack->setMembraneCrossingTrack();
1219 if (nW > 0 && nE == 0) gTrack->setWestTpcOnly();
1220 if (nW == 0 && nE > 0) gTrack->setEastTpcOnly();
1222 if (NoTpcFitPoints < 11 && NoFtpcWestId < 5 && NoFtpcEastId < 5) {
1225 gTrack->setRejected();
1226 flag = - ((flag/100)*100 + 2);
1231 int evtTime = mEvent->time();
1232 bool doShort2EMC = (evtTime < 1538352000 || evtTime > 1633046400);
1233 bool doShort2ETOF = (evtTime > 1525910400);
1235 if ((doShort2EMC || doShort2ETOF) && gTrack->geometry()) {
1237 const float eta = momentum.pseudoRapidity();
1238 if (TMath::Abs(eta) > 0.5) {
1240 const StPtrVecHit& hits = dinfo->hits();
1241 Int_t Nhits = hits.size();
1242 Bool_t ShortTrack2EMC = kFALSE;
1243 Bool_t ShortTrack2ETOF = kFALSE;
1244 for (Int_t i = 0; i < Nhits; i++) {
1246 if (doShort2EMC && eta > 0.5 && hit->position().z() > 150.0) {
1247 ShortTrack2EMC = kTRUE;
1250 if (doShort2ETOF && eta < -0.5 && hit->position().z() < -150.0) {
1251 ShortTrack2ETOF = kTRUE;
1255 if (ShortTrack2EMC) {
1256 gTrack->setShortTrack2EMC();
1257 flag = (TMath::Abs(flag)/100)*100+11;
1258 }
else if (ShortTrack2ETOF) {
1259 gTrack->setShortTrack2ETOF();
1260 flag = (TMath::Abs(flag)/100)*100+12;
1267 gTrack->setFlag( flag);
1268 if (gTrack->type()==global) {
1272 mFastDetectorMatcher->matchTrack2FastDetectors(&hlx,&t);
1273 if (t.btofBin > 0) {
1274 if (t.mBtof > 0) gTrack->setToFMatched();
1275 else gTrack->setToFNotMatched();
1278 if (t.mCtb > 0) gTrack->setCtbMatched();
1279 else gTrack->setCtbNotMatched();
1281 if (t.bemcBin > 0 || t.eemcBin > 0) {
1283 if (t.bemcBin > 0) {
1284 W = StBemcHitList::instance()->getFired(t.bemcBin);
1285 if (W > 0) gTrack->setBemcMatched();
1286 else gTrack->setBemcNotMatched();
1287 }
else if (t.eemcBin > 0) {
1288 W = StEemcHitList::instance()->getFired(t.eemcBin);
1289 if (W > 0) gTrack->setEemcMatched();
1290 else gTrack->setEemcNotMatched();
1293 UInt_t fext = gTrack->flagExtension();
1297 gTrack->setFlagExtension(fext);
1300 }
else if (gTrack->type()==primary) {
1303 StTrack *t = n->track(global);
1305 gTrack->setFlagExtension(t->flagExtension());
1327 gTrack->setEncodedMethod(mStiEncoded);
1329 assert(tlen >0.0 && tlen<1000.);
1330 gTrack->setLength(tlen);
1335 int dets[kMaxDetectorId][3];
1337 for (
int i=1;i<kMaxDetectorId;i++) {
1338 if(!dets[i][0])
continue;
1339 gTrack->setNumberOfPossiblePoints((
unsigned char)dets[i][0],(StDetectorId)i);
1341 fillGeometry(gTrack, track,
false);
1342 fillGeometry(gTrack, track,
true );
1343 fillFitTraits(gTrack, track);
1344 gTrack->setDetectorInfo(detInfo);
1345 StuFixTopoMap(gTrack);
1347 if (!track->
isPrimary()) fillDca(gTrack,track);
1356 if (nFittedPoints < 5 )
return 0;
1358 if (nFittedPoints < 10 && nFittedPoints*2 < nPossiblePoints)
return 0;
1359 if(track->
getPt()<=0.1)
return 0;
1362 if(track->
getChi2()>100)
return 0;
1377 originD->setX(node->x_g());
1378 originD->setY(node->y_g());
1379 originD->setZ(node->z_g());
1383 node->getDipAngle(),
1386 node->getHelicity());
1390 return physicalHelix->
distance(vertexPosition);
1407 aux.xnl[0] = node->getX();
1408 aux.xnl[1] = node->getY();
1409 aux.xnl[2] = node->getZ();
1411 aux.xhl[0] = stiHit->
x();
1412 aux.xhl[1] = stiHit->y();
1413 aux.xhl[2] = stiHit->z();
1415 aux.ca = node->getEta();
1417 aux.nYY = node->getCyy();
1418 aux.nZZ = node->getCzz();
1419 aux.hYY = node->getEyy();
1420 aux.hZZ = node->getEzz();
1422 aux.unl[0] = node->getX();
1423 aux.unl[1] = node->unTouched().mPar[0];
1424 aux.unl[2] = node->unTouched().mPar[1];
1425 aux.uYY = sqrt(node->unTouched().mErr[0]);
1426 aux.uZZ = sqrt(node->unTouched().mErr[2]);
1430 aux.xng[0] = node->x_g();
1431 aux.xng[1] = node->y_g();
1432 aux.xng[2] = node->z_g();
1434 aux.xhg[0] = stiHit->
x_g();
1435 aux.xhg[1] = stiHit->y_g();
1436 aux.xhg[2] = stiHit->z_g();
1437 aux.psi = node->getPsi();
1438 aux.dip = node->getDipAngle();
1440 double chi2 = node->getChi2();
if (chi2>1000) chi2=1000;
1442 int id = mAux->AddIt(&aux);
1457 if (!tNode->isDca())
return;
1460 float alfa = tNode->getAlpha();
1461 Float_t setp[7] = {(float)pars.y(), (float)pars.z(), (float)pars.eta()
1462 ,(float)pars.ptin(), (float)pars.tanl(), (float)pars.curv(), (float)pars.hz()};
1465 for (
int i=1,li=1,jj=0;i< kNPars;li+=++i) {
1466 for (
int j=1;j<=i;j++) {sete[jj++]=errs.G()[li+j];}}
1468 gTrack->setDcaGeometry(dca);
1469 dca->set(setp,sete);
1475 double stiErr[6],stErr[6];
1476 memcpy(stiErr,node->hitErrs(),
sizeof(stiErr));
1477 double alfa = node->getAlpha();
1478 double c = cos(alfa);
1479 double s = sin(alfa);
1480 double T[3][3]={{c,-s, 0}
1486 hh->setPositionError(f3);
1491 enum dcaEmx {kImpImp,
1493 kPsiImp, kPsiZ, kPsiPsi,
1494 kPtiImp, kPtiZ, kPtiPsi, kPtiPti,
1495 kTanImp, kTanZ, kTanPsi, kTanPti, kTanTan};
1498 if (!mPullEvent)
return;
1499 if (gloPri && track->
isPrimary()!=1)
return;
1503 int dets[kMaxDetectorId][3];
1506 aux.mVertex = (
unsigned char)track->
isPrimary();
1507 aux.mTrackNumber=track->getId();
1508 aux.nAllHits = dets[0][2];
1509 aux.nTpcHits = dets[kTpcId][2];
1510 aux.nSvtHits = dets[kSvtId][2];
1511 aux.nSsdHits = dets[kSsdId][2];
1512 aux.nPxlHits = dets[kPxlId][2];
1513 aux.nIstHits = dets[kIstId][2];
1516 aux.mCurv = myDca->curvature();
1517 aux.mPt = myDca->pt();
1518 aux.mPsi = myDca->psi();
1519 aux.mDip = myDca->dipAngle();
1521 aux.mRxy = v3.perp();
1522 aux.mPhi = v3.phi();
1525 const float *errMx = myDca->errMatrix();
1526 aux.mPtErr = sqrt(errMx[kPtiPti])*aux.mPt*aux.mPt;
1527 double c2dip = myDca->tanDip(); c2dip = 1./(1.+c2dip*c2dip);
1528 aux.mPsiErr = sqrt(errMx[kPsiPsi]);
1529 aux.mDipErr = sqrt(errMx[kTanTan])*c2dip;
1530 aux.mRxyErr = sqrt(errMx[kImpImp]);
1531 aux.mZErr = sqrt(errMx[kZZ]);
1533 aux.mIdTruTk = gTrack->idTruth();
1534 aux.mQaTruTk = gTrack->qaTruth();
1535 mPullEvent->Add(aux,gloPri);
1540 for (;tNode!=eNode;++tNode)
1543 if(!node->isValid())
continue;
1545 StiHit *stiHit = node->getHit();
1546 if (!stiHit)
continue;
1548 if (node->getChi2()>1000)
continue;
1549 if (!node->isFitted())
continue;
1551 const StiDetector *detector = node->getDetector();
1552 assert(detector == stiHit->
detector());
1553 assert(!detector || stiHit->
timesUsed());
1555 fillPulls(hh,stiHit,node,track,dets,gloPri);
1556 if (gloPri)
continue;
1557 fillPulls(hh,stiHit,node,track,dets,2);
1561 void StiStEventFiller::fillPulls(
StHit *stHit,
const StiHit *stiHit
1564 ,
int dets[1][3],
int gloPriRnd)
1566 double x,y,z,r,xp,yp,zp,rp;
1571 inf = node->getInfo();
1574 double timeFlight = node->getTime();
1575 const StiNodeErrs &mFE = (inf)? inf->mPE : node->fitErrs();
1576 const StiNodePars &mFP = (inf)? inf->mPP : node->fitPars();
1578 memcpy(mHrr.G(), (inf)? inf->mHrr.G() : node->hitErrs(),
sizeof(
StiHitErrs));
1583 aux.mIdTruth = stHit->idTruth();
1584 aux.mQaTruth = stHit->qaTruth();
1586 aux.mVertex = (
unsigned char)track->
isPrimary();
1587 aux.nHitCand = node->getHitCand();
1588 aux.iHitCand = node->getIHitCand();
1589 if (!aux.nHitCand) aux.nHitCand=1;
1590 aux.lXHit = stiHit->
x();
1591 aux.lYHit = stiHit->y(timeFlight);
1592 aux.lZHit = stiHit->z(timeFlight);
1593 aux.lYHitErr = sqrt(mHrr.hYY);
1594 aux.lZHitErr = sqrt(mHrr.hZZ);
1595 aux.lHitEmx[0] = mHrr.hYY;
1596 aux.lHitEmx[1] = mHrr.hZY;
1597 aux.lHitEmx[2] = mHrr.hZZ;
1600 aux.lXFit = mFP.x();
1601 aux.lYFit = mFP.y();
1602 aux.lZFit = mFP.z();
1603 aux.lYFitErr = sqrt(mFE._cYY);
1604 aux.lZFitErr = sqrt(mFE._cZZ);
1605 aux.lFitEmx[0] = mFE._cYY;
1606 aux.lFitEmx[1] = mFE._cZY;
1607 aux.lFitEmx[2] = mFE._cZZ;
1612 yp = (inf)? mFP.y(): (double)node->unTouched().mPar[0];
1613 zp = (inf)? mFP.z(): (double)node->unTouched().mPar[1];
1614 aux.lYPul = aux.lYHit-yp;
1615 aux.lZPul = aux.lZHit-zp;
1616 if (fabs(aux.lYPul)>10) StiDebug::Break(-1);
1617 if (fabs(aux.lZPul)>10) StiDebug::Break(-1);
1618 if (!inf) {TCL::ucopy(node->unTouched().mErr,untErrs,3);}
1619 else {TCL::ucopy(aux.lFitEmx ,untErrs,3);}
1621 assert(untErrs[0]>=0);
1622 assert(untErrs[2]>=0);
1624 TCL::vadd(untErrs,aux.lHitEmx,aux.lPulEmx,3);
1625 aux.lYPulErr = sqrt(aux.lPulEmx[0]);
1626 aux.lZPulErr = sqrt(aux.lPulEmx[2]);
1628 aux.lPsi = mFP.eta();
1629 aux.lDip = atan(mFP.tanl());
1632 double alfa = node->getAlpha();
1636 x = stiHit->
x(); y = stiHit->y(timeFlight); z = stiHit->z(timeFlight);
1640 aux.gPHit = atan2(stiHit->y_g(),stiHit->
x_g());
1641 aux.gZHit = stiHit->z_g();
1642 memset(F[0],0,
sizeof(F));
1646 aux.gPHitErr = sqrt(aux.gHitEmx[0]);
1647 aux.gZHitErr = sqrt(aux.gHitEmx[2]);
1651 x = mFP.x(); y = mFP.y();z = mFP.z();
1654 aux.gPFit = NICE(atan2(y,x)+alfa);
1657 memset(F[0],0,
sizeof(F));
1661 aux.gPFitErr = sqrt(aux.gFitEmx[0]);
1662 aux.gZFitErr = sqrt(aux.gFitEmx[2]);
1665 rp = sqrt(xp*xp+yp*yp);
1666 aux.gPPul = ((aux.gPHit-alfa)-atan2(yp,xp))*rp;
1667 aux.gZPul = aux.lZHit-zp;
1668 memset(F[0],0,
sizeof(F));
1669 F[0][0]= xp/(rp*rp);
1672 TCL::vadd(aux.gHitEmx,aux.gPulEmx,aux.gPulEmx,3);
1674 aux.gPulEmx[0]*= rp*rp;
1675 aux.gPulEmx[1]*= rp;
1676 aux.gPPulErr = sqrt(aux.gPulEmx[0]);
1677 aux.gZPulErr = sqrt(aux.gPulEmx[2]);
1679 aux.gPsi = node->getPsi();
1680 aux.gDip = node->getDipAngle();
1683 aux.mCurv = mFP.curv();
1684 aux.mPt = fabs(1./mFP.ptin());
1685 aux.mCharge = stHit->charge();
1686 aux.mChi2 = node->getChi2();
1687 aux.mNormalRefAngle = alfa;
1688 aux.mHardwarePosition=0;
1690 aux.mTrackNumber=track->getId();
1691 aux.nAllHits = dets[0][2];
1692 aux.nTpcHits = dets[kTpcId][2];
1693 aux.nSvtHits = dets[kSvtId][2];
1694 aux.nSsdHits = dets[kSsdId][2];
1695 aux.nPxlHits = dets[kPxlId][2];
1696 aux.nIstHits = dets[kIstId][2];
1699 aux.mHardwarePosition=stHit->hardwarePosition();
1700 aux.mDetector=stHit->detector();
1702 aux.mNormalRadius = place->getNormalRadius();
1703 aux.mNormalYOffset = place->getNormalYoffset();
1706 mPullEvent->Add(aux,gloPriRnd);
StiKalmanTrackNode * getInnOutMostNode(int inot, int qua) const
Same for getNNodes(qua)
void setParameters(double c, double dip, double phase, const StThreeVector< double > &o, int h)
starting point
StiKalmanTrackNode * getInnerMostHitNode(int qua=0) const
Accessor method returns the inner most hit node associated with the track.
Definition of Kalman Track.
static void hftHist(const char *tit, const StiKalmanTrack *tk)
void fillFlags(StTrack *track)
StiKalmanTrackNode * getLastNode() const
Accessor method returns the last node associated with the track.
void getAllPointCount(int count[1][3], int maxDetId) const
Returns all the PointCount far all detectors and types of nodes.
const Float_t & x() const
Return the local x, y, z values.
StThreeVectorF getGlobalMomentumF() const
const StiDetector * detector() const
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix
Float_t x_g() const
Return the global x, y, z values.
int getFitPointCount(int detectorId=0) const
Returns the number of hits associated and used in the fit of this track.
StiKalmanTrackNode * getInnerMostNode(int qua=0) const
Accessor method returns the inner most node associated with the track.
int getPointCount(int detectorId=0) const
Return the number of hits associated with this track.
Definition of Kalman Track.
static float * trasat(const float *a, const float *s, float *r, int m, int n)
UInt_t timesUsed() const
Return the number of times this hit was assigned to a track.
UShort_t getSeedHitCount() const
number of hits used to seed the track
double evaluateChi2(const StiHit *hit)
double getTrackLength() const
double getCurvature() const
Calculates and returns the tangent of the track pitch angle at this node.
void fillEvent(StEvent *e, StiTrackContainer *t)
void getGlobalTpt(float x[6], float e[15])
Extract state information from this node in TPT representation.
const StMeasuredPoint * stHit() const
double getPt() const
Calculates and returns the transverse momentum of the track at the inner most node.
void fillDetectorInfo(StTrackDetectorInfo *detInfo, StiKalmanTrack *kTrack, bool refCountIncr)