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

SimpleShowersTool class. More...

#include <SimpleShowersTool.h>

Inheritance diagram for lar_content::SimpleShowersTool:
lar_content::ShowerTensorTool

Public Member Functions

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

Private Member Functions

void FindBestShower (const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
 Find best shower match as a simple way to (try to) resolve ambiguities in the tensor. More...
 
bool PassesElementCuts (TensorType::ElementList::const_iterator eIter) const
 Whether a provided (iterator to a) tensor element passes the selection cuts for particle creation. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_minMatchedFraction
 The min matched sampling point fraction for particle creation. More...
 
unsigned int m_minMatchedSamplingPoints
 The min number of matched sampling points for particle creation. More...
 
float m_minXOverlapFraction
 The min x overlap fraction (in each view) for particle creation. More...
 

Additional Inherited Members

- Public Types inherited from lar_content::ShowerTensorTool
typedef ThreeViewShowersAlgorithm::MatchingType::TensorType TensorType
 
typedef std::vector< TensorType::ElementList::const_iteratorIteratorList
 

Detailed Description

SimpleShowersTool class.

Definition at line 19 of file SimpleShowersTool.h.

Constructor & Destructor Documentation

lar_content::SimpleShowersTool::SimpleShowersTool ( )

Default constructor.

Definition at line 18 of file SimpleShowersTool.cc.

19 {
20 }
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.

Member Function Documentation

void lar_content::SimpleShowersTool::FindBestShower ( const TensorType overlapTensor,
ProtoParticleVector protoParticleVector 
) const
private

Find best shower match as a simple way to (try to) resolve ambiguities in the tensor.

Parameters
overlapTensorthe overlap tensor
protoParticleVectorto receive the list of proto particles

Definition at line 38 of file SimpleShowersTool.cc.

39 {
40  ClusterVector sortedKeyClusters;
41  overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
42 
43  for (const Cluster *const pKeyCluster : sortedKeyClusters)
44  {
45  if (!pKeyCluster->IsAvailable())
46  continue;
47 
48  unsigned int nU(0), nV(0), nW(0);
49  TensorType::ElementList elementList;
50  overlapTensor.GetConnectedElements(pKeyCluster, true, elementList, nU, nV, nW);
51 
52  if (elementList.empty())
53  continue;
54 
55  TensorType::Element bestElement(elementList.back());
56 
57  if (!bestElement.GetOverlapResult().IsInitialized())
58  continue;
59 
60  if ((NULL == bestElement.GetClusterU()) || (NULL == bestElement.GetClusterV()) || (NULL == bestElement.GetClusterW()))
61  continue;
62 
63  ProtoParticle protoParticle;
64  protoParticle.m_clusterList.push_back(bestElement.GetClusterU());
65  protoParticle.m_clusterList.push_back(bestElement.GetClusterV());
66  protoParticle.m_clusterList.push_back(bestElement.GetClusterW());
67  protoParticleVector.push_back(protoParticle);
68 
69  return;
70  }
71 }
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool lar_content::SimpleShowersTool::PassesElementCuts ( TensorType::ElementList::const_iterator  eIter) const
private

Whether a provided (iterator to a) tensor element passes the selection cuts for particle creation.

Parameters
eIterthe iterator to the tensor element

Definition at line 75 of file SimpleShowersTool.cc.

76 {
77  if (eIter->GetOverlapResult().GetMatchedFraction() < m_minMatchedFraction)
78  return false;
79 
80  if (eIter->GetOverlapResult().GetNMatchedSamplingPoints() < m_minMatchedSamplingPoints)
81  return false;
82 
83  const XOverlap &xOverlap(eIter->GetOverlapResult().GetXOverlap());
84 
85  if ((xOverlap.GetXSpanU() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanU() > m_minXOverlapFraction) &&
86  (xOverlap.GetXSpanV() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanV() > m_minXOverlapFraction) &&
87  (xOverlap.GetXSpanW() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanW() > m_minXOverlapFraction))
88  {
89  return true;
90  }
91 
92  return false;
93 }
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
StatusCode lar_content::SimpleShowersTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 97 of file SimpleShowersTool.cc.

98 {
99  PANDORA_RETURN_RESULT_IF_AND_IF(
100  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedFraction", m_minMatchedFraction));
101 
102  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
103  XmlHelper::ReadValue(xmlHandle, "MinMatchedSamplingPoints", m_minMatchedSamplingPoints));
104 
105  PANDORA_RETURN_RESULT_IF_AND_IF(
106  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinXOverlapFraction", m_minXOverlapFraction));
107 
108  return STATUS_CODE_SUCCESS;
109 }
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
bool lar_content::SimpleShowersTool::Run ( ThreeViewShowersAlgorithm *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::ShowerTensorTool.

Definition at line 24 of file SimpleShowersTool.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->FindBestShower(overlapTensor, protoParticleVector);
31 
32  const bool particlesMade(pAlgorithm->CreateThreeDParticles(protoParticleVector));
33  return particlesMade;
34 }
std::vector< ProtoParticle > ProtoParticleVector
void FindBestShower(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Find best shower match as a simple way to (try to) resolve ambiguities in the tensor.
QTextStream & endl(QTextStream &s)

Member Data Documentation

float lar_content::SimpleShowersTool::m_minMatchedFraction
private

The min matched sampling point fraction for particle creation.

Definition at line 47 of file SimpleShowersTool.h.

unsigned int lar_content::SimpleShowersTool::m_minMatchedSamplingPoints
private

The min number of matched sampling points for particle creation.

Definition at line 48 of file SimpleShowersTool.h.

float lar_content::SimpleShowersTool::m_minXOverlapFraction
private

The min x overlap fraction (in each view) for particle creation.

Definition at line 49 of file SimpleShowersTool.h.


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