11 #include "art/Framework/Principal/Event.h"
12 #include "art/Framework/Services/Registry/ServiceHandle.h"
13 #include "canvas/Utilities/Exception.h"
14 #include "messagefacility/MessageLogger/MessageLogger.h"
40 fRefits = pset.get<
double>(
"Refits");
51 fMaxViewRMS = pset.get<std::vector<double>>(
"MaxViewRMS");
60 std::vector<recob::Seed>
63 art::PtrVector<recob::Hit>
const& HitsFlat,
64 std::vector<art::PtrVector<recob::Hit>>& CataloguedHits,
65 unsigned int StopAfter)
const
68 std::vector<recob::Seed> ReturnVector;
71 std::vector<recob::SpacePoint> spts;
76 if (
int(spts.size()) <
fMinPointsInSeed) {
return std::vector<recob::Seed>(); }
84 std::vector<std::vector<std::vector<int>>> OrgHits(3);
85 for (
size_t n = 0;
n != 3; ++
n)
90 std::vector<std::vector<int>> SpacePointsPerHit(HitsFlat.size(), std::vector<int>());
91 std::vector<std::vector<int>> HitsPerSpacePoint(spts.size(), std::vector<int>());
99 std::vector<char> HitStatus(HitsFlat.size(), 0);
103 for (
size_t i = 0; i != HitsFlat.size(); ++i) {
104 OrgHits[HitsFlat.at(i)->View()][HitsFlat.at(i)->Channel()].push_back(i);
109 for (
size_t iSP = 0; iSP != spts.size(); ++iSP) {
112 for (
size_t iH = 0; iH != HitsThisSP.size(); ++iH) {
114 uint32_t ThisChannel = HitsThisSP.at(iH)->Channel();
115 float ThisTime = HitsThisSP.at(iH)->PeakTime();
118 for (
size_t iOrg = 0; iOrg != OrgHits[ThisView][ThisChannel].size(); ++iOrg) {
119 if (fabs(ThisTime - HitsFlat.at(OrgHits[ThisView][ThisChannel][iOrg])->PeakTime()) <
121 SpacePointsPerHit.at(OrgHits[ThisView][ThisChannel][iOrg]).push_back(iSP);
122 HitsPerSpacePoint.at(iSP).push_back(OrgHits[ThisView][ThisChannel][iOrg]);
142 std::vector<char> PointStatus(spts.size(), 0);
144 std::vector<std::map<geo::View_t, std::vector<int>>> WhichHitsPerSeed;
146 bool KeepChopping =
true;
148 while (KeepChopping) {
150 std::vector<int> PointsUsed;
154 FindSeedAtEnd(detProp, spts, PointStatus, PointsUsed, HitsFlat, OrgHits);
161 for (
size_t iP = 0; iP != PointsUsed.size(); ++iP) {
162 for (
size_t iH = 0; iH != HitsPerSpacePoint.at(PointsUsed.at(iP)).
size(); ++iH) {
163 int UsedHitID = HitsPerSpacePoint.at(PointsUsed.at(iP)).at(iH);
164 HitStatus[UsedHitID] = 2;
167 PointStatus[PointsUsed.at(0)] = 1;
168 ConsolidateSeed(detProp, TheSeed, HitsFlat, HitStatus, OrgHits,
false);
173 std::vector<char> HitStatusGood;
175 for (
size_t r = 0;
r != (
unsigned int)
fRefits; ++
r) {
179 HitStatusGood = HitStatus;
181 std::vector<int> PresentHitList;
182 for (
size_t iH = 0; iH != HitStatus.size(); ++iH) {
183 if (HitStatus[iH] == 2) { PresentHitList.push_back(iH); }
185 double pt[3],
dir[3],
err[3];
190 TVector3 Center, Direction;
191 std::vector<double> ViewRMS;
192 std::vector<int> HitsPerView;
194 detProp, HitsFlat, PresentHitList, Center, Direction, ViewRMS, HitsPerView);
196 Direction = Direction.Unit() * TheSeed.
GetLength();
198 int nViewsWithHits(0);
199 for (
size_t n = 0;
n != 3; ++
n) {
201 dir[
n] = Direction[
n];
206 if (HitsPerView[
n] > 0) nViewsWithHits++;
209 if (nViewsWithHits < 2) TheSeed.
SetValidity(
false);
218 HitStatus = HitStatusGood;
231 WhichHitsPerSeed.push_back(std::map<
geo::View_t, std::vector<int>>());
233 art::PtrVector<recob::Hit> HitsWithThisSeed;
234 for (
size_t iH = 0; iH != HitStatus.size(); ++iH) {
235 if (HitStatus.at(iH) == 2) {
236 WhichHitsPerSeed.at(WhichHitsPerSeed.size() - 1)[HitsFlat[iH]->View()].push_back(iH);
237 HitsWithThisSeed.push_back(HitsFlat.at(iH));
238 HitStatus.at(iH) = 1;
240 for (
size_t iSP = 0; iSP != SpacePointsPerHit.at(iH).size(); ++iSP) {
241 PointStatus[SpacePointsPerHit.at(iH).at(iSP)] = 1;
247 ReturnVector.push_back(TheSeed);
248 CataloguedHits.push_back(HitsWithThisSeed);
251 HitsWithThisSeed.clear();
255 PointStatus.at(PointsUsed.at(0)) = 2;
258 int TotalSPsUsed = 0;
259 for (
size_t i = 0; i != PointStatus.size(); ++i) {
260 if (PointStatus[i] != 0) TotalSPsUsed++;
263 if ((
int(spts.size()) - TotalSPsUsed) <
fMinPointsInSeed) KeepChopping =
false;
265 if ((PointStatus[0] == 3) || (PointStatus.size() == 0)) KeepChopping =
false;
269 if ((ReturnVector.size() >= StopAfter) && (StopAfter > 0))
break;
277 if (ReturnVector.size() == 0) {
278 std::vector<int> ListAllHits;
279 for (
size_t i = 0; i != HitsFlat.size(); ++i) {
280 ListAllHits.push_back(i);
283 TVector3 SeedCenter(0, 0, 0);
284 TVector3 SeedDirection(0, 0, 0);
286 std::vector<double> ViewRMS;
287 std::vector<int> HitsPerView;
289 std::vector<art::PtrVector<recob::Hit>> HitsInThisCollection(3);
292 detProp, HitsFlat, ListAllHits, SeedCenter, SeedDirection, ViewRMS, HitsPerView);
294 bool ThrowOutSeed =
false;
296 double PtArray[3], DirArray[3];
297 int nViewsWithHits(0);
298 for (
size_t n = 0;
n != 3; ++
n) {
299 PtArray[
n] = SeedCenter[
n];
300 DirArray[
n] = SeedDirection[
n];
301 if (HitsPerView[
n] > 0) nViewsWithHits++;
305 if (nViewsWithHits < 2 || (nViewsWithHits < 3 && !
fAllow2DSeeds)) ThrowOutSeed =
true;
308 ConsolidateSeed(detProp, TheSeed, HitsFlat, HitStatus, OrgHits,
false);
313 for (
size_t i = 0; i != HitStatus.size(); ++i) {
314 if (HitStatus.at(i) == 2) ListAllHits.push_back(i);
316 std::vector<int> HitsPerView;
318 detProp, HitsFlat, ListAllHits, SeedCenter, SeedDirection, ViewRMS, HitsPerView);
320 int nViewsWithHits(0);
321 for (
size_t n = 0;
n != 3; ++
n) {
322 PtArray[
n] = SeedCenter[
n];
323 DirArray[
n] = SeedDirection[
n];
325 if (HitsPerView[
n] > 0) nViewsWithHits++;
328 if (nViewsWithHits < 2 || (nViewsWithHits < 3 && !
fAllow2DSeeds)) ThrowOutSeed =
true;
334 if (
fMaxViewRMS.at(j) < ViewRMS.at(j)) { ThrowOutSeed =
true; }
339 if ((!ThrowOutSeed) && (TheSeed.
IsValid())) {
340 ReturnVector.push_back(TheSeed);
341 art::PtrVector<recob::Hit> HitsThisSeed;
342 for (
size_t i = 0; i != ListAllHits.size(); ++i) {
343 HitsThisSeed.push_back(HitsFlat.at(ListAllHits.at(i)));
345 CataloguedHits.push_back(HitsThisSeed);
350 SpacePointsPerHit.clear();
351 HitsPerSpacePoint.clear();
356 for (
size_t i = 0; i != ReturnVector.size(); ++i) {
357 double CrazyValue = 1000000;
358 double Length = ReturnVector.at(i).GetLength();
359 if (!((Length >
fLengthCut) && (Length < CrazyValue))) {
360 ReturnVector.erase(ReturnVector.begin() + i);
361 CataloguedHits.erase(CataloguedHits.begin() + i);
376 art::PtrVector<recob::Hit>
const& HitsFlat,
377 std::vector<char>& HitStatus,
382 bool ThrowOutSeed =
false;
385 std::map<geo::View_t, std::map<uint32_t, std::vector<int>>> HitsInThisSeed;
387 int NHitsThisSeed = 0;
389 double MinS = 1000, MaxS = -1000;
390 for (
size_t i = 0; i != HitStatus.size(); ++i) {
391 if (HitStatus.at(i) == 2) {
401 if (s < MinS) MinS =
s;
402 if (s > MaxS) MaxS =
s;
403 HitsInThisSeed[HitsFlat.at(i)->View()][HitsFlat.at(i)->Channel()].push_back(i);
408 double LengthRescale = (MaxS - MinS) / 2.;
409 double PositionShift = (MaxS + MinS) / 2.;
411 double pt[3],
dir[3],
err[3];
415 for (
size_t n = 0;
n != 3; ++
n) {
416 pt[
n] += dir[
n] * PositionShift;
417 dir[
n] *= LengthRescale;
424 for (
auto itP = HitsInThisSeed.begin(); itP != HitsInThisSeed.end(); ++itP) {
427 uint32_t LowestChan = itP->second.begin()->first;
428 uint32_t HighestChan = itP->second.rbegin()->first;
429 for (uint32_t c = LowestChan; c != HighestChan; ++c) {
430 for (
size_t h = 0;
h != OrgHits[View][c].size(); ++
h) {
431 if (HitStatus[OrgHits[View][c].at(
h)] == 0) {
436 HitStatus[OrgHits[View][c].at(
h)] = 2;
438 HitsInThisSeed[View][c].push_back(OrgHits[View][c].at(
h));
441 HitStatus[OrgHits[View][c].at(
h)] = 0;
447 if (NHitsThisSeed == 0) ThrowOutSeed =
true;
451 uint32_t LowestChanInSeed[3], HighestChanInSeed[3];
452 double Occupancy[] = {0., 0., 0.};
453 int nHitsPerView[] = {0, 0, 0};
455 for (
auto itP = HitsInThisSeed.begin(); itP != HitsInThisSeed.end(); ++itP) {
459 LowestChanInSeed[View] = itP->second.begin()->first;
460 HighestChanInSeed[View] = itP->second.rbegin()->first;
462 nHitsPerView[View]++;
464 int FilledChanCount = 0;
466 for (
size_t c = LowestChanInSeed[View]; c != HighestChanInSeed[View]; ++c) {
467 if (itP->second[c].size() > 0) ++FilledChanCount;
471 float(FilledChanCount) / float(HighestChanInSeed[View] - LowestChanInSeed[View]);
475 int nViewsWithHits(0);
476 for (
size_t n = 0;
n != 3; ++
n) {
478 if (nHitsPerView[
n] > 0) nViewsWithHits++;
485 if (nBelowCut > belowCut) ThrowOutSeed =
true;
487 if ((Extend) && (!ThrowOutSeed)) {
488 std::vector<std::vector<double>> ToAddNegativeS(3, std::vector<double>());
489 std::vector<std::vector<double>> ToAddPositiveS(3, std::vector<double>());
490 std::vector<std::vector<int>> ToAddNegativeH(3, std::vector<int>());
491 std::vector<std::vector<int>> ToAddPositiveH(3, std::vector<int>());
493 for (
auto itP = HitsInThisSeed.begin(); itP != HitsInThisSeed.end(); ++itP) {
498 if (LowestChanInSeed[View] > 0) {
499 for (uint32_t c = LowestChanInSeed[View] - 1; c != 0; --c) {
500 bool GotOneThisChannel =
false;
501 for (
size_t h = 0;
h != OrgHits[View][c].size(); ++
h) {
502 if (HitStatus[OrgHits[View][c][
h]] == 0) {
505 GotOneThisChannel =
true;
507 ToAddNegativeS[View].push_back(s);
508 ToAddNegativeH[View].push_back(OrgHits[View][c].at(
h));
511 ToAddPositiveS[View].push_back(s);
512 ToAddPositiveH[View].push_back(OrgHits[View][c].at(
h));
517 if (GotOneThisChannel ==
false)
break;
522 for (uint32_t c = HighestChanInSeed[View] + 1; c !=
fNChannels; ++c) {
523 bool GotOneThisChannel =
false;
524 for (
size_t h = 0;
h != OrgHits[View][c].size(); ++
h) {
525 if (HitStatus[OrgHits[View][c][
h]] == 0) {
528 GotOneThisChannel =
true;
531 ToAddNegativeS[View].push_back(s);
532 ToAddNegativeH[View].push_back(OrgHits[View][c].at(
h));
535 ToAddPositiveS[View].push_back(s);
536 ToAddPositiveH[View].push_back(OrgHits[View][c].at(
h));
541 if (GotOneThisChannel ==
false)
break;
545 double ExtendPositiveS = 0, ExtendNegativeS = 0;
547 if ((ToAddPositiveS[0].
size() > 0) && (ToAddPositiveS[1].
size() > 0) &&
548 (ToAddPositiveS[2].
size() > 0)) {
549 for (
size_t n = 0;
n != 3; ++
n) {
550 int n1 = (
n + 1) % 3;
551 int n2 = (
n + 2) % 3;
553 if ((ToAddPositiveS[
n].back() <= ToAddPositiveS[n1].back()) &&
554 (ToAddPositiveS[
n].back() <= ToAddPositiveS[n2].back())) {
555 ExtendPositiveS = ToAddPositiveS[
n].back();
560 if ((ToAddNegativeS[0].
size() > 0) && (ToAddNegativeS[1].
size() > 0) &&
561 (ToAddNegativeS[2].
size() > 0)) {
562 for (
size_t n = 0;
n != 3; ++
n) {
563 int n1 = (
n + 1) % 3;
564 int n2 = (
n + 2) % 3;
565 if ((ToAddNegativeS[
n].back() >= ToAddNegativeS[n1].back()) &&
566 (ToAddNegativeS[
n].back() >= ToAddNegativeS[n2].back())) {
567 ExtendNegativeS = ToAddNegativeS[
n].back();
572 if (fabs(ExtendNegativeS) < 1.) ExtendNegativeS = -1.;
573 if (fabs(ExtendPositiveS) < 1.) ExtendPositiveS = 1.;
575 LengthRescale = (ExtendPositiveS - ExtendNegativeS) / 2.;
576 PositionShift = (ExtendPositiveS + ExtendNegativeS) / 2.;
578 for (
size_t n = 0;
n != 3; ++
n) {
579 pt[
n] += dir[
n] * PositionShift;
580 dir[
n] *= LengthRescale;
582 for (
size_t i = 0; i != ToAddPositiveS[
n].size(); ++i) {
583 if (ToAddPositiveS[
n].at(i) < ExtendPositiveS)
584 HitStatus[ToAddPositiveH[
n].at(i)] = 2;
586 HitStatus[ToAddPositiveH[
n].at(i)] = 0;
589 for (
size_t i = 0; i != ToAddNegativeS[
n].size(); ++i) {
590 if (ToAddNegativeS[
n].at(i) > ExtendNegativeS)
591 HitStatus[ToAddNegativeH[
n].at(i)] = 2;
593 HitStatus[ToAddNegativeH[
n].at(i)] = 0;
609 art::Ptr<recob::Hit>
const& AHit,
613 art::ServiceHandle<geo::Geometry const> geom;
615 double xyzStart[3], xyzEnd[3];
617 geom->WireEndPoints(0, 0, AHit->WireID().Plane, AHit->WireID().Wire, xyzStart, xyzEnd);
619 double HitX = detProp.
ConvertTicksToX(AHit->PeakTime(), AHit->WireID().Plane, 0, 0);
621 double HitXHigh = detProp.
ConvertTicksToX(AHit->PeakTimePlusRMS(), AHit->WireID().Plane, 0, 0);
622 double HitXLow = detProp.
ConvertTicksToX(AHit->PeakTimeMinusRMS(), AHit->WireID().Plane, 0, 0);
624 double HitWidth = HitXHigh - HitXLow;
626 double pt[3],
dir[3],
err[3];
631 TVector3 sPt(pt[0], pt[1], pt[2]);
632 TVector3 sDir(dir[0], dir[1], dir[2]);
633 TVector3 hPt(HitX, xyzStart[1], xyzStart[2]);
634 TVector3 hDir(0, xyzStart[1] - xyzEnd[1], xyzStart[2] - xyzEnd[2]);
636 s = (sPt - hPt).Dot(hDir * (hDir.Dot(sDir)) - sDir * (hDir.Dot(hDir))) /
637 (hDir.Dot(hDir) * sDir.Dot(sDir) - pow(hDir.Dot(sDir), 2));
639 disp = fabs((sPt - hPt).Dot(sDir.Cross(hDir)) / (sDir.Cross(hDir)).Mag()) / HitWidth;
648 std::vector<recob::SpacePoint>
const& Points,
649 std::vector<char>& PointStatus,
650 std::vector<int>& PointsInRange,
651 art::PtrVector<recob::Hit>
const& HitsFlat,
658 std::vector<recob::SpacePoint> PointsUsed;
661 PointsInRange.clear();
664 TVector3 HighestZPoint;
665 bool NoPointFound =
true;
666 int counter = Points.size() - 1;
667 while ((NoPointFound ==
true) && (counter >= 0)) {
668 if (PointStatus[counter] == 0) {
669 HighestZPoint = TVector3(
670 Points.at(counter).XYZ()[0], Points.at(counter).XYZ()[1], Points.at(counter).XYZ()[2]);
671 NoPointFound =
false;
688 for (
int index = Points.size() - 1; index != -1; --index) {
689 if (PointStatus[index] == 0) {
692 if ((HighestZPoint[2] - Points.at(index).XYZ()[2]) < TwiceLength) {
693 double DistanceToHighZ = pow(pow(HighestZPoint[1] - Points.at(index).XYZ()[1], 2) +
694 pow(HighestZPoint[2] - Points.at(index).XYZ()[2], 2),
696 if (DistanceToHighZ < TwiceLength) {
697 PointsInRange.push_back(index);
698 PointsUsed.push_back(Points.at(index));
706 TVector3 SeedCenter(0, 0, 0);
707 TVector3 SeedDirection(0, 0, 0);
711 int NPoints = PointsInRange.size();
715 std::map<int, bool>
HitMap;
718 for (
unsigned int i = 0; i != PointsInRange.size(); i++) {
719 std::vector<art::PtrVector<recob::Hit>> HitsInThisCollection(3);
721 art::PtrVector<recob::Hit> HitsThisSP =
723 for (art::PtrVector<recob::Hit>::const_iterator itHit = HitsThisSP.begin();
724 itHit != HitsThisSP.end();
726 uint32_t Channel = (*itHit)->Channel();
730 for (
size_t iH = 0; iH != OrgHits[View][Channel].size(); ++iH) {
731 if (fabs(HitsFlat[OrgHits[View][Channel][iH]]->PeakTime() - (*itHit)->PeakTime()) < eta) {
732 HitMap[OrgHits[View][Channel][iH]] =
true;
738 for (
auto itH = HitMap.begin(); itH != HitMap.end(); ++itH) {
739 HitList.push_back(itH->first);
742 std::vector<double> ViewRMS;
743 std::vector<int> HitsPerView;
746 detProp, HitsFlat, HitList, SeedCenter, SeedDirection, ViewRMS, HitsPerView);
753 bool ThrowOutSeed =
false;
755 double PtArray[3], DirArray[3];
757 pow(pow(SeedDirection.Y(), 2) + pow(SeedDirection.Z(), 2), 0.5) / SeedDirection.Mag();
759 int nViewsWithHits(0);
761 for (
size_t n = 0;
n != 3; ++
n) {
763 PtArray[
n] = SeedCenter[
n];
764 if (HitsPerView[
n] > 0) nViewsWithHits++;
767 if (nViewsWithHits < 2 || (nViewsWithHits < 3 && !
fAllow2DSeeds)) ThrowOutSeed =
true;
774 if (
fMaxViewRMS.at(j) < ViewRMS.at(j)) { ThrowOutSeed =
true; }
791 art::PtrVector<recob::Hit>
const& HitsFlat,
792 std::vector<int>& HitsToUse,
795 std::vector<double>& ViewRMS,
796 std::vector<int>&
N)
const
800 std::map<uint32_t, bool> HitsClaimed;
804 std::vector<std::vector<double>> HitTimes(3);
805 std::vector<std::vector<double>> HitWires(3);
806 std::vector<std::vector<double>> HitWidths(3);
807 std::vector<double> MeanWireCoord(3, 0);
808 std::vector<double> MeanTimeCoord(3, 0);
812 std::vector<double>
x(3, 0),
y(3, 0), xx(3, 0), xy(3, 0), yy(3, 0), sig(3, 0);
814 for (
size_t i = 0; i != HitsToUse.size(); ++i) {
815 auto itHit = HitsFlat.begin() + HitsToUse[i];
819 auto const hitView = (*itHit)->View();
827 throw art::Exception(art::errors::LogicError)
831 double WireCoord = (*itHit)->WireID().Wire *
fPitches.at(ViewIndex);
832 double TimeCoord = detProp.
ConvertTicksToX((*itHit)->PeakTime(), ViewIndex, 0, 0);
833 double TimeUpper = detProp.
ConvertTicksToX((*itHit)->PeakTimePlusRMS(), ViewIndex, 0, 0);
834 double TimeLower = detProp.
ConvertTicksToX((*itHit)->PeakTimeMinusRMS(), ViewIndex, 0, 0);
835 double Width = fabs(0.5 * (TimeUpper - TimeLower));
836 double Width2 = pow(Width, 2);
838 HitWires.at(ViewIndex).push_back(WireCoord);
839 HitTimes.at(ViewIndex).push_back(TimeCoord);
840 HitWidths.at(ViewIndex).push_back(fabs(0.5 * (TimeUpper - TimeLower)));
842 MeanWireCoord.at(ViewIndex) += WireCoord;
843 MeanTimeCoord.at(ViewIndex) += TimeCoord;
846 x.at(ViewIndex) += WireCoord / Width2;
847 y.at(ViewIndex) += TimeCoord / Width2;
848 xy.at(ViewIndex) += (TimeCoord * WireCoord) / Width2;
849 xx.at(ViewIndex) += (WireCoord * WireCoord) / Width2;
850 yy.at(ViewIndex) += (TimeCoord * TimeCoord) / Width2;
851 sig.at(ViewIndex) += 1. / Width2;
857 std::vector<double> ViewGrad(3);
858 std::vector<double> ViewOffset(3);
860 for (
size_t n = 0;
n != 3; ++
n) {
861 MeanWireCoord[
n] /= N[
n];
862 MeanTimeCoord[
n] /= N[
n];
864 double BigN = 1000000;
865 double SmallN = 1. / BigN;
868 double Numerator = (
y[
n] / sig[
n] - xy[
n] /
x[
n]);
869 double Denominator = (
x[
n] / sig[
n] - xx[
n] /
x[
n]);
870 if (fabs(Denominator) > SmallN)
871 ViewGrad.at(
n) = Numerator / Denominator;
876 ViewGrad[
n] = xy[
n] / xx[
n];
880 ViewOffset.at(
n) = (
y[
n] - ViewGrad[
n] *
x[
n]) / sig[
n];
881 ViewRMS.at(
n) = pow((yy[
n] + pow(ViewGrad[
n], 2) * xx[n] + pow(ViewOffset[n], 2) * sig[n] -
882 2 * ViewGrad[n] * xy[n] - 2 * ViewOffset[n] *
y[n] +
883 2 * ViewGrad[n] * ViewOffset[n] *
x[n]) /
887 if (ViewGrad.at(n) != 0) ViewRMS[n] *= sin(atan(1. / ViewGrad.at(n)));
890 for (
size_t n = 0;
n != 3; ++
n) {
891 size_t n1 = (
n + 1) % 3;
892 size_t n2 = (
n + 2) % 3;
893 if ((N[
n] <= N[n1]) && (N[
n] <= N[n2])) {
895 if (N[n1] < N[n2]) { std::swap(n1, n2); }
896 if ((N[n1] == 0) || (N[n2] == 0))
continue;
912 double TimeCoord = 0.5 * (MeanTimeCoord[n1] + MeanTimeCoord[n2]);
913 double WireCoordIn1 = (TimeCoord - ViewOffset[n1]) / ViewGrad[n1] +
fWireZeroOffset[n1];
914 double WireCoordIn2 = (TimeCoord - ViewOffset[n2]) / ViewGrad[n2] +
fWireZeroOffset[n2];
920 ViewRMS[
n] = -fabs(ViewRMS[
n]);
921 ViewRMS[n1] = fabs(ViewRMS[n1]);
922 ViewRMS[n2] = fabs(ViewRMS[n2]);
933 art::ServiceHandle<geo::Geometry const> geom;
945 fXDir = TVector3(1, 0, 0);
946 fYDir = TVector3(0, 1, 0);
947 fZDir = TVector3(0, 0, 1);
953 double xyzStart1[3], xyzStart2[3];
954 double xyzEnd1[3], xyzEnd2[3];
957 for (
size_t n = 0;
n != 3; ++
n) {
958 geom->WireEndPoints(0, 0,
n, 0, xyzStart1, xyzEnd1);
959 geom->WireEndPoints(0, 0,
n, 1, xyzStart2, xyzEnd2);
961 TVector3(xyzEnd1[0] - xyzStart1[0], xyzEnd1[1] - xyzStart1[1], xyzEnd1[2] - xyzStart1[2])
965 xyzEnd2[0] - xyzEnd1[0], xyzEnd2[1] - xyzEnd1[1], xyzEnd2[2] - xyzEnd1[2])) < 0)
975 std::vector<recob::Seed>
979 art::PtrVector<recob::Hit>
const&
Hits,
980 std::vector<art::PtrVector<recob::Hit>>& HitCatalogue,
981 unsigned int StopAfter)
const
983 std::vector<recob::Seed> ReturnVec;
984 return FindSeeds(clockData, detProp, Hits, HitCatalogue, StopAfter);
989 std::vector<std::vector<recob::Seed>>
995 unsigned int StopAfter)
const
998 std::vector<std::vector<recob::Seed>> ReturnVec;
1004 mf::LogWarning(
"BezierTrackerModule")
1005 <<
"Warning: SpacePointAlg is does not have three views enabled. This may cause unexpected "
1006 "behaviour in the bezier tracker.";
1009 for (
std::vector<art::PtrVector<recob::Hit>>::const_iterator itU =
1010 SortedHits.at(
geo::kU).begin();
1011 itU != SortedHits.at(
geo::kU).end();
1013 for (
std::vector<art::PtrVector<recob::Hit>>::const_iterator itV =
1014 SortedHits.at(
geo::kV).begin();
1015 itV != SortedHits.at(
geo::kV).end();
1017 for (
std::vector<art::PtrVector<recob::Hit>>::const_iterator itW =
1018 SortedHits.at(
geo::kW).begin();
1019 itW != SortedHits.at(
geo::kW).end();
1021 art::PtrVector<recob::Hit> HitsThisComboFlat;
1024 for (
size_t i = 0; i != itU->size(); ++i)
1025 HitsThisComboFlat.push_back(itU->at(i));
1028 for (
size_t i = 0; i != itV->size(); ++i)
1029 HitsThisComboFlat.push_back(itV->at(i));
1032 for (
size_t i = 0; i != itW->size(); ++i)
1033 HitsThisComboFlat.push_back(itW->at(i));
1035 std::vector<art::PtrVector<recob::Hit>> CataloguedHits;
1037 std::vector<recob::Seed> Seeds =
1038 FindSeeds(clockData, detProp, HitsThisComboFlat, CataloguedHits, StopAfter);
1041 HitsPerSeed.push_back(CataloguedHits);
1042 ReturnVec.push_back(Seeds);
1045 CataloguedHits.clear();
1050 mf::LogWarning(
"SeedFinderTrackerModule")
1051 <<
" bailed during hit map lookup - have you enabled all 3 planes?";
1052 ReturnVec.push_back(std::vector<recob::Seed>());
std::vector< double > fPitches
float Length(const PFPStruct &pfp)
SeedFinderAlgorithm(const fhicl::ParameterSet &pset)
static std::string ViewName(geo::View_t view)
Returns the name of the specified view.
process_name opflash particleana ie x
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Declaration of signal hit object.
EResult err(const char *call)
void GetPoint(double *Pt, double *Err) const
void CalculateGeometricalElements()
void GetHitDistAndProj(detinfo::DetectorPropertiesData const &detProp, recob::Seed const &ASeed, art::Ptr< recob::Hit > const &AHit, double &disp, double &s) const
std::size_t size(FixedBins< T, C > const &) noexcept
void reconfigure(fhicl::ParameterSet const &pset)
bool enableV() const noexcept
recob::Seed FindSeedAtEnd(detinfo::DetectorPropertiesData const &detProp, std::vector< recob::SpacePoint > const &, std::vector< char > &, std::vector< int > &, art::PtrVector< recob::Hit > const &HitsFlat, std::vector< std::vector< std::vector< int >>> &OrgHits) const
const art::PtrVector< recob::Hit > & getAssociatedHits(const recob::SpacePoint &spt) const
void ConsolidateSeed(detinfo::DetectorPropertiesData const &detProp, recob::Seed &TheSeed, art::PtrVector< recob::Hit > const &, std::vector< char > &HitStatus, std::vector< std::vector< std::vector< int >>> &OrgHits, bool Extend) const
std::map< int, art::Ptr< recob::Hit > > HitMap
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
process_name opflash particleana ie ie y
void SetPoint(double *Pt, double *Err)
void makeSpacePoints(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::PtrVector< recob::Hit > &hits, std::vector< recob::SpacePoint > &spts) const
bool enableU() const noexcept
void GetCenterAndDirection(detinfo::DetectorPropertiesData const &detProp, art::PtrVector< recob::Hit > const &HitsFlat, std::vector< int > &HitsToUse, TVector3 &Center, TVector3 &Direction, std::vector< double > &ViewRMS, std::vector< int > &HitsPerView) const
std::vector< recob::Seed > FindSeeds(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::PtrVector< recob::Hit > const &HitsFlat, std::vector< art::PtrVector< recob::Hit >> &CataloguedHits, unsigned int StopAfter) const
std::vector< recob::Seed > GetSeedsFromUnSortedHits(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::PtrVector< recob::Hit > const &, std::vector< art::PtrVector< recob::Hit >> &, unsigned int StopAfter=0) const
double ConvertTicksToX(double ticks, int p, int t, int c) const
art::PtrVector< recob::Hit > Hits
Encapsulate the construction of a single detector plane.
Contains all timing reference information for the detector.
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
std::vector< TVector3 > fWireDir
then echo File list $list not found else cat $list while read file do echo $file sed s
process_name largeant stream1 can override from command line with o or output physics producers generator N
bool enableW() const noexcept
std::vector< TVector3 > fPitchDir
Planes which measure W (third view for Bo, MicroBooNE, etc).
Algorithm for generating space points from hits.
std::set< art::Ptr< recob::Hit > > HitList
void SetValidity(bool Validity)
std::vector< std::vector< recob::Seed > > GetSeedsFromSortedHits(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< std::vector< art::PtrVector< recob::Hit >>> const &SortedHits, std::vector< std::vector< art::PtrVector< recob::Hit >>> &HitsPerSeed, unsigned int StopAfter=0) const
void GetDirection(double *Dir, double *Err) const
std::vector< double > fWireZeroOffset
art framework interface to geometry description
void SetDirection(double *Dir, double *Err)
std::vector< double > fMaxViewRMS