9 #include "Pandora/AlgorithmHeaders.h" 18 TwoViewAmbiguousDeltaRayTool::TwoViewAmbiguousDeltaRayTool()
26 m_pParentAlgorithm = pAlgorithm;
28 if (PandoraContentApi::GetSettings(*m_pParentAlgorithm)->ShouldDisplayAlgorithmInfo())
29 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
31 this->ExamineConnectedElements(overlapMatrix);
39 void TwoViewAmbiguousDeltaRayTool::ExamineConnectedElements(
MatrixType &overlapMatrix)
const 41 bool particleCreated(
false);
45 particleCreated =
false;
50 ClusterSet usedKeyClusters;
52 for (
const Cluster *
const pKeyCluster : sortedKeyClusters)
54 if (usedKeyClusters.count(pKeyCluster))
60 for (
const MatrixType::Element &element : elementList)
61 usedKeyClusters.insert(element.GetCluster1());
63 if (this->PickOutGoodMatches(elementList))
65 particleCreated =
true;
69 }
while (particleCreated);
76 unsigned int highestHitCount(0);
77 float bestChiSquared(std::numeric_limits<float>::max());
78 auto bestElementIter(elementList.end());
80 for (
auto iter = elementList.begin(); iter != elementList.end(); ++iter)
82 const MatrixType::Element &element(*iter);
83 const float chiSquared(element.GetOverlapResult().GetReducedChiSquared());
84 const Cluster *
const pCluster1(element.GetCluster1()), *
const pCluster2(element.GetCluster2());
85 const unsigned int hitSum(pCluster1->GetNCaloHits() + pCluster2->GetNCaloHits());
87 if ((hitSum > highestHitCount) || ((hitSum == highestHitCount) && (chiSquared < bestChiSquared)))
89 bestChiSquared = chiSquared;
90 highestHitCount = hitSum;
91 bestElementIter = iter;
95 if (bestElementIter != elementList.end())
97 m_pParentAlgorithm->CreatePfo(*bestElementIter);
106 StatusCode TwoViewAmbiguousDeltaRayTool::ReadSettings(
const TiXmlHandle )
108 return STATUS_CODE_SUCCESS;
TwoViewDeltaRayMatchingAlgorithm class.
std::vector< Element > ElementList
void GetSortedKeyClusters(pandora::ClusterVector &sortedKeyClusters) const
Get a sorted vector of key clusters (view 1 clusters with current implementation) ...
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
std::vector< art::Ptr< recob::Cluster > > ClusterVector