All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
lar_content::MatchedEndPointsTool Class Reference

MatchedEndPointsTool class. More...

#include <MatchedEndPointsTool.h>

Inheritance diagram for lar_content::MatchedEndPointsTool:
lar_content::LongitudinalTensorTool

Public Member Functions

 MatchedEndPointsTool ()
 Default constructor. More...
 
bool Run (ThreeViewLongitudinalTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
 Run the algorithm tool. More...
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void FindMatchedTracks (const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
 Find matched tracks, hidden by ambiguities in the tensor. More...
 

Static Private Member Functions

static bool SortByChiSquared (const TensorType::Element &lhs, const TensorType::Element &rhs)
 Sort tensor elements by chi-squared. More...
 

Private Attributes

float m_minMatchedFraction
 The min matched sampling point fraction for particle creation. More...
 
float m_maxEndPointChi2
 The max chi2 of matched vertex and end points for particle creation. More...
 

Additional Inherited Members

- Public Types inherited from lar_content::LongitudinalTensorTool
typedef
ThreeViewLongitudinalTracksAlgorithm::MatchingType::TensorType 
TensorType
 
typedef std::vector
< TensorType::ElementList::const_iterator
IteratorList
 

Detailed Description

MatchedEndPointsTool class.

Definition at line 19 of file MatchedEndPointsTool.h.

Constructor & Destructor Documentation

lar_content::MatchedEndPointsTool::MatchedEndPointsTool ( )

Default constructor.

Definition at line 18 of file MatchedEndPointsTool.cc.

19 {
20 }
float m_maxEndPointChi2
The max chi2 of matched vertex and end points for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.

Member Function Documentation

void lar_content::MatchedEndPointsTool::FindMatchedTracks ( const TensorType overlapTensor,
ProtoParticleVector protoParticleVector 
) const
private

Find matched tracks, hidden by ambiguities in the tensor.

Parameters
overlapTensorthe overlap tensor
protoParticleVectorto receive the list of proto particles

Definition at line 38 of file MatchedEndPointsTool.cc.

39 {
40  ClusterSet usedClusters;
41  ClusterVector sortedKeyClusters;
42  overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
43 
44  for (const Cluster *const pKeyCluster : sortedKeyClusters)
45  {
46  if (!pKeyCluster->IsAvailable())
47  continue;
48 
49  unsigned int nU(0), nV(0), nW(0);
50  TensorType::ElementList elementList;
51  overlapTensor.GetConnectedElements(pKeyCluster, true, elementList, nU, nV, nW);
52 
53  if (nU * nV * nW == 0)
54  continue;
55 
56  std::sort(elementList.begin(), elementList.end(), MatchedEndPointsTool::SortByChiSquared);
57 
58  for (TensorType::ElementList::const_iterator iter = elementList.begin(); iter != elementList.end(); ++iter)
59  {
60  if (usedClusters.count(iter->GetClusterU()) || usedClusters.count(iter->GetClusterV()) || usedClusters.count(iter->GetClusterW()))
61  continue;
62 
63  if (iter->GetOverlapResult().GetMatchedFraction() < m_minMatchedFraction)
64  continue;
65 
66  if (std::max(iter->GetOverlapResult().GetInnerChi2(), iter->GetOverlapResult().GetOuterChi2()) > m_maxEndPointChi2)
67  continue;
68 
69  ProtoParticle protoParticle;
70  protoParticle.m_clusterList.push_back(iter->GetClusterU());
71  protoParticle.m_clusterList.push_back(iter->GetClusterV());
72  protoParticle.m_clusterList.push_back(iter->GetClusterW());
73  protoParticleVector.push_back(protoParticle);
74 
75  usedClusters.insert(iter->GetClusterU());
76  usedClusters.insert(iter->GetClusterV());
77  usedClusters.insert(iter->GetClusterW());
78  }
79  }
80 }
float m_maxEndPointChi2
The max chi2 of matched vertex and end points for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
static bool SortByChiSquared(const TensorType::Element &lhs, const TensorType::Element &rhs)
Sort tensor elements by chi-squared.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
StatusCode lar_content::MatchedEndPointsTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 92 of file MatchedEndPointsTool.cc.

93 {
94  PANDORA_RETURN_RESULT_IF_AND_IF(
95  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedFraction", m_minMatchedFraction));
96 
97  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxEndPointChi2", m_maxEndPointChi2));
98 
99  return STATUS_CODE_SUCCESS;
100 }
float m_maxEndPointChi2
The max chi2 of matched vertex and end points for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
bool lar_content::MatchedEndPointsTool::Run ( ThreeViewLongitudinalTracksAlgorithm *const  pAlgorithm,
TensorType overlapTensor 
)
virtual

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::LongitudinalTensorTool.

Definition at line 24 of file MatchedEndPointsTool.cc.

25 {
26  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
27  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
28 
29  ProtoParticleVector protoParticleVector;
30  this->FindMatchedTracks(overlapTensor, protoParticleVector);
31 
32  const bool particlesMade(pAlgorithm->CreateThreeDParticles(protoParticleVector));
33  return particlesMade;
34 }
std::vector< ProtoParticle > ProtoParticleVector
void FindMatchedTracks(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Find matched tracks, hidden by ambiguities in the tensor.
BEGIN_PROLOG could also be cout
bool lar_content::MatchedEndPointsTool::SortByChiSquared ( const TensorType::Element &  lhs,
const TensorType::Element &  rhs 
)
staticprivate

Sort tensor elements by chi-squared.

Parameters
lhsthe first tensor element
rhsthe second tensor element
Returns
boolean

Definition at line 84 of file MatchedEndPointsTool.cc.

85 {
86  return (lhs.GetOverlapResult().GetInnerChi2() + lhs.GetOverlapResult().GetOuterChi2() <
87  rhs.GetOverlapResult().GetInnerChi2() + rhs.GetOverlapResult().GetOuterChi2());
88 }

Member Data Documentation

float lar_content::MatchedEndPointsTool::m_maxEndPointChi2
private

The max chi2 of matched vertex and end points for particle creation.

Definition at line 51 of file MatchedEndPointsTool.h.

float lar_content::MatchedEndPointsTool::m_minMatchedFraction
private

The min matched sampling point fraction for particle creation.

Definition at line 50 of file MatchedEndPointsTool.h.


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