LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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.

18  :
21 {
22 }
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 78 of file ClusteringParentAlgorithm.cc.

References m_associationAlgorithmName, m_clusteringAlgorithmName, m_clusterListName, m_inputCaloHitListName, m_replaceCurrentCaloHitList, and m_replaceCurrentClusterList.

79 {
80  // Daughter algorithm parameters
81  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithm(*this, xmlHandle, "ClusterFormation", m_clusteringAlgorithmName));
82 
83  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
84  XmlHelper::ProcessAlgorithm(*this, xmlHandle, "ClusterAssociation", m_associationAlgorithmName));
85 
86  // Input parameters: name of input calo hit list and whether it should persist as the current list after algorithm has finished
87  PANDORA_RETURN_RESULT_IF_AND_IF(
88  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListName", m_inputCaloHitListName));
89 
90  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ReplaceCurrentCaloHitList", m_replaceCurrentCaloHitList));
91 
92  // Output parameters: name of output cluster list and whether it should subsequently be used as the current list
93  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ClusterListName", m_clusterListName));
94 
95  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ReplaceCurrentClusterList", m_replaceCurrentClusterList));
96 
97  return STATUS_CODE_SUCCESS;
98 }
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 26 of file ClusteringParentAlgorithm.cc.

References m_associationAlgorithmName, m_clusteringAlgorithmName, m_clusterListName, m_inputCaloHitListName, m_replaceCurrentCaloHitList, and m_replaceCurrentClusterList.

27 {
28  // If specified, change the current calo hit list, i.e. the input to the clustering algorithm
29  std::string originalCaloHitListName;
30 
31  if (!m_inputCaloHitListName.empty())
32  {
33  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentListName<CaloHit>(*this, originalCaloHitListName));
34  const StatusCode statusCode(PandoraContentApi::ReplaceCurrentList<CaloHit>(*this, m_inputCaloHitListName));
35 
36  if (STATUS_CODE_NOT_FOUND == statusCode)
37  {
38  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
39  std::cout << "ClusteringParentAlgorithm: calohit list not found " << m_inputCaloHitListName << std::endl;
40 
41  return STATUS_CODE_SUCCESS;
42  }
43 
44  if (STATUS_CODE_SUCCESS != statusCode)
45  return statusCode;
46  }
47 
48  // Run the initial cluster formation algorithm
49  const ClusterList *pClusterList = NULL;
50  std::string newClusterListName;
51  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=,
52  PandoraContentApi::RunClusteringAlgorithm(*this, m_clusteringAlgorithmName, pClusterList, newClusterListName));
53 
54  // Run the topological association algorithms to modify clusters
55  if (!pClusterList->empty() && !m_associationAlgorithmName.empty())
56  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::RunDaughterAlgorithm(*this, m_associationAlgorithmName));
57 
58  // Save the new cluster list
59  if (!pClusterList->empty())
60  {
61  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Cluster>(*this, m_clusterListName));
62 
64  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, m_clusterListName));
65  }
66 
67  // Unless specified, return current calo hit list to that when algorithm started
69  {
70  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<CaloHit>(*this, originalCaloHitListName));
71  }
72 
73  return STATUS_CODE_SUCCESS;
74 }
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.

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.

Referenced by ReadSettings(), and Run().

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

The name of the clustering algorithm to run.

Definition at line 31 of file ClusteringParentAlgorithm.h.

Referenced by ReadSettings(), and Run().

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.

Referenced by ReadSettings(), and Run().

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.

Referenced by ReadSettings(), and Run().

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.

Referenced by ReadSettings(), and Run().

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.

Referenced by ReadSettings(), and Run().


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