9 #include "Pandora/AlgorithmHeaders.h" 23 TrackHitsBaseTool::TrackHitsBaseTool() :
25 m_slidingFitWindow(20)
32 const CaloHitVector &inputTwoDHits,
ProtoHitVector &protoHitVector)
34 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
35 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
45 if (matchedSlidingFitMap.size() < 2)
48 this->
GetTrackHits3D(inputTwoDHits, matchedSlidingFitMap, protoHitVector);
50 catch (StatusCodeException &)
59 const ClusterList &pfoClusterList(pPfo->GetClusterList());
62 pfoClusterVector.insert(pfoClusterVector.end(), pfoClusterList.begin(), pfoClusterList.end());
65 for (
const Cluster *
const pCluster : pfoClusterVector)
69 if (TPC_3D == hitType)
72 if (matchedSlidingFitMap.end() != matchedSlidingFitMap.find(hitType))
80 if (!matchedSlidingFitMap.insert(MatchedSlidingFitMap::value_type(hitType, slidingFitResult)).second)
81 throw StatusCodeException(STATUS_CODE_FAILURE);
83 catch (StatusCodeException &statusCodeException)
85 if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
86 throw statusCodeException;
95 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinViews",
m_minViews));
97 PANDORA_RETURN_RESULT_IF_AND_IF(
98 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingFitWindow",
m_slidingFitWindow));
virtual void GetTrackHits3D(const pandora::CaloHitVector &inputTwoDHits, const MatchedSlidingFitMap &matchedSlidingFitMap, ProtoHitVector &protoHitVector) const =0
Calculate 3D hits from an input list of 2D hits.
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position, then pulse-height.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
virtual void BuildSlidingFitMap(const pandora::ParticleFlowObject *const pPfo, MatchedSlidingFitMap &matchedSlidingFitMap) const
Calculate sliding fit results for clusters from each view.
Header file for the pfo helper class.
std::map< pandora::HitType, TwoDSlidingFitResult > MatchedSlidingFitMap
ThreeDHitCreationAlgorithm::ProtoHitVector ProtoHitVector
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static bool IsTrack(const pandora::ParticleFlowObject *const pPfo)
Return track flag based on Pfo Particle ID.
Header file for the three dimensional hit creation algorithm class.
Header file for the geometry helper class.
Header file for the cluster helper class.
static float GetWirePitch(const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
unsigned int m_minViews
The minimum number of views required for building hits.
ThreeDHitCreationAlgorithm::Algorithm class.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
virtual void Run(ThreeDHitCreationAlgorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pPfo, const pandora::CaloHitVector &inputTwoDHits, ProtoHitVector &protoHitVector)
Run the algorithm tool.
TwoDSlidingFitResult class.