Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
TwoDSlidingFitSplittingAlgorithm.cc
Go to the documentation of this file.
1
10
13
15
16using namespace pandora;
17
18namespace lar_content
19{
20
21TwoDSlidingFitSplittingAlgorithm::TwoDSlidingFitSplittingAlgorithm() : m_slidingFitHalfWindow(20), m_minClusterLength(10.f)
22{
23}
24
25//------------------------------------------------------------------------------------------------------------------------------------------
26
27StatusCode TwoDSlidingFitSplittingAlgorithm::DivideCaloHits(const Cluster *const pCluster, CaloHitList &firstHitList, CaloHitList &secondHitList) const
28{
30 return STATUS_CODE_NOT_FOUND;
31
32 try
33 {
34 const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
35
36 const TwoDSlidingFitResult slidingFitResult(pCluster, m_slidingFitHalfWindow, slidingFitPitch);
37 CartesianVector splitPosition(0.f, 0.f, 0.f);
38
39 if (STATUS_CODE_SUCCESS == this->FindBestSplitPosition(slidingFitResult, splitPosition))
40 {
41 return this->DivideCaloHits(slidingFitResult, splitPosition, firstHitList, secondHitList);
42 }
43 }
44 catch (StatusCodeException &statusCodeException)
45 {
46 if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
47 throw statusCodeException;
48 }
49
50 return STATUS_CODE_NOT_FOUND;
51}
52
53//------------------------------------------------------------------------------------------------------------------------------------------
54
56 const CartesianVector &splitPosition, CaloHitList &firstCaloHitList, CaloHitList &secondCaloHitList) const
57{
58 float rL(0.f), rT(0.f);
59 slidingFitResult.GetLocalPosition(splitPosition, rL, rT);
60
61 const Cluster *const pCluster(slidingFitResult.GetCluster());
62 const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
63
64 for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(); iter != orderedCaloHitList.end(); ++iter)
65 {
66 for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
67 {
68 const CaloHit *const pCaloHit = *hitIter;
69
70 float thisL(0.f), thisT(0.f);
71 slidingFitResult.GetLocalPosition(pCaloHit->GetPositionVector(), thisL, thisT);
72
73 if (thisL < rL)
74 {
75 firstCaloHitList.push_back(pCaloHit);
76 }
77 else
78 {
79 secondCaloHitList.push_back(pCaloHit);
80 }
81 }
82 }
83
84 if (firstCaloHitList.empty() || secondCaloHitList.empty())
85 return STATUS_CODE_NOT_FOUND;
86
87 return STATUS_CODE_SUCCESS;
88}
89
90//------------------------------------------------------------------------------------------------------------------------------------------
91
93{
95 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitHalfWindow", m_slidingFitHalfWindow));
96
98 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterLength", m_minClusterLength));
99
101}
102
103} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cluster helper class.
Header file for the geometry helper class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
Header file for the two dimensional sliding fit splitting algorithm class.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
static float GetLengthSquared(const pandora::Cluster *const pCluster)
Get length squared of cluster.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
const pandora::Cluster * GetCluster() const
Get the address of the cluster, if originally provided.
virtual pandora::StatusCode FindBestSplitPosition(const TwoDSlidingFitResult &slidingFitResult, pandora::CartesianVector &splitPosition) const =0
Use sliding linear fit to identify the best split position.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
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.
CaloHit class.
Definition CaloHit.h:26
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
Definition CaloHit.h:350
CartesianVector class.
Cluster class.
Definition Cluster.h:31
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
Definition Cluster.h:470
Calo hit lists arranged by pseudo layer.
const_iterator end() const
Returns a const iterator referring to the past-the-end element in the ordered calo hit list.
const_iterator begin() const
Returns a const iterator referring to the first element in the ordered calo hit list.
TheList::const_iterator const_iterator
const Pandora & GetPandora() const
Get the associated pandora instance.
Definition Process.h:116
StatusCodeException class.
StatusCode GetStatusCode() const
Get status code.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.