Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
TransverseTensorVisualizationTool.cc
Go to the documentation of this file.
1
10
12
13using namespace pandora;
14
15namespace lar_content
16{
17
19 m_minClusterConnections(1),
20 m_ignoreUnavailableClusters(true),
21 m_showEachIndividualElement(false),
22 m_showContext(false)
23{
24}
25
26//------------------------------------------------------------------------------------------------------------------------------------------
27
29{
31 std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
32
33 ClusterSet usedKeyClusters;
34 ClusterVector sortedKeyClusters;
35 overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
36
37 for (const Cluster *const pKeyCluster : sortedKeyClusters)
38 {
39 if (m_ignoreUnavailableClusters && !pKeyCluster->IsAvailable())
40 continue;
41
42 if (usedKeyClusters.count(pKeyCluster))
43 continue;
44
45 unsigned int nU(0), nV(0), nW(0);
46 TensorType::ElementList elementList;
47 overlapTensor.GetConnectedElements(pKeyCluster, m_ignoreUnavailableClusters, elementList, nU, nV, nW);
48
50 continue;
51
52 if (nU * nV * nW == 0)
53 continue;
54
55 int counter(0);
56 ClusterList allClusterListU, allClusterListV, allClusterListW;
57 std::cout << " Connections: nU " << nU << ", nV " << nV << ", nW " << nW << ", nElements " << elementList.size() << std::endl;
58
59 for (TensorType::ElementList::const_iterator eIter = elementList.begin(); eIter != elementList.end(); ++eIter)
60 {
61 if (allClusterListU.end() == std::find(allClusterListU.begin(), allClusterListU.end(), eIter->GetClusterU()))
62 allClusterListU.push_back(eIter->GetClusterU());
63 if (allClusterListV.end() == std::find(allClusterListV.begin(), allClusterListV.end(), eIter->GetClusterV()))
64 allClusterListV.push_back(eIter->GetClusterV());
65 if (allClusterListW.end() == std::find(allClusterListW.begin(), allClusterListW.end(), eIter->GetClusterW()))
66 allClusterListW.push_back(eIter->GetClusterW());
67 usedKeyClusters.insert(eIter->GetClusterU());
68
69 std::cout << " Element " << counter++ << ": MatchedFraction " << eIter->GetOverlapResult().GetMatchedFraction()
70 << ", MatchedSamplingPoints " << eIter->GetOverlapResult().GetNMatchedSamplingPoints() << ", xSpanU "
71 << eIter->GetOverlapResult().GetXOverlap().GetXSpanU() << ", xSpanV " << eIter->GetOverlapResult().GetXOverlap().GetXSpanV()
72 << ", xSpanW " << eIter->GetOverlapResult().GetXOverlap().GetXSpanW() << ", xOverlapSpan "
73 << eIter->GetOverlapResult().GetXOverlap().GetXOverlapSpan() << std::endl;
74
76 {
77 const ClusterList clusterListU(1, eIter->GetClusterU()), clusterListV(1, eIter->GetClusterV()),
78 clusterListW(1, eIter->GetClusterW());
79 PANDORA_MONITORING_API(SetEveDisplayParameters(this->GetPandora(), false, DETECTOR_VIEW_XZ, -1.f, -1.f, 1.f));
80 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &clusterListU, "UCluster", RED));
81 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &clusterListV, "VCluster", GREEN));
82 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &clusterListW, "WCluster", BLUE));
83 PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
84 }
85 }
86
87 std::cout << " All Connected Clusters " << std::endl;
88 PANDORA_MONITORING_API(SetEveDisplayParameters(this->GetPandora(), false, DETECTOR_VIEW_XZ, -1.f, -1.f, 1.f));
89 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &allClusterListU, "AllUClusters", RED));
90 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &allClusterListV, "AllVClusters", GREEN));
91 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &allClusterListW, "AllWClusters", BLUE));
92
93 if (m_showContext)
94 {
95 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &(pAlgorithm->GetInputClusterList(TPC_VIEW_U)), "InputClusterListU", GRAY));
96 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &(pAlgorithm->GetInputClusterList(TPC_VIEW_V)), "InputClusterListV", GRAY));
97 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &(pAlgorithm->GetInputClusterList(TPC_VIEW_W)), "InputClusterListW", GRAY));
98 }
99
100 PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
101 }
102
103 return false;
104}
105
106//------------------------------------------------------------------------------------------------------------------------------------------
107
109{
111 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterConnections", m_minClusterConnections));
112
113 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
114 XmlHelper::ReadValue(xmlHandle, "IgnoreUnavailableClusters", m_ignoreUnavailableClusters));
115
116 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
117 XmlHelper::ReadValue(xmlHandle, "ShowEachIndividualElement", m_showEachIndividualElement));
118
119 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ShowContext", m_showContext));
120
121 return STATUS_CODE_SUCCESS;
122}
123
124} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
#define PANDORA_MONITORING_API(command)
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
Header file for the transverse tensor visualization tool class.
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
const pandora::ClusterList & GetInputClusterList(const pandora::HitType hitType) const
Get the input cluster list corresponding to a specified hit type.
ThreeViewTransverseTracksAlgorithm::MatchingType::TensorType TensorType
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
unsigned int m_minClusterConnections
The minimum number of cluster connections for display.
bool m_showEachIndividualElement
Whether to draw each individual tensor element.
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters in the tensor.
bool m_showContext
Whether to show input cluster lists to add context to tensor elements.
Cluster class.
Definition Cluster.h:31
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
const std::string & GetType() const
Get the type.
Definition Process.h:102
const Pandora & GetPandora() const
Get the associated pandora instance.
Definition Process.h:116
const std::string & GetInstanceName() const
Get the instance name.
Definition Process.h:109
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
std::vector< const Cluster * > ClusterVector
MANAGED_CONTAINER< const Cluster * > ClusterList
std::unordered_set< const Cluster * > ClusterSet
StatusCode
The StatusCode enum.