LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
UnambiguousDeltaRayTool.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
13 
15 
16 using namespace pandora;
17 
18 namespace lar_content
19 {
20 
21 UnambiguousDeltaRayTool::UnambiguousDeltaRayTool() :
22  m_maxSeparation(2.f),
23  m_minNConnectedClusters(1)
24 {
25 }
26 
27 //------------------------------------------------------------------------------------------------------------------------------------------
28 
30 {
31  m_pParentAlgorithm = pAlgorithm;
32 
33  if (PandoraContentApi::GetSettings(*m_pParentAlgorithm)->ShouldDisplayAlgorithmInfo())
34  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
35 
36  TensorType::ElementList elementList;
37  overlapTensor.GetUnambiguousElements(true, elementList);
38 
39  return this->ExamineUnambiguousElements(elementList);
40 }
41 
42 //------------------------------------------------------------------------------------------------------------------------------------------
43 
45 {
46  ProtoParticleVector protoParticleVector;
47 
48  for (TensorType::Element &element : elementList)
49  {
50  if (!this->IsConnected(element))
51  continue;
52 
53  ProtoParticle protoParticle;
54  protoParticle.m_clusterList.push_back(element.GetClusterU());
55  protoParticle.m_clusterList.push_back(element.GetClusterV());
56  protoParticle.m_clusterList.push_back(element.GetClusterW());
57  protoParticleVector.push_back(protoParticle);
58  }
59 
60  return m_pParentAlgorithm->CreatePfos(protoParticleVector);
61 }
62 
63 //------------------------------------------------------------------------------------------------------------------------------------------
64 
65 bool UnambiguousDeltaRayTool::IsConnected(const TensorType::Element &element) const
66 {
67  PfoList commonMuonPfoList(element.GetOverlapResult().GetCommonMuonPfoList());
68 
69  for (const ParticleFlowObject *const pMuonPfo : commonMuonPfoList)
70  {
71  unsigned int connectedClusterCount(0);
72 
73  for (const HitType hitType : {TPC_VIEW_U, TPC_VIEW_V, TPC_VIEW_W})
74  {
75  ClusterList muonClusterList;
76  LArPfoHelper::GetClusters(pMuonPfo, hitType, muonClusterList);
77 
78  const float separation(LArClusterHelper::GetClosestDistance(element.GetCluster(hitType), muonClusterList));
79 
80  if (separation < m_maxSeparation)
81  ++connectedClusterCount;
82  }
83 
84  if (connectedClusterCount > m_minNConnectedClusters)
85  return true;
86  }
87 
88  return false;
89 }
90 
91 //------------------------------------------------------------------------------------------------------------------------------------------
92 
93 StatusCode UnambiguousDeltaRayTool::ReadSettings(const TiXmlHandle xmlHandle)
94 {
95  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinSeparation", m_maxSeparation));
96 
97  PANDORA_RETURN_RESULT_IF_AND_IF(
98  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinNConnectedClusters", m_minNConnectedClusters));
99 
100  return STATUS_CODE_SUCCESS;
101 }
102 
103 } // namespace lar_content
std::vector< ProtoParticle > ProtoParticleVector
Header file for the pfo helper class.
unsigned int m_minNConnectedClusters
The threshold number of connected delta ray clusters required for particle creation.
bool ExamineUnambiguousElements(TensorType::ElementList &elementList)
Create delta ray pfos out of unambiguous (1:1:1) matches that are connected to a parent cosmic ray...
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.
Header file for the unambiguous delta ray tool class.
bool IsConnected(const TensorType::Element &element) const
Determine whether the clusters of an element are connected to a cosmic ray pfo.
bool Run(ThreeViewDeltaRayMatchingAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
ThreeViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.
TFile f
Definition: plotHisto.C:6
Header file for the cluster helper class.
void GetUnambiguousElements(const bool ignoreUnavailable, ElementList &elementList) const
Get unambiguous elements.
pandora::ClusterList m_clusterList
List of 2D clusters in a 3D proto particle.
HitType
Definition: HitType.h:12
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
bool CreatePfos(ProtoParticleVector &protoParticleVector)
Create delta ray pfos maxmising completeness by searching for and merging in any stray clusters...
float m_maxSeparation
The maximum separation between a connected delta ray cluster and a cosmic ray cluster.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.