9 #include "Pandora/AlgorithmHeaders.h"
21 TwoDSlidingFitSplittingAlgorithm::TwoDSlidingFitSplittingAlgorithm() : m_slidingFitHalfWindow(20), m_minClusterLength(10.f)
30 return STATUS_CODE_NOT_FOUND;
37 CartesianVector splitPosition(0.f, 0.f, 0.f);
41 return this->
DivideCaloHits(slidingFitResult, splitPosition, firstHitList, secondHitList);
44 catch (StatusCodeException &statusCodeException)
46 if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
47 throw statusCodeException;
50 return STATUS_CODE_NOT_FOUND;
56 const CartesianVector &splitPosition, CaloHitList &firstCaloHitList, CaloHitList &secondCaloHitList)
const
58 float rL(0.f), rT(0.f);
59 slidingFitResult.GetLocalPosition(splitPosition, rL, rT);
61 const Cluster *
const pCluster(slidingFitResult.GetCluster());
62 const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
64 for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(); iter != orderedCaloHitList.end(); ++iter)
66 for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
68 const CaloHit *
const pCaloHit = *hitIter;
70 float thisL(0.f), thisT(0.f);
71 slidingFitResult.GetLocalPosition(pCaloHit->GetPositionVector(), thisL, thisT);
75 firstCaloHitList.push_back(pCaloHit);
79 secondCaloHitList.push_back(pCaloHit);
84 if (firstCaloHitList.empty() || secondCaloHitList.empty())
85 return STATUS_CODE_NOT_FOUND;
87 return STATUS_CODE_SUCCESS;
94 PANDORA_RETURN_RESULT_IF_AND_IF(
95 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingFitHalfWindow",
m_slidingFitHalfWindow));
97 PANDORA_RETURN_RESULT_IF_AND_IF(
98 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinClusterLength", m_minClusterLength));
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_slidingFitHalfWindow
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
Header file for the geometry helper class.
pandora::StatusCode DivideCaloHits(const pandora::Cluster *const pCluster, pandora::CaloHitList &firstCaloHitList, pandora::CaloHitList &secondCaloHitList) const
Divide calo hits in a cluster into two lists, each associated with a separate fragment cluster...
Header file for the cluster helper class.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
Header file for the two dimensional sliding fit splitting algorithm class.
static float GetLengthSquared(const pandora::Cluster *const pCluster)
Get length squared of cluster.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
virtual pandora::StatusCode FindBestSplitPosition(const TwoDSlidingFitResult &slidingFitResult, pandora::CartesianVector &splitPosition) const =0
Use sliding linear fit to identify the best split position.
TwoDSlidingFitResult class.