Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::KinkSplittingAlgorithm Class Reference

KinkSplittingAlgorithm class. More...

#include <KinkSplittingAlgorithm.h>

Inheritance diagram for lar_content::KinkSplittingAlgorithm:
lar_content::TwoDSlidingFitSplittingAlgorithm lar_content::ClusterSplittingAlgorithm

Public Member Functions

 KinkSplittingAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::TwoDSlidingFitSplittingAlgorithm
 TwoDSlidingFitSplittingAlgorithm ()
 Default constructor. More...
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
pandora::StatusCode FindBestSplitPosition (const TwoDSlidingFitResult &slidingFitResult, pandora::CartesianVector &splitPosition) const
 Use sliding linear fit to identify the best split position. More...
 

Private Attributes

float m_maxScatterRms
 
float m_maxScatterCosTheta
 
float m_maxSlidingCosTheta
 

Additional Inherited Members

- Protected Member Functions inherited from lar_content::ClusterSplittingAlgorithm
virtual pandora::StatusCode Run ()
 
pandora::StatusCode RunUsingCurrentList () const
 Run the algorithm using the current cluster list as input. More...
 
- Protected Attributes inherited from lar_content::TwoDSlidingFitSplittingAlgorithm
unsigned int m_slidingFitHalfWindow
 
float m_minClusterLength
 

Detailed Description

KinkSplittingAlgorithm class.

Definition at line 19 of file KinkSplittingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::KinkSplittingAlgorithm::KinkSplittingAlgorithm ( )

Member Function Documentation

StatusCode lar_content::KinkSplittingAlgorithm::FindBestSplitPosition ( const TwoDSlidingFitResult slidingFitResult,
pandora::CartesianVector &  splitPosition 
) const
privatevirtual

Use sliding linear fit to identify the best split position.

Parameters
slidingFitResultthe input sliding fit result
splitPositionthe best split position
Returns
pandora::StatusCode

Implements lar_content::TwoDSlidingFitSplittingAlgorithm.

Definition at line 24 of file KinkSplittingAlgorithm.cc.

25 {
26  // Search for scatters by scanning over the layers in the sliding fit result
27  const LayerFitResultMap &layerFitResultMap(slidingFitResult.GetLayerFitResultMap());
28  const int minLayer(layerFitResultMap.begin()->first), maxLayer(layerFitResultMap.rbegin()->first);
29 
30  const int nLayersHalfWindow(slidingFitResult.GetLayerFitHalfWindow());
31  const int nLayersSpanned(1 + maxLayer - minLayer);
32 
33  if (nLayersSpanned <= 2 * nLayersHalfWindow)
34  return STATUS_CODE_NOT_FOUND;
35 
36  bool foundSplit(false);
37 
38  float bestCosTheta(1.f);
39 
40  for (LayerFitResultMap::const_iterator iter = layerFitResultMap.begin(), iterEnd = layerFitResultMap.end(); iter != iterEnd; ++iter)
41  {
42  const int iLayer(iter->first);
43 
44  const float rL(slidingFitResult.GetL(iLayer));
45  const float rL1(slidingFitResult.GetL(iLayer - nLayersHalfWindow));
46  const float rL2(slidingFitResult.GetL(iLayer + nLayersHalfWindow));
47 
48  CartesianVector centralPosition(0.f, 0.f, 0.f), firstDirection(0.f, 0.f, 0.f), secondDirection(0.f, 0.f, 0.f);
49 
50  if ((STATUS_CODE_SUCCESS != slidingFitResult.GetGlobalFitPosition(rL, centralPosition)) ||
51  (STATUS_CODE_SUCCESS != slidingFitResult.GetGlobalFitDirection(rL1, firstDirection)) ||
52  (STATUS_CODE_SUCCESS != slidingFitResult.GetGlobalFitDirection(rL2, secondDirection)))
53  {
54  continue;
55  }
56 
57  const float cosTheta(firstDirection.GetDotProduct(secondDirection));
58  const float rms1(slidingFitResult.GetFitRms(rL1));
59  const float rms2(slidingFitResult.GetFitRms(rL2));
60  const float rms(std::max(rms1, rms2));
61 
62  float rmsCut(m_maxScatterRms);
63 
64  if (cosTheta > m_maxScatterCosTheta)
65  {
66  rmsCut *= ((m_maxSlidingCosTheta > cosTheta) ? (m_maxSlidingCosTheta - cosTheta) / (m_maxSlidingCosTheta - m_maxScatterCosTheta) : 0.f);
67  }
68 
69  if (rms < rmsCut && cosTheta < bestCosTheta)
70  {
71  bestCosTheta = cosTheta;
72  splitPosition = centralPosition;
73  foundSplit = true;
74  }
75  }
76 
77  if (!foundSplit)
78  return STATUS_CODE_NOT_FOUND;
79 
80  return STATUS_CODE_SUCCESS;
81 }
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:40
intermediate_table::const_iterator const_iterator
std::map< int, LayerFitResult > LayerFitResultMap
static int max(int a, int b)
StatusCode lar_content::KinkSplittingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::TwoDSlidingFitSplittingAlgorithm.

Definition at line 85 of file KinkSplittingAlgorithm.cc.

86 {
87  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxScatterRms", m_maxScatterRms));
88 
89  PANDORA_RETURN_RESULT_IF_AND_IF(
90  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxScatterCosTheta", m_maxScatterCosTheta));
91 
92  PANDORA_RETURN_RESULT_IF_AND_IF(
93  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxSlidingCosTeta", m_maxSlidingCosTheta));
94 
96 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)

Member Data Documentation

float lar_content::KinkSplittingAlgorithm::m_maxScatterCosTheta
private

Definition at line 41 of file KinkSplittingAlgorithm.h.

float lar_content::KinkSplittingAlgorithm::m_maxScatterRms
private

Definition at line 40 of file KinkSplittingAlgorithm.h.

float lar_content::KinkSplittingAlgorithm::m_maxSlidingCosTheta
private

Definition at line 42 of file KinkSplittingAlgorithm.h.


The documentation for this class was generated from the following files: