LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::CutPfoCharacterisationAlgorithm Class Reference

CutPfoCharacterisationAlgorithm class. More...

#include "CutPfoCharacterisationAlgorithm.h"

Inheritance diagram for lar_content::CutPfoCharacterisationAlgorithm:
lar_content::PfoCharacterisationBaseAlgorithm

Public Member Functions

 CutPfoCharacterisationAlgorithm ()
 Default constructor. More...
 

Protected Member Functions

pandora::StatusCode Run ()
 
virtual bool IsClearTrack3x2D (const pandora::ParticleFlowObject *const pPfo) const
 Whether pfo is identified as a clear track using its three clusters. More...
 

Protected Attributes

std::string m_trackPfoListName
 The track pfo list name. More...
 
std::string m_showerPfoListName
 The shower pfo list name. More...
 
pandora::StringVector m_inputPfoListNames
 The names of the input pfo lists. More...
 
bool m_updateClusterIds
 Whether to update daughter cluster particle id labels to match pfo id. More...
 
bool m_useThreeDInformation
 Whether to use PFO and 3D information or clusters for characterisation. More...
 
unsigned int m_minTrackLikeViews
 The minimum number of track-like views to declare a pfo as track-like. More...
 

Private Member Functions

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

Private Attributes

bool m_postBranchAddition
 Whether to use configuration for shower clusters post branch addition. More...
 
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...
 
float m_maxShowerLengthCut
 The maximum cluster length to qualify as a shower. More...
 
float m_dTdLWidthRatioCut
 The maximum ratio of transverse fit gradient 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...
 

Detailed Description

Constructor & Destructor Documentation

lar_content::CutPfoCharacterisationAlgorithm::CutPfoCharacterisationAlgorithm ( )

Default constructor.

Definition at line 25 of file CutPfoCharacterisationAlgorithm.cc.

References f, lar_content::LArClusterHelper::GetClusterHitType(), lar_content::TwoDSlidingFitResult::GetGlobalMaxLayerPosition(), lar_content::TwoDSlidingFitResult::GetGlobalMinLayerPosition(), lar_content::TwoDSlidingFitResult::GetLayerFitResultMap(), lar_content::CutClusterCharacterisationAlgorithm::GetShowerFitWidth(), lar_content::CutClusterCharacterisationAlgorithm::GetVertexDistance(), lar_content::LArGeometryHelper::GetWirePitch(), IsClearTrack(), m_dTdLWidthRatioCut, m_maxShowerLengthCut, m_showerWidthRatioCut, m_slidingFitWindow, m_slidingShowerFitWindow, and m_vertexDistanceRatioCut.

25  :
26  m_postBranchAddition(false),
30  m_dTdLWidthRatioCut(0.045f),
33 {
34 }
float m_dTdLWidthRatioCut
The maximum ratio of transverse fit gradient width to straight line length to qualify as a track...
unsigned int m_slidingShowerFitWindow
The layer window for the sliding shower fits.
TFile f
Definition: plotHisto.C:6
float m_showerWidthRatioCut
The maximum ratio of shower fit 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_slidingFitWindow
The layer window for the sliding linear fits.
bool m_postBranchAddition
Whether to use configuration for shower clusters post branch addition.

Member Function Documentation

bool lar_content::CutPfoCharacterisationAlgorithm::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::PfoCharacterisationBaseAlgorithm.

Referenced by CutPfoCharacterisationAlgorithm().

bool lar_content::CutPfoCharacterisationAlgorithm::IsClearTrack ( const pandora::ParticleFlowObject *const  pPfo) const
privatevirtual

Whether pfo is identified as a clear track.

Parameters
pPfoaddress of the relevant pfo
Returns
boolean

Implements lar_content::PfoCharacterisationBaseAlgorithm.

Definition at line 83 of file CutPfoCharacterisationAlgorithm.cc.

84 {
85  throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
86 }
bool lar_content::PfoCharacterisationBaseAlgorithm::IsClearTrack3x2D ( const pandora::ParticleFlowObject *const  pPfo) const
protectedvirtualinherited

Whether pfo is identified as a clear track using its three clusters.

Parameters
pPfoaddress of the relevant pfo
Returns
boolean

Definition at line 108 of file PfoCharacterisationBaseAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType(), lar_content::LArPfoHelper::GetTwoDClusterList(), lar_content::PfoCharacterisationBaseAlgorithm::IsClearTrack(), and lar_content::PfoCharacterisationBaseAlgorithm::m_minTrackLikeViews.

Referenced by lar_content::PfoCharacterisationBaseAlgorithm::Run().

109 {
110  ClusterList twoDClusterList;
111  LArPfoHelper::GetTwoDClusterList(pPfo, twoDClusterList);
112 
113  typedef std::set<pandora::HitType> HitTypeSet;
114  HitTypeSet hitTypeSet;
115 
116  unsigned int nTrackLikeViews(0);
117  for (const Cluster *const pCluster : twoDClusterList)
118  {
119  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
120  if (!hitTypeSet.insert(hitType).second)
121  continue;
122 
123  if (this->IsClearTrack(pCluster))
124  ++nTrackLikeViews;
125 
126  if (nTrackLikeViews >= m_minTrackLikeViews)
127  return true;
128  }
129 
130  return false;
131 }
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
virtual bool IsClearTrack(const pandora::ParticleFlowObject *const pPfo) const =0
Whether pfo is identified as a clear track.
unsigned int m_minTrackLikeViews
The minimum number of track-like views to declare a pfo as track-like.
HitType
Definition: HitType.h:12
StatusCode lar_content::CutPfoCharacterisationAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 90 of file CutPfoCharacterisationAlgorithm.cc.

References m_dTdLWidthRatioCut, m_maxShowerLengthCut, m_postBranchAddition, m_showerWidthRatioCut, m_slidingFitWindow, m_slidingShowerFitWindow, m_vertexDistanceRatioCut, and lar_content::PfoCharacterisationBaseAlgorithm::ReadSettings().

91 {
92  PANDORA_RETURN_RESULT_IF_AND_IF(
93  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PostBranchAddition", m_postBranchAddition));
94 
95  // Allow change in default values via a single xml tag, can subsequently override all individual values below, if required
97  {
98  m_maxShowerLengthCut = 80.f;
99  m_dTdLWidthRatioCut = 0.03f;
101  m_showerWidthRatioCut = 0.3f;
102  }
103 
104  PANDORA_RETURN_RESULT_IF_AND_IF(
105  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitWindow", m_slidingFitWindow));
106 
107  PANDORA_RETURN_RESULT_IF_AND_IF(
108  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingShowerFitWindow", m_slidingShowerFitWindow));
109 
110  PANDORA_RETURN_RESULT_IF_AND_IF(
111  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxShowerLengthCut", m_maxShowerLengthCut));
112 
113  PANDORA_RETURN_RESULT_IF_AND_IF(
114  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "DTDLWidthRatioCut", m_dTdLWidthRatioCut));
115 
116  PANDORA_RETURN_RESULT_IF_AND_IF(
117  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexDistanceRatioCut", m_vertexDistanceRatioCut));
118 
119  PANDORA_RETURN_RESULT_IF_AND_IF(
120  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ShowerWidthRatioCut", m_showerWidthRatioCut));
121 
123 }
float m_dTdLWidthRatioCut
The maximum ratio of transverse fit gradient width to straight line length to qualify as a track...
unsigned int m_slidingShowerFitWindow
The layer window for the sliding shower fits.
float m_showerWidthRatioCut
The maximum ratio of shower fit 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.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
bool m_postBranchAddition
Whether to use configuration for shower clusters post branch addition.
StatusCode lar_content::PfoCharacterisationBaseAlgorithm::Run ( )
protectedinherited

Definition at line 39 of file PfoCharacterisationBaseAlgorithm.cc.

References lar_content::LArPfoHelper::GetTwoDClusterList(), lar_content::PfoCharacterisationBaseAlgorithm::IsClearTrack(), lar_content::PfoCharacterisationBaseAlgorithm::IsClearTrack3x2D(), lar_content::PfoCharacterisationBaseAlgorithm::m_inputPfoListNames, lar_content::PfoCharacterisationBaseAlgorithm::m_showerPfoListName, lar_content::PfoCharacterisationBaseAlgorithm::m_trackPfoListName, lar_content::PfoCharacterisationBaseAlgorithm::m_updateClusterIds, and lar_content::PfoCharacterisationBaseAlgorithm::m_useThreeDInformation.

40 {
41  PfoList tracksToShowers, showersToTracks;
42 
43  for (const std::string &pfoListName : m_inputPfoListNames)
44  {
45  const PfoList *pPfoList(nullptr);
46  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, pfoListName, pPfoList));
47 
48  if (!pPfoList || pPfoList->empty())
49  {
50  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
51  std::cout << "PfoCharacterisationBaseAlgorithm: unable to find pfo list " << pfoListName << std::endl;
52 
53  continue;
54  }
55 
56  for (const ParticleFlowObject *const pPfo : *pPfoList)
57  {
58  PandoraContentApi::ParticleFlowObject::Metadata pfoMetadata;
59  const bool isTrackLike(m_useThreeDInformation ? this->IsClearTrack(pPfo) : this->IsClearTrack3x2D(pPfo));
60 
61  if (isTrackLike)
62  {
63  pfoMetadata.m_particleId = MU_MINUS;
64 
65  if (m_showerPfoListName == pfoListName)
66  showersToTracks.push_back(pPfo);
67  }
68  else
69  {
70  pfoMetadata.m_particleId = E_MINUS;
71 
72  if (m_trackPfoListName == pfoListName)
73  tracksToShowers.push_back(pPfo);
74  }
75 
76  if (pPfo->GetParticleId() != pfoMetadata.m_particleId.Get())
77  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*this, pPfo, pfoMetadata));
78 
79  if (!m_updateClusterIds)
80  continue;
81 
82  ClusterList twoDClusterList;
83  LArPfoHelper::GetTwoDClusterList(pPfo, twoDClusterList);
84 
85  for (const Cluster *const pCluster : twoDClusterList)
86  {
87  if (pCluster->GetParticleId() == pfoMetadata.m_particleId.Get())
88  continue;
89 
90  PandoraContentApi::Cluster::Metadata clusterMetadata;
91  clusterMetadata.m_particleId = pfoMetadata.m_particleId.Get();
92  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::AlterMetadata(*this, pCluster, clusterMetadata));
93  }
94  }
95  }
96 
97  if (!tracksToShowers.empty())
98  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_trackPfoListName, m_showerPfoListName, tracksToShowers));
99 
100  if (!showersToTracks.empty())
101  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_showerPfoListName, m_trackPfoListName, showersToTracks));
102 
103  return STATUS_CODE_SUCCESS;
104 }
virtual bool IsClearTrack3x2D(const pandora::ParticleFlowObject *const pPfo) const
Whether pfo is identified as a clear track using its three clusters.
pandora::StringVector m_inputPfoListNames
The names of the input pfo lists.
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
virtual bool IsClearTrack(const pandora::ParticleFlowObject *const pPfo) const =0
Whether pfo is identified as a clear track.
bool m_updateClusterIds
Whether to update daughter cluster particle id labels to match pfo id.
bool m_useThreeDInformation
Whether to use PFO and 3D information or clusters for characterisation.
std::string m_showerPfoListName
The shower pfo list name.

Member Data Documentation

float lar_content::CutPfoCharacterisationAlgorithm::m_dTdLWidthRatioCut
private

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

Definition at line 36 of file CutPfoCharacterisationAlgorithm.h.

Referenced by CutPfoCharacterisationAlgorithm(), and ReadSettings().

pandora::StringVector lar_content::PfoCharacterisationBaseAlgorithm::m_inputPfoListNames
protectedinherited
float lar_content::CutPfoCharacterisationAlgorithm::m_maxShowerLengthCut
private

The maximum cluster length to qualify as a shower.

Definition at line 35 of file CutPfoCharacterisationAlgorithm.h.

Referenced by CutPfoCharacterisationAlgorithm(), and ReadSettings().

unsigned int lar_content::PfoCharacterisationBaseAlgorithm::m_minTrackLikeViews
protectedinherited

The minimum number of track-like views to declare a pfo as track-like.

Definition at line 71 of file PfoCharacterisationBaseAlgorithm.h.

Referenced by lar_content::PfoCharacterisationBaseAlgorithm::IsClearTrack3x2D(), and lar_content::PfoCharacterisationBaseAlgorithm::ReadSettings().

bool lar_content::CutPfoCharacterisationAlgorithm::m_postBranchAddition
private

Whether to use configuration for shower clusters post branch addition.

Definition at line 32 of file CutPfoCharacterisationAlgorithm.h.

Referenced by ReadSettings().

std::string lar_content::PfoCharacterisationBaseAlgorithm::m_showerPfoListName
protectedinherited
float lar_content::CutPfoCharacterisationAlgorithm::m_showerWidthRatioCut
private

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

Definition at line 38 of file CutPfoCharacterisationAlgorithm.h.

Referenced by CutPfoCharacterisationAlgorithm(), and ReadSettings().

unsigned int lar_content::CutPfoCharacterisationAlgorithm::m_slidingFitWindow
private

The layer window for the sliding linear fits.

Definition at line 33 of file CutPfoCharacterisationAlgorithm.h.

Referenced by CutPfoCharacterisationAlgorithm(), and ReadSettings().

unsigned int lar_content::CutPfoCharacterisationAlgorithm::m_slidingShowerFitWindow
private

The layer window for the sliding shower fits.

Definition at line 34 of file CutPfoCharacterisationAlgorithm.h.

Referenced by CutPfoCharacterisationAlgorithm(), and ReadSettings().

std::string lar_content::PfoCharacterisationBaseAlgorithm::m_trackPfoListName
protectedinherited
bool lar_content::PfoCharacterisationBaseAlgorithm::m_updateClusterIds
protectedinherited

Whether to update daughter cluster particle id labels to match pfo id.

Definition at line 68 of file PfoCharacterisationBaseAlgorithm.h.

Referenced by lar_content::PfoCharacterisationBaseAlgorithm::ReadSettings(), and lar_content::PfoCharacterisationBaseAlgorithm::Run().

bool lar_content::PfoCharacterisationBaseAlgorithm::m_useThreeDInformation
protectedinherited

Whether to use PFO and 3D information or clusters for characterisation.

Definition at line 70 of file PfoCharacterisationBaseAlgorithm.h.

Referenced by lar_content::PfoCharacterisationBaseAlgorithm::ReadSettings(), and lar_content::PfoCharacterisationBaseAlgorithm::Run().

float lar_content::CutPfoCharacterisationAlgorithm::m_vertexDistanceRatioCut
private

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

Definition at line 37 of file CutPfoCharacterisationAlgorithm.h.

Referenced by CutPfoCharacterisationAlgorithm(), and ReadSettings().


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