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

OneViewDeltaRayMatchingAlgorithm class. More...

#include <OneViewDeltaRayMatchingAlgorithm.h>

Inheritance diagram for lar_content::OneViewDeltaRayMatchingAlgorithm:

Public Member Functions

 OneViewDeltaRayMatchingAlgorithm ()
 Default constructor. More...
 

Private Member Functions

pandora::StatusCode Run ()
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
const pandora::ClusterList GetInputClusterList (const pandora::HitType hitType)
 Get the input cluster list of a given hit type. More...
 
const pandora::PfoList GetMuonPfoList ()
 Get the input cosmic ray pfo list. More...
 
const pandora::PfoList GetDeltaRayPfoList ()
 Get the input delta ray pfo list. More...
 
void PerformOneViewMatching (const pandora::HitType hitType)
 Use nearby muon pfos to project into other views and attempt to match the remaining delta ray clusters. More...
 
bool IsMuonPfo (const pandora::Cluster *const pCluster)
 Determine whether an input cluster belongs to a cosmic ray pfo. More...
 
bool AddIntoExistingDeltaRay (const pandora::Cluster *const pAvailableCluster, const pandora::PfoVector &nearbyMuonPfoVector)
 Use nearby muon pfos to project into other views and attempt to add a remaining delta ray cluster into an existing delta ray pfo. More...
 
const pandora::Cluster * GetBestProjectedCluster (const pandora::ClusterList &deltaRayClusterGroup, const pandora::ParticleFlowObject *const pNearbyMuonPfo, const pandora::HitType hitType, const bool findAvailable)
 Get the best matched available or unavailable cluster of a remaining delta ray cluster group wrt a cosmic ray pfo. More...
 
bool IsDeltaRayPfo (const pandora::Cluster *const pCluster)
 Determine whether an input cluster belongs to a delta ray pfo. More...
 
void GetClusterSpanX (const pandora::ClusterList &clusterList, float &spanMinX, float &spanMaxX)
 Determine cluster span (in x) of a group of clusters. More...
 
void CreateDeltaRay (const pandora::Cluster *const pAvailableCluster, const pandora::PfoVector &nearbyMuonPfoVector, pandora::ClusterSet &modifiedClusters)
 Use nearby muon pfos to project into other views and attempt to match a remaining delta ray cluster to form a delta ray pfo. More...
 
void GetNearbyAvailableClusters (const pandora::Cluster *const pCluster, pandora::ClusterList &consideredClusters, pandora::ClusterList &foundClusters)
 In the view of the input available cluster, gather nearby available clusters. More...
 
const pandora::Cluster * MergeClusterGroup (const pandora::ClusterList &clusterGroup)
 Merge a collection of available clusters together updating hit containers accordingly. More...
 
void CreatePfo (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3)
 Create a pfo from the input clusters updating the cluster to pfo map accordingly. More...
 
void PerformRecovery (const pandora::HitType hitType)
 Create a delta ray pfo from any remaining, significant clusters. More...
 

Private Attributes

std::string m_muonPfoListName
 The list of reconstructed cosmic ray pfos. More...
 
std::string m_deltaRayPfoListName
 The list of reconstructed delta ray pfos. More...
 
std::string m_inputClusterListNameU
 The list of reconstructed U clusters. More...
 
std::string m_inputClusterListNameV
 The list of reconstructed V clusters. More...
 
std::string m_inputClusterListNameW
 The list of reconstructed W clusters. More...
 
std::string m_outputPfoListName
 The list to receive the created delta ray pfos. More...
 
DeltaRayMatchingContainers m_deltaRayMatchingContainers
 The class of hit, cluster and pfo ownership and proximity maps. More...
 
float m_overlapExtension
 The extension to each side of the x overlap region in which to search for matched clusters. More...
 
unsigned int m_minClusterHits
 The minimum number of hits for a cluster to be significant. More...
 

Detailed Description

OneViewDeltaRayMatchingAlgorithm class.

Definition at line 23 of file OneViewDeltaRayMatchingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::OneViewDeltaRayMatchingAlgorithm::OneViewDeltaRayMatchingAlgorithm ( )

Default constructor.

Definition at line 23 of file OneViewDeltaRayMatchingAlgorithm.cc.

24 {
25 }
unsigned int m_minClusterHits
The minimum number of hits for a cluster to be significant.
float m_overlapExtension
The extension to each side of the x overlap region in which to search for matched clusters...

Member Function Documentation

bool lar_content::OneViewDeltaRayMatchingAlgorithm::AddIntoExistingDeltaRay ( const pandora::Cluster *const  pAvailableCluster,
const pandora::PfoVector &  nearbyMuonPfoVector 
)
private

Use nearby muon pfos to project into other views and attempt to add a remaining delta ray cluster into an existing delta ray pfo.

Parameters
pAvailableClusterthe address of the delta ray cluster to add
nearbyMuonPfoVectorthe vector of nearby cosmic ray pfos
Returns
whether the input cluster was aded into an existing delta ray pfo

Definition at line 191 of file OneViewDeltaRayMatchingAlgorithm.cc.

192 {
193  const HitType hitType(LArClusterHelper::GetClusterHitType(pAvailableCluster));
194  const HitType projectedHitType1((hitType == TPC_VIEW_U) ? TPC_VIEW_V : (hitType == TPC_VIEW_V) ? TPC_VIEW_W : TPC_VIEW_U);
195  const HitType projectedHitType2((projectedHitType1 == TPC_VIEW_U) ? TPC_VIEW_V : (projectedHitType1 == TPC_VIEW_V) ? TPC_VIEW_W : TPC_VIEW_U);
198 
199  for (const ParticleFlowObject *const pNearbyMuonPfo : nearbyMuonPfoVector)
200  {
201  const Cluster *const pProjectedCluster1(this->GetBestProjectedCluster({pAvailableCluster}, pNearbyMuonPfo, projectedHitType1, false));
202  const Cluster *const pProjectedCluster2(this->GetBestProjectedCluster({pAvailableCluster}, pNearbyMuonPfo, projectedHitType2, false));
203 
204  if ((!pProjectedCluster1) || (!pProjectedCluster2))
205  continue;
206 
207  const ParticleFlowObject *const pPfo1(clusterToPfoMap1.at(pProjectedCluster1));
208  const ParticleFlowObject *const pPfo2(clusterToPfoMap2.at(pProjectedCluster2));
209 
210  if (pPfo1 == pPfo2)
211  {
212  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo(*this, pPfo1, pAvailableCluster));
213 
215 
216  return true;
217  }
218  }
219 
220  return false;
221 }
std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
enum cvn::HType HitType
void AddClustersToPfoMaps(const pandora::ParticleFlowObject *const pPfo)
Add the clusters of a cosmic ray/delta ray pfo to the cluster to pfo maps.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
const pandora::Cluster * GetBestProjectedCluster(const pandora::ClusterList &deltaRayClusterGroup, const pandora::ParticleFlowObject *const pNearbyMuonPfo, const pandora::HitType hitType, const bool findAvailable)
Get the best matched available or unavailable cluster of a remaining delta ray cluster group wrt a co...
const ClusterToPfoMap & GetClusterToPfoMap(const pandora::HitType hitType) const
Get the mapping of clusters to the pfos to which they belong.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
void lar_content::OneViewDeltaRayMatchingAlgorithm::CreateDeltaRay ( const pandora::Cluster *const  pAvailableCluster,
const pandora::PfoVector &  nearbyMuonPfoVector,
pandora::ClusterSet &  modifiedClusters 
)
private

Use nearby muon pfos to project into other views and attempt to match a remaining delta ray cluster to form a delta ray pfo.

Parameters
pAvailableClusterthe address of the delta ray cluster to add
nearbyMuonPfoVectorthe vector of nearby cosmic ray pfos
modifiedClustersthe output list of any delta ray clusters in the view of pAvailableCluster made unavailable in this process

Definition at line 310 of file OneViewDeltaRayMatchingAlgorithm.cc.

311 {
312  ClusterList clusterGroup, consideredClusters;
313  this->GetNearbyAvailableClusters(pAvailableCluster, consideredClusters, clusterGroup);
314 
315  for (const Cluster *const pModifiedCluster : clusterGroup)
316  modifiedClusters.insert(pModifiedCluster);
317 
318  const HitType hitType(LArClusterHelper::GetClusterHitType(pAvailableCluster));
319  const HitType projectedHitType1((hitType == TPC_VIEW_U) ? TPC_VIEW_V : (hitType == TPC_VIEW_V) ? TPC_VIEW_W : TPC_VIEW_U);
320  const HitType projectedHitType2((projectedHitType1 == TPC_VIEW_U) ? TPC_VIEW_V : (projectedHitType1 == TPC_VIEW_V) ? TPC_VIEW_W : TPC_VIEW_U);
321  ClusterList projectedClusters1, projectedClusters2;
322 
323  for (const ParticleFlowObject *const pNearbyMuonPfo : nearbyMuonPfoVector)
324  {
325  const Cluster *const pProjectedCluster1(this->GetBestProjectedCluster(clusterGroup, pNearbyMuonPfo, projectedHitType1, true));
326  const Cluster *const pProjectedCluster2(this->GetBestProjectedCluster(clusterGroup, pNearbyMuonPfo, projectedHitType2, true));
327 
328  if ((!pProjectedCluster1) && (!pProjectedCluster2))
329  continue;
330 
331  ClusterList consideredClusters1;
332  if (pProjectedCluster1)
333  this->GetNearbyAvailableClusters(pProjectedCluster1, consideredClusters1, projectedClusters1);
334 
335  ClusterList consideredClusters2;
336  if (pProjectedCluster2)
337  this->GetNearbyAvailableClusters(pProjectedCluster2, consideredClusters2, projectedClusters2);
338  }
339 
340  const Cluster *const pCluster1(this->MergeClusterGroup(clusterGroup));
341  const Cluster *const pCluster2(this->MergeClusterGroup(projectedClusters1));
342  const Cluster *const pCluster3(this->MergeClusterGroup(projectedClusters2));
343 
344  this->CreatePfo(pCluster1, pCluster2, pCluster3);
345 }
enum cvn::HType HitType
void CreatePfo(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3)
Create a pfo from the input clusters updating the cluster to pfo map accordingly. ...
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
const pandora::Cluster * GetBestProjectedCluster(const pandora::ClusterList &deltaRayClusterGroup, const pandora::ParticleFlowObject *const pNearbyMuonPfo, const pandora::HitType hitType, const bool findAvailable)
Get the best matched available or unavailable cluster of a remaining delta ray cluster group wrt a co...
const pandora::Cluster * MergeClusterGroup(const pandora::ClusterList &clusterGroup)
Merge a collection of available clusters together updating hit containers accordingly.
void GetNearbyAvailableClusters(const pandora::Cluster *const pCluster, pandora::ClusterList &consideredClusters, pandora::ClusterList &foundClusters)
In the view of the input available cluster, gather nearby available clusters.
void lar_content::OneViewDeltaRayMatchingAlgorithm::CreatePfo ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const pandora::Cluster *const  pCluster3 
)
private

Create a pfo from the input clusters updating the cluster to pfo map accordingly.

Parameters
pCluster1the address of the first cluster
pCluster2the address of the second cluster
pCluster3the address of the third cluster

Definition at line 416 of file OneViewDeltaRayMatchingAlgorithm.cc.

417 {
418  const PfoList *pPfoList(nullptr);
419  std::string pfoListName;
420  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pPfoList, pfoListName));
421 
422  PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
423  pfoParameters.m_particleId = E_MINUS;
424  pfoParameters.m_charge = PdgTable::GetParticleCharge(E_MINUS);
425  pfoParameters.m_mass = PdgTable::GetParticleMass(E_MINUS);
426  pfoParameters.m_energy = 0.f;
427  pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
428 
429  if (pCluster1)
430  pfoParameters.m_clusterList.push_back(pCluster1);
431 
432  if (pCluster2)
433  pfoParameters.m_clusterList.push_back(pCluster2);
434 
435  if (pCluster3)
436  pfoParameters.m_clusterList.push_back(pCluster3);
437 
438  if (pfoParameters.m_clusterList.empty())
439  throw StatusCodeException(STATUS_CODE_FAILURE);
440 
441  const ParticleFlowObject *pPfo(nullptr);
442 
443  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*this, pfoParameters, pPfo));
444  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*this, m_outputPfoListName));
445  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Pfo>(*this, m_outputPfoListName));
446 
448 }
std::string string
Definition: nybbler.cc:12
void AddClustersToPfoMaps(const pandora::ParticleFlowObject *const pPfo)
Add the clusters of a cosmic ray/delta ray pfo to the cluster to pfo maps.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
std::string m_outputPfoListName
The list to receive the created delta ray pfos.
const Cluster * lar_content::OneViewDeltaRayMatchingAlgorithm::GetBestProjectedCluster ( const pandora::ClusterList &  deltaRayClusterGroup,
const pandora::ParticleFlowObject *const  pNearbyMuonPfo,
const pandora::HitType  hitType,
const bool  findAvailable 
)
private

Get the best matched available or unavailable cluster of a remaining delta ray cluster group wrt a cosmic ray pfo.

Parameters
deltaRayClusterGroupthe input group of to be merged remaining delta ray clusters
pNearbyMuonPfothe address of the nearby cosmic ray pfo
hitTypethe hit type to project into
findAvailablewhether to search for available or unavailable delta ray clusters
Returns
whether the best matched cluster of the specified view

Definition at line 225 of file OneViewDeltaRayMatchingAlgorithm.cc.

227 {
228  ClusterList muonClusterList;
229  LArPfoHelper::GetClusters(pNearbyMuonPfo, hitType, muonClusterList);
230 
231  if (muonClusterList.size() != 1)
232  return nullptr;
233 
235  auto muonProximityIter(clusterProximityMap.find(muonClusterList.front()));
236 
237  if (muonProximityIter == clusterProximityMap.end())
238  return nullptr;
239 
240  float spanMinX(0.f), spanMaxX(0.f);
241  this->GetClusterSpanX(deltaRayClusterGroup, spanMinX, spanMaxX);
242 
243  unsigned int highestHit(0);
244  const Cluster *pProjectedCluster(nullptr);
245 
246  for (const Cluster *const pNearbyCluster : muonProximityIter->second)
247  {
248  if (findAvailable && !pNearbyCluster->IsAvailable())
249  continue;
250 
251  if (!findAvailable && !this->IsDeltaRayPfo(pNearbyCluster))
252  continue;
253 
254  float minX(0.f), maxX(0.f);
255  pNearbyCluster->GetClusterSpanX(minX, maxX);
256 
257  if ((maxX < (spanMinX - m_overlapExtension)) || (minX > (spanMaxX + m_overlapExtension)))
258  continue;
259 
260  if (pNearbyCluster->GetNCaloHits() > highestHit)
261  {
262  highestHit = pNearbyCluster->GetNCaloHits();
263  pProjectedCluster = pNearbyCluster;
264  }
265  }
266 
267  return pProjectedCluster;
268 }
const ClusterProximityMap & GetClusterProximityMap(const pandora::HitType hitType) const
Get the mapping of clusters to to their neighbouring clusters.
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 IsDeltaRayPfo(const pandora::Cluster *const pCluster)
Determine whether an input cluster belongs to a delta ray pfo.
void GetClusterSpanX(const pandora::ClusterList &clusterList, float &spanMinX, float &spanMaxX)
Determine cluster span (in x) of a group of clusters.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
float m_overlapExtension
The extension to each side of the x overlap region in which to search for matched clusters...
void lar_content::OneViewDeltaRayMatchingAlgorithm::GetClusterSpanX ( const pandora::ClusterList &  clusterList,
float &  spanMinX,
float &  spanMaxX 
)
private

Determine cluster span (in x) of a group of clusters.

Parameters
clusterListthe input list of clusters
spanMinXthe output minimum x value
spanMaxXthe output maximum x value

Definition at line 290 of file OneViewDeltaRayMatchingAlgorithm.cc.

291 {
292  spanMinX = std::numeric_limits<float>::max();
293  spanMaxX = -std::numeric_limits<float>::max();
294 
295  for (const Cluster *const pCluster : clusterList)
296  {
297  float minX(0.f), maxX(0.f);
298  pCluster->GetClusterSpanX(minX, maxX);
299 
300  if (minX < spanMinX)
301  spanMinX = minX;
302 
303  if (maxX > spanMaxX)
304  spanMaxX = maxX;
305  }
306 }
static int max(int a, int b)
const PfoList lar_content::OneViewDeltaRayMatchingAlgorithm::GetDeltaRayPfoList ( )
private

Get the input delta ray pfo list.

Returns
the input delta ray pfo list

Definition at line 85 of file OneViewDeltaRayMatchingAlgorithm.cc.

86 {
87  const PfoList *pDeltaRayPfoList(nullptr);
88 
89  PANDORA_THROW_RESULT_IF_AND_IF(
90  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_deltaRayPfoListName, pDeltaRayPfoList));
91 
92  if (!pDeltaRayPfoList)
93  return PfoList();
94 
95  return *pDeltaRayPfoList;
96 }
std::string m_deltaRayPfoListName
The list of reconstructed delta ray pfos.
const ClusterList lar_content::OneViewDeltaRayMatchingAlgorithm::GetInputClusterList ( const pandora::HitType  hitType)
private

Get the input cluster list of a given hit type.

Parameters
hitTypethe hit type of list to retrieve
Returns
the input cluster list of the specified hit type

Definition at line 52 of file OneViewDeltaRayMatchingAlgorithm.cc.

53 {
54  const std::string inputClusterListName(
55  (hitType == TPC_VIEW_U) ? m_inputClusterListNameU : (hitType == TPC_VIEW_V) ? m_inputClusterListNameV : m_inputClusterListNameW);
56 
57  const ClusterList *pInputClusterList(nullptr);
58 
59  PANDORA_THROW_RESULT_IF_AND_IF(
60  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, inputClusterListName, pInputClusterList));
61 
62  if (!pInputClusterList)
63  return ClusterList();
64 
65  return *pInputClusterList;
66 }
std::string m_inputClusterListNameW
The list of reconstructed W clusters.
std::string string
Definition: nybbler.cc:12
std::string m_inputClusterListNameU
The list of reconstructed U clusters.
std::string m_inputClusterListNameV
The list of reconstructed V clusters.
const PfoList lar_content::OneViewDeltaRayMatchingAlgorithm::GetMuonPfoList ( )
private

Get the input cosmic ray pfo list.

Returns
the input cosmic ray pfo list

Definition at line 70 of file OneViewDeltaRayMatchingAlgorithm.cc.

71 {
72  const PfoList *pMuonPfoList(nullptr);
73 
74  PANDORA_THROW_RESULT_IF_AND_IF(
75  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_muonPfoListName, pMuonPfoList));
76 
77  if (!pMuonPfoList)
78  return PfoList();
79 
80  return *pMuonPfoList;
81 }
std::string m_muonPfoListName
The list of reconstructed cosmic ray pfos.
void lar_content::OneViewDeltaRayMatchingAlgorithm::GetNearbyAvailableClusters ( const pandora::Cluster *const  pCluster,
pandora::ClusterList &  consideredClusters,
pandora::ClusterList &  foundClusters 
)
private

In the view of the input available cluster, gather nearby available clusters.

Parameters
pClusterthe input available cluster
consideredClustersthe list of investigated clusters
foundClustersthe output list of nearby available clusters (including the available cluster)

Definition at line 349 of file OneViewDeltaRayMatchingAlgorithm.cc.

350 {
351  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
353 
354  consideredClusters.push_back(pCluster);
355 
356  if (!pCluster->IsAvailable())
357  return;
358 
359  if (std::find(foundClusters.begin(), foundClusters.end(), pCluster) == foundClusters.end())
360  foundClusters.push_back(pCluster);
361 
362  const DeltaRayMatchingContainers::ClusterProximityMap::const_iterator proximityIter(clusterProximityMap.find(pCluster));
363 
364  if (proximityIter == clusterProximityMap.end())
365  return;
366 
367  for (const Cluster *const pNearbyCluster : proximityIter->second)
368  {
369  if (!pNearbyCluster->IsAvailable())
370  continue;
371 
372  if (std::find(consideredClusters.begin(), consideredClusters.end(), pNearbyCluster) != consideredClusters.end())
373  continue;
374 
375  if (std::find(foundClusters.begin(), foundClusters.end(), pNearbyCluster) != foundClusters.end())
376  continue;
377 
378  this->GetNearbyAvailableClusters(pNearbyCluster, consideredClusters, foundClusters);
379  }
380 }
const ClusterProximityMap & GetClusterProximityMap(const pandora::HitType hitType) const
Get the mapping of clusters to to their neighbouring clusters.
enum cvn::HType HitType
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
void GetNearbyAvailableClusters(const pandora::Cluster *const pCluster, pandora::ClusterList &consideredClusters, pandora::ClusterList &foundClusters)
In the view of the input available cluster, gather nearby available clusters.
bool lar_content::OneViewDeltaRayMatchingAlgorithm::IsDeltaRayPfo ( const pandora::Cluster *const  pCluster)
private

Determine whether an input cluster belongs to a delta ray pfo.

Parameters
pClusterthe address of the input cluster
Returns
whether the input cluster belongs to a delta ray pfo

Definition at line 272 of file OneViewDeltaRayMatchingAlgorithm.cc.

273 {
274  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
276 
277  const DeltaRayMatchingContainers::ClusterToPfoMap::const_iterator iter(clusterToPfoMap.find(pCluster));
278 
279  if (iter == clusterToPfoMap.end())
280  return false;
281 
282  const ParticleFlowObject *const pDeltaRayPfo(iter->second);
283  const PfoList &deltaRayPfoList(this->GetDeltaRayPfoList());
284 
285  return (std::find(deltaRayPfoList.begin(), deltaRayPfoList.end(), pDeltaRayPfo) != deltaRayPfoList.end());
286 }
std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
enum cvn::HType HitType
const pandora::PfoList GetDeltaRayPfoList()
Get the input delta ray pfo list.
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
const ClusterToPfoMap & GetClusterToPfoMap(const pandora::HitType hitType) const
Get the mapping of clusters to the pfos to which they belong.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
bool lar_content::OneViewDeltaRayMatchingAlgorithm::IsMuonPfo ( const pandora::Cluster *const  pCluster)
private

Determine whether an input cluster belongs to a cosmic ray pfo.

Parameters
pClusterthe address of the input cluster
Returns
whether the input cluster belongs to a cosmic ray pfo

Definition at line 174 of file OneViewDeltaRayMatchingAlgorithm.cc.

175 {
176  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
178  const DeltaRayMatchingContainers::ClusterToPfoMap::const_iterator iter(clusterToPfoMap.find(pCluster));
179 
180  if (iter == clusterToPfoMap.end())
181  return false;
182 
183  const ParticleFlowObject *const pPfo(iter->second);
184  const PfoList &muonPfoList(this->GetMuonPfoList());
185 
186  return (std::find(muonPfoList.begin(), muonPfoList.end(), pPfo) != muonPfoList.end());
187 }
std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
enum cvn::HType HitType
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
const ClusterToPfoMap & GetClusterToPfoMap(const pandora::HitType hitType) const
Get the mapping of clusters to the pfos to which they belong.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
const pandora::PfoList GetMuonPfoList()
Get the input cosmic ray pfo list.
const Cluster * lar_content::OneViewDeltaRayMatchingAlgorithm::MergeClusterGroup ( const pandora::ClusterList &  clusterGroup)
private

Merge a collection of available clusters together updating hit containers accordingly.

Parameters
clusterGroupthe input group of clusters to merge
themerged cluster

Definition at line 384 of file OneViewDeltaRayMatchingAlgorithm.cc.

385 {
386  if (clusterGroup.empty())
387  return nullptr;
388 
389  const Cluster *const pClusterToEnlarge(clusterGroup.front());
390 
391  if (clusterGroup.size() == 1)
392  return pClusterToEnlarge;
393 
394  const HitType hitType(LArClusterHelper::GetClusterHitType(pClusterToEnlarge));
395  const std::string inputClusterListName(
396  (hitType == TPC_VIEW_U) ? m_inputClusterListNameU : (hitType == TPC_VIEW_V) ? m_inputClusterListNameV : m_inputClusterListNameW);
397 
398  for (const Cluster *const pClusterToDelete : clusterGroup)
399  {
401 
402  if (pClusterToDelete != pClusterToEnlarge)
403  {
404  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, inputClusterListName));
405  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::MergeAndDeleteClusters(*this, pClusterToEnlarge, pClusterToDelete));
406  }
407  }
408 
409  m_deltaRayMatchingContainers.AddClustersToContainers({pClusterToEnlarge}, {nullptr});
410 
411  return pClusterToEnlarge;
412 }
std::string m_inputClusterListNameW
The list of reconstructed W clusters.
enum cvn::HType HitType
std::string string
Definition: nybbler.cc:12
std::string m_inputClusterListNameU
The list of reconstructed U clusters.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
std::string m_inputClusterListNameV
The list of reconstructed V clusters.
void AddClustersToContainers(const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector)
Add a list of clusters to the hit to cluster and cluster proximity maps and, if appropriate, to the cluster to pfo map.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
void RemoveClusterFromContainers(const pandora::Cluster *const pDeletedCluster)
Remove an input cluster&#39;s hits from the hit to cluster and cluster proximity maps and...
void lar_content::OneViewDeltaRayMatchingAlgorithm::PerformOneViewMatching ( const pandora::HitType  hitType)
private

Use nearby muon pfos to project into other views and attempt to match the remaining delta ray clusters.

Parameters
hitTypethe hit type of the input cluster and of the map to add to

Definition at line 100 of file OneViewDeltaRayMatchingAlgorithm.cc.

101 {
104  ClusterVector availableClusterList;
105 
106  for (auto &entry : clusterProximityMap)
107  {
108  if (entry.first->IsAvailable())
109  availableClusterList.push_back(entry.first);
110  }
111 
112  std::sort(availableClusterList.begin(), availableClusterList.end(), LArClusterHelper::SortByNHits);
113 
114  ClusterSet modifiedClusters;
115 
116  for (const Cluster *const pAvailableCluster : availableClusterList)
117  {
118  if (modifiedClusters.count(pAvailableCluster))
119  continue;
120 
121  const DeltaRayMatchingContainers::ClusterProximityMap::const_iterator iter(clusterProximityMap.find(pAvailableCluster));
122 
123  // ATTN: Map will update during loop
124  if (iter == clusterProximityMap.end())
125  continue;
126 
127  bool found(false);
128  const ClusterList &nearbyClusters(clusterProximityMap.at(pAvailableCluster));
129  PfoVector nearbyMuonPfoVector;
130 
131  do
132  {
133  found = false;
134 
135  const ParticleFlowObject *pClosestMuonPfo(nullptr);
136  float closestDistance(std::numeric_limits<float>::max());
137 
138  for (const Cluster *const pNearbyCluster : nearbyClusters)
139  {
140  if (!this->IsMuonPfo(pNearbyCluster))
141  continue;
142 
143  if (std::find(nearbyMuonPfoVector.begin(), nearbyMuonPfoVector.end(), clusterToPfoMap.at(pNearbyCluster)) !=
144  nearbyMuonPfoVector.end())
145  continue;
146 
147  found = true;
148 
149  const float separation(LArClusterHelper::GetClosestDistance(pNearbyCluster, pAvailableCluster));
150 
151  if (separation < closestDistance)
152  {
153  closestDistance = separation;
154  pClosestMuonPfo = clusterToPfoMap.at(pNearbyCluster);
155  }
156  }
157 
158  if (pClosestMuonPfo)
159  nearbyMuonPfoVector.push_back(pClosestMuonPfo);
160  } while (found);
161 
162  if (nearbyMuonPfoVector.empty())
163  continue;
164 
165  if (this->AddIntoExistingDeltaRay(pAvailableCluster, nearbyMuonPfoVector))
166  continue;
167 
168  this->CreateDeltaRay(pAvailableCluster, nearbyMuonPfoVector, modifiedClusters);
169  }
170 }
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position, then pulse-height.
std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
const ClusterProximityMap & GetClusterProximityMap(const pandora::HitType hitType) const
Get the mapping of clusters to to their neighbouring clusters.
QList< Entry > entry
bool AddIntoExistingDeltaRay(const pandora::Cluster *const pAvailableCluster, const pandora::PfoVector &nearbyMuonPfoVector)
Use nearby muon pfos to project into other views and attempt to add a remaining delta ray cluster int...
void CreateDeltaRay(const pandora::Cluster *const pAvailableCluster, const pandora::PfoVector &nearbyMuonPfoVector, pandora::ClusterSet &modifiedClusters)
Use nearby muon pfos to project into other views and attempt to match a remaining delta ray cluster t...
intermediate_table::const_iterator const_iterator
QCollection::Item first()
Definition: qglist.cpp:807
const ClusterToPfoMap & GetClusterToPfoMap(const pandora::HitType hitType) const
Get the mapping of clusters to the pfos to which they belong.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
static int max(int a, int b)
bool IsMuonPfo(const pandora::Cluster *const pCluster)
Determine whether an input cluster belongs to a cosmic ray pfo.
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
std::vector< art::Ptr< recob::Cluster > > ClusterVector
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::OneViewDeltaRayMatchingAlgorithm::PerformRecovery ( const pandora::HitType  hitType)
private

Create a delta ray pfo from any remaining, significant clusters.

Parameters
hitTypethe view to run in

Definition at line 452 of file OneViewDeltaRayMatchingAlgorithm.cc.

453 {
454  const ClusterList &inputClusterList(this->GetInputClusterList(hitType));
455 
456  for (const Cluster *const pCluster : inputClusterList)
457  {
458  if (!pCluster->IsAvailable())
459  continue;
460 
461  if (pCluster->GetNCaloHits() < m_minClusterHits)
462  continue;
463 
464  this->CreatePfo(pCluster, nullptr, nullptr);
465  }
466 }
const pandora::ClusterList GetInputClusterList(const pandora::HitType hitType)
Get the input cluster list of a given hit type.
unsigned int m_minClusterHits
The minimum number of hits for a cluster to be significant.
void CreatePfo(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3)
Create a pfo from the input clusters updating the cluster to pfo map accordingly. ...
StatusCode lar_content::OneViewDeltaRayMatchingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 470 of file OneViewDeltaRayMatchingAlgorithm.cc.

471 {
472  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "MuonPfoListName", m_muonPfoListName));
473 
474  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "DeltaRayPfoListName", m_deltaRayPfoListName));
475 
476  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameU", m_inputClusterListNameU));
477 
478  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameV", m_inputClusterListNameV));
479 
480  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameW", m_inputClusterListNameW));
481 
482  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputPfoListName", m_outputPfoListName));
483 
484  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
485  XmlHelper::ReadValue(xmlHandle, "SearchRegion1D", m_deltaRayMatchingContainers.m_searchRegion1D));
486 
487  PANDORA_RETURN_RESULT_IF_AND_IF(
488  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "OverlapExtension", m_overlapExtension));
489 
490  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterHits", m_minClusterHits));
491 
492  return STATUS_CODE_SUCCESS;
493 }
std::string m_inputClusterListNameW
The list of reconstructed W clusters.
unsigned int m_minClusterHits
The minimum number of hits for a cluster to be significant.
std::string m_inputClusterListNameU
The list of reconstructed U clusters.
std::string m_muonPfoListName
The list of reconstructed cosmic ray pfos.
std::string m_inputClusterListNameV
The list of reconstructed V clusters.
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
float m_overlapExtension
The extension to each side of the x overlap region in which to search for matched clusters...
std::string m_deltaRayPfoListName
The list of reconstructed delta ray pfos.
std::string m_outputPfoListName
The list to receive the created delta ray pfos.
float m_searchRegion1D
Search region, applied to each dimension, for look-up from kd-tree.
StatusCode lar_content::OneViewDeltaRayMatchingAlgorithm::Run ( )
private

Definition at line 29 of file OneViewDeltaRayMatchingAlgorithm.cc.

30 {
31  const PfoList muonPfoList(this->GetMuonPfoList());
32  PfoList allPfoList(this->GetDeltaRayPfoList());
33 
34  allPfoList.insert(allPfoList.end(), muonPfoList.begin(), muonPfoList.end());
35 
37  allPfoList, this->GetInputClusterList(TPC_VIEW_U), this->GetInputClusterList(TPC_VIEW_V), this->GetInputClusterList(TPC_VIEW_W));
38 
39  for (const HitType hitType : {TPC_VIEW_U, TPC_VIEW_V, TPC_VIEW_W})
40  this->PerformOneViewMatching(hitType);
41 
42  for (const HitType hitType : {TPC_VIEW_U, TPC_VIEW_V, TPC_VIEW_W})
43  this->PerformRecovery(hitType);
44 
46 
47  return STATUS_CODE_SUCCESS;
48 }
const pandora::ClusterList GetInputClusterList(const pandora::HitType hitType)
Get the input cluster list of a given hit type.
enum cvn::HType HitType
const pandora::PfoList GetDeltaRayPfoList()
Get the input delta ray pfo list.
void FillContainers(const pandora::PfoList &inputPfoList, const pandora::ClusterList &inputClusterList1, const pandora::ClusterList &inputClusterList2=pandora::ClusterList(), const pandora::ClusterList &inputClusterList3=pandora::ClusterList())
Fill the HitToClusterMap, the ClusterProximityMap and the ClusterToPfoMap in all input views...
void PerformOneViewMatching(const pandora::HitType hitType)
Use nearby muon pfos to project into other views and attempt to match the remaining delta ray cluster...
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
void PerformRecovery(const pandora::HitType hitType)
Create a delta ray pfo from any remaining, significant clusters.
const pandora::PfoList GetMuonPfoList()
Get the input cosmic ray pfo list.
void ClearContainers()
Empty all algorithm containers.

Member Data Documentation

DeltaRayMatchingContainers lar_content::OneViewDeltaRayMatchingAlgorithm::m_deltaRayMatchingContainers
private

The class of hit, cluster and pfo ownership and proximity maps.

Definition at line 164 of file OneViewDeltaRayMatchingAlgorithm.h.

std::string lar_content::OneViewDeltaRayMatchingAlgorithm::m_deltaRayPfoListName
private

The list of reconstructed delta ray pfos.

Definition at line 159 of file OneViewDeltaRayMatchingAlgorithm.h.

std::string lar_content::OneViewDeltaRayMatchingAlgorithm::m_inputClusterListNameU
private

The list of reconstructed U clusters.

Definition at line 160 of file OneViewDeltaRayMatchingAlgorithm.h.

std::string lar_content::OneViewDeltaRayMatchingAlgorithm::m_inputClusterListNameV
private

The list of reconstructed V clusters.

Definition at line 161 of file OneViewDeltaRayMatchingAlgorithm.h.

std::string lar_content::OneViewDeltaRayMatchingAlgorithm::m_inputClusterListNameW
private

The list of reconstructed W clusters.

Definition at line 162 of file OneViewDeltaRayMatchingAlgorithm.h.

unsigned int lar_content::OneViewDeltaRayMatchingAlgorithm::m_minClusterHits
private

The minimum number of hits for a cluster to be significant.

Definition at line 166 of file OneViewDeltaRayMatchingAlgorithm.h.

std::string lar_content::OneViewDeltaRayMatchingAlgorithm::m_muonPfoListName
private

The list of reconstructed cosmic ray pfos.

Definition at line 158 of file OneViewDeltaRayMatchingAlgorithm.h.

std::string lar_content::OneViewDeltaRayMatchingAlgorithm::m_outputPfoListName
private

The list to receive the created delta ray pfos.

Definition at line 163 of file OneViewDeltaRayMatchingAlgorithm.h.

float lar_content::OneViewDeltaRayMatchingAlgorithm::m_overlapExtension
private

The extension to each side of the x overlap region in which to search for matched clusters.

Definition at line 165 of file OneViewDeltaRayMatchingAlgorithm.h.


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