47 #include "art/Framework/Core/EDProducer.h"
48 #include "art/Framework/Principal/Event.h"
49 #include "art/Framework/Core/ModuleMacros.h"
50 #include "art/Persistency/Common/PtrMaker.h"
51 #include "art/Utilities/make_tool.h"
52 #include "art_root_io/TFileService.h"
53 #include "cetlib/cpu_timer.h"
96 namespace lar_cluster3d {
98 std::unordered_map<const reco::ClusterHit3D*, art::Ptr<recob::SpacePoint>>;
119 std::string& pathName,
120 std::string& vertexName,
121 std::string& extremeName)
165 art::Assns<recob::Hit, recob::SpacePoint>& spHitAssns,
166 const std::string&
path =
"")
168 for (
auto&
hit : recobHits)
207 std::vector<recob::SpacePoint>& spacePointVector,
208 art::Assns<recob::SpacePoint, recob::PFParticle>& pfPartSPAssociations,
209 size_t spacePointStart,
212 for (
size_t idx = spacePointStart; idx < spacePointVector.size(); idx++) {
220 art::Assns<recob::Edge, recob::PFParticle>& pfPartEdgeAssociations,
224 for (
size_t idx = edgeStart; idx < edgeVector.size(); idx++) {
234 art::Assns<recob::SpacePoint, recob::Edge>& edgeSPAssociations,
235 const std::string&
path =
"")
237 for (
auto& spacePoint : spacePointVector)
270 art::Ptr<recob::SpacePoint>
277 art::Ptr<recob::Edge>
345 std::vector<recob::Seed>& seedVec,
346 art::Assns<recob::Seed, recob::Hit>& seedHitAssns)
const;
375 std::vector<recob::SpacePoint>& spacePointVec,
376 art::Assns<recob::Hit, recob::SpacePoint>& spHitAssns,
380 const std::string&
path =
"")
const;
408 using IdxToPCAMap = std::map<size_t, const reco::PrincipalComponents*>;
426 size_t pfParticleParent,
456 size_t pfParticleParent,
510 std::unique_ptr<lar_cluster3d::IHit3DBuilder>
512 std::unique_ptr<lar_cluster3d::IClusterAlg>
514 std::unique_ptr<lar_cluster3d::IClusterModAlg>
516 std::unique_ptr<lar_cluster3d::IClusterModAlg>
518 std::unique_ptr<lar_cluster3d::IClusterParametersBuilder>
534 namespace lar_cluster3d {
538 , m_pcaAlg(pset.get<fhicl::ParameterSet>(
"PrincipalComponentsAlg"))
539 , m_skeletonAlg(pset.get<fhicl::ParameterSet>(
"SkeletonAlg"))
540 , m_seedFinderAlg(pset.get<fhicl::ParameterSet>(
"SeedFinderAlg"))
541 , m_pcaSeedFinderAlg(pset.get<fhicl::ParameterSet>(
"PCASeedFinderAlg"))
542 , m_parallelHitsAlg(pset.get<fhicl::ParameterSet>(
"ParallelHitsAlg"))
544 m_onlyMakSpacePoints = pset.get<
bool>(
"MakeSpacePointsOnly",
false);
545 m_enableMonitoring = pset.get<
bool>(
"EnableMonitoring",
false);
546 m_parallelHitsCosAng = pset.get<
float>(
"ParallelHitsCosAng", 0.999);
547 m_parallelHitsTransWid = pset.get<
float>(
"ParallelHitsTransWid", 25.0);
548 m_pathInstance = pset.get<std::string>(
"PathPointsName",
"Path");
549 m_vertexInstance = pset.get<std::string>(
"VertexPointsName",
"Vertex");
550 m_extremeInstance = pset.get<std::string>(
"ExtremePointsName",
"Extreme");
552 m_hit3DBuilderAlg = art::make_tool<lar_cluster3d::IHit3DBuilder>(
553 pset.get<fhicl::ParameterSet>(
"Hit3DBuilderAlg"));
555 art::make_tool<lar_cluster3d::IClusterAlg>(pset.get<fhicl::ParameterSet>(
"ClusterAlg"));
556 m_clusterMergeAlg = art::make_tool<lar_cluster3d::IClusterModAlg>(
557 pset.get<fhicl::ParameterSet>(
"ClusterMergeAlg"));
558 m_clusterPathAlg = art::make_tool<lar_cluster3d::IClusterModAlg>(
559 pset.get<fhicl::ParameterSet>(
"ClusterPathAlg"));
560 m_clusterBuilder = art::make_tool<lar_cluster3d::IClusterParametersBuilder>(
561 pset.get<fhicl::ParameterSet>(
"ClusterParamsBuilder"));
564 m_hit3DBuilderAlg->produces(producesCollector());
566 produces<std::vector<recob::PCAxis>>();
567 produces<std::vector<recob::PFParticle>>();
568 produces<std::vector<recob::Cluster>>();
569 produces<std::vector<recob::Seed>>();
570 produces<std::vector<recob::Edge>>();
572 produces<art::Assns<recob::PFParticle, recob::PCAxis>>();
573 produces<art::Assns<recob::PFParticle, recob::Cluster>>();
574 produces<art::Assns<recob::PFParticle, recob::Seed>>();
575 produces<art::Assns<recob::Edge, recob::PFParticle>>();
576 produces<art::Assns<recob::Seed, recob::Hit>>();
577 produces<art::Assns<recob::Cluster, recob::Hit>>();
579 produces<std::vector<recob::SpacePoint>>();
580 produces<art::Assns<recob::SpacePoint, recob::PFParticle>>();
581 produces<art::Assns<recob::Hit, recob::SpacePoint>>();
582 produces<art::Assns<recob::SpacePoint, recob::Edge>>();
584 produces<std::vector<recob::SpacePoint>>(m_pathInstance);
585 produces<std::vector<recob::Edge>>(m_pathInstance);
586 produces<art::Assns<recob::SpacePoint, recob::PFParticle>>(m_pathInstance);
587 produces<art::Assns<recob::Edge, recob::PFParticle>>(m_pathInstance);
588 produces<art::Assns<recob::Hit, recob::SpacePoint>>(m_pathInstance);
589 produces<art::Assns<recob::SpacePoint, recob::Edge>>(m_pathInstance);
591 produces<std::vector<recob::Edge>>(m_vertexInstance);
592 produces<std::vector<recob::SpacePoint>>(m_vertexInstance);
594 produces<std::vector<recob::SpacePoint>>(m_extremeInstance);
614 mf::LogInfo(
"Cluster3DICARUS") <<
" *** Cluster3D::produce(...) [Run=" << evt.run()
615 <<
", Event=" << evt.id().event() <<
"] Starting Now! *** "
620 cet::cpu_timer theClockTotal;
621 cet::cpu_timer theClockFinish;
631 std::unique_ptr<reco::HitPairList> hitPairList(
640 m_clusterAlg->Cluster3DHits(*hitPairList, clusterParametersList);
656 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
658 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clockData);
660 ProduceArtClusters(gser, output, *hitPairList, clusterParametersList, clusterHitToArtPtrMap);
667 theClockFinish.stop();
668 theClockTotal.stop();
672 m_totalTime = theClockTotal.accumulated_real_time();
681 m_hits =
static_cast<int>(clusterHitToArtPtrMap.size());
682 m_hits3D =
static_cast<int>(hitPairList->size());
685 mf::LogDebug(
"Cluster3DICARUS") <<
"*** Cluster3DICARUS total time: " <<
m_totalTime
703 art::ServiceHandle<art::TFileService>
tfs;
704 m_pRecoTree = tfs->make<TTree>(
"monitoring",
"LAr Reco");
745 std::vector<recob::Seed>& seedVec,
746 art::Assns<recob::Seed, recob::Hit>& seedHitAssns)
const
774 float transRMS = std::hypot(eigenVal0, eigenVal1);
776 bool foundGoodSeed(
false);
787 else if (eigenVal2 > 40. && transRMS < 5.) {
797 if (!foundGoodSeed) {
804 for (
const auto& seedHitPair : seedHitPairVec) {
805 seedVec.push_back(seedHitPair.first);
809 std::set<art::Ptr<recob::Hit>> seedHitSet;
810 for (
const auto& hit3D : seedHitPair.second) {
811 for (
const auto& hit2D : hit3D->getHits()) {
812 if (!hit2D)
continue;
815 seedHitSet.insert(hitToPtrMap[recobHit]);
820 for (
const auto& hit2D : seedHitSet)
821 seedHitVec.push_back(hit2D);
830 const std::pair<float, const reco::ClusterHit3D*>&
right)
832 return left.first < right.first;
852 typedef std::pair<float, const reco::ClusterHit3D*> DistanceHit3DPair;
853 typedef std::list<DistanceHit3DPair> DistanceHit3DPairList;
854 typedef std::map<const reco::ClusterHit3D*, DistanceHit3DPairList> Hit3DToDistanceMap;
857 typedef std::list<const reco::ClusterHit3D*> Hit3DList;
858 typedef std::pair<Hit3DList::iterator, Hit3DList::iterator> Hit3DEdgePair;
859 typedef std::pair<float, Hit3DEdgePair> DistanceEdgePair;
860 typedef std::list<DistanceEdgePair> DistanceEdgePairList;
862 struct DistanceEdgePairOrder {
864 operator()(
const DistanceEdgePair&
left,
const DistanceEdgePair&
right)
const
866 return left.first > right.first;
884 Hit3DToDistanceMap hit3DToDistanceMap;
886 for (reco::HitPairListPtr::const_iterator hit3DOuterItr = skeletonListPtr.begin();
887 hit3DOuterItr != skeletonListPtr.end();) {
889 DistanceHit3DPairList& outerHitList = hit3DToDistanceMap[hit3DOuter];
893 for (reco::HitPairListPtr::const_iterator hit3DInnerItr = hit3DOuterItr;
894 hit3DInnerItr != skeletonListPtr.end();
899 TVector3 deltaPos = innerPos - outerPos;
900 float hitDistance(
float(deltaPos.Mag()));
902 if (hitDistance > 20.)
continue;
904 hit3DToDistanceMap[hit3DInner].emplace_back(hitDistance, hit3DOuter);
905 outerHitList.emplace_back(hitDistance, hit3DInner);
913 for (
auto& mapPair : hit3DToDistanceMap) {
919 DistanceEdgePairList distanceEdgePairList;
922 hit3DList.emplace_back(skeletonListPtr.front());
923 distanceEdgePairList.emplace_back(
924 DistanceEdgePair(0., Hit3DEdgePair(hit3DList.begin(), hit3DList.begin())));
928 float largestDistance(0.);
929 float averageDistance(0.);
933 while (hit3DList.size() < skeletonListPtr.size()) {
934 Hit3DList::iterator bestHit3DIter = hit3DList.begin();
935 float bestDist = 10000000.;
938 for (Hit3DList::iterator hit3DIter = hit3DList.begin(); hit3DIter != hit3DList.end();
943 DistanceHit3DPairList& nearestList = hit3DToDistanceMap[hit3D];
945 while (!nearestList.empty()) {
949 if (nearestList.front().first < bestDist) {
950 bestHit3DIter = hit3DIter;
951 bestDist = nearestList.front().first;
956 nearestList.pop_front();
960 if (bestDist > largestDistance) largestDistance = bestDist;
962 averageDistance += bestDist;
968 hit3DToDistanceMap[bestHit3D].front().second;
970 Hit3DList::iterator nextHit3DIter = hit3DList.insert(hit3DList.end(), nextHit3D);
972 distanceEdgePairList.emplace_back(bestDist, Hit3DEdgePair(bestHit3DIter, nextHit3DIter));
977 averageDistance /= float(hit3DList.size());
982 distanceEdgePairList.sort(DistanceEdgePairOrder());
984 DistanceEdgePairList::iterator largestDistIter = distanceEdgePairList.begin();
986 for (DistanceEdgePairList::iterator edgeIter = distanceEdgePairList.begin();
987 edgeIter != distanceEdgePairList.end();
989 if (edgeIter->first < thirdDist)
break;
991 largestDistIter = edgeIter;
994 reco::HitPairListPtr::iterator breakIter = largestDistIter->second.second;
997 bestList.resize(
std::distance(hit3DList.begin(), breakIter));
999 std::copy(hit3DList.begin(), breakIter, bestList.begin());
1003 hitPairListPtr.sort();
1006 reco::HitPairListPtr::iterator newListEnd = std::set_difference(hitPairListPtr.begin(),
1007 hitPairListPtr.end(),
1010 hitPairListPtr.begin());
1012 hitPairListPtr.erase(newListEnd, hitPairListPtr.end());
1059 skeletonListPtr, clusterParameters.
getSkeletonPCA(), hitPairListPtrList);
1062 if (hitPairListPtrList.size() < 2)
return;
1072 reco::HitPairListPtrList::iterator hitPairListIter = hitPairListPtrList.begin();
1082 for (
const auto& hit3D : hitPairListPtr) {
1083 for (
const auto& hit2D : hit3D->getHits())
1084 if (hit2D) hit2D->clearStatusBits(0x1);
1091 float allowedHitRange = 6. * firstHitListPCA.
getAveHitDoca();
1104 newClusterHitList.resize(hitPairListPtr.size());
1107 reco::HitPairListPtr::iterator newListEnd = std::copy_if(hitPairListPtr.begin(),
1108 hitPairListPtr.end(),
1109 newClusterHitList.begin(),
1113 newClusterHitList.resize(
std::distance(newClusterHitList.begin(), newListEnd));
1122 m_clusterBuilder->FillClusterParams(newClusterParams, hit2DToClusterMap, 0., 1.);
1142 float newAllowedHitRange = 6. * secondHitListPCA.
getAveHitDoca();
1151 reco::HitPairListPtr::iterator tempListEnd =
1152 std::copy_if(newClusterHitList.begin(),
1153 newClusterHitList.end(),
1154 tempHitList.begin(),
1157 hitPairListPtr.insert(hitPairListPtr.end(), tempHitList.begin(), tempListEnd);
1164 m_clusterBuilder->FillClusterParams(originalParams, hit2DToClusterMap, 0., 1.);
1184 mf::LogDebug(
"Cluster3DICARUS") <<
" *** Cluster3DICARUS::ProduceArtClusters() *** " << std::endl;
1187 if (!clusterParametersList.empty()) {
1191 for (
auto& clusterParameters : clusterParametersList) {
1197 if (!clusterParameters.getFullPCA().getSvdOK()) {
1198 mf::LogDebug(
"Cluster3DICARUS")
1199 <<
"--> no feature extraction done on this cluster!!" << std::endl;
1215 if (clusterParameters.daughterList().empty()) {
1226 clusterParameters.getConvexHull().getConvexHullKinkPoints());
1245 std::vector<size_t> daughterVec;
1247 for (
auto& idxToPCA : idxToPCAMap)
1248 daughterVec.emplace_back(idxToPCA.first);
1256 double eigenVals[] = {0., 0., 0.};
1257 double avePosition[] = {0., 0., 0.};
1259 eigenVecs.resize(3);
1263 for (
size_t outerIdx = 0; outerIdx < 3; outerIdx++) {
1267 eigenVecs[outerIdx].resize(3);
1270 for (
size_t innerIdx = 0; innerIdx < 3; innerIdx++)
1271 eigenVecs[outerIdx][innerIdx] = skeletonPCA.
getEigenVectors().row(outerIdx)[innerIdx];
1286 for (
size_t outerIdx = 0; outerIdx < 3; outerIdx++) {
1290 for (
size_t innerIdx = 0; innerIdx < 3; innerIdx++)
1291 eigenVecs[outerIdx][innerIdx] = fullPCA.
getEigenVectors().row(outerIdx)(innerIdx);
1311 clusterParameters.getHitPairListPtr(),
1317 clusterParameters.getConvexHull().getConvexHullKinkPoints());
1322 for (
const auto& edge : clusterParameters.getConvexHull().getConvexHullEdgeList()) {
1326 spacePointVec.push_back(hit3DToSPPtrMap.at(std::get<0>(edge)));
1327 spacePointVec.push_back(hit3DToSPPtrMap.at(std::get<1>(edge)));
1330 std::cout <<
"Caught exception in looking up space point ptr... " << std::get<0>(edge)
1331 <<
", " << std::get<1>(edge) << std::endl;
1336 spacePointVec[0].key(),
1337 spacePointVec[1].key(),
1354 for (
auto& hitPair : hitPairVector) {
1357 double spacePointPos[] = {
1358 hitPair.getPosition()[0], hitPair.getPosition()[1], hitPair.getPosition()[2]};
1359 double spacePointErr[] = {1., 0., 0., 1., 0., 1.};
1360 double chisq = hitPair.getHitChiSquare();
1364 for (
const auto hit : hitPair.getHits()) {
1367 art::Ptr<recob::Hit> hitPtr = hitToPtrMap[
hit->getHit()];
1368 recobHits.push_back(hitPtr);
1373 spacePointErr[1] = hitPair.getTotalCharge();
1374 spacePointErr[3] = hitPair.getChargeAsymmetry();
1379 if (!recobHits.empty())
1384 std::cout <<
"++++>>>> total num hits: " << hitPairVector.size()
1385 <<
", num free: " << nFreePoints << std::endl;
1391 size_t localCount(0);
1394 for (
auto& clusterParams : clusterParameters.
daughterList())
1407 size_t pfParticleParent,
1415 for (
auto& clusterParams : clusterParameters.
daughterList())
1435 idxToPCAMap[daughterIdx] = &clusterParameters.
getFullPCA();
1438 return idxToPCAMap.size();
1445 size_t pfParticleParent,
1455 using OverriddenClusterParamsAlg_t =
1473 for (
const auto& clusParametersPair : clusterParameters.
getClusterParams()) {
1480 std::vector<const recob::Hit*> recobHitVec(clusParams.
m_hitVector.size());
1484 recobHitVec.begin(),
1485 [](
const auto& hit2D) {
return hit2D->getHit(); });
1494 ClusterParamAlgo.
ImportHits(gser, recobHitVec);
1518 for (
const auto& hit2D : clusParams.
m_hitVector) {
1519 if (hit2D ==
nullptr || hit2D->getHit() ==
nullptr)
continue;
1521 art::Ptr<recob::Hit> hitPtr = hitToPtrMap[hit2D->getHit()];
1522 recobHits.push_back(hitPtr);
1533 std::vector<size_t> nullVector;
1553 int spacePointStart = spVector->size();
1556 output, *spVector, *spHitAssns, *hit3DListPtr, hitToPtrMap, *hit3DToPtrMap);
1565 hit3DToPtrMap = &best3DToSPPtrMap;
1574 spacePointStart = spVector->size();
1577 output, *spVector, *spHitAssns, *hit3DListPtr, hitToPtrMap, *hit3DToPtrMap, instance);
1585 size_t edgeStart = edgeVector->size();
1591 spacePointVec.push_back(hit3DToPtrMap->at(std::get<0>(edge)));
1592 spacePointVec.push_back(hit3DToPtrMap->at(std::get<1>(edge)));
1595 std::cout <<
"Caught exception in looking up space point ptr... " << std::get<0>(edge)
1596 <<
", " << std::get<1>(edge) << std::endl;
1600 edgeVector->emplace_back(
1601 std::get<2>(edge), spacePointVec[0].key(), spacePointVec[1].key(), edgeVector->size());
1612 double eigenVals[] = {0., 0., 0.};
1613 double avePosition[] = {0., 0., 0.};
1615 eigenVecs.resize(3);
1617 for (
size_t outerIdx = 0; outerIdx < 3; outerIdx++) {
1621 eigenVecs[outerIdx].resize(3);
1623 for (
size_t innerIdx = 0; innerIdx < 3; innerIdx++)
1624 eigenVecs[outerIdx][innerIdx] = skeletonPCA.
getEigenVectors().row(outerIdx)(innerIdx);
1637 for (
size_t outerIdx = 0; outerIdx < 3; outerIdx++) {
1641 for (
size_t innerIdx = 0; innerIdx < 3; innerIdx++)
1642 eigenVecs[outerIdx][innerIdx] = fullPCA.
getEigenVectors().row(outerIdx)(innerIdx);
1660 return pfParticleIdx;
1665 std::vector<recob::SpacePoint>& spacePointVec,
1666 art::Assns<recob::Hit, recob::SpacePoint>& spHitAssns,
1673 spacePointVec.reserve(spacePointVec.size() + clusHitPairVector.size());
1676 double spError[] = {1., 0., 1., 0., 0., 1.};
1679 for (
auto& hitPair : clusHitPairVector) {
1681 if (hit3DToSPPtrMap.find(hitPair) != hit3DToSPPtrMap.end())
continue;
1686 double chisq = hitPair->getHitChiSquare();
1692 size_t spacePointID = spacePointVec.size();
1693 double spacePointPos[] = {
1694 hitPair->getPosition()[0], hitPair->getPosition()[1], hitPair->getPosition()[2]};
1696 spError[1] = hitPair->getTotalCharge();
1697 spError[3] = hitPair->getChargeAsymmetry();
1699 spacePointVec.emplace_back(spacePointPos, spError, chisq, spacePointID);
1707 for (
const auto&
hit : hitPair->getHits()) {
1710 art::Ptr<recob::Hit> hitPtr = hitToPtrMap[
hit->getHit()];
1711 recobHits.push_back(hitPtr);
1714 if (!recobHits.empty())
1726 double spError[] = {1., 0., 1., 0., 0., 1.};
1729 for (
auto& kinkTuple : kinkTupleVec) {
1735 double spacePointPos[] = {
1759 double spError[] = {1., 0., 1., 0., 0., 1.};
1763 std::map<const dcel2d::Vertex*, size_t> vertexToSpacePointMap;
1766 for (
auto&
vertex : vertexList) {
1770 double spacePointPos[] = {coords[0], coords[1], coords[2]};
1779 std::set<const dcel2d::HalfEdge*> halfEdgeSet;
1782 for (
const auto& halfEdge : halfEdgeList) {
1787 if (twin && halfEdgeSet.find(twin) == halfEdgeSet.end()) {
1793 if (!toVertex || !fromVertex)
continue;
1795 if (vertexToSpacePointMap.find(fromVertex) == vertexToSpacePointMap.end() ||
1796 vertexToSpacePointMap.find(toVertex) == vertexToSpacePointMap.end())
1803 vertexToSpacePointMap[fromVertex],
1804 vertexToSpacePointMap[toVertex],
1807 halfEdgeSet.insert(&halfEdge);
1827 Eigen::Vector3f avePosition(
1831 using DocaToPCAPair = std::pair<float, const reco::PrincipalComponents*>;
1832 using DocaToPCAVec = std::vector<DocaToPCAPair>;
1834 DocaToPCAVec docaToPCAVec;
1837 for (
const auto& idxToPCA : idxToPCAMap) {
1842 Eigen::Vector3f pcaPos(
1846 Eigen::Vector3f pcaToAveVec = pcaPos - avePosition;
1849 float arclenToPoca = pcaToAveVec.dot(axisDirVec);
1851 docaToPCAVec.emplace_back(arclenToPoca, pca);
1854 std::sort(docaToPCAVec.begin(), docaToPCAVec.end(), [](
const auto&
left,
const auto&
right) {
1860 double spError[] = {1., 0., 1., 0., 0., 1.};
1866 for (
const auto& docaToPCAPair : docaToPCAVec) {
1871 double lastPointPos[] = {
1874 double curPointPos[] = {
1876 size_t curPointBin = lastPointBin + 1;
1881 Eigen::Vector3f distVec(curPointPos[0] - lastPointPos[0],
1882 curPointPos[1] - lastPointPos[1],
1883 curPointPos[2] - lastPointPos[2]);
1886 distVec.norm(), lastPointBin, curPointBin, output.
artEdgeVector->size());
Definition of the Cluster3D class.
reco::HitPairListPtr & getBestHitPairListPtr()
float m_artHitsTime
Keeps track of time to recover hits.
HoughSeedFinderAlg m_seedFinderAlg
Seed finder.
std::string m_extremeInstance
Instance name for the extreme points.
std::unique_ptr< art::Assns< recob::Edge, recob::PFParticle > > artPFPartPathEdgeAssociations
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
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< art::Assns< recob::Hit, recob::SpacePoint > > artPPHitAssociations
std::unique_ptr< art::Assns< recob::PFParticle, recob::Seed > > artPFPartSeedAssociations
art::PtrMaker< recob::Edge > fEdgePtrMakerPath
std::string m_vertexInstance
Special instance name for vertex points.
std::unique_ptr< std::vector< recob::Edge > > artPathEdgeVector
void makePFPartSpacePointAssns(std::vector< recob::SpacePoint > &spacePointVector, art::Assns< recob::SpacePoint, recob::PFParticle > &pfPartSPAssociations, size_t spacePointStart, const std::string &instance="")
static constexpr size_t kPFParticlePrimary
Define index to signify primary particle.
std::list< HalfEdge > HalfEdgeList
int m_hits
Keeps track of the number of hits seen.
const Eigen::Vector3f getPosition() const
void makeEdgeSpacePointAssns(std::vector< recob::Edge > &edgeVector, RecobSpacePointVector &spacePointVector, art::Assns< recob::SpacePoint, recob::Edge > &edgeSPAssociations, const std::string &path="")
HalfEdge * getTwinHalfEdge() const
std::unique_ptr< std::vector< recob::SpacePoint > > artExtremePointVector
std::unique_ptr< std::vector< recob::PFParticle > > artPFParticleVector
Declaration of signal hit object.
float m_parallelHitsTransWid
Cut on transverse width of cluster (PCA 2nd eigenvalue)
reco::PrincipalComponents & getSkeletonPCA()
void clearStatusBits(unsigned bits) const
CopyIfInRange(float maxRange)
void produce(art::Event &evt) override
bool m_enableMonitoring
Turn on monitoring of this algorithm.
std::unique_ptr< art::Assns< recob::PFParticle, recob::PCAxis > > artPFPartAxisAssociations
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.
const std::string instance
std::string & fExtremeName
std::unique_ptr< art::Assns< recob::Seed, recob::Hit > > artSeedHitAssociations
float getTotalCharge() const
Hit has been rejected for any reason.
reco::EdgeList & getBestEdgeList()
int getNumHitsUsed() const
HoughSeedFinderAlg class.
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.
std::unique_ptr< lar_cluster3d::IClusterAlg > m_clusterAlg
Algorithm to do 3D space point clustering.
std::list< HitPairListPtr > HitPairListPtrList
A utility class used in construction of 3D clusters.
reco::HitPairListPtr & getHitPairListPtr()
float m_pathFindingTime
Keeps track of the path finding time.
reco::PlaneToClusterParamsMap & getClusterParams()
void GetSkeletonHits(const reco::HitPairListPtr &inputHitList, reco::HitPairListPtr &skeletonHitList) const
Return the skeleton hits from the input list.
void MakeAndSaveVertexPoints(ArtOutputHandler &, dcel2d::VertexList &, dcel2d::HalfEdgeList &) const
Special routine to handle creating and saving space points & edges associated to voronoi diagrams...
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.
int m_hits3D
Keeps track of the number of 3D hits made.
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.
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.
art::Ptr< recob::Edge > makeEdgePtr(size_t index, const std::string &instance="")
PCASeedFinderAlg m_pcaSeedFinderAlg
Use PCA axis to find seeds.
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.
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.
size_t countUltimateDaughters(reco::ClusterParameters &clusterParameters) const
Count number of end of line daughters.
Overrides another ClusterParamsAlgBase class with selected constants.
This is an algorithm for finding recob::Seed objects in 3D clusters.
std::unique_ptr< lar_cluster3d::IClusterModAlg > m_clusterPathAlg
Algorithm to do cluster path finding.
const EigenValues & getEigenValues() const
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
reco::PrincipalComponents & getFullPCA()
void makeClusterHitAssns(RecobHitVector &recobHits)
float getChargeAsymmetry() const
art::PtrVector< recob::Hit > RecobHitVector
SkeletonAlg m_skeletonAlg
Skeleton point finder.
This is an algorithm for finding recob::Seed objects in 3D clusters.
PrincipalComponentsAlg m_pcaAlg
Principal Components algorithm.
void InitializeMonitoring()
Initialize the internal monitoring.
std::string m_pathInstance
Special instance for path points.
std::unique_ptr< art::Assns< recob::PFParticle, recob::Cluster > > artPFPartClusAssociations
std::unique_ptr< lar_cluster3d::IClusterModAlg > m_clusterMergeAlg
Algorithm to do cluster merging.
std::unique_ptr< art::Assns< recob::Cluster, recob::Hit > > artClusterAssociations
art::PtrMaker< recob::SpacePoint > fSPPtrMaker
void makeSpacePointHitAssns(std::vector< recob::SpacePoint > &spacePointVector, RecobHitVector &recobHits, art::Assns< recob::Hit, recob::SpacePoint > &spHitAssns, const std::string &path="")
Helper functions to create a cluster.
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
const Eigen::Vector3f & getAvePosition() const
std::unique_ptr< std::vector< recob::SpacePoint > > artPathPointVector
std::list< ConvexHullKinkTuple > ConvexHullKinkTupleList
ParallelHitsSeedFinderAlg m_parallelHitsAlg
Deal with parallel hits clusters.
void AverageSkeletonPositions(reco::HitPairListPtr &skeletonHitList) const
Modifies the position of input skeleton hits by averaging along the "best" wire direction.
Cluster3DICARUS(fhicl::ParameterSet const &pset)
Wrapper for ClusterParamsAlgBase objects to accept arbitrary input.
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::list< const reco::ClusterHit3D * > HitPairListPtr
This provides an art tool interface definition for 3D Cluster algorithms.
std::unique_ptr< std::vector< recob::Edge > > artEdgeVector
void makePFPartEdgeAssns(std::vector< recob::Edge > &edgeVector, art::Assns< recob::Edge, recob::PFParticle > &pfPartEdgeAssociations, size_t edgeStart, const std::string &instance="")
void makePFPartClusterAssns(size_t clusterStart)
std::unique_ptr< art::Assns< recob::SpacePoint, recob::Edge > > artEdgeSPAssociations
art::PtrMaker< recob::SpacePoint > fSPPtrMakerPath
Declaration of cluster object.
void makePFPartSeedAssns(size_t numSeedsStart)
bool operator()(const std::pair< float, const reco::ClusterHit3D * > &left, const std::pair< float, const reco::ClusterHit3D * > &right)
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::Edge, recob::PFParticle > > artPFPartEdgeAssociations
std::unique_ptr< std::vector< recob::SpacePoint > > artVertexPointVector
std::unique_ptr< art::Assns< recob::SpacePoint, recob::PFParticle > > artPFPartSPAssociations
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
ArtOutputHandler(art::Event &evt, std::string &pathName, std::string &vertexName, std::string &extremeName)
std::unique_ptr< art::Assns< recob::Hit, recob::SpacePoint > > artSPHitAssociations
Hierarchical representation of particle flow.
std::string & fVertexName
bool bitsAreSet(const unsigned int &bitsToCheck) const
void splitClustersWithHough(reco::ClusterParameters &clusterParameters, reco::ClusterParametersList &clusterParametersList) const
Attempt to split clusters using the output of the Hough Filter.
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...
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.
Header file to define the interface to the SkeletonAlg.
std::unique_ptr< std::vector< recob::SpacePoint > > artSpacePointVector
Hit has been made into Space Point.
std::vector< SeedHitPairListPair > SeedHitPairListPairVec
This provides an art tool interface definition for 3D Cluster algorithms.
BEGIN_PROLOG sequence::SlidingWindowTriggerPatternsOppositeWindows END_PROLOG simSlidingORM6O6 effSlidingORW output
float m_buildNeighborhoodTime
Keeps track of time to build epsilon neighborhood.
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::Edge > > artVertexEdgeVector
std::unique_ptr< std::vector< recob::Cluster > > artClusterVector
float m_parallelHitsCosAng
Cut for PCA 3rd axis angle to X axis.
float m_totalTime
Keeps track of total execution time.
std::unique_ptr< lar_cluster3d::IClusterParametersBuilder > m_clusterBuilder
Common cluster builder tool.
float m_clusterMergeTime
Keeps track of the time to merge clusters.
void makePFPartPCAAssns()
std::unordered_map< const reco::ClusterHit2D *, ClusterToHitPairSetMap > Hit2DToClusterMap
bool m_onlyMakSpacePoints
If true we don't do the full cluster 3D processing.
std::unique_ptr< lar_cluster3d::IHit3DBuilder > m_hit3DBuilderAlg
Builds the 3D hits to operate on.
ClusterHit2DVec m_hitVector
float m_dbscanTime
Keeps track of time to run DBScan.
float m_finishTime
Keeps track of time to run output module.
2D representation of charge deposited in the TDC/wire plane
art::ServiceHandle< art::TFileService > tfs
Algorithm collection class computing cluster parameters.
float getHitChiSquare() const
Interface to class computing cluster parameters.
art::PtrMaker< recob::Edge > fEdgePtrMaker
Vertex * getTargetVertex() const
std::unordered_map< const reco::ClusterHit3D *, art::Ptr< recob::SpacePoint >> Hit3DToSPPtrMap
std::vector< std::vector< double > > EigenVectors
bool empty(FixedBins< T, C > const &) noexcept
float m_makeHitsTime
Keeps track of time to build 3D hits.
void MakeAndSavePCAPoints(ArtOutputHandler &, const reco::PrincipalComponents &, IdxToPCAMap &) const
std::unique_ptr< art::Assns< recob::SpacePoint, recob::PFParticle > > artPFPartPPAssociations
std::unique_ptr< art::Assns< recob::SpacePoint, recob::Edge > > artEdgePPAssociations
std::unordered_map< const recob::Hit *, art::Ptr< recob::Hit >> RecobHitToPtrMap
Defines a structure mapping art representation to internal.
const Coords & getCoords() const
std::list< Vertex > VertexList
ParallelHitsSeedFinderAlg class.
std::map< size_t, const reco::PrincipalComponents * > IdxToPCAMap
Special routine to handle creating and saving space points & edges PCA points.
art::Ptr< recob::SpacePoint > makeSpacePointPtr(size_t index, const std::string &instance="")
art framework interface to geometry description
BEGIN_PROLOG could also be cout
std::list< ClusterParameters > ClusterParametersList
void MakeAndSaveKinkPoints(ArtOutputHandler &output, reco::ConvexHullKinkTupleList &clusHitPairVector) const
Special routine to handle creating and saving space points.
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.
void PrepareEvent(const art::Event &evt)
Event Preparation.
std::unique_ptr< std::vector< recob::PCAxis > > artPCAxisVector
std::unique_ptr< std::vector< recob::Seed > > artSeedVector
void setStatusBit(unsigned bits) const
art::PtrVector< recob::SpacePoint > RecobSpacePointVector