Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
lar_content::VertexBasedPfoRecoveryAlgorithm Class Reference

VertexBasedPfoRecoveryAlgorithm class. More...

#include <VertexBasedPfoRecoveryAlgorithm.h>

Inheritance diagram for lar_content::VertexBasedPfoRecoveryAlgorithm:

Classes

class  Particle
 Particle class. More...
 

Public Member Functions

 VertexBasedPfoRecoveryAlgorithm ()
 Default constructor. More...
 

Private Types

typedef std::vector< ParticleParticleList
 

Private Member Functions

pandora::StatusCode Run ()
 
pandora::StatusCode GetAvailableClusters (const pandora::StringVector inputClusterListName, pandora::ClusterVector &clusterVector) const
 Get a vector of available clusters. More...
 
void BuildSlidingFitResultMap (const pandora::ClusterVector &clusterVector, TwoDSlidingFitResultMap &slidingFitResultMap) const
 Build the map of sliding fit results. More...
 
void SelectVertexClusters (const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &inputClusters, pandora::ClusterVector &outputClusters) const
 Select clusters in proximity to reconstructed vertex. More...
 
void MatchThreeViews (const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &selectedClusters, pandora::ClusterSet &vetoList, ParticleList &particleList) const
 Match clusters from three views. More...
 
void MatchTwoViews (const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &selectedClusters, pandora::ClusterSet &vetoList, ParticleList &particleList) const
 Match clusters from two views. More...
 
void GetBestChi2 (const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &clusters1, const pandora::ClusterVector &clusters2, const pandora::ClusterVector &clusters3, const pandora::Cluster *&pBestCluster1, const pandora::Cluster *&pBestCluster2, const pandora::Cluster *&pBestCluster3, float &chi2) const
 Get best-matched triplet of clusters from a set of input cluster vectors. More...
 
void GetBestChi2 (const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &clusters1, const pandora::ClusterVector &clusters2, const pandora::Cluster *&pBestCluster1, const pandora::Cluster *&pBestCluster2, float &chi2) const
 Get best-matched pair of clusters from a set of input cluster vectors. More...
 
float GetChi2 (const pandora::Vertex *const pVertex, const LArPointingCluster &pointingCluster1, const LArPointingCluster &pointingCluster2) const
 Merge two pointing clusters and return chi-squared metric giving consistency of matching. More...
 
float GetChi2 (const pandora::Vertex *const pVertex, const LArPointingCluster &pointingCluster1, const LArPointingCluster &pointingCluster2, const LArPointingCluster &pointingCluster3) const
 Merge three clusters between views and return chi-squared metric giving consistency of matching. More...
 
void SelectAvailableClusters (const pandora::ClusterSet &vetoList, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
 Select cluster which haven't been vetoed. More...
 
void SelectClusters (const pandora::HitType hitType, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
 Select clusters of a specified hit type. More...
 
const LArPointingCluster::VertexGetInnerVertex (const pandora::CartesianVector &vertex, const LArPointingCluster &cluster) const
 Find nearest end of pointing cluster to a specified position vector. More...
 
const LArPointingCluster::VertexGetOuterVertex (const pandora::CartesianVector &vertex, const LArPointingCluster &cluster) const
 Find furthest end of pointing cluster from a specified position vector. More...
 
void BuildParticles (const ParticleList &particleList)
 Build particle flow objects from matched clusters. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

pandora::StringVector m_inputClusterListNames
 The list of input cluster list names. More...
 
std::string m_outputPfoListName
 The name of the output pfo list. More...
 
unsigned int m_slidingFitHalfWindow
 
float m_maxLongitudinalDisplacement
 
float m_maxTransverseDisplacement
 
float m_twoViewChi2Cut
 
float m_threeViewChi2Cut
 

Detailed Description

VertexBasedPfoRecoveryAlgorithm class.

Definition at line 22 of file VertexBasedPfoRecoveryAlgorithm.h.

Member Typedef Documentation

Definition at line 53 of file VertexBasedPfoRecoveryAlgorithm.h.

Constructor & Destructor Documentation

lar_content::VertexBasedPfoRecoveryAlgorithm::VertexBasedPfoRecoveryAlgorithm ( )

Member Function Documentation

void lar_content::VertexBasedPfoRecoveryAlgorithm::BuildParticles ( const ParticleList particleList)
private

Build particle flow objects from matched clusters.

Parameters
particleListthe input list of matched clusters

Definition at line 469 of file VertexBasedPfoRecoveryAlgorithm.cc.

470 {
471  if (particleList.empty())
472  return;
473 
474  const PfoList *pPfoList = NULL;
475  std::string pfoListName;
476  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pPfoList, pfoListName));
477 
478  for (ParticleList::const_iterator iter = particleList.begin(), iterEnd = particleList.end(); iter != iterEnd; ++iter)
479  {
480  const Particle &particle = *iter;
481 
482  ClusterList clusterList;
483  const Cluster *const pClusterU = particle.m_pClusterU;
484  const Cluster *const pClusterV = particle.m_pClusterV;
485  const Cluster *const pClusterW = particle.m_pClusterW;
486 
487  const bool isAvailableU((NULL != pClusterU) ? pClusterU->IsAvailable() : true);
488  const bool isAvailableV((NULL != pClusterV) ? pClusterV->IsAvailable() : true);
489  const bool isAvailableW((NULL != pClusterW) ? pClusterW->IsAvailable() : true);
490 
491  if (!(isAvailableU && isAvailableV && isAvailableW))
492  throw StatusCodeException(STATUS_CODE_FAILURE);
493 
494  if (pClusterU)
495  clusterList.push_back(pClusterU);
496  if (pClusterV)
497  clusterList.push_back(pClusterV);
498  if (pClusterW)
499  clusterList.push_back(pClusterW);
500 
501  // TODO Correct these placeholder parameters
502  PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
503  pfoParameters.m_particleId = MU_MINUS; // TRACK
504  pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
505  pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
506  pfoParameters.m_energy = 0.f;
507  pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
508  pfoParameters.m_clusterList = clusterList;
509 
510  const ParticleFlowObject *pPfo(NULL);
511  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*this, pfoParameters, pPfo));
512  }
513 
514  if (!pPfoList->empty())
515  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Pfo>(*this, m_outputPfoListName));
516 }
std::string m_outputPfoListName
The name of the output pfo list.
std::string string
Definition: nybbler.cc:12
intermediate_table::const_iterator const_iterator
void lar_content::VertexBasedPfoRecoveryAlgorithm::BuildSlidingFitResultMap ( const pandora::ClusterVector &  clusterVector,
TwoDSlidingFitResultMap slidingFitResultMap 
) const
private

Build the map of sliding fit results.

Parameters
clusterVectorthe vector of selected clusters
halfWindowLayersthe half-window to use for the sliding fits
slidingFitResultMapthe sliding fit result map

Definition at line 112 of file VertexBasedPfoRecoveryAlgorithm.cc.

113 {
114  const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
115 
116  for (ClusterVector::const_iterator iter = clusterVector.begin(), iterEnd = clusterVector.end(); iter != iterEnd; ++iter)
117  {
118  if (slidingFitResultMap.end() == slidingFitResultMap.find(*iter))
119  {
120  try
121  {
122  const TwoDSlidingFitResult slidingFitResult(*iter, m_slidingFitHalfWindow, slidingFitPitch);
123  const LArPointingCluster pointingCluster(slidingFitResult);
124 
125  if (pointingCluster.GetLengthSquared() < std::numeric_limits<float>::epsilon())
126  continue;
127 
128  if (!slidingFitResultMap.insert(TwoDSlidingFitResultMap::value_type(*iter, slidingFitResult)).second)
129  throw StatusCodeException(STATUS_CODE_FAILURE);
130  }
131  catch (StatusCodeException &statusCodeException)
132  {
133  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
134  throw statusCodeException;
135  }
136  }
137  }
138 }
intermediate_table::const_iterator const_iterator
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
StatusCode lar_content::VertexBasedPfoRecoveryAlgorithm::GetAvailableClusters ( const pandora::StringVector  inputClusterListName,
pandora::ClusterVector &  clusterVector 
) const
private

Get a vector of available clusters.

Parameters
inputClusterListNamethe input vector of the cluster list names
clusterVectorthe output vector of available clusters

Definition at line 75 of file VertexBasedPfoRecoveryAlgorithm.cc.

76 {
77  for (StringVector::const_iterator iter = inputClusterListNames.begin(), iterEnd = inputClusterListNames.end(); iter != iterEnd; ++iter)
78  {
79  const ClusterList *pClusterList(NULL);
80  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, *iter, pClusterList));
81 
82  if (NULL == pClusterList)
83  {
84  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
85  std::cout << "VertexBasedPfoRecoveryAlgorithm: could not find cluster list " << *iter << std::endl;
86  continue;
87  }
88 
89  for (ClusterList::const_iterator cIter = pClusterList->begin(), cIterEnd = pClusterList->end(); cIter != cIterEnd; ++cIter)
90  {
91  const Cluster *const pCluster = *cIter;
92 
93  if (!pCluster->IsAvailable())
94  continue;
95 
96  if (pCluster->GetNCaloHits() <= 1)
97  continue;
98 
99  if (TPC_3D == LArClusterHelper::GetClusterHitType(pCluster))
100  continue;
101 
102  clusterVector.push_back(pCluster);
103  }
104  }
105 
106  std::sort(clusterVector.begin(), clusterVector.end(), LArClusterHelper::SortByNHits);
107 
108  return STATUS_CODE_SUCCESS;
109 }
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.
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.
QTextStream & endl(QTextStream &s)
void lar_content::VertexBasedPfoRecoveryAlgorithm::GetBestChi2 ( const pandora::Vertex *const  pVertex,
const TwoDSlidingFitResultMap slidingFitResultMap,
const pandora::ClusterVector &  clusters1,
const pandora::ClusterVector &  clusters2,
const pandora::ClusterVector &  clusters3,
const pandora::Cluster *&  pBestCluster1,
const pandora::Cluster *&  pBestCluster2,
const pandora::Cluster *&  pBestCluster3,
float &  chi2 
) const
private

Get best-matched triplet of clusters from a set of input cluster vectors.

Parameters
pVertexthe input vertex
slidingFitResultMapthe mapping between clusters and sliding fit results
clusters1the clusters in the first view
clusters2the clusters in the second view
clusters3the clusters in the third view
pBestCluster1the best-matched cluster from the first view
pBestCluster2the best-matched cluster from the second view
pBestCluster3the best-matched cluster from the third view
chi2the chi-squared metric from the best match
void lar_content::VertexBasedPfoRecoveryAlgorithm::GetBestChi2 ( const pandora::Vertex *const  pVertex,
const TwoDSlidingFitResultMap slidingFitResultMap,
const pandora::ClusterVector &  clusters1,
const pandora::ClusterVector &  clusters2,
const pandora::Cluster *&  pBestCluster1,
const pandora::Cluster *&  pBestCluster2,
float &  chi2 
) const
private

Get best-matched pair of clusters from a set of input cluster vectors.

Parameters
pVertexthe input vertex
slidingFitResultMapthe mapping between clusters and sliding fit results
clusters1the clusters in the first view
clusters2the clusters in the second view
pBestCluster1the best-matched cluster from the first view
pBestCluster2the best-matched cluster from the second view
chi2the chi-squared metric from the best match
float lar_content::VertexBasedPfoRecoveryAlgorithm::GetChi2 ( const pandora::Vertex *const  pVertex,
const LArPointingCluster pointingCluster1,
const LArPointingCluster pointingCluster2 
) const
private

Merge two pointing clusters and return chi-squared metric giving consistency of matching.

Parameters
pVertexthe input vertex
pointingCluster1the first pointing cluster
pointingCluster2the second pointing cluster
float lar_content::VertexBasedPfoRecoveryAlgorithm::GetChi2 ( const pandora::Vertex *const  pVertex,
const LArPointingCluster pointingCluster1,
const LArPointingCluster pointingCluster2,
const LArPointingCluster pointingCluster3 
) const
private

Merge three clusters between views and return chi-squared metric giving consistency of matching.

Parameters
pVertexthe input vertex
pointingCluster1the first pointing cluster
pointingCluster2the second pointing cluster
pointingCluster3the third pointing cluster
const LArPointingCluster::Vertex & lar_content::VertexBasedPfoRecoveryAlgorithm::GetInnerVertex ( const pandora::CartesianVector &  vertex,
const LArPointingCluster cluster 
) const
private

Find nearest end of pointing cluster to a specified position vector.

Parameters
vertexthe input position
clusterthe input cluster

Definition at line 444 of file VertexBasedPfoRecoveryAlgorithm.cc.

445 {
446  const float innerDistance((vertex - cluster.GetInnerVertex().GetPosition()).GetMagnitudeSquared());
447  const float outerDistance((vertex - cluster.GetOuterVertex().GetPosition()).GetMagnitudeSquared());
448 
449  if (innerDistance < outerDistance)
450  return cluster.GetInnerVertex();
451  else
452  return cluster.GetOuterVertex();
453 }
Cluster finding and building.
vertex reconstruction
const LArPointingCluster::Vertex & lar_content::VertexBasedPfoRecoveryAlgorithm::GetOuterVertex ( const pandora::CartesianVector &  vertex,
const LArPointingCluster cluster 
) const
private

Find furthest end of pointing cluster from a specified position vector.

Parameters
vertexthe input position
clusterthe input pointing cluster

Definition at line 457 of file VertexBasedPfoRecoveryAlgorithm.cc.

458 {
459  const LArPointingCluster::Vertex &innerVertex = this->GetInnerVertex(vertex, cluster);
460 
461  if (innerVertex.IsInnerVertex())
462  return cluster.GetOuterVertex();
463  else
464  return cluster.GetInnerVertex();
465 }
const LArPointingCluster::Vertex & GetInnerVertex(const pandora::CartesianVector &vertex, const LArPointingCluster &cluster) const
Find nearest end of pointing cluster to a specified position vector.
Cluster finding and building.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
vertex reconstruction
void lar_content::VertexBasedPfoRecoveryAlgorithm::MatchThreeViews ( const pandora::Vertex *const  pVertex,
const TwoDSlidingFitResultMap slidingFitResultMap,
const pandora::ClusterVector &  selectedClusters,
pandora::ClusterSet &  vetoList,
ParticleList particleList 
) const
private

Match clusters from three views.

Parameters
pVertexthe input vertex
slidingFitResultMapthe mapping between clusters and sliding fit results
selectedClustersthe input vertex clusters
vetoListthe list of matched clusters
particleListthe output list of matched clusters

Definition at line 184 of file VertexBasedPfoRecoveryAlgorithm.cc.

186 {
187  while (true)
188  {
189  ClusterVector availableClusters, clustersU, clustersV, clustersW;
190  this->SelectAvailableClusters(vetoList, inputClusters, availableClusters);
191  this->SelectClusters(TPC_VIEW_U, availableClusters, clustersU);
192  this->SelectClusters(TPC_VIEW_V, availableClusters, clustersV);
193  this->SelectClusters(TPC_VIEW_W, availableClusters, clustersW);
194 
195  float chi2(m_threeViewChi2Cut);
196  const Cluster *pCluster1(NULL);
197  const Cluster *pCluster2(NULL);
198  const Cluster *pCluster3(NULL);
199 
200  this->GetBestChi2(pVertex, slidingFitResultMap, clustersU, clustersV, clustersW, pCluster1, pCluster2, pCluster3, chi2);
201 
202  if (NULL == pCluster1 || NULL == pCluster2 || NULL == pCluster3)
203  return;
204 
205  const HitType hitType1(LArClusterHelper::GetClusterHitType(pCluster1));
206  const HitType hitType2(LArClusterHelper::GetClusterHitType(pCluster2));
207  const HitType hitType3(LArClusterHelper::GetClusterHitType(pCluster3));
208 
209  const Cluster *const pClusterU(
210  (TPC_VIEW_U == hitType1) ? pCluster1 : (TPC_VIEW_U == hitType2) ? pCluster2 : (TPC_VIEW_U == hitType3) ? pCluster3 : NULL);
211  const Cluster *const pClusterV(
212  (TPC_VIEW_V == hitType1) ? pCluster1 : (TPC_VIEW_V == hitType2) ? pCluster2 : (TPC_VIEW_V == hitType3) ? pCluster3 : NULL);
213  const Cluster *const pClusterW(
214  (TPC_VIEW_W == hitType1) ? pCluster1 : (TPC_VIEW_W == hitType2) ? pCluster2 : (TPC_VIEW_W == hitType3) ? pCluster3 : NULL);
215 
216  particleList.push_back(Particle(pClusterU, pClusterV, pClusterW));
217 
218  vetoList.insert(pCluster1);
219  vetoList.insert(pCluster2);
220  vetoList.insert(pCluster3);
221  }
222 }
void GetBestChi2(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &clusters1, const pandora::ClusterVector &clusters2, const pandora::ClusterVector &clusters3, const pandora::Cluster *&pBestCluster1, const pandora::Cluster *&pBestCluster2, const pandora::Cluster *&pBestCluster3, float &chi2) const
Get best-matched triplet of clusters from a set of input cluster vectors.
enum cvn::HType HitType
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void SelectAvailableClusters(const pandora::ClusterSet &vetoList, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
Select cluster which haven&#39;t been vetoed.
void SelectClusters(const pandora::HitType hitType, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
Select clusters of a specified hit type.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void lar_content::VertexBasedPfoRecoveryAlgorithm::MatchTwoViews ( const pandora::Vertex *const  pVertex,
const TwoDSlidingFitResultMap slidingFitResultMap,
const pandora::ClusterVector &  selectedClusters,
pandora::ClusterSet &  vetoList,
ParticleList particleList 
) const
private

Match clusters from two views.

Parameters
pVertexthe input vertex
slidingFitResultMapthe mapping between clusters and sliding fit results
selectedClustersthe input vertex clusters
vetoListthe list of matched clusters
particleListthe output list of matched clusters

Definition at line 226 of file VertexBasedPfoRecoveryAlgorithm.cc.

228 {
229  while (true)
230  {
231  ClusterVector availableClusters, clustersU, clustersV, clustersW;
232  this->SelectAvailableClusters(vetoList, inputClusters, availableClusters);
233  this->SelectClusters(TPC_VIEW_U, availableClusters, clustersU);
234  this->SelectClusters(TPC_VIEW_V, availableClusters, clustersV);
235  this->SelectClusters(TPC_VIEW_W, availableClusters, clustersW);
236 
237  float chi2(m_twoViewChi2Cut);
238  const Cluster *pCluster1(NULL);
239  const Cluster *pCluster2(NULL);
240 
241  this->GetBestChi2(pVertex, slidingFitResultMap, clustersU, clustersV, pCluster1, pCluster2, chi2);
242  this->GetBestChi2(pVertex, slidingFitResultMap, clustersV, clustersW, pCluster1, pCluster2, chi2);
243  this->GetBestChi2(pVertex, slidingFitResultMap, clustersW, clustersU, pCluster1, pCluster2, chi2);
244 
245  if (NULL == pCluster1 || NULL == pCluster2)
246  return;
247 
248  const HitType hitType1(LArClusterHelper::GetClusterHitType(pCluster1));
249  const HitType hitType2(LArClusterHelper::GetClusterHitType(pCluster2));
250 
251  const Cluster *const pClusterU((TPC_VIEW_U == hitType1) ? pCluster1 : (TPC_VIEW_U == hitType2) ? pCluster2 : NULL);
252  const Cluster *const pClusterV((TPC_VIEW_V == hitType1) ? pCluster1 : (TPC_VIEW_V == hitType2) ? pCluster2 : NULL);
253  const Cluster *const pClusterW((TPC_VIEW_W == hitType1) ? pCluster1 : (TPC_VIEW_W == hitType2) ? pCluster2 : NULL);
254 
255  particleList.push_back(Particle(pClusterU, pClusterV, pClusterW));
256 
257  vetoList.insert(pCluster1);
258  vetoList.insert(pCluster2);
259  }
260 }
void GetBestChi2(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &clusters1, const pandora::ClusterVector &clusters2, const pandora::ClusterVector &clusters3, const pandora::Cluster *&pBestCluster1, const pandora::Cluster *&pBestCluster2, const pandora::Cluster *&pBestCluster3, float &chi2) const
Get best-matched triplet of clusters from a set of input cluster vectors.
enum cvn::HType HitType
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void SelectAvailableClusters(const pandora::ClusterSet &vetoList, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
Select cluster which haven&#39;t been vetoed.
void SelectClusters(const pandora::HitType hitType, const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
Select clusters of a specified hit type.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
StatusCode lar_content::VertexBasedPfoRecoveryAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 538 of file VertexBasedPfoRecoveryAlgorithm.cc.

539 {
540  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "InputClusterListNames", m_inputClusterListNames));
541 
542  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputPfoListName", m_outputPfoListName));
543 
544  PANDORA_RETURN_RESULT_IF_AND_IF(
545  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitHalfWindow", m_slidingFitHalfWindow));
546 
547  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
548  XmlHelper::ReadValue(xmlHandle, "MaxLongitudinalDisplacement", m_maxLongitudinalDisplacement));
549 
550  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
551  XmlHelper::ReadValue(xmlHandle, "MaxTransverseDisplacement", m_maxTransverseDisplacement));
552 
553  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "TwoViewChi2Cut", m_twoViewChi2Cut));
554 
555  PANDORA_RETURN_RESULT_IF_AND_IF(
556  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ThreeViewChi2Cut", m_threeViewChi2Cut));
557 
558  return STATUS_CODE_SUCCESS;
559 }
std::string m_outputPfoListName
The name of the output pfo list.
pandora::StringVector m_inputClusterListNames
The list of input cluster list names.
StatusCode lar_content::VertexBasedPfoRecoveryAlgorithm::Run ( )
private

Definition at line 33 of file VertexBasedPfoRecoveryAlgorithm.cc.

34 {
35  const VertexList *pVertexList = NULL;
36  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetCurrentList(*this, pVertexList));
37 
38  const Vertex *const pSelectedVertex(
39  (pVertexList && (pVertexList->size() == 1) && (VERTEX_3D == (*(pVertexList->begin()))->GetVertexType())) ? *(pVertexList->begin()) : NULL);
40 
41  if (!pSelectedVertex)
42  {
43  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
44  std::cout << "VertexBasedPfoRecoveryAlgorithm: unable to find vertex in current list " << std::endl;
45 
46  return STATUS_CODE_SUCCESS;
47  }
48 
49  // Get the available clusters from each view
50  ClusterVector availableClusters;
51  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->GetAvailableClusters(m_inputClusterListNames, availableClusters));
52 
53  // Build a set of sliding fit results
54  TwoDSlidingFitResultMap slidingFitResultMap;
55  this->BuildSlidingFitResultMap(availableClusters, slidingFitResultMap);
56 
57  // Select seed clusters (adjacent to vertex)
58  ClusterVector selectedClusters;
59  this->SelectVertexClusters(pSelectedVertex, slidingFitResultMap, availableClusters, selectedClusters);
60 
61  // Match the cluster end points
62  ClusterSet vetoList;
63  ParticleList particleList;
64  this->MatchThreeViews(pSelectedVertex, slidingFitResultMap, selectedClusters, vetoList, particleList);
65  this->MatchTwoViews(pSelectedVertex, slidingFitResultMap, selectedClusters, vetoList, particleList);
66 
67  // Build new particles
68  this->BuildParticles(particleList);
69 
70  return STATUS_CODE_SUCCESS;
71 }
void SelectVertexClusters(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &inputClusters, pandora::ClusterVector &outputClusters) const
Select clusters in proximity to reconstructed vertex.
void MatchTwoViews(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &selectedClusters, pandora::ClusterSet &vetoList, ParticleList &particleList) const
Match clusters from two views.
void MatchThreeViews(const pandora::Vertex *const pVertex, const TwoDSlidingFitResultMap &slidingFitResultMap, const pandora::ClusterVector &selectedClusters, pandora::ClusterSet &vetoList, ParticleList &particleList) const
Match clusters from three views.
pandora::StringVector m_inputClusterListNames
The list of input cluster list names.
pandora::StatusCode GetAvailableClusters(const pandora::StringVector inputClusterListName, pandora::ClusterVector &clusterVector) const
Get a vector of available clusters.
void BuildSlidingFitResultMap(const pandora::ClusterVector &clusterVector, TwoDSlidingFitResultMap &slidingFitResultMap) const
Build the map of sliding fit results.
std::unordered_map< const pandora::Cluster *, TwoDSlidingFitResult > TwoDSlidingFitResultMap
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::vector< art::Ptr< recob::Cluster > > ClusterVector
std::list< Vertex > VertexList
Definition: DCEL.h:182
void BuildParticles(const ParticleList &particleList)
Build particle flow objects from matched clusters.
QTextStream & endl(QTextStream &s)
void lar_content::VertexBasedPfoRecoveryAlgorithm::SelectAvailableClusters ( const pandora::ClusterSet &  vetoList,
const pandora::ClusterVector &  inputVector,
pandora::ClusterVector &  outputVector 
) const
private

Select cluster which haven't been vetoed.

Parameters
vetoListthe list of vetoed clusters
inputVectorthe input vector of clusters
outputVectorthe output vector of clusters

Definition at line 422 of file VertexBasedPfoRecoveryAlgorithm.cc.

423 {
424  for (ClusterVector::const_iterator iter = inputVector.begin(), iterEnd = inputVector.end(); iter != iterEnd; ++iter)
425  {
426  if (0 == vetoList.count(*iter))
427  outputVector.push_back(*iter);
428  }
429 }
intermediate_table::const_iterator const_iterator
void lar_content::VertexBasedPfoRecoveryAlgorithm::SelectClusters ( const pandora::HitType  hitType,
const pandora::ClusterVector &  inputVector,
pandora::ClusterVector &  outputVector 
) const
private

Select clusters of a specified hit type.

Parameters
hitTypethe specified hit type
inputVectorthe input vector of clusters
outputVectorthe output vector of clusters

Definition at line 433 of file VertexBasedPfoRecoveryAlgorithm.cc.

434 {
435  for (ClusterVector::const_iterator iter = inputVector.begin(), iterEnd = inputVector.end(); iter != iterEnd; ++iter)
436  {
437  if (hitType == LArClusterHelper::GetClusterHitType(*iter))
438  outputVector.push_back(*iter);
439  }
440 }
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.
void lar_content::VertexBasedPfoRecoveryAlgorithm::SelectVertexClusters ( const pandora::Vertex *const  pVertex,
const TwoDSlidingFitResultMap slidingFitResultMap,
const pandora::ClusterVector &  inputClusters,
pandora::ClusterVector &  outputClusters 
) const
private

Select clusters in proximity to reconstructed vertex.

Parameters
pVertexthe input vertex
slidingFitResultMapthe mapping between clusters and sliding fit results
inputClustersthe input vector of clusters
outputClustersthe output vector of clusters

Definition at line 142 of file VertexBasedPfoRecoveryAlgorithm.cc.

144 {
145  const CartesianVector vertexU(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), TPC_VIEW_U));
146  const CartesianVector vertexV(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), TPC_VIEW_V));
147  const CartesianVector vertexW(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), TPC_VIEW_W));
148 
149  for (ClusterVector::const_iterator cIter = inputClusters.begin(), cIterEnd = inputClusters.end(); cIter != cIterEnd; ++cIter)
150  {
151  const Cluster *const pCluster = *cIter;
152  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
153 
154  if (TPC_3D == hitType)
155  continue;
156 
157  const CartesianVector vertexPosition((TPC_VIEW_U == hitType) ? vertexU : (TPC_VIEW_V == hitType) ? vertexV : vertexW);
158 
159  TwoDSlidingFitResultMap::const_iterator sIter = slidingFitResultMap.find(pCluster);
160  if (slidingFitResultMap.end() == sIter)
161  continue;
162 
163  const TwoDSlidingFitResult &slidingFitResult = sIter->second;
164  const LArPointingCluster pointingCluster(slidingFitResult);
165 
166  for (unsigned int iVtx = 0; iVtx < 2; ++iVtx)
167  {
168  const LArPointingCluster::Vertex &pointingVertex((0 == iVtx) ? pointingCluster.GetInnerVertex() : pointingCluster.GetOuterVertex());
169 
170  float rL(0.f), rT(0.f);
171  LArPointingClusterHelper::GetImpactParameters(pointingVertex, vertexPosition, rL, rT);
172 
173  if (rL > -1.f && rL < m_maxLongitudinalDisplacement && rT < m_maxTransverseDisplacement)
174  {
175  outputClusters.push_back(pCluster);
176  break;
177  }
178  }
179  }
180 }
enum cvn::HType HitType
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
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.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25

Member Data Documentation

pandora::StringVector lar_content::VertexBasedPfoRecoveryAlgorithm::m_inputClusterListNames
private

The list of input cluster list names.

Definition at line 201 of file VertexBasedPfoRecoveryAlgorithm.h.

float lar_content::VertexBasedPfoRecoveryAlgorithm::m_maxLongitudinalDisplacement
private

Definition at line 205 of file VertexBasedPfoRecoveryAlgorithm.h.

float lar_content::VertexBasedPfoRecoveryAlgorithm::m_maxTransverseDisplacement
private

Definition at line 206 of file VertexBasedPfoRecoveryAlgorithm.h.

std::string lar_content::VertexBasedPfoRecoveryAlgorithm::m_outputPfoListName
private

The name of the output pfo list.

Definition at line 202 of file VertexBasedPfoRecoveryAlgorithm.h.

unsigned int lar_content::VertexBasedPfoRecoveryAlgorithm::m_slidingFitHalfWindow
private

Definition at line 204 of file VertexBasedPfoRecoveryAlgorithm.h.

float lar_content::VertexBasedPfoRecoveryAlgorithm::m_threeViewChi2Cut
private

Definition at line 208 of file VertexBasedPfoRecoveryAlgorithm.h.

float lar_content::VertexBasedPfoRecoveryAlgorithm::m_twoViewChi2Cut
private

Definition at line 207 of file VertexBasedPfoRecoveryAlgorithm.h.


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