9 #include "Pandora/AlgorithmHeaders.h" 18 KinkSplittingAlgorithm::KinkSplittingAlgorithm() : m_maxScatterRms(0.2
f), m_maxScatterCosTheta(0.905
f), m_maxSlidingCosTheta(0.985
f)
28 const int minLayer(layerFitResultMap.begin()->first), maxLayer(layerFitResultMap.rbegin()->first);
31 const int nLayersSpanned(1 + maxLayer - minLayer);
33 if (nLayersSpanned <= 2 * nLayersHalfWindow)
34 return STATUS_CODE_NOT_FOUND;
36 bool foundSplit(
false);
38 float bestCosTheta(1.
f);
42 const int iLayer(iter->first);
44 const float rL(slidingFitResult.
GetL(iLayer));
45 const float rL1(slidingFitResult.
GetL(iLayer - nLayersHalfWindow));
46 const float rL2(slidingFitResult.
GetL(iLayer + nLayersHalfWindow));
48 CartesianVector centralPosition(0.
f, 0.
f, 0.
f), firstDirection(0.
f, 0.
f, 0.
f), secondDirection(0.
f, 0.
f, 0.
f);
57 const float cosTheta(firstDirection.GetDotProduct(secondDirection));
58 const float rms1(slidingFitResult.
GetFitRms(rL1));
59 const float rms2(slidingFitResult.
GetFitRms(rL2));
69 if (rms < rmsCut && cosTheta < bestCosTheta)
71 bestCosTheta = cosTheta;
72 splitPosition = centralPosition;
78 return STATUS_CODE_NOT_FOUND;
80 return STATUS_CODE_SUCCESS;
87 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxScatterRms",
m_maxScatterRms));
89 PANDORA_RETURN_RESULT_IF_AND_IF(
90 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaxScatterCosTheta",
m_maxScatterCosTheta));
92 PANDORA_RETURN_RESULT_IF_AND_IF(
93 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)
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
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
static int max(int a, int b)
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.