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

CutClusterCharacterisationAlgorithm class. More...

#include <CutClusterCharacterisationAlgorithm.h>

Inheritance diagram for lar_content::CutClusterCharacterisationAlgorithm:
lar_content::ClusterCharacterisationBaseAlgorithm

Public Member Functions

 CutClusterCharacterisationAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::ClusterCharacterisationBaseAlgorithm
 ClusterCharacterisationBaseAlgorithm ()
 Default constructor. More...
 
 ~ClusterCharacterisationBaseAlgorithm ()
 Destructor. More...
 

Static Public Member Functions

static float GetVertexDistance (const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
 Get the distance between the interaction vertex (if present in the current vertex list) and a provided cluster. More...
 
static float GetShowerFitWidth (const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, const unsigned int showerFitWindow)
 Get a measure of the width of a cluster, using a sliding shower fit result. More...
 

Private Member Functions

virtual bool IsClearTrack (const pandora::Cluster *const pCluster) const
 Whether cluster is identified as a clear track. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

unsigned int m_slidingFitWindow
 The layer window for the sliding linear fits. More...
 
unsigned int m_slidingShowerFitWindow
 The layer window for the sliding shower fits. More...
 
unsigned int m_minCaloHitsCut
 The minimum number of calo hits to qualify as a track. More...
 
float m_maxShowerLengthCut
 The maximum cluster length to qualify as a shower. More...
 
float m_pathLengthRatioCut
 The maximum ratio of path length to straight line length to qualify as a track. More...
 
float m_rTWidthRatioCut
 The maximum ratio of transverse fit position width to straight line length to qualify as a track. More...
 
float m_vertexDistanceRatioCut
 The maximum ratio of vertex separation to straight line length to qualify as a track. More...
 
float m_showerWidthRatioCut
 The maximum ratio of shower fit width to straight line length to qualify as a track. More...
 

Additional Inherited Members

- Protected Member Functions inherited from lar_content::ClusterCharacterisationBaseAlgorithm
pandora::StatusCode Run ()
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
- Protected Attributes inherited from lar_content::ClusterCharacterisationBaseAlgorithm
pandora::StringVector m_inputClusterListNames
 The names of the input cluster lists. More...
 
bool m_zeroMode
 Whether to zero all existing cluster particle id, overrides all other parameters. More...
 
bool m_overwriteExistingId
 Whether to consider any clusters that already have an assigned particle id. More...
 
bool m_useUnavailableClusters
 Whether to consider clusters that are already constituents of a pfo. More...
 

Detailed Description

CutClusterCharacterisationAlgorithm class.

Definition at line 19 of file CutClusterCharacterisationAlgorithm.h.

Constructor & Destructor Documentation

lar_content::CutClusterCharacterisationAlgorithm::CutClusterCharacterisationAlgorithm ( )

Default constructor.

Definition at line 24 of file CutClusterCharacterisationAlgorithm.cc.

24  :
29  m_pathLengthRatioCut(1.005f),
30  m_rTWidthRatioCut(0.05f),
33 {
34 }
float m_rTWidthRatioCut
The maximum ratio of transverse fit position width to straight line length to qualify as a track...
float m_vertexDistanceRatioCut
The maximum ratio of vertex separation to straight line length to qualify as a track.
float m_maxShowerLengthCut
The maximum cluster length to qualify as a shower.
unsigned int m_minCaloHitsCut
The minimum number of calo hits to qualify as a track.
unsigned int m_slidingShowerFitWindow
The layer window for the sliding shower fits.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
float m_showerWidthRatioCut
The maximum ratio of shower fit width to straight line length to qualify as a track.
float m_pathLengthRatioCut
The maximum ratio of path length to straight line length to qualify as a track.

Member Function Documentation

float lar_content::CutClusterCharacterisationAlgorithm::GetShowerFitWidth ( const pandora::Algorithm *const  pAlgorithm,
const pandora::Cluster *const  pCluster,
const unsigned int  showerFitWindow 
)
static

Get a measure of the width of a cluster, using a sliding shower fit result.

Parameters
pAlgorithmthe address of the calling algorithm
pClusteraddress of the cluster
showerFitWindowthe layer window used for the sliding shower fit
Returns
the shower fit width

Definition at line 55 of file CutClusterCharacterisationAlgorithm.cc.

56 {
57  try
58  {
59  const TwoDSlidingShowerFitResult showerFitResult(pCluster, showerFitWindow, LArGeometryHelper::GetWireZPitch(pAlgorithm->GetPandora()));
60  const LayerFitResultMap &layerFitResultMapS(showerFitResult.GetShowerFitResult().GetLayerFitResultMap());
61  const LayerFitResultMap &layerFitResultMapP(showerFitResult.GetPositiveEdgeFitResult().GetLayerFitResultMap());
62  const LayerFitResultMap &layerFitResultMapN(showerFitResult.GetNegativeEdgeFitResult().GetLayerFitResultMap());
63 
64  if (!layerFitResultMapS.empty())
65  {
66  float showerFitWidth(0.f);
67 
68  for (const auto &mapEntryS : layerFitResultMapS)
69  {
70  LayerFitResultMap::const_iterator iterP = layerFitResultMapP.find(mapEntryS.first);
71  LayerFitResultMap::const_iterator iterN = layerFitResultMapN.find(mapEntryS.first);
72 
73  if ((layerFitResultMapP.end() != iterP) && (layerFitResultMapN.end() != iterN))
74  showerFitWidth += std::fabs(iterP->second.GetFitT() - iterN->second.GetFitT());
75  }
76 
77  return showerFitWidth;
78  }
79  }
80  catch (const StatusCodeException &)
81  {
82  }
83 
84  return -1.f;
85 }
intermediate_table::const_iterator const_iterator
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
std::map< int, LayerFitResult > LayerFitResultMap
float lar_content::CutClusterCharacterisationAlgorithm::GetVertexDistance ( const pandora::Algorithm *const  pAlgorithm,
const pandora::Cluster *const  pCluster 
)
static

Get the distance between the interaction vertex (if present in the current vertex list) and a provided cluster.

Parameters
pAlgorithmthe address of the calling algorithm
pClusteraddress of the cluster
Returns
the vertex distance

Definition at line 38 of file CutClusterCharacterisationAlgorithm.cc.

39 {
40  const VertexList *pVertexList = nullptr;
41  (void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
42 
43  if (!pVertexList || (pVertexList->size() != 1) || (VERTEX_3D != pVertexList->front()->GetVertexType()))
44  return -1.f;
45 
46  const Vertex *const pVertex(pVertexList->front());
47  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
48 
49  const CartesianVector vertexPosition2D(LArGeometryHelper::ProjectPosition(pAlgorithm->GetPandora(), pVertex->GetPosition(), hitType));
50  return LArClusterHelper::GetClosestDistance(vertexPosition2D, pCluster);
51 }
enum cvn::HType HitType
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.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::list< Vertex > VertexList
Definition: DCEL.h:182
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
bool lar_content::CutClusterCharacterisationAlgorithm::IsClearTrack ( const pandora::Cluster *const  pCluster) const
privatevirtual

Whether cluster is identified as a clear track.

Parameters
pClusteraddress of the relevant cluster
Returns
boolean

Implements lar_content::ClusterCharacterisationBaseAlgorithm.

Definition at line 89 of file CutClusterCharacterisationAlgorithm.cc.

90 {
91  if (pCluster->GetNCaloHits() < m_minCaloHitsCut)
92  return false;
93 
94  float straightLineLength(-1.f), integratedPathLength(-1.f);
96 
97  try
98  {
99  const TwoDSlidingFitResult slidingFitResult(pCluster, m_slidingFitWindow, LArGeometryHelper::GetWireZPitch(this->GetPandora()));
100  const CartesianVector globalMinLayerPosition(slidingFitResult.GetGlobalMinLayerPosition());
101  straightLineLength = (slidingFitResult.GetGlobalMaxLayerPosition() - globalMinLayerPosition).GetMagnitude();
102 
103  integratedPathLength = 0.f;
104  CartesianVector previousFitPosition(globalMinLayerPosition);
105 
106  for (const auto &mapEntry : slidingFitResult.GetLayerFitResultMap())
107  {
108  rTMin = std::min(rTMin, static_cast<float>(mapEntry.second.GetFitT()));
109  rTMax = std::max(rTMax, static_cast<float>(mapEntry.second.GetFitT()));
110 
111  CartesianVector thisFitPosition(0.f, 0.f, 0.f);
112  slidingFitResult.GetGlobalPosition(mapEntry.second.GetL(), mapEntry.second.GetFitT(), thisFitPosition);
113  integratedPathLength += (thisFitPosition - previousFitPosition).GetMagnitude();
114  previousFitPosition = thisFitPosition;
115  }
116  }
117  catch (const StatusCodeException &)
118  {
119  }
120 
121  if (straightLineLength < std::numeric_limits<float>::epsilon())
122  return false;
123 
124  if (straightLineLength > m_maxShowerLengthCut)
125  return true;
126 
127  if ((integratedPathLength < std::numeric_limits<float>::epsilon()) || (integratedPathLength / straightLineLength > m_pathLengthRatioCut))
128  return false;
129 
130  if ((rTMax - rTMin) / straightLineLength > m_rTWidthRatioCut)
131  return false;
132 
133  const float vertexDistance(CutClusterCharacterisationAlgorithm::GetVertexDistance(this, pCluster));
134 
135  if ((vertexDistance > std::numeric_limits<float>::epsilon()) && ((vertexDistance / straightLineLength) > m_vertexDistanceRatioCut))
136  return false;
137 
138  const float showerFitWidth(CutClusterCharacterisationAlgorithm::GetShowerFitWidth(this, pCluster, m_slidingShowerFitWindow));
139 
140  if ((showerFitWidth < std::numeric_limits<float>::epsilon()) || ((showerFitWidth / straightLineLength) > m_showerWidthRatioCut))
141  return false;
142 
143  return true;
144 }
static float GetVertexDistance(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
Get the distance between the interaction vertex (if present in the current vertex list) and a provide...
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
float m_rTWidthRatioCut
The maximum ratio of transverse fit position width to straight line length to qualify as a track...
float m_vertexDistanceRatioCut
The maximum ratio of vertex separation to straight line length to qualify as a track.
float m_maxShowerLengthCut
The maximum cluster length to qualify as a shower.
unsigned int m_minCaloHitsCut
The minimum number of calo hits to qualify as a track.
unsigned int m_slidingShowerFitWindow
The layer window for the sliding shower fits.
static int max(int a, int b)
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
float m_showerWidthRatioCut
The maximum ratio of shower fit width to straight line length to qualify as a track.
static float GetShowerFitWidth(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, const unsigned int showerFitWindow)
Get a measure of the width of a cluster, using a sliding shower fit result.
float m_pathLengthRatioCut
The maximum ratio of path length to straight line length to qualify as a track.
StatusCode lar_content::CutClusterCharacterisationAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 148 of file CutClusterCharacterisationAlgorithm.cc.

149 {
150  PANDORA_RETURN_RESULT_IF_AND_IF(
151  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitWindow", m_slidingFitWindow));
152 
153  PANDORA_RETURN_RESULT_IF_AND_IF(
154  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingShowerFitWindow", m_slidingShowerFitWindow));
155 
156  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinCaloHitsCut", m_minCaloHitsCut));
157 
158  PANDORA_RETURN_RESULT_IF_AND_IF(
159  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxShowerLengthCut", m_maxShowerLengthCut));
160 
161  PANDORA_RETURN_RESULT_IF_AND_IF(
162  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PathLengthRatioCut", m_pathLengthRatioCut));
163 
164  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "RTWidthRatioCut", m_rTWidthRatioCut));
165 
166  PANDORA_RETURN_RESULT_IF_AND_IF(
167  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexDistanceRatioCut", m_vertexDistanceRatioCut));
168 
169  PANDORA_RETURN_RESULT_IF_AND_IF(
170  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ShowerWidthRatioCut", m_showerWidthRatioCut));
171 
173 }
float m_rTWidthRatioCut
The maximum ratio of transverse fit position width to straight line length to qualify as a track...
float m_vertexDistanceRatioCut
The maximum ratio of vertex separation to straight line length to qualify as a track.
float m_maxShowerLengthCut
The maximum cluster length to qualify as a shower.
unsigned int m_minCaloHitsCut
The minimum number of calo hits to qualify as a track.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_slidingShowerFitWindow
The layer window for the sliding shower fits.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
float m_showerWidthRatioCut
The maximum ratio of shower fit width to straight line length to qualify as a track.
float m_pathLengthRatioCut
The maximum ratio of path length to straight line length to qualify as a track.

Member Data Documentation

float lar_content::CutClusterCharacterisationAlgorithm::m_maxShowerLengthCut
private

The maximum cluster length to qualify as a shower.

Definition at line 55 of file CutClusterCharacterisationAlgorithm.h.

unsigned int lar_content::CutClusterCharacterisationAlgorithm::m_minCaloHitsCut
private

The minimum number of calo hits to qualify as a track.

Definition at line 54 of file CutClusterCharacterisationAlgorithm.h.

float lar_content::CutClusterCharacterisationAlgorithm::m_pathLengthRatioCut
private

The maximum ratio of path length to straight line length to qualify as a track.

Definition at line 56 of file CutClusterCharacterisationAlgorithm.h.

float lar_content::CutClusterCharacterisationAlgorithm::m_rTWidthRatioCut
private

The maximum ratio of transverse fit position width to straight line length to qualify as a track.

Definition at line 57 of file CutClusterCharacterisationAlgorithm.h.

float lar_content::CutClusterCharacterisationAlgorithm::m_showerWidthRatioCut
private

The maximum ratio of shower fit width to straight line length to qualify as a track.

Definition at line 59 of file CutClusterCharacterisationAlgorithm.h.

unsigned int lar_content::CutClusterCharacterisationAlgorithm::m_slidingFitWindow
private

The layer window for the sliding linear fits.

Definition at line 52 of file CutClusterCharacterisationAlgorithm.h.

unsigned int lar_content::CutClusterCharacterisationAlgorithm::m_slidingShowerFitWindow
private

The layer window for the sliding shower fits.

Definition at line 53 of file CutClusterCharacterisationAlgorithm.h.

float lar_content::CutClusterCharacterisationAlgorithm::m_vertexDistanceRatioCut
private

The maximum ratio of vertex separation to straight line length to qualify as a track.

Definition at line 58 of file CutClusterCharacterisationAlgorithm.h.


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