LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::VertexSplittingAlgorithm Class Reference

VertexSplittingAlgorithm class. More...

#include "VertexSplittingAlgorithm.h"

Inheritance diagram for lar_content::VertexSplittingAlgorithm:
lar_content::TwoDSlidingFitSplittingAlgorithm lar_content::ClusterSplittingAlgorithm

Public Member Functions

 VertexSplittingAlgorithm ()
 Default constructor. More...
 

Protected Member Functions

virtual pandora::StatusCode Run ()
 
pandora::StatusCode RunUsingCurrentList () const
 Run the algorithm using the current cluster list as input. More...
 

Protected Attributes

unsigned int m_slidingFitHalfWindow
 
float m_minClusterLength
 

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_splitDisplacementSquared
 Maximum displacement squared. More...
 
float m_vertexDisplacementSquared
 Maximum displacement squared. More...
 

Detailed Description

VertexSplittingAlgorithm class.

Definition at line 21 of file VertexSplittingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::VertexSplittingAlgorithm::VertexSplittingAlgorithm ( )

Default constructor.

Definition at line 21 of file VertexSplittingAlgorithm.cc.

References lar_content::TwoDSlidingFitSplittingAlgorithm::m_minClusterLength.

21  :
24 {
25  // ATTN Some default values differ from base class
26  m_minClusterLength = 1.f;
27 }
TFile f
Definition: plotHisto.C:6
float m_vertexDisplacementSquared
Maximum displacement squared.
float m_splitDisplacementSquared
Maximum displacement squared.

Member Function Documentation

StatusCode lar_content::VertexSplittingAlgorithm::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 31 of file VertexSplittingAlgorithm.cc.

References lar_content::TwoDSlidingFitResult::GetCluster(), lar_content::LArClusterHelper::GetClusterHitType(), lar_content::TwoDSlidingFitResult::GetGlobalFitProjection(), lar_content::TwoDSlidingFitResult::GetGlobalMaxLayerPosition(), lar_content::TwoDSlidingFitResult::GetGlobalMinLayerPosition(), m_splitDisplacementSquared, m_vertexDisplacementSquared, min, and lar_content::LArGeometryHelper::ProjectPosition().

32 {
33  // Identify event vertex
34  const VertexList *pVertexList(NULL);
35  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pVertexList));
36 
37  if (pVertexList->empty())
38  return STATUS_CODE_NOT_INITIALIZED;
39 
40  if (pVertexList->size() != 1)
41  return STATUS_CODE_OUT_OF_RANGE;
42 
43  const Cluster *const pCluster(slidingFitResult.GetCluster());
44  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
45 
46  const Vertex *const pSelectedVertex(*(pVertexList->begin()));
47 
48  if (VERTEX_3D != pSelectedVertex->GetVertexType())
49  return STATUS_CODE_INVALID_PARAMETER;
50 
51  const CartesianVector theVertex2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), pSelectedVertex->GetPosition(), hitType));
52 
53  const CartesianVector innerVertex2D(slidingFitResult.GetGlobalMinLayerPosition());
54  const CartesianVector outerVertex2D(slidingFitResult.GetGlobalMaxLayerPosition());
55 
56  if ((outerVertex2D - innerVertex2D).GetMagnitudeSquared() < 4.f * m_vertexDisplacementSquared)
57  return STATUS_CODE_NOT_FOUND;
58 
59  bool foundSplit(false);
60  const StatusCode statusCode(slidingFitResult.GetGlobalFitProjection(theVertex2D, splitPosition));
61 
62  if (STATUS_CODE_SUCCESS != statusCode)
63  return statusCode;
64 
65  const float splitDisplacementSquared((splitPosition - theVertex2D).GetMagnitudeSquared());
66  const float vertexDisplacementSquared(std::min((splitPosition - innerVertex2D).GetMagnitudeSquared(), (splitPosition - outerVertex2D).GetMagnitudeSquared()));
67 
68  if ((splitDisplacementSquared < m_splitDisplacementSquared) && (vertexDisplacementSquared > m_vertexDisplacementSquared) &&
69  (splitDisplacementSquared < vertexDisplacementSquared))
70  {
71  foundSplit = true;
72  }
73 
74  if (!foundSplit)
75  return STATUS_CODE_NOT_FOUND;
76 
77  return STATUS_CODE_SUCCESS;
78 }
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
float m_vertexDisplacementSquared
Maximum displacement squared.
Int_t min
Definition: plot.C:26
float m_splitDisplacementSquared
Maximum displacement squared.
std::list< Vertex > VertexList
Definition: DCEL.h:178
StatusCode lar_content::VertexSplittingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::TwoDSlidingFitSplittingAlgorithm.

Definition at line 82 of file VertexSplittingAlgorithm.cc.

References m_splitDisplacementSquared, m_vertexDisplacementSquared, and lar_content::TwoDSlidingFitSplittingAlgorithm::ReadSettings().

83 {
84  float splitDisplacement = std::sqrt(m_splitDisplacementSquared);
85  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
86  "SplitDisplacement", splitDisplacement));
87  m_splitDisplacementSquared = splitDisplacement * splitDisplacement;
88 
89  float vertexDisplacement = std::sqrt(m_vertexDisplacementSquared);
90  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
91  "VertexDisplacement", vertexDisplacement));
92  m_vertexDisplacementSquared = vertexDisplacement * vertexDisplacement;
93 
95 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_vertexDisplacementSquared
Maximum displacement squared.
float m_splitDisplacementSquared
Maximum displacement squared.
StatusCode lar_content::ClusterSplittingAlgorithm::Run ( )
protectedvirtualinherited

Definition at line 20 of file ClusterSplittingAlgorithm.cc.

21 {
22  if (m_inputClusterListNames.empty())
23  return this->RunUsingCurrentList();
24 
25  std::string originalListName;
26  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentListName<Cluster>(*this, originalListName));
27 
28  for (const std::string &clusterListName : m_inputClusterListNames)
29  {
30  const StatusCode listChangeStatusCode(PandoraContentApi::ReplaceCurrentList<Cluster>(*this, clusterListName));
31 
32  if (STATUS_CODE_NOT_FOUND == listChangeStatusCode)
33  {
34  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
35  std::cout << "ClusterSplittingAlgorithm: cluster list not found " << clusterListName << std::endl;
36 
37  continue;
38  }
39 
40  if (STATUS_CODE_SUCCESS != listChangeStatusCode)
41  return listChangeStatusCode;
42 
43  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->RunUsingCurrentList());
44  }
45 
46  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, originalListName));
47  return STATUS_CODE_SUCCESS;
48 }
pandora::StatusCode RunUsingCurrentList() const
Run the algorithm using the current cluster list as input.
pandora::StringVector m_inputClusterListNames
The list of input cluster list names - if empty, use the current cluster list.
StatusCode lar_content::ClusterSplittingAlgorithm::RunUsingCurrentList ( ) const
protectedinherited

Run the algorithm using the current cluster list as input.

Definition at line 52 of file ClusterSplittingAlgorithm.cc.

53 {
54  const ClusterList *pClusterList = NULL;
55  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pClusterList));
56 
57  ClusterList internalClusterList(pClusterList->begin(), pClusterList->end());
58  internalClusterList.sort(LArClusterHelper::SortByNHits);
59 
60  for (ClusterList::iterator iter = internalClusterList.begin(); iter != internalClusterList.end(); ++iter)
61  {
62  const Cluster *const pCluster = *iter;
63  ClusterList clusterSplittingList;
64 
65  if (STATUS_CODE_SUCCESS != this->SplitCluster(pCluster, clusterSplittingList))
66  continue;
67 
68  internalClusterList.splice(internalClusterList.end(), clusterSplittingList);
69  *iter = NULL;
70  }
71 
72  return STATUS_CODE_SUCCESS;
73 }
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.
intermediate_table::iterator iterator
pandora::StatusCode SplitCluster(const pandora::Cluster *const pCluster, pandora::ClusterList &clusterSplittingList) const
Split cluster into two fragments.

Member Data Documentation

float lar_content::TwoDSlidingFitSplittingAlgorithm::m_minClusterLength
protectedinherited
unsigned int lar_content::TwoDSlidingFitSplittingAlgorithm::m_slidingFitHalfWindow
protectedinherited
float lar_content::VertexSplittingAlgorithm::m_splitDisplacementSquared
private

Maximum displacement squared.

Definition at line 33 of file VertexSplittingAlgorithm.h.

Referenced by FindBestSplitPosition(), and ReadSettings().

float lar_content::VertexSplittingAlgorithm::m_vertexDisplacementSquared
private

Maximum displacement squared.

Definition at line 34 of file VertexSplittingAlgorithm.h.

Referenced by FindBestSplitPosition(), and ReadSettings().


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