Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
UnambiguousDeltaRayTool.cc
Go to the documentation of this file.
1
10
13
15
16using namespace pandora;
17
18namespace lar_content
19{
20
21UnambiguousDeltaRayTool::UnambiguousDeltaRayTool() : m_maxSeparation(2.f), m_minNConnectedClusters(1)
22{
23}
24
25//------------------------------------------------------------------------------------------------------------------------------------------
26
28{
29 m_pParentAlgorithm = pAlgorithm;
30
32 std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
33
34 TensorType::ElementList elementList;
35 overlapTensor.GetUnambiguousElements(true, elementList);
36
37 return this->ExamineUnambiguousElements(elementList);
38}
39
40//------------------------------------------------------------------------------------------------------------------------------------------
41
42bool UnambiguousDeltaRayTool::ExamineUnambiguousElements(TensorType::ElementList &elementList)
43{
44 ProtoParticleVector protoParticleVector;
45
46 for (TensorType::Element &element : elementList)
47 {
48 if (!this->IsConnected(element))
49 continue;
50
51 ProtoParticle protoParticle;
52 protoParticle.m_clusterList.push_back(element.GetClusterU());
53 protoParticle.m_clusterList.push_back(element.GetClusterV());
54 protoParticle.m_clusterList.push_back(element.GetClusterW());
55 protoParticleVector.push_back(protoParticle);
56 }
57
58 return m_pParentAlgorithm->CreatePfos(protoParticleVector);
59}
60
61//------------------------------------------------------------------------------------------------------------------------------------------
62
63bool UnambiguousDeltaRayTool::IsConnected(const TensorType::Element &element) const
64{
65 PfoList commonMuonPfoList(element.GetOverlapResult().GetCommonMuonPfoList());
66
67 for (const ParticleFlowObject *const pMuonPfo : commonMuonPfoList)
68 {
69 unsigned int connectedClusterCount(0);
70
71 for (const HitType hitType : {TPC_VIEW_U, TPC_VIEW_V, TPC_VIEW_W})
72 {
73 ClusterList muonClusterList;
74 LArPfoHelper::GetClusters(pMuonPfo, hitType, muonClusterList);
75
76 const float separation(LArClusterHelper::GetClosestDistance(element.GetCluster(hitType), muonClusterList));
77
78 if (separation < m_maxSeparation)
79 ++connectedClusterCount;
80 }
81
82 if (connectedClusterCount > m_minNConnectedClusters)
83 return true;
84 }
85
86 return false;
87}
88
89//------------------------------------------------------------------------------------------------------------------------------------------
90
92{
93 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinSeparation", m_maxSeparation));
94
96 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinNConnectedClusters", m_minNConnectedClusters));
97
98 return STATUS_CODE_SUCCESS;
99}
100
101} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cluster helper class.
Header file for the pfo helper class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
Header file for the unambiguous delta ray tool class.
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
ThreeViewDeltaRayMatchingAlgorithm::MatchingType::TensorType TensorType
ThreeViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
static void GetClusters(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::ClusterList &clusterList)
Get a list of clusters of a particular hit type from a list of pfos.
bool CreatePfos(ProtoParticleVector &protoParticleVector)
Create delta ray pfos maxmising completeness by searching for and merging in any stray clusters.
unsigned int m_minNConnectedClusters
The threshold number of connected delta ray clusters required for particle creation.
float m_maxSeparation
The maximum separation between a connected delta ray cluster and a cosmic ray cluster.
bool IsConnected(const TensorType::Element &element) const
Determine whether the clusters of an element are connected to a cosmic ray pfo.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
bool Run(ThreeViewDeltaRayMatchingAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
bool ExamineUnambiguousElements(TensorType::ElementList &elementList)
Create delta ray pfos out of unambiguous (1:1:1) matches that are connected to a parent cosmic ray.
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
ParticleFlowObject class.
const std::string & GetType() const
Get the type.
Definition Process.h:102
const std::string & GetInstanceName() const
Get the instance name.
Definition Process.h:109
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
std::vector< ProtoParticle > ProtoParticleVector
pandora::ClusterList m_clusterList
List of 2D clusters in a 3D proto particle.
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const Cluster * > ClusterList
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList