LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ClearTracksTool.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
11 
12 using namespace pandora;
13 
14 namespace lar_content
15 {
16 
17 ClearTracksTool::ClearTracksTool() :
18  m_minMatchedFraction(0.9f),
19  m_minXOverlapFraction(0.9f)
20 {
21 }
22 
23 //------------------------------------------------------------------------------------------------------------------------------------------
24 
25 bool ClearTracksTool::Run(ThreeDTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
26 {
27  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
28  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
29 
30  bool particlesMade(false);
31 
32  TensorType::ElementList elementList;
33  overlapTensor.GetUnambiguousElements(true, elementList);
34  this->CreateThreeDParticles(pAlgorithm, elementList, particlesMade);
35 
36  return particlesMade;
37 }
38 
39 //------------------------------------------------------------------------------------------------------------------------------------------
40 
42  bool &particlesMade) const
43 {
44  ProtoParticleVector protoParticleVector;
45 
46  for (TensorType::ElementList::const_iterator iter = elementList.begin(), iterEnd = elementList.end(); iter != iterEnd; ++iter)
47  {
48  if (iter->GetOverlapResult().GetMatchedFraction() < m_minMatchedFraction)
49  continue;
50 
51  const XOverlap &xOverlap(iter->GetOverlapResult().GetXOverlap());
52 
53  if ((xOverlap.GetXSpanU() < std::numeric_limits<float>::epsilon()) || (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanU() < m_minXOverlapFraction))
54  continue;
55 
56  if ((xOverlap.GetXSpanV() < std::numeric_limits<float>::epsilon()) || (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanV() < m_minXOverlapFraction))
57  continue;
58 
59  if ((xOverlap.GetXSpanW() < std::numeric_limits<float>::epsilon()) || (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanW() < m_minXOverlapFraction))
60  continue;
61 
62  ProtoParticle protoParticle;
63  protoParticle.m_clusterListU.push_back(iter->GetClusterU());
64  protoParticle.m_clusterListV.push_back(iter->GetClusterV());
65  protoParticle.m_clusterListW.push_back(iter->GetClusterW());
66  protoParticleVector.push_back(protoParticle);
67  }
68 
69  particlesMade |= pAlgorithm->CreateThreeDParticles(protoParticleVector);
70 }
71 
72 //------------------------------------------------------------------------------------------------------------------------------------------
73 
74 StatusCode ClearTracksTool::ReadSettings(const TiXmlHandle xmlHandle)
75 {
76  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
77  "MinMatchedFraction", m_minMatchedFraction));
78 
79  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
80  "MinXOverlapFraction", m_minXOverlapFraction));
81 
82  return STATUS_CODE_SUCCESS;
83 }
84 
85 } // namespace lar_content
std::vector< ProtoParticle > ProtoParticleVector
Header file for the clear tracks tool class.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
virtual bool CreateThreeDParticles(const ProtoParticleVector &protoParticleVector)
Create particles using findings from recent algorithm processing.
TFile f
Definition: plotHisto.C:6
pandora::ClusterList m_clusterListW
List of 2D W clusters in a 3D proto particle.
void GetUnambiguousElements(const bool ignoreUnavailable, ElementList &elementList) const
Get unambiguous elements.
void CreateThreeDParticles(ThreeDTransverseTracksAlgorithm *const pAlgorithm, const TensorType::ElementList &elementList, bool &particlesMade) const
Create three dimensional particles for a given tensor element list.
pandora::ClusterList m_clusterListV
List of 2D V clusters in a 3D proto particle.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::ClusterList m_clusterListU
List of 2D U clusters in a 3D proto particle.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
bool Run(ThreeDTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
XOverlap class.
Definition: LArXOverlap.h:17