9 #include "Pandora/AlgorithmHeaders.h" 18 KinkSplittingAlgorithm::KinkSplittingAlgorithm() :
19 m_maxScatterRms(0.2
f),
20 m_maxScatterCosTheta(0.905
f),
21 m_maxSlidingCosTheta(0.985
f)
31 const int minLayer(layerFitResultMap.begin()->first), maxLayer(layerFitResultMap.rbegin()->first);
34 const int nLayersSpanned(1 + maxLayer - minLayer);
36 if (nLayersSpanned <= 2 * nLayersHalfWindow)
37 return STATUS_CODE_NOT_FOUND;
39 bool foundSplit(
false);
41 float bestCosTheta(1.
f);
45 const int iLayer(iter->first);
47 const float rL(slidingFitResult.
GetL(iLayer));
48 const float rL1(slidingFitResult.
GetL(iLayer - nLayersHalfWindow));
49 const float rL2(slidingFitResult.
GetL(iLayer + nLayersHalfWindow));
51 CartesianVector centralPosition(0.
f, 0.
f, 0.
f), firstDirection(0.
f, 0.
f, 0.
f), secondDirection(0.
f, 0.
f, 0.
f);
60 const float cosTheta(firstDirection.GetDotProduct(secondDirection));
61 const float rms1(slidingFitResult.
GetFitRms(rL1));
62 const float rms2(slidingFitResult.
GetFitRms(rL2));
63 const float rms(std::max(rms1, rms2));
72 if (rms < rmsCut && cosTheta < bestCosTheta)
74 bestCosTheta = cosTheta;
75 splitPosition = centralPosition;
81 return STATUS_CODE_NOT_FOUND;
83 return STATUS_CODE_SUCCESS;
90 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxScatterRms",
m_maxScatterRms));
92 PANDORA_RETURN_RESULT_IF_AND_IF(
93 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxScatterCosTheta",
m_maxScatterCosTheta));
95 PANDORA_RETURN_RESULT_IF_AND_IF(
96 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxSlidingCosTeta",
m_maxSlidingCosTheta));
unsigned int GetLayerFitHalfWindow() const
Get the layer fit half window.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_maxSlidingCosTheta
float GetFitRms(const float rL) const
Get fit rms for a given longitudinal coordinate.
pandora::StatusCode GetGlobalFitPosition(const float rL, pandora::CartesianVector &position) const
Get global fit position for a given longitudinal coordinate.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::map< int, LayerFitResult > LayerFitResultMap
float m_maxScatterCosTheta
const LayerFitResultMap & GetLayerFitResultMap() const
Get the layer fit result map.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
float GetL(const int layer) const
Get longitudinal coordinate for a given sliding linear fit layer number.
pandora::StatusCode FindBestSplitPosition(const TwoDSlidingFitResult &slidingFitResult, pandora::CartesianVector &splitPosition) const
Use sliding linear fit to identify the best split position.
Header file for the kink splitting algorithm class.
TwoDSlidingFitResult class.