LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::ShowerTensorVisualizationTool Class Reference

ShowerTensorVisualizationTool class. More...

#include "ShowerTensorVisualizationTool.h"

Inheritance diagram for lar_content::ShowerTensorVisualizationTool:
lar_content::ShowerTensorTool

Public Types

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

Public Member Functions

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

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

unsigned int m_minClusterConnections
 The minimum number of cluster connections for display. More...
 
bool m_ignoreUnavailableClusters
 Whether to ignore (skip-over) unavailable clusters in the tensor. More...
 
bool m_showEachIndividualElement
 Whether to draw each individual tensor element. More...
 
bool m_showContext
 Whether to show input cluster lists to add context to tensor elements. More...
 

Detailed Description

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::ShowerTensorVisualizationTool::ShowerTensorVisualizationTool ( )

Default constructor.

Definition at line 18 of file ShowerTensorVisualizationTool.cc.

18  :
22  m_showContext(false)
23 {
24 }
unsigned int m_minClusterConnections
The minimum number of cluster connections for display.
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters in the tensor.
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.

Member Function Documentation

StatusCode lar_content::ShowerTensorVisualizationTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 108 of file ShowerTensorVisualizationTool.cc.

References m_ignoreUnavailableClusters, m_minClusterConnections, m_showContext, and m_showEachIndividualElement.

109 {
110  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
111  "MinClusterConnections", m_minClusterConnections));
112 
113  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
114  "IgnoreUnavailableClusters", m_ignoreUnavailableClusters));
115 
116  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
117  "ShowEachIndividualElement", m_showEachIndividualElement));
118 
119  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
120  "ShowContext", m_showContext));
121 
122  return STATUS_CODE_SUCCESS;
123 }
unsigned int m_minClusterConnections
The minimum number of cluster connections for display.
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters in the tensor.
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.
bool lar_content::ShowerTensorVisualizationTool::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 28 of file ShowerTensorVisualizationTool.cc.

References f, lar_content::OverlapTensor< T >::GetConnectedElements(), lar_content::ThreeDBaseAlgorithm< T >::GetInputClusterListU(), lar_content::ThreeDBaseAlgorithm< T >::GetInputClusterListV(), lar_content::ThreeDBaseAlgorithm< T >::GetInputClusterListW(), lar_content::OverlapTensor< T >::GetSortedKeyClusters(), m_ignoreUnavailableClusters, m_minClusterConnections, m_showContext, and m_showEachIndividualElement.

29 {
30  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
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())) 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());
65 
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())) << ") "
74  << std::endl;
75 
77  {
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()));
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->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));
98  }
99 
100  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
101  }
102 
103  return false;
104 }
unsigned int m_minClusterConnections
The minimum number of cluster connections for display.
TFile f
Definition: plotHisto.C:6
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters in the tensor.
intermediate_table::const_iterator const_iterator
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.

Member Data Documentation

bool lar_content::ShowerTensorVisualizationTool::m_ignoreUnavailableClusters
private

Whether to ignore (skip-over) unavailable clusters in the tensor.

Definition at line 33 of file ShowerTensorVisualizationTool.h.

Referenced by ReadSettings(), and Run().

unsigned int lar_content::ShowerTensorVisualizationTool::m_minClusterConnections
private

The minimum number of cluster connections for display.

Definition at line 32 of file ShowerTensorVisualizationTool.h.

Referenced by ReadSettings(), and Run().

bool lar_content::ShowerTensorVisualizationTool::m_showContext
private

Whether to show input cluster lists to add context to tensor elements.

Definition at line 35 of file ShowerTensorVisualizationTool.h.

Referenced by ReadSettings(), and Run().

bool lar_content::ShowerTensorVisualizationTool::m_showEachIndividualElement
private

Whether to draw each individual tensor element.

Definition at line 34 of file ShowerTensorVisualizationTool.h.

Referenced by ReadSettings(), and Run().


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