Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::ClusteringParentAlgorithm Class Reference

ClusteringParentAlgorithm class. More...

#include <ClusteringParentAlgorithm.h>

Inheritance diagram for lar_content::ClusteringParentAlgorithm:

Public Member Functions

 ClusteringParentAlgorithm ()
 Default constructor. More...
 

Private Member Functions

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

Private Attributes

std::string m_clusteringAlgorithmName
 The name of the clustering algorithm to run. More...
 
std::string m_associationAlgorithmName
 The name of the topological association algorithm to run. More...
 
std::string m_inputCaloHitListName
 The name of the input calo hit list, containing the hits to be clustered. More...
 
bool m_replaceCurrentCaloHitList
 Whether to permanently replace the original calo hit list as the "current" list upon completion. More...
 
std::string m_clusterListName
 The name under which to save the new cluster list. More...
 
bool m_replaceCurrentClusterList
 Whether to subsequently use the new cluster list as the "current" list. More...
 

Detailed Description

ClusteringParentAlgorithm class.

Definition at line 19 of file ClusteringParentAlgorithm.h.

Constructor & Destructor Documentation

lar_content::ClusteringParentAlgorithm::ClusteringParentAlgorithm ( )

Default constructor.

Definition at line 18 of file ClusteringParentAlgorithm.cc.

19 {
20 }
bool m_replaceCurrentCaloHitList
Whether to permanently replace the original calo hit list as the "current" list upon completion...
bool m_replaceCurrentClusterList
Whether to subsequently use the new cluster list as the "current" list.

Member Function Documentation

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

Definition at line 76 of file ClusteringParentAlgorithm.cc.

77 {
78  // Daughter algorithm parameters
79  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithm(*this, xmlHandle, "ClusterFormation", m_clusteringAlgorithmName));
80 
81  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
82  XmlHelper::ProcessAlgorithm(*this, xmlHandle, "ClusterAssociation", m_associationAlgorithmName));
83 
84  // Input parameters: name of input calo hit list and whether it should persist as the current list after algorithm has finished
85  PANDORA_RETURN_RESULT_IF_AND_IF(
86  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListName", m_inputCaloHitListName));
87 
88  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ReplaceCurrentCaloHitList", m_replaceCurrentCaloHitList));
89 
90  // Output parameters: name of output cluster list and whether it should subsequently be used as the current list
91  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ClusterListName", m_clusterListName));
92 
93  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ReplaceCurrentClusterList", m_replaceCurrentClusterList));
94 
95  return STATUS_CODE_SUCCESS;
96 }
std::string m_clusteringAlgorithmName
The name of the clustering algorithm to run.
std::string m_associationAlgorithmName
The name of the topological association algorithm to run.
std::string m_inputCaloHitListName
The name of the input calo hit list, containing the hits to be clustered.
bool m_replaceCurrentCaloHitList
Whether to permanently replace the original calo hit list as the "current" list upon completion...
bool m_replaceCurrentClusterList
Whether to subsequently use the new cluster list as the "current" list.
std::string m_clusterListName
The name under which to save the new cluster list.
StatusCode lar_content::ClusteringParentAlgorithm::Run ( )
private

Definition at line 24 of file ClusteringParentAlgorithm.cc.

25 {
26  // If specified, change the current calo hit list, i.e. the input to the clustering algorithm
27  std::string originalCaloHitListName;
28 
29  if (!m_inputCaloHitListName.empty())
30  {
31  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentListName<CaloHit>(*this, originalCaloHitListName));
32  const StatusCode statusCode(PandoraContentApi::ReplaceCurrentList<CaloHit>(*this, m_inputCaloHitListName));
33 
34  if (STATUS_CODE_NOT_FOUND == statusCode)
35  {
36  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
37  std::cout << "ClusteringParentAlgorithm: calohit list not found " << m_inputCaloHitListName << std::endl;
38 
39  return STATUS_CODE_SUCCESS;
40  }
41 
42  if (STATUS_CODE_SUCCESS != statusCode)
43  return statusCode;
44  }
45 
46  // Run the initial cluster formation algorithm
47  const ClusterList *pClusterList = NULL;
48  std::string newClusterListName;
49  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=,
50  PandoraContentApi::RunClusteringAlgorithm(*this, m_clusteringAlgorithmName, pClusterList, newClusterListName));
51 
52  // Run the topological association algorithms to modify clusters
53  if (!pClusterList->empty() && !m_associationAlgorithmName.empty())
54  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::RunDaughterAlgorithm(*this, m_associationAlgorithmName));
55 
56  // Save the new cluster list
57  if (!pClusterList->empty())
58  {
59  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Cluster>(*this, m_clusterListName));
60 
62  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, m_clusterListName));
63  }
64 
65  // Unless specified, return current calo hit list to that when algorithm started
67  {
68  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<CaloHit>(*this, originalCaloHitListName));
69  }
70 
71  return STATUS_CODE_SUCCESS;
72 }
std::string string
Definition: nybbler.cc:12
std::string m_clusteringAlgorithmName
The name of the clustering algorithm to run.
std::string m_associationAlgorithmName
The name of the topological association algorithm to run.
std::string m_inputCaloHitListName
The name of the input calo hit list, containing the hits to be clustered.
bool m_replaceCurrentCaloHitList
Whether to permanently replace the original calo hit list as the "current" list upon completion...
bool m_replaceCurrentClusterList
Whether to subsequently use the new cluster list as the "current" list.
QTextStream & endl(QTextStream &s)
std::string m_clusterListName
The name under which to save the new cluster list.

Member Data Documentation

std::string lar_content::ClusteringParentAlgorithm::m_associationAlgorithmName
private

The name of the topological association algorithm to run.

Definition at line 32 of file ClusteringParentAlgorithm.h.

std::string lar_content::ClusteringParentAlgorithm::m_clusteringAlgorithmName
private

The name of the clustering algorithm to run.

Definition at line 31 of file ClusteringParentAlgorithm.h.

std::string lar_content::ClusteringParentAlgorithm::m_clusterListName
private

The name under which to save the new cluster list.

Definition at line 37 of file ClusteringParentAlgorithm.h.

std::string lar_content::ClusteringParentAlgorithm::m_inputCaloHitListName
private

The name of the input calo hit list, containing the hits to be clustered.

Definition at line 34 of file ClusteringParentAlgorithm.h.

bool lar_content::ClusteringParentAlgorithm::m_replaceCurrentCaloHitList
private

Whether to permanently replace the original calo hit list as the "current" list upon completion.

Definition at line 35 of file ClusteringParentAlgorithm.h.

bool lar_content::ClusteringParentAlgorithm::m_replaceCurrentClusterList
private

Whether to subsequently use the new cluster list as the "current" list.

Definition at line 38 of file ClusteringParentAlgorithm.h.


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