47 #include "art/Framework/Core/EDProducer.h"
48 #include "art/Framework/Core/ModuleMacros.h"
49 #include "art/Framework/Services/Registry/ServiceHandle.h"
50 #include "art/Framework/Principal/Event.h"
51 #include "art/Persistency/Common/PtrMaker.h"
52 #include "art/Utilities/make_tool.h"
53 #include "art_root_io/TFileService.h"
54 #include "cetlib/cpu_timer.h"
97 namespace lar_cluster3d {
99 std::unordered_map<const reco::ClusterHit3D*, art::Ptr<recob::SpacePoint>>;
111 explicit Cluster3D(fhicl::ParameterSet
const& pset);
120 std::string& pathName,
121 std::string& vertexName,
122 std::string& extremeName)
166 art::Assns<recob::Hit, recob::SpacePoint>& spHitAssns,
167 const std::string&
path =
"")
169 for (
auto&
hit : recobHits)
208 std::vector<recob::SpacePoint>& spacePointVector,
209 art::Assns<recob::SpacePoint, recob::PFParticle>& pfPartSPAssociations,
210 size_t spacePointStart,
213 for (
size_t idx = spacePointStart; idx < spacePointVector.size(); idx++) {
221 art::Assns<recob::Edge, recob::PFParticle>& pfPartEdgeAssociations,
225 for (
size_t idx = edgeStart; idx < edgeVector.size(); idx++) {
235 art::Assns<recob::SpacePoint, recob::Edge>& edgeSPAssociations,
236 const std::string&
path =
"")
238 for (
auto& spacePoint : spacePointVector)
271 art::Ptr<recob::SpacePoint>
278 art::Ptr<recob::Edge>
346 std::vector<recob::Seed>& seedVec,
347 art::Assns<recob::Seed, recob::Hit>& seedHitAssns)
const;
376 std::vector<recob::SpacePoint>& spacePointVec,
377 art::Assns<recob::Hit, recob::SpacePoint>& spHitAssns,
381 const std::string&
path =
"")
const;
409 using IdxToPCAMap = std::map<size_t, const reco::PrincipalComponents*>;
427 size_t pfParticleParent,
457 size_t pfParticleParent,
511 std::unique_ptr<lar_cluster3d::IHit3DBuilder>
513 std::unique_ptr<lar_cluster3d::IClusterAlg>
515 std::unique_ptr<lar_cluster3d::IClusterModAlg>
517 std::unique_ptr<lar_cluster3d::IClusterModAlg>
519 std::unique_ptr<lar_cluster3d::IClusterParametersBuilder>
535 namespace lar_cluster3d {
539 , m_pcaAlg(pset.get<fhicl::ParameterSet>(
"PrincipalComponentsAlg"))
540 , m_skeletonAlg(pset.get<fhicl::ParameterSet>(
"SkeletonAlg"))
541 , m_seedFinderAlg(pset.get<fhicl::ParameterSet>(
"SeedFinderAlg"))
542 , m_pcaSeedFinderAlg(pset.get<fhicl::ParameterSet>(
"PCASeedFinderAlg"))
543 , m_parallelHitsAlg(pset.get<fhicl::ParameterSet>(
"ParallelHitsAlg"))
545 m_onlyMakSpacePoints = pset.get<
bool>(
"MakeSpacePointsOnly",
false);
546 m_enableMonitoring = pset.get<
bool>(
"EnableMonitoring",
false);
547 m_parallelHitsCosAng = pset.get<
float>(
"ParallelHitsCosAng", 0.999);
548 m_parallelHitsTransWid = pset.get<
float>(
"ParallelHitsTransWid", 25.0);
549 m_pathInstance = pset.get<std::string>(
"PathPointsName",
"Path");
550 m_vertexInstance = pset.get<std::string>(
"VertexPointsName",
"Vertex");
551 m_extremeInstance = pset.get<std::string>(
"ExtremePointsName",
"Extreme");
553 m_hit3DBuilderAlg = art::make_tool<lar_cluster3d::IHit3DBuilder>(
554 pset.get<fhicl::ParameterSet>(
"Hit3DBuilderAlg"));
556 art::make_tool<lar_cluster3d::IClusterAlg>(pset.get<fhicl::ParameterSet>(
"ClusterAlg"));
557 m_clusterMergeAlg = art::make_tool<lar_cluster3d::IClusterModAlg>(
558 pset.get<fhicl::ParameterSet>(
"ClusterMergeAlg"));
559 m_clusterPathAlg = art::make_tool<lar_cluster3d::IClusterModAlg>(
560 pset.get<fhicl::ParameterSet>(
"ClusterPathAlg"));
561 m_clusterBuilder = art::make_tool<lar_cluster3d::IClusterParametersBuilder>(
562 pset.get<fhicl::ParameterSet>(
"ClusterParamsBuilder"));
565 m_hit3DBuilderAlg->produces(producesCollector());
567 produces<std::vector<recob::PCAxis>>();
568 produces<std::vector<recob::PFParticle>>();
569 produces<std::vector<recob::Cluster>>();
570 produces<std::vector<recob::Seed>>();
571 produces<std::vector<recob::Edge>>();
573 produces<art::Assns<recob::PFParticle, recob::PCAxis>>();
574 produces<art::Assns<recob::PFParticle, recob::Cluster>>();
575 produces<art::Assns<recob::PFParticle, recob::Seed>>();
576 produces<art::Assns<recob::Edge, recob::PFParticle>>();
577 produces<art::Assns<recob::Seed, recob::Hit>>();
578 produces<art::Assns<recob::Cluster, recob::Hit>>();
580 produces<std::vector<recob::SpacePoint>>();
581 produces<art::Assns<recob::SpacePoint, recob::PFParticle>>();
582 produces<art::Assns<recob::Hit, recob::SpacePoint>>();
583 produces<art::Assns<recob::SpacePoint, recob::Edge>>();
585 produces<std::vector<recob::SpacePoint>>(m_pathInstance);
586 produces<std::vector<recob::Edge>>(m_pathInstance);
587 produces<art::Assns<recob::SpacePoint, recob::PFParticle>>(m_pathInstance);
588 produces<art::Assns<recob::Edge, recob::PFParticle>>(m_pathInstance);
589 produces<art::Assns<recob::Hit, recob::SpacePoint>>(m_pathInstance);
590 produces<art::Assns<recob::SpacePoint, recob::Edge>>(m_pathInstance);
592 produces<std::vector<recob::Edge>>(m_vertexInstance);
593 produces<std::vector<recob::SpacePoint>>(m_vertexInstance);
595 produces<std::vector<recob::SpacePoint>>(m_extremeInstance);
615 mf::LogInfo(
"Cluster3D") <<
" *** Cluster3D::produce(...) [Run=" << evt.run()
616 <<
", Event=" << evt.id().event() <<
"] Starting Now! *** "
621 cet::cpu_timer theClockTotal;
622 cet::cpu_timer theClockFinish;
632 std::unique_ptr<reco::HitPairList> hitPairList(
641 m_clusterAlg->Cluster3DHits(*hitPairList, clusterParametersList);
657 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
659 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clockData);
661 ProduceArtClusters(gser, output, *hitPairList, clusterParametersList, clusterHitToArtPtrMap);
668 theClockFinish.stop();
669 theClockTotal.stop();
673 m_totalTime = theClockTotal.accumulated_real_time();
682 m_hits =
static_cast<int>(clusterHitToArtPtrMap.size());
683 m_hits3D =
static_cast<int>(hitPairList->size());
686 mf::LogDebug(
"Cluster3D") <<
"*** Cluster3D total time: " <<
m_totalTime
704 art::ServiceHandle<art::TFileService>
tfs;
705 m_pRecoTree = tfs->make<TTree>(
"monitoring",
"LAr Reco");
746 std::vector<recob::Seed>& seedVec,
747 art::Assns<recob::Seed, recob::Hit>& seedHitAssns)
const
775 float transRMS = std::hypot(eigenVal0, eigenVal1);
777 bool foundGoodSeed(
false);
788 else if (eigenVal2 > 40. && transRMS < 5.) {
798 if (!foundGoodSeed) {
805 for (
const auto& seedHitPair : seedHitPairVec) {
806 seedVec.push_back(seedHitPair.first);
810 std::set<art::Ptr<recob::Hit>> seedHitSet;
811 for (
const auto& hit3D : seedHitPair.second) {
812 for (
const auto& hit2D : hit3D->getHits()) {
813 if (!hit2D)
continue;
816 seedHitSet.insert(hitToPtrMap[recobHit]);
821 for (
const auto& hit2D : seedHitSet)
822 seedHitVec.push_back(hit2D);
831 const std::pair<float, const reco::ClusterHit3D*>&
right)
833 return left.first < right.first;
853 typedef std::pair<float, const reco::ClusterHit3D*> DistanceHit3DPair;
854 typedef std::list<DistanceHit3DPair> DistanceHit3DPairList;
855 typedef std::map<const reco::ClusterHit3D*, DistanceHit3DPairList> Hit3DToDistanceMap;
858 typedef std::list<const reco::ClusterHit3D*> Hit3DList;
859 typedef std::pair<Hit3DList::iterator, Hit3DList::iterator> Hit3DEdgePair;
860 typedef std::pair<float, Hit3DEdgePair> DistanceEdgePair;
861 typedef std::list<DistanceEdgePair> DistanceEdgePairList;
863 struct DistanceEdgePairOrder {
865 operator()(
const DistanceEdgePair&
left,
const DistanceEdgePair&
right)
const
867 return left.first > right.first;
885 Hit3DToDistanceMap hit3DToDistanceMap;
887 for (reco::HitPairListPtr::const_iterator hit3DOuterItr = skeletonListPtr.begin();
888 hit3DOuterItr != skeletonListPtr.end();) {
890 DistanceHit3DPairList& outerHitList = hit3DToDistanceMap[hit3DOuter];
894 for (reco::HitPairListPtr::const_iterator hit3DInnerItr = hit3DOuterItr;
895 hit3DInnerItr != skeletonListPtr.end();
900 TVector3 deltaPos = innerPos - outerPos;
901 float hitDistance(
float(deltaPos.Mag()));
903 if (hitDistance > 20.)
continue;
905 hit3DToDistanceMap[hit3DInner].emplace_back(hitDistance, hit3DOuter);
906 outerHitList.emplace_back(hitDistance, hit3DInner);
914 for (
auto& mapPair : hit3DToDistanceMap) {
920 DistanceEdgePairList distanceEdgePairList;
923 hit3DList.emplace_back(skeletonListPtr.front());
924 distanceEdgePairList.emplace_back(
925 DistanceEdgePair(0., Hit3DEdgePair(hit3DList.begin(), hit3DList.begin())));
929 float largestDistance(0.);
930 float averageDistance(0.);
934 while (hit3DList.size() < skeletonListPtr.size()) {
935 Hit3DList::iterator bestHit3DIter = hit3DList.begin();
936 float bestDist = 10000000.;
939 for (Hit3DList::iterator hit3DIter = hit3DList.begin(); hit3DIter != hit3DList.end();
944 DistanceHit3DPairList& nearestList = hit3DToDistanceMap[hit3D];
946 while (!nearestList.empty()) {
950 if (nearestList.front().first < bestDist) {
951 bestHit3DIter = hit3DIter;
952 bestDist = nearestList.front().first;
957 nearestList.pop_front();
961 if (bestDist > largestDistance) largestDistance = bestDist;
963 averageDistance += bestDist;
969 hit3DToDistanceMap[bestHit3D].front().second;
971 Hit3DList::iterator nextHit3DIter = hit3DList.insert(hit3DList.end(), nextHit3D);
973 distanceEdgePairList.emplace_back(bestDist, Hit3DEdgePair(bestHit3DIter, nextHit3DIter));
978 averageDistance /= float(hit3DList.size());
983 distanceEdgePairList.sort(DistanceEdgePairOrder());
985 DistanceEdgePairList::iterator largestDistIter = distanceEdgePairList.begin();
987 for (DistanceEdgePairList::iterator edgeIter = distanceEdgePairList.begin();
988 edgeIter != distanceEdgePairList.end();
990 if (edgeIter->first < thirdDist)
break;
992 largestDistIter = edgeIter;
995 reco::HitPairListPtr::iterator breakIter = largestDistIter->second.second;
998 bestList.resize(
std::distance(hit3DList.begin(), breakIter));
1000 std::copy(hit3DList.begin(), breakIter, bestList.begin());
1004 hitPairListPtr.sort();
1007 reco::HitPairListPtr::iterator newListEnd = std::set_difference(hitPairListPtr.begin(),
1008 hitPairListPtr.end(),
1011 hitPairListPtr.begin());
1013 hitPairListPtr.erase(newListEnd, hitPairListPtr.end());
1060 skeletonListPtr, clusterParameters.
getSkeletonPCA(), hitPairListPtrList);
1063 if (hitPairListPtrList.size() < 2)
return;
1073 reco::HitPairListPtrList::iterator hitPairListIter = hitPairListPtrList.begin();
1083 for (
const auto& hit3D : hitPairListPtr) {
1084 for (
const auto& hit2D : hit3D->getHits())
1085 if (hit2D) hit2D->clearStatusBits(0x1);
1092 float allowedHitRange = 6. * firstHitListPCA.
getAveHitDoca();
1105 newClusterHitList.resize(hitPairListPtr.size());
1108 reco::HitPairListPtr::iterator newListEnd = std::copy_if(hitPairListPtr.begin(),
1109 hitPairListPtr.end(),
1110 newClusterHitList.begin(),
1114 newClusterHitList.resize(
std::distance(newClusterHitList.begin(), newListEnd));
1123 m_clusterBuilder->FillClusterParams(newClusterParams, hit2DToClusterMap, 0., 1.);
1143 float newAllowedHitRange = 6. * secondHitListPCA.
getAveHitDoca();
1152 reco::HitPairListPtr::iterator tempListEnd =
1153 std::copy_if(newClusterHitList.begin(),
1154 newClusterHitList.end(),
1155 tempHitList.begin(),
1158 hitPairListPtr.insert(hitPairListPtr.end(), tempHitList.begin(), tempListEnd);
1165 m_clusterBuilder->FillClusterParams(originalParams, hit2DToClusterMap, 0., 1.);
1185 mf::LogDebug(
"Cluster3D") <<
" *** Cluster3D::ProduceArtClusters() *** " << std::endl;
1188 if (!clusterParametersList.empty()) {
1192 for (
auto& clusterParameters : clusterParametersList) {
1198 if (!clusterParameters.getFullPCA().getSvdOK()) {
1199 mf::LogDebug(
"Cluster3D")
1200 <<
"--> no feature extraction done on this cluster!!" << std::endl;
1216 if (clusterParameters.daughterList().empty()) {
1227 clusterParameters.getConvexHull().getConvexHullKinkPoints());
1246 std::vector<size_t> daughterVec;
1248 for (
auto& idxToPCA : idxToPCAMap)
1249 daughterVec.emplace_back(idxToPCA.first);
1257 double eigenVals[] = {0., 0., 0.};
1258 double avePosition[] = {0., 0., 0.};
1260 eigenVecs.resize(3);
1264 for (
size_t outerIdx = 0; outerIdx < 3; outerIdx++) {
1268 eigenVecs[outerIdx].resize(3);
1271 for (
size_t innerIdx = 0; innerIdx < 3; innerIdx++)
1272 eigenVecs[outerIdx][innerIdx] = skeletonPCA.
getEigenVectors().row(outerIdx)[innerIdx];
1287 for (
size_t outerIdx = 0; outerIdx < 3; outerIdx++) {
1291 for (
size_t innerIdx = 0; innerIdx < 3; innerIdx++)
1292 eigenVecs[outerIdx][innerIdx] = fullPCA.
getEigenVectors().row(outerIdx)(innerIdx);
1312 clusterParameters.getHitPairListPtr(),
1318 clusterParameters.getConvexHull().getConvexHullKinkPoints());
1323 for (
const auto& edge : clusterParameters.getConvexHull().getConvexHullEdgeList()) {
1327 spacePointVec.push_back(hit3DToSPPtrMap.at(std::get<0>(edge)));
1328 spacePointVec.push_back(hit3DToSPPtrMap.at(std::get<1>(edge)));
1331 std::cout <<
"Caught exception in looking up space point ptr... " << std::get<0>(edge)
1332 <<
", " << std::get<1>(edge) << std::endl;
1337 spacePointVec[0].key(),
1338 spacePointVec[1].key(),
1355 for (
auto& hitPair : hitPairVector) {
1358 double spacePointPos[] = {
1359 hitPair.getPosition()[0], hitPair.getPosition()[1], hitPair.getPosition()[2]};
1360 double spacePointErr[] = {1., 0., 0., 1., 0., 1.};
1361 double chisq = hitPair.getHitChiSquare();
1365 for (
const auto hit : hitPair.getHits()) {
1371 art::Ptr<recob::Hit> hitPtr = hitToPtrMap[
hit->getHit()];
1372 recobHits.push_back(hitPtr);
1377 spacePointErr[1] = hitPair.getTotalCharge();
1378 spacePointErr[3] = hitPair.getChargeAsymmetry();
1383 if (!recobHits.empty())
1388 std::cout <<
"++++>>>> total num hits: " << hitPairVector.size()
1389 <<
", num free: " << nFreePoints << std::endl;
1395 size_t localCount(0);
1398 for (
auto& clusterParams : clusterParameters.
daughterList())
1411 size_t pfParticleParent,
1419 for (
auto& clusterParams : clusterParameters.
daughterList())
1439 idxToPCAMap[daughterIdx] = &clusterParameters.
getFullPCA();
1442 return idxToPCAMap.size();
1449 size_t pfParticleParent,
1459 using OverriddenClusterParamsAlg_t =
1477 for (
const auto& clusParametersPair : clusterParameters.
getClusterParams()) {
1484 std::vector<const recob::Hit*> recobHitVec(clusParams.
m_hitVector.size());
1488 recobHitVec.begin(),
1489 [](
const auto& hit2D) {
return hit2D->getHit(); });
1498 ClusterParamAlgo.
ImportHits(gser, recobHitVec);
1522 for (
const auto& hit2D : clusParams.
m_hitVector) {
1523 if (hit2D ==
nullptr || hit2D->getHit() ==
nullptr)
continue;
1525 art::Ptr<recob::Hit> hitPtr = hitToPtrMap[hit2D->getHit()];
1526 recobHits.push_back(hitPtr);
1537 std::vector<size_t> nullVector;
1557 int spacePointStart = spVector->size();
1560 output, *spVector, *spHitAssns, *hit3DListPtr, hitToPtrMap, *hit3DToPtrMap);
1569 hit3DToPtrMap = &best3DToSPPtrMap;
1578 spacePointStart = spVector->size();
1581 output, *spVector, *spHitAssns, *hit3DListPtr, hitToPtrMap, *hit3DToPtrMap, instance);
1589 size_t edgeStart = edgeVector->size();
1595 spacePointVec.push_back(hit3DToPtrMap->at(std::get<0>(edge)));
1596 spacePointVec.push_back(hit3DToPtrMap->at(std::get<1>(edge)));
1599 std::cout <<
"Caught exception in looking up space point ptr... " << std::get<0>(edge)
1600 <<
", " << std::get<1>(edge) << std::endl;
1604 edgeVector->emplace_back(
1605 std::get<2>(edge), spacePointVec[0].key(), spacePointVec[1].key(), edgeVector->size());
1616 double eigenVals[] = {0., 0., 0.};
1617 double avePosition[] = {0., 0., 0.};
1619 eigenVecs.resize(3);
1621 for (
size_t outerIdx = 0; outerIdx < 3; outerIdx++) {
1625 eigenVecs[outerIdx].resize(3);
1627 for (
size_t innerIdx = 0; innerIdx < 3; innerIdx++)
1628 eigenVecs[outerIdx][innerIdx] = skeletonPCA.
getEigenVectors().row(outerIdx)(innerIdx);
1641 for (
size_t outerIdx = 0; outerIdx < 3; outerIdx++) {
1645 for (
size_t innerIdx = 0; innerIdx < 3; innerIdx++)
1646 eigenVecs[outerIdx][innerIdx] = fullPCA.
getEigenVectors().row(outerIdx)(innerIdx);
1664 return pfParticleIdx;
1669 std::vector<recob::SpacePoint>& spacePointVec,
1670 art::Assns<recob::Hit, recob::SpacePoint>& spHitAssns,
1677 spacePointVec.reserve(spacePointVec.size() + clusHitPairVector.size());
1680 double spError[] = {1., 0., 1., 0., 0., 1.};
1683 for (
auto& hitPair : clusHitPairVector) {
1685 if (hit3DToSPPtrMap.find(hitPair) != hit3DToSPPtrMap.end())
continue;
1690 double chisq = hitPair->getHitChiSquare();
1696 size_t spacePointID = spacePointVec.size();
1697 double spacePointPos[] = {
1698 hitPair->getPosition()[0], hitPair->getPosition()[1], hitPair->getPosition()[2]};
1700 spError[1] = hitPair->getTotalCharge();
1701 spError[3] = hitPair->getChargeAsymmetry();
1703 spacePointVec.emplace_back(spacePointPos, spError, chisq, spacePointID);
1711 for (
const auto&
hit : hitPair->getHits()) {
1714 art::Ptr<recob::Hit> hitPtr = hitToPtrMap[
hit->getHit()];
1715 recobHits.push_back(hitPtr);
1718 if (!recobHits.empty())
1730 double spError[] = {1., 0., 1., 0., 0., 1.};
1733 for (
auto& kinkTuple : kinkTupleVec) {
1739 double spacePointPos[] = {
1763 double spError[] = {1., 0., 1., 0., 0., 1.};
1767 std::map<const dcel2d::Vertex*, size_t> vertexToSpacePointMap;
1770 for (
auto&
vertex : vertexList) {
1774 double spacePointPos[] = {coords[0], coords[1], coords[2]};
1783 std::set<const dcel2d::HalfEdge*> halfEdgeSet;
1786 for (
const auto& halfEdge : halfEdgeList) {
1791 if (twin && halfEdgeSet.find(twin) == halfEdgeSet.end()) {
1797 if (!toVertex || !fromVertex)
continue;
1799 if (vertexToSpacePointMap.find(fromVertex) == vertexToSpacePointMap.end() ||
1800 vertexToSpacePointMap.find(toVertex) == vertexToSpacePointMap.end())
1807 vertexToSpacePointMap[fromVertex],
1808 vertexToSpacePointMap[toVertex],
1811 halfEdgeSet.insert(&halfEdge);
1831 Eigen::Vector3f avePosition(
1835 using DocaToPCAPair = std::pair<float, const reco::PrincipalComponents*>;
1836 using DocaToPCAVec = std::vector<DocaToPCAPair>;
1838 DocaToPCAVec docaToPCAVec;
1841 for (
const auto& idxToPCA : idxToPCAMap) {
1846 Eigen::Vector3f pcaPos(
1850 Eigen::Vector3f pcaToAveVec = pcaPos - avePosition;
1853 float arclenToPoca = pcaToAveVec.dot(axisDirVec);
1855 docaToPCAVec.emplace_back(arclenToPoca, pca);
1858 std::sort(docaToPCAVec.begin(), docaToPCAVec.end(), [](
const auto&
left,
const auto&
right) {
1864 double spError[] = {1., 0., 1., 0., 0., 1.};
1870 for (
const auto& docaToPCAPair : docaToPCAVec) {
1875 double lastPointPos[] = {
1878 double curPointPos[] = {
1880 size_t curPointBin = lastPointBin + 1;
1885 Eigen::Vector3f distVec(curPointPos[0] - lastPointPos[0],
1886 curPointPos[1] - lastPointPos[1],
1887 curPointPos[2] - lastPointPos[2]);
1890 distVec.norm(), lastPointBin, curPointBin, output.
artEdgeVector->size());
reco::HitPairListPtr & getBestHitPairListPtr()
std::unique_ptr< std::vector< recob::Edge > > artPathEdgeVector
float m_buildNeighborhoodTime
Keeps track of time to build epsilon neighborhood.
std::unique_ptr< art::Assns< recob::SpacePoint, recob::PFParticle > > artPFPartSPAssociations
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
void PCAAnalysis_calc3DDocas(const reco::HitPairListPtr &hitPairVector, const reco::PrincipalComponents &pca) const
std::list< reco::ClusterHit3D > HitPairList
std::unique_ptr< std::vector< recob::SpacePoint > > artVertexPointVector
std::unique_ptr< lar_cluster3d::IClusterModAlg > m_clusterPathAlg
Algorithm to do cluster path finding.
void makeEdgeSpacePointAssns(std::vector< recob::Edge > &edgeVector, RecobSpacePointVector &spacePointVector, art::Assns< recob::SpacePoint, recob::Edge > &edgeSPAssociations, const std::string &path="")
Utilities related to art service access.
An object to define a "edge" which is used to connect space points in a triangulation algorithm...
void PCAAnalysis_3D(const reco::HitPairListPtr &hitPairList, reco::PrincipalComponents &pca, bool skeletonOnly=false) const
Class managing the creation of a new recob::Cluster object.
std::unique_ptr< std::vector< recob::Seed > > artSeedVector
std::string m_vertexInstance
Special instance name for vertex points.
static constexpr size_t kPFParticlePrimary
Define index to signify primary particle.
std::list< HalfEdge > HalfEdgeList
void makePFPartSpacePointAssns(std::vector< recob::SpacePoint > &spacePointVector, art::Assns< recob::SpacePoint, recob::PFParticle > &pfPartSPAssociations, size_t spacePointStart, const std::string &instance="")
const Eigen::Vector3f getPosition() const
std::unique_ptr< art::Assns< recob::Seed, recob::Hit > > artSeedHitAssociations
float m_parallelHitsTransWid
Cut on transverse width of cluster (PCA 2nd eigenvalue)
HalfEdge * getTwinHalfEdge() const
float m_parallelHitsCosAng
Cut for PCA 3rd axis angle to X axis.
bool aParallelHitsCluster(const reco::PrincipalComponents &pca) const
There are several places we will want to know if a candidate cluster is a "parallel hits" type of clu...
Declaration of signal hit object.
std::string & fVertexName
reco::PrincipalComponents & getSkeletonPCA()
void clearStatusBits(unsigned bits) const
void findTrackSeeds(art::Event &evt, reco::ClusterParameters &cluster, IHit3DBuilder::RecobHitToPtrMap &hitToPtrMap, std::vector< recob::Seed > &seedVec, art::Assns< recob::Seed, recob::Hit > &seedHitAssns) const
An interface to the seed finding algorithm.
void makeClusterHitAssns(RecobHitVector &recobHits)
SkeletonAlg m_skeletonAlg
Skeleton point finder.
CopyIfInRange(float maxRange)
void makePFPartEdgeAssns(std::vector< recob::Edge > &edgeVector, art::Assns< recob::Edge, recob::PFParticle > &pfPartEdgeAssociations, size_t edgeStart, const std::string &instance="")
std::unique_ptr< std::vector< recob::Edge > > artVertexEdgeVector
const std::string instance
int m_hits3D
Keeps track of the number of 3D hits made.
float getTotalCharge() const
Hit has been rejected for any reason.
reco::EdgeList & getBestEdgeList()
int getNumHitsUsed() const
HoughSeedFinderAlg class.
std::list< HitPairListPtr > HitPairListPtrList
A utility class used in construction of 3D clusters.
reco::HitPairListPtr & getHitPairListPtr()
void ProduceArtClusters(util::GeometryUtilities const &gser, ArtOutputHandler &output, reco::HitPairList &hitPairList, reco::ClusterParametersList &clusterParametersList, IHit3DBuilder::RecobHitToPtrMap &hitToPtrMap) const
Top level output routine, allows checking cluster status.
bool m_onlyMakSpacePoints
If true we don't do the full cluster 3D processing.
void makePFPartSeedAssns(size_t numSeedsStart)
reco::PlaneToClusterParamsMap & getClusterParams()
HoughSeedFinderAlg m_seedFinderAlg
Seed finder.
std::unique_ptr< lar_cluster3d::IClusterAlg > m_clusterAlg
Algorithm to do 3D space point clustering.
std::unique_ptr< art::Assns< recob::PFParticle, recob::Seed > > artPFPartSeedAssociations
float m_makeHitsTime
Keeps track of time to build 3D hits.
std::unique_ptr< std::vector< recob::PFParticle > > artPFParticleVector
void makeSpacePointHitAssns(std::vector< recob::SpacePoint > &spacePointVector, RecobHitVector &recobHits, art::Assns< recob::Hit, recob::SpacePoint > &spHitAssns, const std::string &path="")
void GetSkeletonHits(const reco::HitPairListPtr &inputHitList, reco::HitPairListPtr &skeletonHitList) const
Return the skeleton hits from the input list.
art::Ptr< recob::Edge > makeEdgePtr(size_t index, const std::string &instance="")
bool findTrackSeeds(reco::HitPairListPtr &hitPairListPtr, reco::PrincipalComponents &inputPCA, SeedHitPairListPairVec &seedHitMap) const override
Given the list of hits this will search for candidate Seed objects and return them.
This is an algorithm for finding recob::Seed objects in 3D clusters.
float getDocaToAxis() const
static const SentryArgument_t Sentry
An instance of the sentry object.
float m_dbscanTime
Keeps track of time to run DBScan.
Hit has been used in Cluster Splitting MST.
void ImportHits(util::GeometryUtilities const &gser, Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
BEGIN_PROLOG triggeremu_data_config_icarus settings PMTADCthresholds sequence::icarus_stage0_multiTPC_TPC physics sequence::icarus_stage0_EastHits_TPC physics sequence::icarus_stage0_WestHits_TPC physics producers purityana0 caloskimCalorimetryCryoE physics caloskimCalorimetryCryoW physics path
ClusterParametersList & daughterList()
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::unique_ptr< art::Assns< recob::Hit, recob::SpacePoint > > artPPHitAssociations
Overrides another ClusterParamsAlgBase class with selected constants.
This is an algorithm for finding recob::Seed objects in 3D clusters.
const EigenValues & getEigenValues() const
art::PtrMaker< recob::Edge > fEdgePtrMaker
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
std::string m_extremeInstance
Instance name for the extreme points.
reco::PrincipalComponents & getFullPCA()
size_t countUltimateDaughters(reco::ClusterParameters &clusterParameters) const
Count number of end of line daughters.
float getChargeAsymmetry() const
art::PtrVector< recob::Hit > RecobHitVector
art::PtrMaker< recob::SpacePoint > fSPPtrMakerPath
This is an algorithm for finding recob::Seed objects in 3D clusters.
void splitClustersWithMST(reco::ClusterParameters &clusterParameters, reco::ClusterParametersList &clusterParametersList) const
Attempt to split clusters by using a minimum spanning tree.
std::unique_ptr< std::vector< recob::SpacePoint > > artPathPointVector
void InitializeMonitoring()
Initialize the internal monitoring.
float m_finishTime
Keeps track of time to run output module.
Helper functions to create a cluster.
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
std::unique_ptr< std::vector< recob::SpacePoint > > artSpacePointVector
float m_clusterMergeTime
Keeps track of the time to merge clusters.
const Eigen::Vector3f & getAvePosition() const
std::unique_ptr< art::Assns< recob::PFParticle, recob::PCAxis > > artPFPartAxisAssociations
std::unique_ptr< art::Assns< recob::Cluster, recob::Hit > > artClusterAssociations
PCASeedFinderAlg m_pcaSeedFinderAlg
Use PCA axis to find seeds.
ArtOutputHandler(art::Event &evt, std::string &pathName, std::string &vertexName, std::string &extremeName)
std::list< ConvexHullKinkTuple > ConvexHullKinkTupleList
void AverageSkeletonPositions(reco::HitPairListPtr &skeletonHitList) const
Modifies the position of input skeleton hits by averaging along the "best" wire direction.
Wrapper for ClusterParamsAlgBase objects to accept arbitrary input.
ParallelHitsSeedFinderAlg m_parallelHitsAlg
Deal with parallel hits clusters.
std::unique_ptr< std::vector< recob::Edge > > artEdgeVector
void MakeAndSavePCAPoints(ArtOutputHandler &, const reco::PrincipalComponents &, IdxToPCAMap &) const
std::list< const reco::ClusterHit3D * > HitPairListPtr
std::unique_ptr< art::Assns< recob::Hit, recob::SpacePoint > > artSPHitAssociations
This provides an art tool interface definition for 3D Cluster algorithms.
std::unique_ptr< art::Assns< recob::SpacePoint, recob::Edge > > artEdgePPAssociations
int m_hits
Keeps track of the number of hits seen.
void produce(art::Event &evt) override
Declaration of cluster object.
size_t FindAndStoreDaughters(util::GeometryUtilities const &gser, ArtOutputHandler &output, reco::ClusterParameters &clusterParameters, size_t pfParticleParent, IdxToPCAMap &idxToPCAMap, IHit3DBuilder::RecobHitToPtrMap &hitToPtrMap, Hit3DToSPPtrMap &hit3DToSPPtrMap, Hit3DToSPPtrMap &best3DToSPPtrMap) const
This will produce art output for daughters noting that it needs to be done recursively.
bool operator()(const std::pair< float, const reco::ClusterHit3D * > &left, const std::pair< float, const reco::ClusterHit3D * > &right)
void MakeAndSaveSpacePoints(ArtOutputHandler &output, std::vector< recob::SpacePoint > &spacePointVec, art::Assns< recob::Hit, recob::SpacePoint > &spHitAssns, reco::HitPairListPtr &clusHitPairVector, IHit3DBuilder::RecobHitToPtrMap &hitToPtrMap, Hit3DToSPPtrMap &hit3DToSPPtrMap, const std::string &path="") const
Special routine to handle creating and saving space points.
This provides an art tool interface definition for tools which construct 3D hits used in 3D clusterin...
This header file defines the interface to a principal components analysis designed to be used within ...
std::unique_ptr< art::Assns< recob::SpacePoint, recob::PFParticle > > artPFPartPPAssociations
std::unique_ptr< art::Assns< recob::PFParticle, recob::Cluster > > artPFPartClusAssociations
float m_pathFindingTime
Keeps track of the path finding time.
bool findTrackHits(reco::HitPairListPtr &hitPairListPtr, reco::PrincipalComponents &inputPCA, reco::HitPairListPtrList &hitPairListPtrList) const
Given the list of hits this will return the sets of hits which belong on the same line...
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
bool operator()(const reco::ClusterHit3D *hit3D) const
art::Ptr< recob::SpacePoint > makeSpacePointPtr(size_t index, const std::string &instance="")
std::unique_ptr< lar_cluster3d::IClusterParametersBuilder > m_clusterBuilder
Common cluster builder tool.
Cluster3D(fhicl::ParameterSet const &pset)
art::PtrMaker< recob::SpacePoint > fSPPtrMaker
std::unique_ptr< std::vector< recob::SpacePoint > > artExtremePointVector
Hierarchical representation of particle flow.
bool bitsAreSet(const unsigned int &bitsToCheck) const
void makePFPartPCAAssns()
const float getAveHitDoca() const
bool findTrackSeeds(reco::HitPairListPtr &hitPairListPtr, reco::PrincipalComponents &inputPCA, SeedHitPairListPairVec &seedHitMap) const override
Given the list of hits this will search for candidate Seed objects and return them.
void makePFPartClusterAssns(size_t clusterStart)
Header file to define the interface to the SkeletonAlg.
Hit has been made into Space Point.
std::vector< SeedHitPairListPair > SeedHitPairListPairVec
This provides an art tool interface definition for 3D Cluster algorithms.
void MakeAndSaveVertexPoints(ArtOutputHandler &, dcel2d::VertexList &, dcel2d::HalfEdgeList &) const
Special routine to handle creating and saving space points & edges associated to voronoi diagrams...
std::unique_ptr< std::vector< recob::Cluster > > artClusterVector
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
std::unique_ptr< lar_cluster3d::IClusterModAlg > m_clusterMergeAlg
Algorithm to do cluster merging.
size_t ConvertToArtOutput(util::GeometryUtilities const &gser, ArtOutputHandler &output, reco::ClusterParameters &clusterParameters, size_t pfParticleParent, IHit3DBuilder::RecobHitToPtrMap &hitToPtrMap, Hit3DToSPPtrMap &hit3DToSPPtrMap, Hit3DToSPPtrMap &best3DToSPPtrMap) const
Produces the art output from all the work done in this producer module.
std::unique_ptr< lar_cluster3d::IHit3DBuilder > m_hit3DBuilderAlg
Builds the 3D hits to operate on.
PrincipalComponentsAlg m_pcaAlg
Principal Components algorithm.
std::unordered_map< const reco::ClusterHit2D *, ClusterToHitPairSetMap > Hit2DToClusterMap
art::PtrMaker< recob::Edge > fEdgePtrMakerPath
ClusterHit2DVec m_hitVector
2D representation of charge deposited in the TDC/wire plane
art::ServiceHandle< art::TFileService > tfs
Algorithm collection class computing cluster parameters.
float getHitChiSquare() const
Definition of the Cluster3D class.
float m_artHitsTime
Keeps track of time to recover hits.
Interface to class computing cluster parameters.
std::string & fExtremeName
std::unique_ptr< std::vector< recob::PCAxis > > artPCAxisVector
Vertex * getTargetVertex() const
std::unique_ptr< art::Assns< recob::SpacePoint, recob::Edge > > artEdgeSPAssociations
std::unordered_map< const reco::ClusterHit3D *, art::Ptr< recob::SpacePoint >> Hit3DToSPPtrMap
void MakeAndSaveKinkPoints(ArtOutputHandler &output, reco::ConvexHullKinkTupleList &clusHitPairVector) const
Special routine to handle creating and saving space points.
std::vector< std::vector< double > > EigenVectors
bool empty(FixedBins< T, C > const &) noexcept
std::unordered_map< const recob::Hit *, art::Ptr< recob::Hit >> RecobHitToPtrMap
Defines a structure mapping art representation to internal.
void PrepareEvent(const art::Event &evt)
Event Preparation.
const Coords & getCoords() const
std::list< Vertex > VertexList
ParallelHitsSeedFinderAlg class.
void splitClustersWithHough(reco::ClusterParameters &clusterParameters, reco::ClusterParametersList &clusterParametersList) const
Attempt to split clusters using the output of the Hough Filter.
std::string m_pathInstance
Special instance for path points.
art framework interface to geometry description
BEGIN_PROLOG could also be cout
float m_totalTime
Keeps track of total execution time.
std::list< ClusterParameters > ClusterParametersList
const EigenVectors & getEigenVectors() const
bool findTrackSeeds(reco::HitPairListPtr &hitPairListPtr, reco::PrincipalComponents &inputPCA, SeedHitPairListPairVec &seedHitPairVec) const override
Given the list of hits this will search for candidate Seed objects and return them.
std::unique_ptr< art::Assns< recob::Edge, recob::PFParticle > > artPFPartEdgeAssociations
std::unique_ptr< art::Assns< recob::Edge, recob::PFParticle > > artPFPartPathEdgeAssociations
void setStatusBit(unsigned bits) const
std::map< size_t, const reco::PrincipalComponents * > IdxToPCAMap
Special routine to handle creating and saving space points & edges PCA points.
art::PtrVector< recob::SpacePoint > RecobSpacePointVector
bool m_enableMonitoring
Turn on monitoring of this algorithm.