LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::SimpleShowersTool Class Reference

SimpleShowersTool class. More...

#include "SimpleShowersTool.h"

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

Public Types

typedef ThreeDShowersAlgorithm::TensorType TensorType
 
typedef std::vector< TensorType::ElementList::const_iteratorIteratorList
 

Public Member Functions

 SimpleShowersTool ()
 Default constructor. More...
 
bool Run (ThreeDShowersAlgorithm *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...
 

Detailed Description

SimpleShowersTool class.

Definition at line 19 of file SimpleShowersTool.h.

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::SimpleShowersTool::SimpleShowersTool ( )

Default constructor.

Definition at line 18 of file SimpleShowersTool.cc.

18  :
22 {
23 }
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
TFile f
Definition: plotHisto.C:6
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 41 of file SimpleShowersTool.cc.

References lar_content::OverlapTensor< T >::GetConnectedElements(), lar_content::OverlapTensor< T >::GetSortedKeyClusters(), lar_content::ProtoParticle::m_clusterListU, lar_content::ProtoParticle::m_clusterListV, and lar_content::ProtoParticle::m_clusterListW.

Referenced by Run().

42 {
43  ClusterVector sortedKeyClusters;
44  overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
45 
46  for (const Cluster *const pKeyCluster : sortedKeyClusters)
47  {
48  if (!pKeyCluster->IsAvailable())
49  continue;
50 
51  unsigned int nU(0), nV(0), nW(0);
52  TensorType::ElementList elementList;
53  overlapTensor.GetConnectedElements(pKeyCluster, true, elementList, nU, nV, nW);
54 
55  if (elementList.empty())
56  continue;
57 
58  TensorType::Element bestElement(elementList.back());
59 
60  if (!bestElement.GetOverlapResult().IsInitialized())
61  continue;
62 
63  if ((NULL == bestElement.GetClusterU()) || (NULL == bestElement.GetClusterV()) || (NULL == bestElement.GetClusterW()))
64  continue;
65 
66  ProtoParticle protoParticle;
67  protoParticle.m_clusterListU.push_back(bestElement.GetClusterU());
68  protoParticle.m_clusterListV.push_back(bestElement.GetClusterV());
69  protoParticle.m_clusterListW.push_back(bestElement.GetClusterW());
70  protoParticleVector.push_back(protoParticle);
71 
72  return;
73  }
74 }
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 78 of file SimpleShowersTool.cc.

References m_minMatchedFraction, m_minMatchedSamplingPoints, and m_minXOverlapFraction.

79 {
80  if (eIter->GetOverlapResult().GetMatchedFraction() < m_minMatchedFraction)
81  return false;
82 
83  if (eIter->GetOverlapResult().GetNMatchedSamplingPoints() < m_minMatchedSamplingPoints)
84  return false;
85 
86  const XOverlap &xOverlap(eIter->GetOverlapResult().GetXOverlap());
87 
88  if ((xOverlap.GetXSpanU() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanU() > m_minXOverlapFraction) &&
89  (xOverlap.GetXSpanV() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanV() > m_minXOverlapFraction) &&
90  (xOverlap.GetXSpanW() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanW() > m_minXOverlapFraction))
91  {
92  return true;
93  }
94 
95  return false;
96 }
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 100 of file SimpleShowersTool.cc.

References m_minMatchedFraction, m_minMatchedSamplingPoints, and m_minXOverlapFraction.

101 {
102  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
103  "MinMatchedFraction", m_minMatchedFraction));
104 
105  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
106  "MinMatchedSamplingPoints", m_minMatchedSamplingPoints));
107 
108  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
109  "MinXOverlapFraction", m_minXOverlapFraction));
110 
111  return STATUS_CODE_SUCCESS;
112 }
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 ( ThreeDShowersAlgorithm *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 27 of file SimpleShowersTool.cc.

References lar_content::ThreeDBaseAlgorithm< T >::CreateThreeDParticles(), and FindBestShower().

28 {
29  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
30  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
31 
32  ProtoParticleVector protoParticleVector;
33  this->FindBestShower(overlapTensor, protoParticleVector);
34 
35  const bool particlesMade(pAlgorithm->CreateThreeDParticles(protoParticleVector));
36  return particlesMade;
37 }
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.

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.

Referenced by PassesElementCuts(), and ReadSettings().

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.

Referenced by PassesElementCuts(), and ReadSettings().

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.

Referenced by PassesElementCuts(), and ReadSettings().


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