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;
981 FillTpcdX(track,node,hh);
983 fillResHack(hh,stiHit,node);
985 assert(lastNode && fistNode && (lastNode != fistNode));
987 StThreeVectorF posL(lastNode->x_g(),lastNode->y_g(),lastNode->z_g());
988 detInfo->setLastPoint (posL);
989 StThreeVectorF posF(fistNode->x_g(),fistNode->y_g(),fistNode->z_g());
990 detInfo->setFirstPoint(posF);
1004 StiHit *ihit = node->getHit();
1007 if (node->getDetector()) {
1008 double dif = (hitpos-origin).mag();
1011 dif = node->z_g()-ihit->z_g();
1013 printf(
"***Track(%d) DIFF TOO BIG %g chi2 = %g %g\n",track->getId(),dif,node->getChi2(),nowChi2);
1014 printf(
"H=%g %g %g N =%g %g %g\n",ihit->
x() ,ihit->y() ,ihit->z()
1015 ,node->getX(),node->getY(),node->getZ());
1017 printf(
"H=%g %g %g N =%g %g %g\n",mp->position().x(),mp->position().y(),mp->position().z()
1018 ,origin.x(),origin.y(),origin.z());
1020 assert(fabs(dif)<50.);
1026 int ibad = origin.bad();
1028 cout <<
"StiStEventFiller::fillGeometry() Encountered non-finite numbers!!!! Bail out completely!!! " << endl;
1029 cout <<
"StThreeVectorF::bad() = " << ibad << endl;
1030 cout <<
"Last node had:" << endl;
1031 cout <<
"Ref Position " << node->getRefPosition() << endl;
1032 cout <<
"node->getY() " << node->getY() << endl;
1033 cout <<
"node->getZ() " << node->getZ() << endl;
1034 cout <<
"Ref Angle " << node->getAlpha() << endl;
1035 cout <<
"origin " << origin << endl;
1042 node->getDipAngle(),
1045 node->getHelicity());
1048 gTrack->setOuterGeometry(geometry);
1050 gTrack->setGeometry(geometry);
1072 unsigned short geantIdPidHyp = 9999;
1078 float x[6],covMFloat[15];
1083 assert(chi2[0]<100);
1087 if (gTrack->type()==primary) {
1088 assert(node->getDetector()==0);
1089 chi2[1]=node->getChi2();
1099 int dets[kMaxDetectorId][3];
1102 for (
int i=1;i<kMaxDetectorId;i++) {
1103 if (!dets[i][2])
continue;
1104 fitTraits.setNumberOfFitPoints((
unsigned char)dets[i][2],(StDetectorId)i);
1106 if (gTrack->type()==primary) {
1107 fitTraits.setPrimaryVertexUsedInFit(
true);
1109 gTrack->setFitTraits(fitTraits);
1149 if (gTrack->type()==global) {
1152 else if (gTrack->type()==primary) {
1157 int svtFitPoints = fitTrait.numberOfFitPoints(kSvtId);
1158 int ssdFitPoints = fitTrait.numberOfFitPoints(kSsdId);
1159 int pxlFitPoints = fitTrait.numberOfFitPoints(kPxlId);
1160 int istFitPoints = fitTrait.numberOfFitPoints(kIstId);
1171 if (svtFitPoints+ssdFitPoints+pxlFitPoints+istFitPoints>0) {
1172 if (gTrack->type()==global) {
1175 else if (gTrack->type()==primary) {
1181 Int_t NoTpcFitPoints = dinfo->numberOfPoints(kTpcId);
1182 Int_t NoFtpcWestId = dinfo->numberOfPoints(kFtpcWestId);
1183 Int_t NoFtpcEastId = dinfo->numberOfPoints(kFtpcEastId);
1186 if (NoTpcFitPoints >= 11) {
1187 const StPtrVecHit& hits = dinfo->hits(kTpcId);
1188 Int_t Nhits = hits.size();
1189 Int_t NoWrongSignZ = 0;
1190 Int_t NoPositiveSignZ = 0;
1191 Int_t NoNegativeSignZ = 0;
1192 Int_t NoPromptHits = 0;
1193 Double_t zE = -200, zW = 200;
1194 Int_t rE = 0, rW = 0;
1195 Int_t nW = 0, nE = 0;
1196 for (Int_t i = 0; i < Nhits; i++) {
1198 Double_t z = hit->position().z();
1199 Int_t sector = hit->sector();
1200 if (sector <= 12) nW++;
1202 Int_t row = hit->padrow();
1203 if ((z < -1.0 && sector <= 12) ||
1204 (z > 1.0 && sector > 12)) NoWrongSignZ++;
1206 if (z < -1.0) {NoNegativeSignZ++;
if (z > zE) {zE = z; rE = row;}}
1207 if (z > 1.0) {NoPositiveSignZ++;
if (z < zW) {zW = z; rW = row;}}
1209 if (TMath::Abs(209.4 - TMath::Abs(z)) < 3.0) NoPromptHits++;
1211 if (NoWrongSignZ >= 2) gTrack->setPostCrossingTrack();
1213 if (NoPromptHits == 1) gTrack->setPromptTrack();
1214 if (NoPositiveSignZ >= 2 && NoNegativeSignZ >=2) {
1216 TMath::Abs(rW - rE) < 3)
1217 gTrack->setMembraneCrossingTrack();
1220 if (nW > 0 && nE == 0) gTrack->setWestTpcOnly();
1221 if (nW == 0 && nE > 0) gTrack->setEastTpcOnly();
1223 if (NoTpcFitPoints < 11 && NoFtpcWestId < 5 && NoFtpcEastId < 5) {
1226 gTrack->setRejected();
1227 flag = - ((flag/100)*100 + 2);
1232 int evtTime = mEvent->time();
1233 bool doShort2EMC = (evtTime < 1538352000 || evtTime > 1633046400);
1234 bool doShort2ETOF = (evtTime > 1525910400);
1236 if ((doShort2EMC || doShort2ETOF) && gTrack->geometry()) {
1238 const float eta = momentum.pseudoRapidity();
1239 if (TMath::Abs(eta) > 0.5) {
1241 const StPtrVecHit& hits = dinfo->hits();
1242 Int_t Nhits = hits.size();
1243 Bool_t ShortTrack2EMC = kFALSE;
1244 Bool_t ShortTrack2ETOF = kFALSE;
1245 for (Int_t i = 0; i < Nhits; i++) {
1247 if (doShort2EMC && eta > 0.5 && hit->position().z() > 150.0) {
1248 ShortTrack2EMC = kTRUE;
1251 if (doShort2ETOF && eta < -0.5 && hit->position().z() < -150.0) {
1252 ShortTrack2ETOF = kTRUE;
1256 if (ShortTrack2EMC) {
1257 gTrack->setShortTrack2EMC();
1258 flag = (TMath::Abs(flag)/100)*100+11;
1259 }
else if (ShortTrack2ETOF) {
1260 gTrack->setShortTrack2ETOF();
1261 flag = (TMath::Abs(flag)/100)*100+12;
1268 gTrack->setFlag( flag);
1269 if (gTrack->type()==global) {
1273 mFastDetectorMatcher->matchTrack2FastDetectors(&hlx,&t);
1274 if (t.btofBin > 0) {
1275 if (t.mBtof > 0) gTrack->setToFMatched();
1276 else gTrack->setToFNotMatched();
1279 if (t.mCtb > 0) gTrack->setCtbMatched();
1280 else gTrack->setCtbNotMatched();
1282 if (t.bemcBin > 0 || t.eemcBin > 0) {
1284 if (t.bemcBin > 0) {
1285 W = StBemcHitList::instance()->getFired(t.bemcBin);
1286 if (W > 0) gTrack->setBemcMatched();
1287 else gTrack->setBemcNotMatched();
1288 }
else if (t.eemcBin > 0) {
1289 W = StEemcHitList::instance()->getFired(t.eemcBin);
1290 if (W > 0) gTrack->setEemcMatched();
1291 else gTrack->setEemcNotMatched();
1294 UInt_t fext = gTrack->flagExtension();
1298 gTrack->setFlagExtension(fext);
1301 }
else if (gTrack->type()==primary) {
1304 StTrack *t = n->track(global);
1306 gTrack->setFlagExtension(t->flagExtension());
1328 gTrack->setEncodedMethod(mStiEncoded);
1330 assert(tlen >0.0 && tlen<1000.);
1331 gTrack->setLength(tlen);
1336 int dets[kMaxDetectorId][3];
1338 for (
int i=1;i<kMaxDetectorId;i++) {
1339 if(!dets[i][0])
continue;
1340 gTrack->setNumberOfPossiblePoints((
unsigned char)dets[i][0],(StDetectorId)i);
1342 fillGeometry(gTrack, track,
false);
1343 fillGeometry(gTrack, track,
true );
1344 fillFitTraits(gTrack, track);
1345 gTrack->setDetectorInfo(detInfo);
1346 StuFixTopoMap(gTrack);
1348 if (!track->
isPrimary()) fillDca(gTrack,track);
1357 if (nFittedPoints < 5 )
return 0;
1359 if (nFittedPoints < 10 && nFittedPoints*2 < nPossiblePoints)
return 0;
1360 if(track->
getPt()<=0.1)
return 0;
1363 if(track->
getChi2()>100)
return 0;
1378 originD->setX(node->x_g());
1379 originD->setY(node->y_g());
1380 originD->setZ(node->z_g());
1384 node->getDipAngle(),
1387 node->getHelicity());
1391 return physicalHelix->
distance(vertexPosition);
1408 aux.xnl[0] = node->getX();
1409 aux.xnl[1] = node->getY();
1410 aux.xnl[2] = node->getZ();
1412 aux.xhl[0] = stiHit->
x();
1413 aux.xhl[1] = stiHit->y();
1414 aux.xhl[2] = stiHit->z();
1416 aux.ca = node->getEta();
1418 aux.nYY = node->getCyy();
1419 aux.nZZ = node->getCzz();
1420 aux.hYY = node->getEyy();
1421 aux.hZZ = node->getEzz();
1423 aux.unl[0] = node->getX();
1424 aux.unl[1] = node->unTouched().mPar[0];
1425 aux.unl[2] = node->unTouched().mPar[1];
1426 aux.uYY = sqrt(node->unTouched().mErr[0]);
1427 aux.uZZ = sqrt(node->unTouched().mErr[2]);
1431 aux.xng[0] = node->x_g();
1432 aux.xng[1] = node->y_g();
1433 aux.xng[2] = node->z_g();
1435 aux.xhg[0] = stiHit->
x_g();
1436 aux.xhg[1] = stiHit->y_g();
1437 aux.xhg[2] = stiHit->z_g();
1438 aux.psi = node->getPsi();
1439 aux.dip = node->getDipAngle();
1441 double chi2 = node->getChi2();
if (chi2>1000) chi2=1000;
1443 int id = mAux->AddIt(&aux);
1458 if (!tNode->isDca())
return;
1461 float alfa = tNode->getAlpha();
1462 Float_t setp[7] = {(float)pars.y(), (float)pars.z(), (float)pars.eta()
1463 ,(float)pars.ptin(), (float)pars.tanl(), (float)pars.curv(), (float)pars.hz()};
1466 for (
int i=1,li=1,jj=0;i< kNPars;li+=++i) {
1467 for (
int j=1;j<=i;j++) {sete[jj++]=errs.G()[li+j];}}
1469 gTrack->setDcaGeometry(dca);
1470 dca->set(setp,sete);
1477 if (! tpcHit)
return;
1478 if (! node || ! hh)
return;
1479 originD->setX(node->x_g());
1480 originD->setY(node->y_g());
1481 originD->setZ(node->z_g());
1484 node->getDipAngle(),
1487 node->getHelicity());
1488 StThreeVectorD upper(tpcHit->positionU().x(),tpcHit->positionU().y(),tpcHit->positionU().z());
1489 StThreeVectorD lower(tpcHit->positionL().x(),tpcHit->positionL().y(),tpcHit->positionL().z());
1490 StThreeVectorD middle(tpcHit->position().x(),tpcHit->position().y(),tpcHit->position().z());
1494 s[0] = physicalHelix->
pathLength(upper, normal);
1495 s[1] = physicalHelix->
pathLength(lower, normal);
1496 Double_t dx = TMath::Abs(s[0]) + TMath::Abs(s[1]);
1502 double stiErr[6],stErr[6];
1503 memcpy(stiErr,node->hitErrs(),
sizeof(stiErr));
1504 double alfa = node->getAlpha();
1505 double c = cos(alfa);
1506 double s = sin(alfa);
1507 double T[3][3]={{c,-s, 0}
1513 hh->setPositionError(f3);
1518 enum dcaEmx {kImpImp,
1520 kPsiImp, kPsiZ, kPsiPsi,
1521 kPtiImp, kPtiZ, kPtiPsi, kPtiPti,
1522 kTanImp, kTanZ, kTanPsi, kTanPti, kTanTan};
1525 if (!mPullEvent)
return;
1526 if (gloPri && track->
isPrimary()!=1)
return;
1530 int dets[kMaxDetectorId][3];
1533 aux.mVertex = (
unsigned char)track->
isPrimary();
1534 aux.mTrackNumber=track->getId();
1535 aux.nAllHits = dets[0][2];
1536 aux.nTpcHits = dets[kTpcId][2];
1537 aux.nSvtHits = dets[kSvtId][2];
1538 aux.nSsdHits = dets[kSsdId][2];
1539 aux.nPxlHits = dets[kPxlId][2];
1540 aux.nIstHits = dets[kIstId][2];
1543 aux.mCurv = myDca->curvature();
1544 aux.mPt = myDca->pt();
1545 aux.mPsi = myDca->psi();
1546 aux.mDip = myDca->dipAngle();
1548 aux.mRxy = v3.perp();
1549 aux.mPhi = v3.phi();
1552 const float *errMx = myDca->errMatrix();
1553 aux.mPtErr = sqrt(errMx[kPtiPti])*aux.mPt*aux.mPt;
1554 double c2dip = myDca->tanDip(); c2dip = 1./(1.+c2dip*c2dip);
1555 aux.mPsiErr = sqrt(errMx[kPsiPsi]);
1556 aux.mDipErr = sqrt(errMx[kTanTan])*c2dip;
1557 aux.mRxyErr = sqrt(errMx[kImpImp]);
1558 aux.mZErr = sqrt(errMx[kZZ]);
1560 aux.mIdTruTk = gTrack->idTruth();
1561 aux.mQaTruTk = gTrack->qaTruth();
1562 mPullEvent->Add(aux,gloPri);
1567 for (;tNode!=eNode;++tNode)
1570 if(!node->isValid())
continue;
1572 StiHit *stiHit = node->getHit();
1573 if (!stiHit)
continue;
1575 if (node->getChi2()>1000)
continue;
1576 if (!node->isFitted())
continue;
1578 const StiDetector *detector = node->getDetector();
1579 assert(detector == stiHit->
detector());
1580 assert(!detector || stiHit->
timesUsed());
1582 fillPulls(hh,stiHit,node,track,dets,gloPri);
1583 if (gloPri)
continue;
1584 fillPulls(hh,stiHit,node,track,dets,2);
1588 void StiStEventFiller::fillPulls(
StHit *stHit,
const StiHit *stiHit
1591 ,
int dets[1][3],
int gloPriRnd)
1593 double x,y,z,r,xp,yp,zp,rp;
1598 inf = node->getInfo();
1601 double timeFlight = node->getTime();
1602 const StiNodeErrs &mFE = (inf)? inf->mPE : node->fitErrs();
1603 const StiNodePars &mFP = (inf)? inf->mPP : node->fitPars();
1605 memcpy(mHrr.G(), (inf)? inf->mHrr.G() : node->hitErrs(),
sizeof(
StiHitErrs));
1610 aux.mIdTruth = stHit->idTruth();
1611 aux.mQaTruth = stHit->qaTruth();
1613 aux.mVertex = (
unsigned char)track->
isPrimary();
1614 aux.nHitCand = node->getHitCand();
1615 aux.iHitCand = node->getIHitCand();
1616 if (!aux.nHitCand) aux.nHitCand=1;
1617 aux.lXHit = stiHit->
x();
1618 aux.lYHit = stiHit->y(timeFlight);
1619 aux.lZHit = stiHit->z(timeFlight);
1620 aux.lYHitErr = sqrt(mHrr.hYY);
1621 aux.lZHitErr = sqrt(mHrr.hZZ);
1622 aux.lHitEmx[0] = mHrr.hYY;
1623 aux.lHitEmx[1] = mHrr.hZY;
1624 aux.lHitEmx[2] = mHrr.hZZ;
1627 aux.lXFit = mFP.x();
1628 aux.lYFit = mFP.y();
1629 aux.lZFit = mFP.z();
1630 aux.lYFitErr = sqrt(mFE._cYY);
1631 aux.lZFitErr = sqrt(mFE._cZZ);
1632 aux.lFitEmx[0] = mFE._cYY;
1633 aux.lFitEmx[1] = mFE._cZY;
1634 aux.lFitEmx[2] = mFE._cZZ;
1639 yp = (inf)? mFP.y(): (double)node->unTouched().mPar[0];
1640 zp = (inf)? mFP.z(): (double)node->unTouched().mPar[1];
1641 aux.lYPul = aux.lYHit-yp;
1642 aux.lZPul = aux.lZHit-zp;
1643 if (fabs(aux.lYPul)>10) StiDebug::Break(-1);
1644 if (fabs(aux.lZPul)>10) StiDebug::Break(-1);
1645 if (!inf) {TCL::ucopy(node->unTouched().mErr,untErrs,3);}
1646 else {TCL::ucopy(aux.lFitEmx ,untErrs,3);}
1648 assert(untErrs[0]>=0);
1649 assert(untErrs[2]>=0);
1651 TCL::vadd(untErrs,aux.lHitEmx,aux.lPulEmx,3);
1652 aux.lYPulErr = sqrt(aux.lPulEmx[0]);
1653 aux.lZPulErr = sqrt(aux.lPulEmx[2]);
1655 aux.lPsi = mFP.eta();
1656 aux.lDip = atan(mFP.tanl());
1659 double alfa = node->getAlpha();
1663 x = stiHit->
x(); y = stiHit->y(timeFlight); z = stiHit->z(timeFlight);
1667 aux.gPHit = atan2(stiHit->y_g(),stiHit->
x_g());
1668 aux.gZHit = stiHit->z_g();
1669 memset(F[0],0,
sizeof(F));
1673 aux.gPHitErr = sqrt(aux.gHitEmx[0]);
1674 aux.gZHitErr = sqrt(aux.gHitEmx[2]);
1678 x = mFP.x(); y = mFP.y();z = mFP.z();
1681 aux.gPFit = NICE(atan2(y,x)+alfa);
1684 memset(F[0],0,
sizeof(F));
1688 aux.gPFitErr = sqrt(aux.gFitEmx[0]);
1689 aux.gZFitErr = sqrt(aux.gFitEmx[2]);
1692 rp = sqrt(xp*xp+yp*yp);
1693 aux.gPPul = ((aux.gPHit-alfa)-atan2(yp,xp))*rp;
1694 aux.gZPul = aux.lZHit-zp;
1695 memset(F[0],0,
sizeof(F));
1696 F[0][0]= xp/(rp*rp);
1699 TCL::vadd(aux.gHitEmx,aux.gPulEmx,aux.gPulEmx,3);
1701 aux.gPulEmx[0]*= rp*rp;
1702 aux.gPulEmx[1]*= rp;
1703 aux.gPPulErr = sqrt(aux.gPulEmx[0]);
1704 aux.gZPulErr = sqrt(aux.gPulEmx[2]);
1706 aux.gPsi = node->getPsi();
1707 aux.gDip = node->getDipAngle();
1710 aux.mCurv = mFP.curv();
1711 aux.mPt = fabs(1./mFP.ptin());
1712 aux.mCharge = stHit->charge();
1713 aux.mChi2 = node->getChi2();
1714 aux.mNormalRefAngle = alfa;
1715 aux.mHardwarePosition=0;
1717 aux.mTrackNumber=track->getId();
1718 aux.nAllHits = dets[0][2];
1719 aux.nTpcHits = dets[kTpcId][2];
1720 aux.nSvtHits = dets[kSvtId][2];
1721 aux.nSsdHits = dets[kSsdId][2];
1722 aux.nPxlHits = dets[kPxlId][2];
1723 aux.nIstHits = dets[kIstId][2];
1726 aux.mHardwarePosition=stHit->hardwarePosition();
1727 aux.mDetector=stHit->detector();
1729 aux.mNormalRadius = place->getNormalRadius();
1730 aux.mNormalYOffset = place->getNormalYoffset();
1733 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.
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
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)