9 #include "Pandora/AlgorithmHeaders.h" 18 ShowerTensorVisualizationTool::ShowerTensorVisualizationTool() :
19 m_minClusterConnections(1),
20 m_ignoreUnavailableClusters(true),
21 m_showEachIndividualElement(false),
30 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
31 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() << std::endl;
33 ClusterSet usedKeyClusters;
37 for (
const Cluster *
const pKeyCluster : sortedKeyClusters)
42 if (usedKeyClusters.count(pKeyCluster))
45 unsigned int nU(0), nV(0), nW(0);
52 if (nU * nV * nW == 0)
56 ClusterList allClusterListU, allClusterListV, allClusterListW;
57 std::cout <<
" Connections: nU " << nU <<
", nV " << nV <<
", nW " << nW <<
", nElements " << elementList.size() << std::endl;
61 if (allClusterListU.end() == std::find(allClusterListU.begin(), allClusterListU.end(), eIter->GetClusterU())) allClusterListU.push_back(eIter->GetClusterU());
62 if (allClusterListV.end() == std::find(allClusterListV.begin(), allClusterListV.end(), eIter->GetClusterV())) allClusterListV.push_back(eIter->GetClusterV());
63 if (allClusterListW.end() == std::find(allClusterListW.begin(), allClusterListW.end(), eIter->GetClusterW())) allClusterListW.push_back(eIter->GetClusterW());
64 usedKeyClusters.insert(eIter->GetClusterU());
66 std::cout <<
" Element " << counter++ <<
": MatchedFraction " << eIter->GetOverlapResult().GetMatchedFraction()
67 <<
", MatchedSamplingPoints " << eIter->GetOverlapResult().GetNMatchedSamplingPoints()
68 <<
", xSpanU " << eIter->GetOverlapResult().GetXOverlap().GetXSpanU()
69 <<
", xSpanV " << eIter->GetOverlapResult().GetXOverlap().GetXSpanV()
70 <<
", xSpanW " << eIter->GetOverlapResult().GetXOverlap().GetXSpanW()
71 <<
", xOverlapSpan " << eIter->GetOverlapResult().GetXOverlap().GetXOverlapSpan()
72 <<
", Availability (" << eIter->GetClusterU()->IsAvailable() << eIter->GetClusterV()->IsAvailable() << eIter->GetClusterW()->IsAvailable() <<
") " 73 <<
", TrackFlags (" << (MU_MINUS == std::abs(eIter->GetClusterU()->GetParticleId())) << (MU_MINUS == std::abs(eIter->GetClusterV()->GetParticleId())) << (MU_MINUS == std::abs(eIter->GetClusterW()->GetParticleId())) <<
") " 78 const ClusterList clusterListU(1, eIter->GetClusterU()), clusterListV(1, eIter->GetClusterV()), 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()));
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));
95 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &(pAlgorithm->
GetInputClusterListU()),
"InputClusterListU", GRAY));
96 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &(pAlgorithm->
GetInputClusterListV()),
"InputClusterListV", GRAY));
97 PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &(pAlgorithm->
GetInputClusterListW()),
"InputClusterListW", GRAY));
100 PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
110 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
113 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
116 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
119 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
122 return STATUS_CODE_SUCCESS;
const pandora::ClusterList & GetInputClusterListW() const
Get the input w cluster list.
unsigned int m_minClusterConnections
The minimum number of cluster connections for display.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void GetConnectedElements(const pandora::Cluster *const pCluster, const bool ignoreUnavailable, ElementList &elementList) const
Get a list of elements connected to a specified cluster.
bool Run(ThreeDShowersAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
ThreeDShowersAlgorithm class.
const pandora::ClusterList & GetInputClusterListV() const
Get the input v cluster list.
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters in the tensor.
std::vector< Element > ElementList
const pandora::ClusterList & GetInputClusterListU() const
Get the input u cluster list.
void GetSortedKeyClusters(pandora::ClusterVector &sortedKeyClusters) const
Get a sorted vector of key clusters (U clusters with current implementation)
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool m_showEachIndividualElement
Whether to draw each individual tensor element.
bool m_showContext
Whether to show input cluster lists to add context to tensor elements.
TheTensor::const_iterator const_iterator