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

DeltaRayMergeTool class. More...

#include <DeltaRayMergeTool.h>

Inheritance diagram for lar_content::DeltaRayMergeTool:
lar_content::DeltaRayTensorTool

Public Member Functions

 DeltaRayMergeTool ()
 Default constructor. More...
 

Private Member Functions

bool Run (ThreeViewDeltaRayMatchingAlgorithm *const pAlgorithm, TensorType &overlapTensor)
 Run the algorithm tool. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
bool ExamineConnectedElements (TensorType &overlapTensor) const
 Identify ambiguous matches (e.g. 3:2:1) and attempt to merge clusters together. More...
 
bool MakeTwoCommonViewMerges (const TensorType::ElementList &elementList) const
 Search for two matches with two common clusters and attempt to merge the clusters in the third view together. More...
 
void CombineCommonMuonPfoLists (const pandora::PfoList &commonMuonPfoList1, const pandora::PfoList &commonMuonPfoList2, pandora::PfoList &commonMuonPfoList) const
 Create a list of the shared common muon pfos of two elements. More...
 
bool AreAssociated (const TensorType::Element &element1, const TensorType::Element &element2, const pandora::HitType &mergeHitType) const
 Determine, from a topological point of view, whether two delta ray clusters should be merged together. More...
 
void GetConnectedMuons (const pandora::Cluster *const pDeltaRayCluster, const pandora::PfoList &commonMuonPfoList, pandora::PfoList &connectedMuonPfoList) const
 Return the list of muon pfos that a specified delta ray cluster is directly connected to. More...
 
bool IsConnected (const pandora::Cluster *const pCluster, const pandora::Pfo *const pCommonMuonPfo) const
 Determine whether a given cluster is connected to a cosmic ray pfo. More...
 
bool IsBrokenCluster (const pandora::Cluster *const pClusterToEnlarge, const pandora::Cluster *const pClusterToDelete) const
 Determine whether two delta ray clusters have been split. More...
 
bool IsHiddenByTrack (const pandora::ParticleFlowObject *const pMuonPfo, const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2) const
 Determine whether two delta ray clusters are actually a single cluster that is hidden behind a cosmic ray track. More...
 
void FindVertices (const pandora::Pfo *const pCommonMuonPfo, const pandora::Cluster *const pCluster, pandora::CaloHitList &vertexList) const
 Find all connection points of a delta ray cluster and a cosmic ray pfo. More...
 
bool MakeOneCommonViewMerges (const TensorType::ElementList &elementList) const
 Search for two matches with a single common cluster and attempt to merge the clusters in the other two views together. More...
 

Private Attributes

float m_maxDRSeparationFromTrack
 The maximum distance of a connected delta ray from a cosmic ray track. More...
 
float m_maxClusterSeparation
 The maximum separation of two broken clusters that should be merged. More...
 
float m_maxVertexSeparation
 The maximum separation of the connection points of two delta ray clusters that are hidden by a CR track and should be merged. More...
 
float m_maxGoodMatchReducedChiSquared
 The threshold reduced chi squared value for a potential two view merge to go ahead. More...
 

Additional Inherited Members

- Public Types inherited from lar_content::DeltaRayTensorTool
typedef ThreeViewDeltaRayMatchingAlgorithm::MatchingType::TensorType TensorType
 
typedef std::vector< TensorType::ElementList::const_iteratorIteratorList
 
- Public Attributes inherited from lar_content::DeltaRayTensorTool
ThreeViewDeltaRayMatchingAlgorithmm_pParentAlgorithm
 Address of the parent matching algorithm. More...
 

Detailed Description

DeltaRayMergeTool class.

Definition at line 18 of file DeltaRayMergeTool.h.

Constructor & Destructor Documentation

lar_content::DeltaRayMergeTool::DeltaRayMergeTool ( )

Default constructor.

Definition at line 22 of file DeltaRayMergeTool.cc.

22  :
27 {
28 }
float m_maxVertexSeparation
The maximum separation of the connection points of two delta ray clusters that are hidden by a CR tra...
float m_maxClusterSeparation
The maximum separation of two broken clusters that should be merged.
float m_maxGoodMatchReducedChiSquared
The threshold reduced chi squared value for a potential two view merge to go ahead.
float m_maxDRSeparationFromTrack
The maximum distance of a connected delta ray from a cosmic ray track.

Member Function Documentation

bool lar_content::DeltaRayMergeTool::AreAssociated ( const TensorType::Element &  element1,
const TensorType::Element &  element2,
const pandora::HitType &  mergeHitType 
) const
private

Determine, from a topological point of view, whether two delta ray clusters should be merged together.

Parameters
element1the first tensor element
element2the second tensor element
mergeHitTypethe hit type of the view in which to assess the merge
Returns
whether the clusters are topologically associated

Definition at line 145 of file DeltaRayMergeTool.cc.

146 {
147  const PfoList &commonMuonPfoList1(element1.GetOverlapResult().GetCommonMuonPfoList());
148  const PfoList &commonMuonPfoList2(element2.GetOverlapResult().GetCommonMuonPfoList());
149 
150  // Demand the elements to have a shared common muon
151  PfoList commonMuonPfoList;
152  this->CombineCommonMuonPfoLists(commonMuonPfoList1, commonMuonPfoList2, commonMuonPfoList);
153 
154  if (commonMuonPfoList.empty())
155  return false;
156 
157  const Cluster *const pCluster1(element1.GetCluster(mergeHitType)), *const pCluster2(element2.GetCluster(mergeHitType));
158 
159  PfoList connectedMuonPfoList1, connectedMuonPfoList2;
160  this->GetConnectedMuons(pCluster1, commonMuonPfoList1, connectedMuonPfoList1);
161  this->GetConnectedMuons(pCluster2, commonMuonPfoList2, connectedMuonPfoList2);
162 
163  if (connectedMuonPfoList1.empty() || connectedMuonPfoList2.empty())
164  return (this->IsBrokenCluster(pCluster1, pCluster2));
165 
166  for (const ParticleFlowObject *const pConnectedMuon1 : connectedMuonPfoList1)
167  {
168  for (const ParticleFlowObject *const pConnectedMuon2 : connectedMuonPfoList2)
169  {
170  if ((pConnectedMuon1 == pConnectedMuon2) && (this->IsHiddenByTrack(pConnectedMuon1, pCluster1, pCluster2)))
171  return true;
172  }
173  }
174 
175  return false;
176 }
void GetConnectedMuons(const pandora::Cluster *const pDeltaRayCluster, const pandora::PfoList &commonMuonPfoList, pandora::PfoList &connectedMuonPfoList) const
Return the list of muon pfos that a specified delta ray cluster is directly connected to...
bool IsHiddenByTrack(const pandora::ParticleFlowObject *const pMuonPfo, const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2) const
Determine whether two delta ray clusters are actually a single cluster that is hidden behind a cosmic...
void CombineCommonMuonPfoLists(const pandora::PfoList &commonMuonPfoList1, const pandora::PfoList &commonMuonPfoList2, pandora::PfoList &commonMuonPfoList) const
Create a list of the shared common muon pfos of two elements.
bool IsBrokenCluster(const pandora::Cluster *const pClusterToEnlarge, const pandora::Cluster *const pClusterToDelete) const
Determine whether two delta ray clusters have been split.
void lar_content::DeltaRayMergeTool::CombineCommonMuonPfoLists ( const pandora::PfoList &  commonMuonPfoList1,
const pandora::PfoList &  commonMuonPfoList2,
pandora::PfoList &  commonMuonPfoList 
) const
private

Create a list of the shared common muon pfos of two elements.

Parameters
commonMuonPfoList1the common muon pfo list of the first element
commonMuonPfoList2the common muon pfo list of the second element
commonMuonPfoListthe output common muon pfo list

Definition at line 180 of file DeltaRayMergeTool.cc.

181 {
182  for (const ParticleFlowObject *const pCommonMuonPfo1 : commonMuonPfoList1)
183  {
184  for (const ParticleFlowObject *const pCommonMuonPfo2 : commonMuonPfoList2)
185  {
186  if (pCommonMuonPfo1 == pCommonMuonPfo2)
187  commonMuonPfoList.push_back(pCommonMuonPfo1);
188  }
189  }
190 }
bool lar_content::DeltaRayMergeTool::ExamineConnectedElements ( TensorType overlapTensor) const
private

Identify ambiguous matches (e.g. 3:2:1) and attempt to merge clusters together.

Parameters
overlapTensorthe overlap tensor
Returns
whether any merges have been made

Definition at line 44 of file DeltaRayMergeTool.cc.

45 {
46  bool mergeMade(false), mergesMade(false), finishedTwoViewMerges(false);
47 
48  do
49  {
50  mergeMade = false;
51 
52  ClusterVector sortedKeyClusters;
53  overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
54 
55  ClusterSet usedKeyClusters;
56  for (const Cluster *const pKeyCluster : sortedKeyClusters)
57  {
58  if (usedKeyClusters.count(pKeyCluster))
59  continue;
60 
61  TensorType::ElementList elementList;
62  overlapTensor.GetConnectedElements(pKeyCluster, true, elementList);
63 
64  for (const TensorType::Element &element : elementList)
65  usedKeyClusters.insert(element.GetClusterU());
66 
67  if (elementList.size() < 2)
68  continue;
69 
70  if (!finishedTwoViewMerges && this->MakeTwoCommonViewMerges(elementList))
71  {
72  mergeMade = true;
73  mergesMade = true;
74  break;
75  }
76 
77  finishedTwoViewMerges = true;
78 
79  if (this->MakeOneCommonViewMerges(elementList))
80  {
81  mergeMade = true;
82  mergesMade = true;
83  break;
84  }
85  }
86  } while (mergeMade);
87 
88  return mergesMade;
89 }
bool MakeOneCommonViewMerges(const TensorType::ElementList &elementList) const
Search for two matches with a single common cluster and attempt to merge the clusters in the other tw...
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool MakeTwoCommonViewMerges(const TensorType::ElementList &elementList) const
Search for two matches with two common clusters and attempt to merge the clusters in the third view t...
void lar_content::DeltaRayMergeTool::FindVertices ( const pandora::Pfo *const  pCommonMuonPfo,
const pandora::Cluster *const  pCluster,
pandora::CaloHitList &  vertexList 
) const
private

Find all connection points of a delta ray cluster and a cosmic ray pfo.

Parameters
pCommonMuonPfothe address of the cosmic ray pfo
pClusterthe address of the delta ray cluster
vertexListthe output list of connection points

Definition at line 253 of file DeltaRayMergeTool.cc.

254 {
255  HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
256 
257  ClusterList muonClusterList;
258  LArPfoHelper::GetClusters(pCommonMuonPfo, hitType, muonClusterList);
259 
260  if (muonClusterList.size() != 1)
261  return;
262 
263  CaloHitList caloHitList;
264  muonClusterList.front()->GetOrderedCaloHitList().FillCaloHitList(caloHitList);
265 
266  for (const CaloHit *const pCaloHit : caloHitList)
267  {
268  if (LArClusterHelper::GetClosestDistance(pCaloHit->GetPositionVector(), pCluster) < m_maxDRSeparationFromTrack)
269  vertexList.push_back(pCaloHit);
270  }
271 }
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.
enum cvn::HType HitType
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
float m_maxDRSeparationFromTrack
The maximum distance of a connected delta ray from a cosmic ray track.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
void lar_content::DeltaRayMergeTool::GetConnectedMuons ( const pandora::Cluster *const  pDeltaRayCluster,
const pandora::PfoList &  commonMuonPfoList,
pandora::PfoList &  connectedMuonPfoList 
) const
private

Return the list of muon pfos that a specified delta ray cluster is directly connected to.

Parameters
pDeltaRayClusterthe address of the input delta ray cluster
commonMuonPfoListthe common muon pfo list of the element to which the DR cluster belongs
connectedMuonPfoListthe output list of connected muon pfos

Definition at line 194 of file DeltaRayMergeTool.cc.

195 {
196  for (const ParticleFlowObject *const pCommonMuonPfo : commonMuonPfoList)
197  {
198  if (this->IsConnected(pDeltaRayCluster, pCommonMuonPfo))
199  connectedMuonPfoList.push_back(pCommonMuonPfo);
200  }
201 }
bool IsConnected(const pandora::Cluster *const pCluster, const pandora::Pfo *const pCommonMuonPfo) const
Determine whether a given cluster is connected to a cosmic ray pfo.
bool lar_content::DeltaRayMergeTool::IsBrokenCluster ( const pandora::Cluster *const  pClusterToEnlarge,
const pandora::Cluster *const  pClusterToDelete 
) const
private

Determine whether two delta ray clusters have been split.

Parameters
pClusterToEnlargethe address of one delta ray cluster
pClusterToDeletethe address of the other delta ray cluster
Returns
whether the clusters have been split

Definition at line 222 of file DeltaRayMergeTool.cc.

223 {
224  const float clusterSeparation(LArClusterHelper::GetClosestDistance(pClusterToEnlarge, pClusterToDelete));
225 
226  return clusterSeparation < m_maxClusterSeparation;
227 }
float m_maxClusterSeparation
The maximum separation of two broken clusters that should be merged.
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::DeltaRayMergeTool::IsConnected ( const pandora::Cluster *const  pCluster,
const pandora::Pfo *const  pCommonMuonPfo 
) const
private

Determine whether a given cluster is connected to a cosmic ray pfo.

Parameters
pClusterthe address of the input cluster
pCommonMuonPfothe address of the cosmic ray pfo
Returns
whether the cluster is connected to the cosmic ray pfo

Definition at line 205 of file DeltaRayMergeTool.cc.

206 {
207  HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
208 
209  ClusterList muonClusterList;
210  LArPfoHelper::GetClusters(pCommonMuonPfo, hitType, muonClusterList);
211 
212  if (muonClusterList.size() != 1)
213  return false;
214 
215  const float separation(LArClusterHelper::GetClosestDistance(pCluster, muonClusterList));
216 
217  return separation < m_maxDRSeparationFromTrack;
218 }
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.
enum cvn::HType HitType
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
float m_maxDRSeparationFromTrack
The maximum distance of a connected delta ray from a cosmic ray track.
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::DeltaRayMergeTool::IsHiddenByTrack ( const pandora::ParticleFlowObject *const  pMuonPfo,
const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2 
) const
private

Determine whether two delta ray clusters are actually a single cluster that is hidden behind a cosmic ray track.

Parameters
pMuonPfothe address of the cosmic ray pfo
pCluster1the address of one delta ray cluster
pCluster2the address of the other delta ray cluster
Returns
whether the delta ray clusters are one delta ray cluster, hidden behind a cosmic ray track

Definition at line 231 of file DeltaRayMergeTool.cc.

232 {
233  CaloHitList vertices1, vertices2;
234  this->FindVertices(pMuonPfo, pCluster1, vertices1);
235  this->FindVertices(pMuonPfo, pCluster2, vertices2);
236 
237  if (vertices1.empty() || vertices2.empty())
238  return false;
239 
240  for (const CaloHit *const pCaloHit : vertices1)
241  {
242  const float separation(LArClusterHelper::GetClosestDistance(pCaloHit->GetPositionVector(), vertices2));
243 
244  if (separation < m_maxVertexSeparation)
245  return true;
246  }
247 
248  return false;
249 }
float m_maxVertexSeparation
The maximum separation of the connection points of two delta ray clusters that are hidden by a CR tra...
void FindVertices(const pandora::Pfo *const pCommonMuonPfo, const pandora::Cluster *const pCluster, pandora::CaloHitList &vertexList) const
Find all connection points of a delta ray cluster and a cosmic ray pfo.
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::DeltaRayMergeTool::MakeOneCommonViewMerges ( const TensorType::ElementList elementList) const
private

Search for two matches with a single common cluster and attempt to merge the clusters in the other two views together.

Parameters
elementListthe tensor element list
Returns
whether a merge was made

Definition at line 275 of file DeltaRayMergeTool.cc.

276 {
277  for (auto iter1 = elementList.begin(); iter1 != elementList.end(); ++iter1)
278  {
279  const TensorType::Element &element1(*iter1);
280 
281  for (auto iter2 = std::next(iter1); iter2 != elementList.end(); ++iter2)
282  {
283  const TensorType::Element &element2(*iter2);
284 
285  for (const HitType hitType : {TPC_VIEW_U, TPC_VIEW_V, TPC_VIEW_W})
286  {
287  if (element1.GetCluster(hitType) == element2.GetCluster(hitType))
288  {
289  const HitType mergeHitType1(hitType == TPC_VIEW_U ? TPC_VIEW_V : hitType == TPC_VIEW_V ? TPC_VIEW_W : TPC_VIEW_U);
290  const HitType mergeHitType2(mergeHitType1 == TPC_VIEW_U ? TPC_VIEW_V : mergeHitType1 == TPC_VIEW_V ? TPC_VIEW_W : TPC_VIEW_U);
291 
292  const Cluster *pClusterToEnlarge1 = element1.GetCluster(mergeHitType1), *pClusterToDelete1 = element2.GetCluster(mergeHitType1);
293  const Cluster *pClusterToEnlarge2 = element1.GetCluster(mergeHitType2), *pClusterToDelete2 = element2.GetCluster(mergeHitType2);
294 
295  if ((pClusterToEnlarge1 == pClusterToDelete1) || (pClusterToEnlarge2 == pClusterToDelete2))
296  continue;
297 
298  if (!this->AreAssociated(element1, element2, mergeHitType1))
299  continue;
300 
301  if (!this->AreAssociated(element1, element2, mergeHitType2))
302  continue;
303 
304  CaloHitList caloHitList1, caloHitList2, caloHitList3;
305  pClusterToEnlarge1->GetOrderedCaloHitList().FillCaloHitList(caloHitList1);
306  pClusterToDelete1->GetOrderedCaloHitList().FillCaloHitList(caloHitList1);
307  pClusterToEnlarge2->GetOrderedCaloHitList().FillCaloHitList(caloHitList2);
308  pClusterToDelete2->GetOrderedCaloHitList().FillCaloHitList(caloHitList2);
309  element1.GetCluster(hitType)->GetOrderedCaloHitList().FillCaloHitList(caloHitList3);
310 
311  float reducedChiSquared(std::numeric_limits<float>::max());
312  StatusCode status(m_pParentAlgorithm->PerformThreeViewMatching(caloHitList1, caloHitList2, caloHitList3, reducedChiSquared));
313 
314  if (status == STATUS_CODE_NOT_FOUND)
315  continue;
316 
317  if (reducedChiSquared < m_maxGoodMatchReducedChiSquared)
318  {
319  m_pParentAlgorithm->UpdateUponDeletion(pClusterToEnlarge1);
320  m_pParentAlgorithm->UpdateUponDeletion(pClusterToDelete1);
321 
322  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
323  PandoraContentApi::ReplaceCurrentList<Cluster>(*m_pParentAlgorithm, m_pParentAlgorithm->GetClusterListName(mergeHitType1)));
324 
325  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
326  PandoraContentApi::MergeAndDeleteClusters(*m_pParentAlgorithm, pClusterToEnlarge1, pClusterToDelete1));
327 
328  m_pParentAlgorithm->UpdateForNewClusters({pClusterToEnlarge1}, {nullptr});
329 
330  m_pParentAlgorithm->UpdateUponDeletion(pClusterToEnlarge2);
331  m_pParentAlgorithm->UpdateUponDeletion(pClusterToDelete2);
332 
333  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
334  PandoraContentApi::ReplaceCurrentList<Cluster>(*m_pParentAlgorithm, m_pParentAlgorithm->GetClusterListName(mergeHitType2)));
335 
336  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
337  PandoraContentApi::MergeAndDeleteClusters(*m_pParentAlgorithm, pClusterToEnlarge2, pClusterToDelete2));
338 
339  m_pParentAlgorithm->UpdateForNewClusters({pClusterToEnlarge2}, {nullptr});
340 
341  return true;
342  }
343  }
344  }
345  }
346  }
347 
348  return false;
349 }
enum cvn::HType HitType
void UpdateForNewClusters(const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector)
Add a new cluster to algorithm ownership maps and, if it a delta ray cluster, to the underlying match...
ThreeViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.
void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
pandora::StatusCode PerformThreeViewMatching(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3, float &reducedChiSquared) const
To determine how well three clusters (one in each view) map onto one another expressing this in terms...
static int max(int a, int b)
float m_maxGoodMatchReducedChiSquared
The threshold reduced chi squared value for a potential two view merge to go ahead.
const std::string & GetClusterListName(const pandora::HitType hitType) const
Get the cluster list name corresponding to a specified hit type.
bool AreAssociated(const TensorType::Element &element1, const TensorType::Element &element2, const pandora::HitType &mergeHitType) const
Determine, from a topological point of view, whether two delta ray clusters should be merged together...
bool lar_content::DeltaRayMergeTool::MakeTwoCommonViewMerges ( const TensorType::ElementList elementList) const
private

Search for two matches with two common clusters and attempt to merge the clusters in the third view together.

Parameters
elementListthe tensor element list
Returns
whether a merge was made

Definition at line 93 of file DeltaRayMergeTool.cc.

94 {
95  for (auto iter1 = elementList.begin(); iter1 != elementList.end(); ++iter1)
96  {
97  const TensorType::Element &element1(*iter1);
98 
99  for (auto iter2 = std::next(iter1); iter2 != elementList.end(); ++iter2)
100  {
101  const TensorType::Element &element2(*iter2);
102 
103  for (const HitType hitType1 : {TPC_VIEW_U, TPC_VIEW_V})
104  {
105  if ((element1.GetCluster(hitType1) == element2.GetCluster(hitType1)))
106  {
107  for (const HitType hitType2 : {TPC_VIEW_V, TPC_VIEW_W})
108  {
109  if (hitType1 == hitType2)
110  continue;
111 
112  if ((element1.GetCluster(hitType2) == element2.GetCluster(hitType2)))
113  {
114  const HitType mergeHitType(hitType1 == TPC_VIEW_U ? (hitType2 == TPC_VIEW_V ? TPC_VIEW_W : TPC_VIEW_V) : TPC_VIEW_U);
115  const Cluster *pClusterToEnlarge(element1.GetCluster(mergeHitType)), *pClusterToDelete(element2.GetCluster(mergeHitType));
116 
117  if (this->AreAssociated(element1, element2, mergeHitType))
118  {
119  m_pParentAlgorithm->UpdateUponDeletion(pClusterToEnlarge);
120  m_pParentAlgorithm->UpdateUponDeletion(pClusterToDelete);
121 
122  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
123  PandoraContentApi::ReplaceCurrentList<Cluster>(
125 
126  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=,
127  PandoraContentApi::MergeAndDeleteClusters(*m_pParentAlgorithm, pClusterToEnlarge, pClusterToDelete));
128 
129  m_pParentAlgorithm->UpdateForNewClusters({pClusterToEnlarge}, {nullptr});
130 
131  return true;
132  }
133  }
134  }
135  }
136  }
137  }
138  }
139 
140  return false;
141 }
enum cvn::HType HitType
void UpdateForNewClusters(const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector)
Add a new cluster to algorithm ownership maps and, if it a delta ray cluster, to the underlying match...
ThreeViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.
void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
const std::string & GetClusterListName(const pandora::HitType hitType) const
Get the cluster list name corresponding to a specified hit type.
bool AreAssociated(const TensorType::Element &element1, const TensorType::Element &element2, const pandora::HitType &mergeHitType) const
Determine, from a topological point of view, whether two delta ray clusters should be merged together...
StatusCode lar_content::DeltaRayMergeTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 353 of file DeltaRayMergeTool.cc.

354 {
355  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
356  XmlHelper::ReadValue(xmlHandle, "MaxDRSeparationFromTrack", m_maxDRSeparationFromTrack));
357 
358  PANDORA_RETURN_RESULT_IF_AND_IF(
359  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxClusterSeparation", m_maxClusterSeparation));
360 
361  PANDORA_RETURN_RESULT_IF_AND_IF(
362  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxVertexSeparation", m_maxVertexSeparation));
363 
364  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
365  XmlHelper::ReadValue(xmlHandle, "MaxGoodMatchReducedChiSquared", m_maxGoodMatchReducedChiSquared));
366 
367  return STATUS_CODE_SUCCESS;
368 }
float m_maxVertexSeparation
The maximum separation of the connection points of two delta ray clusters that are hidden by a CR tra...
float m_maxClusterSeparation
The maximum separation of two broken clusters that should be merged.
float m_maxGoodMatchReducedChiSquared
The threshold reduced chi squared value for a potential two view merge to go ahead.
float m_maxDRSeparationFromTrack
The maximum distance of a connected delta ray from a cosmic ray track.
bool lar_content::DeltaRayMergeTool::Run ( ThreeViewDeltaRayMatchingAlgorithm *const  pAlgorithm,
TensorType overlapTensor 
)
privatevirtual

Run the algorithm tool.

Parameters
pAlgorithmaddress of the calling algorithm
overlapTensorthe overlap tensor
Returns
whether changes have been made by the tool

Implements lar_content::DeltaRayTensorTool.

Definition at line 32 of file DeltaRayMergeTool.cc.

33 {
34  m_pParentAlgorithm = pAlgorithm;
35 
36  if (PandoraContentApi::GetSettings(*m_pParentAlgorithm)->ShouldDisplayAlgorithmInfo())
37  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
38 
39  return this->ExamineConnectedElements(overlapTensor);
40 }
ThreeViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.
bool ExamineConnectedElements(TensorType &overlapTensor) const
Identify ambiguous matches (e.g. 3:2:1) and attempt to merge clusters together.
QTextStream & endl(QTextStream &s)

Member Data Documentation

float lar_content::DeltaRayMergeTool::m_maxClusterSeparation
private

The maximum separation of two broken clusters that should be merged.

Definition at line 130 of file DeltaRayMergeTool.h.

float lar_content::DeltaRayMergeTool::m_maxDRSeparationFromTrack
private

The maximum distance of a connected delta ray from a cosmic ray track.

Definition at line 129 of file DeltaRayMergeTool.h.

float lar_content::DeltaRayMergeTool::m_maxGoodMatchReducedChiSquared
private

The threshold reduced chi squared value for a potential two view merge to go ahead.

Definition at line 132 of file DeltaRayMergeTool.h.

float lar_content::DeltaRayMergeTool::m_maxVertexSeparation
private

The maximum separation of the connection points of two delta ray clusters that are hidden by a CR track and should be merged.

Definition at line 131 of file DeltaRayMergeTool.h.


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