12 #include <gear/TPCParameters.h> 13 #include <gear/BField.h> 14 #include <gearimpl/Vector3D.h> 17 #include <EVENT/LCEvent.h> 18 #include <IMPL/LCCollectionVec.h> 19 #include <UTIL/BitField64.h> 20 #include <UTIL/ILDConf.h> 21 #include <IMPL/TrackerHitImpl.h> 22 #include <IMPL/TrackImpl.h> 23 #include <IMPL/LCFlagImpl.h> 24 #include <Exceptions.h> 35 static bool comparePixelsZ(tp_Pixel* one, tp_Pixel* two) {
36 return ((one->getZ()) < (two->getZ()));
39 static bool comparePixelsS(tp_Pixel* one, tp_Pixel* two) {
40 return ((one->getArcLength()) < (two->getArcLength()));
43 static bool compareSegments(tp_PixelSegment* one, tp_PixelSegment* two) {
44 return ((one->getLength()) > (two->getLength()));
50 TimePixLocalRoadSearchProcessor::TimePixLocalRoadSearchProcessor() :
51 Processor(
"TimePixLocalRoadSearchProcessor") {
53 _description =
"TimePixLocalRoadSearchProcessor is intended to ...";
55 registerInputCollection(LCIO::TRACKERHIT,
"InputHits",
"Name of the input Hit Collection",
_inputColName,
string(
"TPCHits"));
56 registerOutputCollection(LCIO::TRACK,
"OutputTracks",
"Name of the output Track Collection",
_outputColName,
57 string(
"RoadSearchTracks"));
59 registerOptionalParameter(
"BFieldScaleFactor",
"Scales magnetic field (map), use 1.0 (default) for field ON or 0.0 for field OFF",
62 registerProcessorParameter(
"MinTrackLevel",
"Min. track level",
_minTrackLevel,
int(1));
64 registerProcessorParameter(
"MacroPixelSize",
"Macro pixel (bin) size",
_mpSize,
int(32));
66 registerProcessorParameter(
"MinZmeas",
"Min. measured Z value",
_minZmeas,
double(0.001));
68 registerProcessorParameter(
"MaxZmeas",
"Max. measured Z value",
_maxZmeas,
double(600.));
70 registerProcessorParameter(
"SigmaZ",
"Resolution in Z (for clustering)",
_sigmaZ,
double(3.0));
72 registerProcessorParameter(
"Xoffset",
"Offset in x of (local) coordinate system",
_xOffset,
double(0.));
74 registerProcessorParameter(
"Yoffset",
"Offset in y of (local) coordinate system",
_yOffset,
double(1500.));
76 registerProcessorParameter(
"MaxMult",
"Max. multiplicity for road seeding bins",
_maxMult,
int(3));
78 registerProcessorParameter(
"MinPixels",
"Min. number of pixels for road seeding macro pixel",
_minPixels,
int(3));
80 registerOptionalParameter(
"MinDist",
"Min. distance for road seeding bins",
_minDist,
int(2));
82 registerOptionalParameter(
"MaxPull2XY",
"Max. pull squared to road in XY",
_maxPull2XY,
double(15.));
84 registerOptionalParameter(
"MaxPull2Z",
"Max. pull squared to road in Z",
_maxPull2Z,
double(15.));
86 registerOptionalParameter(
"MaxChi2",
"Max. Chi2/Ndf for road",
_maxChi2,
double(5.));
88 registerOptionalParameter(
"MaxSvar",
"Max. relative arc-length variance for road",
_maxSvar,
double(0.15));
90 registerOptionalParameter(
"MaxGap",
"Max. (arc-length) gap for road",
_maxGap,
double(4.));
92 registerOptionalParameter(
"OctoboardOffset",
"Octoboard number offset (in module=(octo+offset)/scale)",
_octoOffset,
int(8));
94 registerOptionalParameter(
"OctoboardScale",
"Octoboard number scale (in module=(octo+offset)/scale)",
_octoScale,
int(12));
96 registerOptionalParameter(
"Chi2CutChip",
"Max. Chi2/Ndf for chip segment matching",
_chi2CutChip,
double(30.));
98 registerOptionalParameter(
"Chi2CutOcto",
"Max. Chi2/Ndf for octoboard segment matching",
_chi2CutOcto,
double(30.));
100 registerOptionalParameter(
"Chi2CutMod",
"Max. Chi2/Ndf for module segment matching",
_chi2CutMod,
double(50.));
102 registerOptionalParameter(
"DistCut",
"Max. relative (to track length sum) distance (of centers) for segment matching",
_distCut,
105 registerOptionalParameter(
"ReferencePointAtPca",
"Use PCA as reference point, else 1. hit",
_refAtPCA,
bool(
false));
111 streamlog_out(DEBUG) <<
" init() called " << endl;
120 std::clock_t start1 = std::clock();
122 streamlog_out(DEBUG) <<
"Event Number: " << evt->getEventNumber() << endl;
125 LCCollection* inputCol = 0;
127 LCCollectionVec* outputCol =
new LCCollectionVec(LCIO::TRACK);
128 LCFlagImpl trkFlag(0);
129 trkFlag.setBit(LCIO::TRBIT_HITS);
130 outputCol->setFlag(trkFlag.getFlag());
135 }
catch (DataNotAvailableException &e) {
141 Vector3D bfield = marlin::Global::GEAR->getBField().at(theTPCCenter);
145 streamlog_out(DEBUG) <<
"BField(GEAR) is OFF" << std::endl;
147 streamlog_out(DEBUG) <<
"BField(GEAR) is ON" << std::endl;
158 int nInput = inputCol->getNumberOfElements();
172 for (
int iInput = 0; iInput < nInput; iInput++) {
173 TrackerHit* Hit =
dynamic_cast<TrackerHit*
>(inputCol->getElementAt(iInput));
174 int chip = Hit->getCellID1();
175 double zMeas = Hit->getPosition()[2];
180 pixelData[chip].push_back(somePixel);
184 streamlog_out(DEBUG) <<
"Event " << evt->getEventNumber() <<
" in run " << evt->getRunNumber() <<
", number of input hits: " 185 << nInput <<
", accepted (in Z): " << nAccepted << endl;
189 for (chipPixelMapType::iterator itChip = pixelData.begin(); itChip != pixelData.end(); ++itChip) {
193 pixelChips.push_back(someChip);
200 for (pixelChipListType::iterator itChip = pixelChips.begin(); itChip != pixelChips.end(); ++itChip) {
204 streamlog_out(DEBUG) <<
" found " << pixelChips.size() <<
" TimePix chips with " << numSeg <<
" segments " << endl;
209 for (pixelChipListType::iterator itChip = pixelChips.begin(); itChip != pixelChips.end(); ++itChip) {
210 const int iOcto = (*itChip)->getId() / 8;
212 if (segments.size() > 0) chipSegmentMap[iOcto].insert(chipSegmentMap[iOcto].
end(), segments.begin(), segments.end());
216 for (pixelSegmentListMapType::iterator itOcto = chipSegmentMap.begin(); itOcto != chipSegmentMap.end(); ++itOcto) {
217 const int iOcto = itOcto->first;
222 octoSegmentMap[iMod].insert(octoSegmentMap[iMod].
end(), combinedSegments.begin(), combinedSegments.end());
225 for (pixelSegmentListMapType::iterator itMod = octoSegmentMap.begin(); itMod != octoSegmentMap.end(); ++itMod) {
226 const int iMod = itMod->first;
229 modSegmentList.insert(modSegmentList.end(), combinedSegments.begin(), combinedSegments.end());
235 sort(trackCandidates.begin(), trackCandidates.end(), compareSegments);
239 streamlog_out(DEBUG) <<
" found " << trackCandidates.size() <<
" track candidates " << endl;
242 for (pixelSegmentListType::iterator itSeg = trackCandidates.begin(); itSeg != trackCandidates.end(); ++itSeg) {
245 TrackImpl* theTrack =
new TrackImpl();
249 for (macroPixelListType::iterator itMpix = macroPixels.begin(); itMpix != macroPixels.end(); ++itMpix) {
251 allPixels.insert(allPixels.end(), pixels.begin(), pixels.end());
254 sort(allPixels.begin(), allPixels.end(), comparePixelsS);
257 allPixels.front()->getPos(posFirst);
259 double refPos[] = { 0., 0., 0. };
261 refPos[0] = posFirst[0];
262 refPos[1] = posFirst[1];
263 refPos[2] = posFirst[2];
265 float refPoint[3] = { refPos[0] -
_xOffset, refPos[1] -
_yOffset, refPos[2] };
267 TVectorD parameters(5);
268 TMatrixDSym covariance(5);
269 (*itSeg)->getLCIOStateAtRefPoint(refPos, parameters, covariance);
271 theTrack->setOmega(parameters[2]);
272 theTrack->setTanLambda(parameters[4]);
273 theTrack->setPhi(parameters[1]);
274 theTrack->setD0(parameters[0]);
275 theTrack->setZ0(parameters[3]);
276 theTrack->setChi2((*itSeg)->getChi2());
277 theTrack->setNdf((*itSeg)->getNdf());
278 theTrack->setReferencePoint(refPoint);
284 float rInner = sqrt(pow(posFirst[0], 2) + pow(posFirst[1], 2));
285 theTrack->setRadiusOfInnermostHit(rInner);
287 float compressedCovariance[15];
289 for (
int i = 0; i < 5; ++i)
290 for (
int j = 0; j <= i; ++j)
291 compressedCovariance[ind++] = covariance[i][j];
292 theTrack->setCovMatrix(compressedCovariance);
294 for (pixelListType::iterator itP = allPixels.begin(); itP != allPixels.end(); ++itP) {
295 TrackerHit* Hit =
dynamic_cast<TrackerHit*
>(inputCol->getElementAt((*itP)->getHitNum()));
296 theTrack->addHit(Hit);
299 streamlog_out(DEBUG) <<
" +++ the found track has a chi^2 value of " << theTrack->getChi2() <<
" for ndf = " 300 << theTrack->getNdf() <<
" and the parameters [omega, tanLambda, phi0, d0, z0] = [" << theTrack->getOmega() <<
"," 301 << theTrack->getTanLambda() <<
"," << theTrack->getPhi() <<
"," << theTrack->getD0() <<
"," << theTrack->getZ0()
302 <<
"] at the reference position [" << refPoint[0] <<
"," << refPoint[1] <<
"," << refPoint[2] <<
"]." << endl;
304 outputCol->addElement(theTrack);
307 streamlog_out(DEBUG) <<
"TimePixLocalRoadSearch ... done!" << endl;
309 if (!outputCol->empty()) {
313 streamlog_out(DEBUG) << ((std::clock() - start1) / (
double) CLOCKS_PER_SEC) <<
" sec" << endl;
316 for (pixelSegmentListType::iterator itSeg = trackCandidates.begin(); itSeg != trackCandidates.end(); ++itSeg) {
319 trackCandidates.clear();
321 for (pixelChipListType::iterator itChip = pixelChips.begin(); itChip != pixelChips.end(); ++itChip) {
326 for (chipPixelMapType::iterator itChip = pixelData.begin(); itChip != pixelData.end(); ++itChip) {
327 for (pixelListType::iterator itP = itChip->second.begin(); itP != itChip->second.end(); ++itP) {
351 tp_Pixel::tp_Pixel(
const int iHit,
const TrackerHit& aHit,
const double xOffset,
const double yOffset) :
352 _hitNum(iHit), _chipNum(aHit.getCellID1()), _rowNum(aHit.getCellID0() / 256), _colNum(aHit.getCellID0() % 256), _posX(
353 aHit.getPosition()[0] + xOffset), _posY(aHit.getPosition()[1] + yOffset), _posZ(aHit.getPosition()[2]), _sigma2XY(
354 0.5 * (aHit.getCovMatrix()[0] + aHit.getCovMatrix()[2])), _sigma2Z(aHit.getCovMatrix()[5]), _used(false), _sarc(0.) {
445 _mpId(mpId), _size(mpSize), _entries(pixelList.size()), _pixels(pixelList),
_used(false) {
449 double sx, sy, sz, sxx, sxy, syy, szz, srxy, srz;
450 sx = sy = sz = sxx = sxy = syy = szz = srxy = srz = 0.;
452 for (pixelListType::iterator itP =
_pixels.begin(); itP !=
_pixels.end(); ++itP) {
453 int row = (*itP)->getRow();
454 int col = (*itP)->getCol();
461 sxx += pos[0] * pos[0];
462 sxy += pos[0] * pos[1];
463 syy += pos[1] * pos[1];
464 szz += pos[2] * pos[2];
465 srxy += (*itP)->getSigma2XY();
466 srz += (*itP)->getSigma2Z();
590 const double zRoadWidth) :
591 _binId(binId),
_size(mpSize), _numPix(0), _macroPixels() {
594 int ntot = pixelList.size();
596 pixelListType::iterator itFirst = pixelList.begin();
597 pixelListType::iterator itLast = pixelList.end();
603 double bestZPos = 0.;
604 pixelListType::iterator itStart = itFirst;
605 double zStart = (*itStart)->getZ();
606 pixelListType::iterator itBest = itStart;
608 double sumZ = zStart;
610 pixelListType::iterator itP = itStart;
611 while (++itP < itLast) {
612 if ((*itP)->getUsed())
continue;
614 double z = (*itP)->getZ();
615 if (z - zStart > 2. * zCoreWidth) {
616 if (numPix > bestNumPix) {
619 bestZPos = sumZ / numPix;
622 while (++itStart < itLast) {
623 if ((*itStart)->getUsed())
continue;
627 zStart = (*itStart)->getZ();
628 if (z - zStart < 2. * zCoreWidth)
break;
634 if (numPix > bestNumPix) {
637 bestZPos = sumZ / numPix;
641 if (bestNumPix < 2)
break;
647 bool singleRow =
true;
648 bool singleCol =
true;
649 for (pixelListType::iterator itP = itFirst; itP != itLast; ++itP) {
650 if ((*itP)->getUsed())
continue;
651 if (abs((*itP)->getZ() - bestZPos) < zRoadWidth) {
652 pixels.push_back(*itP);
655 firstRow = (*itP)->getRow();
656 firstCol = (*itP)->getCol();
659 singleRow = singleRow && (firstRow == (*itP)->getRow());
660 singleCol = singleCol && (firstCol == (*itP)->getCol());
664 bestNumPix = pixels.size();
667 if (bestNumPix > 1 && !singleRow && !singleCol) {
676 if (itBest == itFirst) itFirst += bestNumPix;
678 if (itBest + bestNumPix == itLast) itLast -= bestNumPix;
725 double pos1[3], pos2[3];
726 mPixPair.first->getPos(pos1);
727 mPixPair.second->getPos(pos2);
729 const double distX = pos2[0] - pos1[0];
730 const double distY = pos2[1] - pos1[1];
731 const double dist2D = sqrt(distX * distX + distY * distY);
732 const double ex = distX / dist2D;
733 const double ey = distY / dist2D;
735 const double distZ = pos2[2] - pos1[2];
736 const double dzds = distZ / dist2D;
738 const double maxPull2XY = cuts[0];
739 const double maxPull2Z = cuts[1];
740 const double maxChi2 = cuts[2];
741 const double maxSvar = cuts[3];
742 const double maxGap = cuts[4];
745 for (pixelBinListType::iterator itBin = pixelBins.begin(); itBin != pixelBins.end(); ++itBin) {
747 for (macroPixelListType::iterator itMpix = mPixList.begin(); itMpix != mPixList.end(); ++itMpix) {
748 if ((*itMpix)->getUsed())
continue;
750 (*itMpix)->getPos(pos2);
751 const double resXY = (pos2[0] - pos1[0]) * ey - (pos2[1] - pos1[1]) * ex;
752 const double sArc = (pos2[0] - pos1[0]) * ex + (pos2[1] - pos1[1]) * ey;
753 const double resZ = pos2[2] - (pos1[2] + sArc * dzds);
756 const double pull2XY = (resXY * resXY + (*itMpix)->getVarXY(ey, -ex)) / (*itMpix)->getSigma2XY();
757 const double pull2Z = (resZ * resZ + (*itMpix)->getVarZ()) / (*itMpix)->getSigma2Z();
758 if (pull2XY > maxPull2XY || pull2Z > maxPull2Z)
continue;
760 const int nPix = (*itMpix)->getEntries();
765 sumChi2 += nPix * (pull2XY + pull2Z);
781 for (std::vector<double>::iterator itS =
_sList.begin(); itS !=
_sList.end(); ++itS) {
782 const double sArc = *itS;
785 sumS2 += sArc * sArc;
786 if (itS !=
_sList.begin()) {
787 const double gap = sArc - *(itS - 1);
788 mxGap = max(mxGap, gap);
793 const double sVar = (sumS2 - sumS1 * sumS1) / (sLen * sLen);
795 if (sVar > maxSvar || mxGap > maxGap)
return;
845 _segId(segId), _level(level), _bzc(Bzc), _npar((Bzc != 0.) ? 5 : 4),
_macroPixels(macroPixels), _parameters(_npar), _covariance(
850 for (macroPixelListType::iterator itMpix = macroPixels.begin(); itMpix != macroPixels.end(); ++itMpix) {
851 sumX += (*itMpix)->getX();
852 sumY += (*itMpix)->getY();
854 _refX = sumX / macroPixels.size();
855 _refY = sumY / macroPixels.size();
861 double pos[3], sArc, chi2XY, chi2ZS;
862 double parameters[] = { 0., 0., 0., 0., 0. };
864 int nParXY, nPointXY, nPointZS;
867 for (macroPixelListType::iterator itMpix = macroPixels.begin(); itMpix != macroPixels.end(); ++itMpix) {
869 for (pixelListType::iterator itP = pixels.begin(); itP != pixels.end(); ++itP) {
870 xyFit.
addPoint((*itP)->getX(), (*itP)->getY(), 1.0 / (*itP)->getSigma2XY());
873 nParXY = xyFit.
fit(chi2XY, nPointXY);
876 for (
int i = 0; i < nParXY; ++i)
884 for (macroPixelListType::iterator itMpix = macroPixels.begin(); itMpix != macroPixels.end(); ++itMpix) {
886 for (pixelListType::iterator itP = pixels.begin(); itP != pixels.end(); ++itP) {
889 (*itP)->setArcLength(sArc);
890 zsFit.
addPoint(sArc, pos[2] - _refZ, 1.0 / (*itP)->getSigma2Z());
894 sMin = min(sMin, sArc);
895 sMax = max(sMax, sArc);
900 zsFit.
fit(chi2ZS, nPointZS);
905 _chi2 = chi2XY + chi2ZS;
919 for (
int i = 0; i <
_npar; ++i)
921 std::cout << std::endl;
967 for (
int i = 0; i <
_npar; ++i)
996 double refPoint[3], par[5];
1000 TVectorD tmpPar(
_npar);
1003 hlx.
getStateAt(refPos[0], refPos[1], refPos[2], cov, tmpPar, tmpCov);
1005 newPar = hlx2LCIO * tmpPar;
1006 newCov = tmpCov.Similarity(hlx2LCIO);
1022 double refPoint1[3], refPoint2[3];
1026 const double distX = refPoint2[0] - refPoint1[0];
1027 const double distY = refPoint2[1] - refPoint1[1];
1028 const double distZ = refPoint2[2] - refPoint1[2];
1030 const double dist2D = sqrt(distX * distX + distY * distY) / combinedLength;
1033 if (dist2D < 0.25)
return false;
1035 if (dist2D > distCut)
return false;
1037 double par1[5], par2[5];
1043 const double fraction = this->
getLength() / combinedLength;
1044 const double xav = refPoint1[0] + fraction * distX;
1045 const double yav = refPoint1[1] + fraction * distY;
1046 const double zav = refPoint1[2] + fraction * distZ;
1050 hlx1.
getStateAt(xav, yav, zav, cov1, newPar1, newCov1);
1051 hlx2.
getStateAt(xav, yav, zav, cov2, newPar2, newCov2);
1052 TVectorD diffPar(newPar1 - newPar2);
1053 TMatrixDSym diffPrec(newCov1 + newCov2);
1056 double chi2 = diffPrec.Similarity(diffPar);
1058 return (chi2 < chi2Cut *
_npar);
1069 _chipId(chipId), _size(mpSize), _numPix(0), _numMPix(0), _pixelBins(), _pixelSegments() {
1072 std::map<int, pixelListType> pixHist;
1073 const int nBin = 256 /
_size;
1074 const int nBorder = (256 %
_size) / 2;
1076 for (pixelListType::iterator itP = pixelList.begin(); itP != pixelList.end(); ++itP) {
1077 int macroRow = min(max(((*itP)->getRow() - nBorder) /
_size, 0), nBin - 1);
1078 int macroCol = min(max(((*itP)->getCol() - nBorder) /
_size, 0), nBin - 1);
1079 int iBin = macroRow + 1000 * macroCol;
1080 pixHist[iBin].push_back(*itP);
1085 for (std::map<int, pixelListType>::iterator itBin = pixHist.begin(); itBin != pixHist.end(); ++itBin) {
1086 int iBin = itBin->first;
1089 if (pixels.size() < 2)
continue;
1091 sort(pixels.begin(), pixels.end(), comparePixelsZ);
1094 if (someBin->getNumMPix() > 0) {
1097 _numPix += someBin->getNumPix();
1107 for (pixelBinListType::iterator itBin =
_pixelBins.begin(); itBin !=
_pixelBins.end(); ++itBin) {
1165 int maxMult = iCuts[0];
1166 int minPixels = iCuts[1];
1167 int minDist = iCuts[2];
1170 while (freeMPix > 1) {
1174 for (pixelBinListType::iterator itBin1 =
_pixelBins.begin(); itBin1 !=
_pixelBins.end(); ++itBin1) {
1175 if ((*itBin1)->getNumMPix() > maxMult)
continue;
1177 int row1 = (*itBin1)->getId() % 1000;
1178 int col1 = (*itBin1)->getId() / 1000;
1182 for (pixelBinListType::iterator itBin2 = itBin1 + 1; itBin2 !=
_pixelBins.end(); ++itBin2) {
1183 if ((*itBin2)->getNumMPix() > maxMult)
continue;
1185 int row2 = (*itBin2)->getId() % 1000;
1186 int col2 = (*itBin2)->getId() / 1000;
1188 int rank = max(abs(row1 - row2), abs(col1 - col2));
1189 if (rank < minDist)
continue;
1193 for (macroPixelListType::iterator itMpix1 = mPixList1.begin(); itMpix1 != mPixList1.end(); ++itMpix1) {
1194 if ((*itMpix1)->getUsed() || (*itMpix1)->getEntries() < minPixels)
continue;
1196 for (macroPixelListType::iterator itMpix2 = mPixList2.begin(); itMpix2 != mPixList2.end(); ++itMpix2) {
1197 if ((*itMpix2)->getUsed() || (*itMpix2)->getEntries() < minPixels)
continue;
1198 rankedPairs[rank].push_back(make_pair(*itMpix1, *itMpix2));
1207 for (macroPixelPairListMapType::reverse_iterator itPairs = rankedPairs.rbegin(); itPairs != rankedPairs.rend(); ++itPairs) {
1208 int rank = itPairs->first;
1216 for (macroPixelPairListType::iterator itPair = pairList.begin(); itPair != pairList.end(); ++itPair) {
1220 if (bestRoad != NULL) {
1224 bestRoad = someRoad;
1228 bestRoad = someRoad;
1229 stopRank = max(stopRank, rank - 1);
1239 if (rank <= stopRank)
break;
1242 if (bestRoad == NULL)
break;
1247 for (macroPixelListType::iterator itMpix = macroPixels.begin(); itMpix != macroPixels.end(); ++itMpix)
1248 (*itMpix)->setUsed();
1278 const double chi2Cut,
const double distCut) {
1285 for (pixelSegmentListType::iterator itSeg = segments.begin(); itSeg != segments.end(); ++itSeg) {
1286 segmentEquiClass.
addIndex(itSeg - segments.begin());
1289 for (pixelSegmentListType::iterator itSeg1 = segments.begin(); itSeg1 != segments.end(); ++itSeg1) {
1290 for (pixelSegmentListType::iterator itSeg2 = itSeg1 + 1; itSeg2 != segments.end(); ++itSeg2) {
1291 if ((*itSeg1)->match((*itSeg2), chi2Cut, distCut))
1292 segmentEquiClass.
addMatch(make_pair(itSeg1 - segments.begin(), itSeg2 - segments.begin()));
1296 std::map<int, std::vector<int> > segmentClasses = segmentEquiClass.
getClasses();
1297 for (std::map<
int, std::vector<int> >::iterator itC = segmentClasses.begin(); itC != segmentClasses.end(); ++itC) {
1299 if (itC->second.size() > 1) {
1302 for (std::vector<int>::iterator itInd = itC->second.begin(); itInd != itC->second.end(); ++itInd) {
1304 allMacroPixels.insert(allMacroPixels.end(), macroPixels.begin(), macroPixels.end());
1305 delete segments[*itInd];
1310 combinedSegments.push_back(someSegment);
1313 combinedSegments.push_back(segments[itC->second.front()]);
1316 return combinedSegments;
const TMatrixDSym & getCov() const
Get covariance matrix.
double _sarc
arc length (from segment fitting)
int fit(double &, int &)
Perform fit.
int _octoScale
octoboard number scale (in module=(octo+offset)/scale) (default 12)
double _maxGap
max. (arc-length) gap for road (default: 4.0)
int _numPix
number of pixels in macro pixels
std::string _outputColName
Name of the output collection.
void getPos(double *) const
Get position.
const int _hitNum
input hit collection index
double _sigmaZ
resolution in Z (default: 3.0)
TMatrixDSym _covariance
covariance matrix
void getPar(double *) const
Get (all five helix) parameters from segment fit.
TimePix pixel segment combiner.
double getLength() const
Get length.
int _numMPix
number of macro pixels
double _minZmeas
min. measured Z value (default 0.)
int getSize() const
Get size.
std::map< int, pixelListType > chipPixelMapType
const int _rowNum
row number
double _refZ
Z of reference point.
tp_MacroPixel(const int, pixelListType &, const int)
Construct TimePix macro pixel.
const double _sigma2XY
resolution (squared) for XY measurement
double _refY
Y of reference point.
int getChip() const
Get chip number.
double getSigma2Z() const
Get Z variance.
int _numPix
number of pixels in macro pixels
~tp_MacroPixel()
Destructor.
int getNumMPix() const
Get (number of) pixels.
pixelSegmentListType _pixelSegments
pixel segments
int getNumPix() const
Get (number of) pixels.
const int _level
segment level
TimePix (macro) pixel bin.
double getY() const
Get Y coordinate.
std::vector< tp_Pixel * > pixelListType
double getSigma2Z() const
Get Z resolution (squared).
double getChi2() const
Get Chi2/Ndf.
double _chi2CutChip
max. Chi2/Ndf for chip segment matching (default: 30.)
const double _posZ
Z position.
TMatrixDSym getCov() const
Get covariance matrix.
int getNdf() const
Get Chi2/Ndf.
tp_PixelChip(const int, pixelListType &, const int, const double)
Construct TimePix (macro) pixel bin.
tp_Pixel(const int iHit, const EVENT::TrackerHit &aHit, const double xOffset, const double yOffset)
Construct TimePix pixel.
std::map< int, std::vector< int > > getClasses()
Get equivalence classes.
tp_PixelSegmentCombiner(const double)
Construct TimePix pixel segment combiner.
std::string _inputColName
Name of the input collection.
~tp_PixelChip()
Destructor.
void setUsed()
Set use flag.
Track finder for TimePix data based on local road search.
pixelListType _pixels
pixels
double _Ycenter
TPC center, Y coordinate.
const int _mpId2
ID of macro pixel 2.
void setUsed()
Set use flag.
pixelBinListType _pixelBins
(macro) pixel bins
double _chi2
chi2 from segment fit
macroPixelListType getMacroPixels() const
Get macro pixels.
void addPoint(double, double, double)
Add point.
void getRefPoint(double *) const
Get reference point.
std::vector< tp_PixelBin * > pixelBinListType
int _maxMult
max. multiplicity for road seeding bins (default: 3)
~tp_PixelSegment()
Destructor.
double _length
segment (arc) length
pixelSegmentListType run(const int, const int, pixelSegmentListType &, const double, const double)
Run segment combiner.
void getStateAt(const double, const double, const double, TMatrixDSym &, TVectorD &, TMatrixDSym &)
Get state (parameters, covariance matrix) at point.
void addIndex(int)
Add index.
virtual void processEvent(EVENT::LCEvent *evt)
Process event.
const TVectorD & getPar() const
Get parameter vector.
int _minDist
min. distance for road seeding bins (default: 2)
double _distCut
max. relative (to track length sum) distance (of centers) for segment matching (default: 2...
const double _posY
Y position.
const int _binId
bin Id (row, col)
int fit(double &, int &)
Perform fit.
bool isValid() const
Get validity flag.
void getPos(double *) const
Get position.
const double _bzc
magnetic field strength (Bz*c)
tp_PixelRoad(macroPixelPairType, pixelBinListType &, const double *)
Construct TimePix (macro) pixel road.
int _octoOffset
octoboard number offset (in module=(octo+offset)/scale) (default 8)
int getCol() const
Get column number.
int getNumPix() const
Get (number of) pixels.
std::vector< macroPixelPairType > macroPixelPairListType
virtual void processRunHeader(EVENT::LCRunHeader *run)
tp_PixelSegment(const int, const int, const double, macroPixelListType &)
Construct TimePix pixel segment.
int getRow() const
Get row number.
macroPixelListType _macroPixels
macro pixel
std::vector< tp_PixelSegment * > pixelSegmentListType
double _bzc
magnetic field strength (Bz*c)
int getHitNum() const
Get index to input hit collection.
~tp_PixelBin()
Destructor.
bool getUsed() const
Get use flag.
int _minTrackLevel
min. track level for output (default 1)
bool getUsed() const
Get use flag.
virtual void init()
Initialize processor.
double getVarZ() const
Get Z variance.
int getRow() const
Get row number.
void setArcLength(const double)
Set arc length.
macroPixelListType getMacroPixels() const
Get macro pixels.
std::map< int, macroPixelPairListType > macroPixelPairListMapType
const double _posX
X position.
const int _mpId
ID (row/col bin: z bin)
double _chi2ByNdf
sum of chi2 / Ndf
double getY() const
Get Y-position.
std::map< int, pixelSegmentListType > pixelSegmentListMapType
TVectorD getPar() const
Get parameters vector.
int getNumMPix() const
Get (number of) macro pixels.
int _mpSize
macro pixel (bin) size (default: 32)
void addPoint(double, double, double)
Add point.
std::vector< tp_MacroPixel * > macroPixelListType
int getNumBins() const
Get (number of) pixels bins.
double _bfieldScaleFactor
scale factor for magnetic field (default: 1.0)
int _minPixels
min. number of pixels for road seeding maxro pixel (default: 3)
double getZ() const
Get Z coordinate.
int findSegments(const double, const int *, const double *)
Find segments.
int getCol() const
Get column number.
pixelSegmentListType getPixelSegments() const
double getVarXY(const double, const double) const
Get XY variance.
double _Xcenter
TPC center, X coordinate.
macroPixelListType getMacroPixels() const
Get macro pixels.
double _maxPull2Z
max. pull squared to road in Z (default: 15.)
double getX() const
Get X-position.
TMatrixDSym getCov() const
Get covariance matrix.
double getArcLength() const
Get arc length.
TimePix (macro) pixel road.
bool _valid
flag for valid road
int getEntries() const
Get (number of) entries.
const int _npar
number of parameters (5: helix, 4: line)
double _refX
X of reference point.
double _sigma2Z
resolution (squared) for Z measurement
double getArcLengthXY(const double *) const
Get (2D) arc length for given point.
double getSigma2XY() const
Get XY variance.
int _ndf
number of degrees of freedom of segment fit
tp_PixelBin(const int, const int, pixelListType &, const int, const double, const double)
Construct TimePix (macro) pixel bin.
const int _segId
segment ID
TVectorD _parameters
parameter vector
double getSigma2XY() const
Get XY resolution (squared).
TMatrixD helixToLCIOJacobian() const
Get transformation from helix to LCIO track parameters (at reference point)
double _maxSvar
max. relative arc-length variance for road (default: 0.15)
double _maxChi2
max. Chi2/Ndf for road (default 5.)
double _chi2CutOcto
max. Chi2/Ndf for octoboard segment matching (default: 30.)
bool match(tp_PixelSegment *, const double, const double) const
virtual void check(EVENT::LCEvent *evt)
TimePixLocalRoadSearchProcessor aTimePixLocalRoadSearchProcessor
double _maxZmeas
max. measured Z value (default 600.)
TVectorD getPar() const
Get parameters vector.
int getNumPar() const
Get number of parameters.
const int _chipNum
chip number
std::vector< tp_PixelChip * > pixelChipListType
double getX() const
Get X coordinate.
std::vector< double > _sList
arc length list
double _Bzc
magnetic field strength (Bz*c)
double _sigma2XY
resolution (squared) for XY measurement
double _xOffset
offset in x of (local) coordinate system (default 0.)
int getLevel() const
Get level.
pixelListType getPixels() const
Get pixels.
int _numPix
number of pixels in macro pixels
macroPixelListType _macroPixels
macro pixel
int getNumMPix() const
Get (number of) pixels.
int getNumPix() const
Get (number of) pixels.
~tp_PixelRoad()
Destructor.
const int _entries
entries
macroPixelListType _macroPixels
macro pixels
double _yOffset
offset in y of (local) coordinate system (default 1500.)
const int _colNum
column number
void getLCIOStateAtRefPoint(const double *, TVectorD &, TMatrixDSym &) const
Get segment state at reference point.
std::pair< tp_MacroPixel *, tp_MacroPixel * > macroPixelPairType
double _chi2CutMod
max. Chi2/Ndf for module segment matching (default: 50.)
const double _sigma2Z
resolution (squared) for Z measurement
bool _refAtPCA
Use Pca as reference point (else 1. hit)
double _maxPull2XY
max. pull squared to road in XY (default: 15.)
const int _mpId1
ID of macro pixel 1.
void addMatch(std::pair< int, int >)
Add match.
double getChi2() const
Get Chi2/Ndf.