Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::SlicingAlgorithm Class Reference

SlicingAlgorithm class. More...

#include <SlicingAlgorithm.h>

Inheritance diagram for lar_content::SlicingAlgorithm:

Classes

class  Slice
 Slice class. More...
 

Public Types

typedef std::vector< SliceSliceList
 
typedef std::map< pandora::HitType, std::stringHitTypeToNameMap
 

Public Member Functions

 SlicingAlgorithm ()
 Default constructor. More...
 

Private Member Functions

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

Private Attributes

EventSlicingBaseToolm_pEventSlicingTool
 The address of the event slicing tool. More...
 
std::string m_slicingListDeletionAlgorithm
 The name of the slicing list deletion algorithm. More...
 
HitTypeToNameMap m_caloHitListNames
 The hit type to calo hit list name map. More...
 
HitTypeToNameMap m_clusterListNames
 The hit type to cluster list name map. More...
 
std::string m_sliceClusterListName
 The name of the output slice cluster list. More...
 
std::string m_slicePfoListName
 The name of the output slice pfo list. More...
 

Detailed Description

SlicingAlgorithm class.

Definition at line 24 of file SlicingAlgorithm.h.

Member Typedef Documentation

typedef std::map<pandora::HitType, std::string> lar_content::SlicingAlgorithm::HitTypeToNameMap

Definition at line 39 of file SlicingAlgorithm.h.

Definition at line 38 of file SlicingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::SlicingAlgorithm::SlicingAlgorithm ( )

Default constructor.

Definition at line 20 of file SlicingAlgorithm.cc.

20  : m_pEventSlicingTool(nullptr)
21 {
22 }
EventSlicingBaseTool * m_pEventSlicingTool
The address of the event slicing tool.

Member Function Documentation

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

Definition at line 93 of file SlicingAlgorithm.cc.

94 {
95  AlgorithmTool *pAlgorithmTool(nullptr);
96  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmTool(*this, xmlHandle, "SliceCreation", pAlgorithmTool));
97  m_pEventSlicingTool = dynamic_cast<EventSlicingBaseTool *>(pAlgorithmTool);
98 
100  return STATUS_CODE_INVALID_PARAMETER;
101 
102  PANDORA_RETURN_RESULT_IF(
103  STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithm(*this, xmlHandle, "SlicingListDeletion", m_slicingListDeletionAlgorithm));
104 
105  std::string caloHitListNameU, caloHitListNameV, caloHitListNameW;
106  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListNameU", caloHitListNameU));
107  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListNameV", caloHitListNameV));
108  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListNameW", caloHitListNameW));
109  m_caloHitListNames[TPC_VIEW_U] = caloHitListNameU;
110  m_caloHitListNames[TPC_VIEW_V] = caloHitListNameV;
111  m_caloHitListNames[TPC_VIEW_W] = caloHitListNameW;
112 
113  std::string clusterListNameU, clusterListNameV, clusterListNameW;
114  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameU", clusterListNameU));
115  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameV", clusterListNameV));
116  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameW", clusterListNameW));
117  m_clusterListNames[TPC_VIEW_U] = clusterListNameU;
118  m_clusterListNames[TPC_VIEW_V] = clusterListNameV;
119  m_clusterListNames[TPC_VIEW_W] = clusterListNameW;
120 
121  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputClusterListName", m_sliceClusterListName));
122  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputPfoListName", m_slicePfoListName));
123 
124  return STATUS_CODE_SUCCESS;
125 }
std::string string
Definition: nybbler.cc:12
HitTypeToNameMap m_caloHitListNames
The hit type to calo hit list name map.
std::string m_slicingListDeletionAlgorithm
The name of the slicing list deletion algorithm.
std::string m_sliceClusterListName
The name of the output slice cluster list.
HitTypeToNameMap m_clusterListNames
The hit type to cluster list name map.
std::string m_slicePfoListName
The name of the output slice pfo list.
EventSlicingBaseTool * m_pEventSlicingTool
The address of the event slicing tool.
StatusCode lar_content::SlicingAlgorithm::Run ( )
private

Definition at line 26 of file SlicingAlgorithm.cc.

27 {
28  SliceList sliceList;
30  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::RunDaughterAlgorithm(*this, m_slicingListDeletionAlgorithm));
31 
32  if (sliceList.empty())
33  return STATUS_CODE_SUCCESS;
34 
35  std::string clusterListName;
36  const ClusterList *pClusterList(nullptr);
37  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pClusterList, clusterListName));
38 
39  std::string pfoListName;
40  const PfoList *pPfoList(nullptr);
41  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pPfoList, pfoListName));
42 
43  for (const Slice &slice : sliceList)
44  {
45  const Cluster *pClusterU(nullptr), *pClusterV(nullptr), *pClusterW(nullptr);
46  PandoraContentApi::Cluster::Parameters clusterParametersU, clusterParametersV, clusterParametersW;
47  clusterParametersU.m_caloHitList = slice.m_caloHitListU;
48  clusterParametersV.m_caloHitList = slice.m_caloHitListV;
49  clusterParametersW.m_caloHitList = slice.m_caloHitListW;
50  if (!clusterParametersU.m_caloHitList.empty())
51  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, clusterParametersU, pClusterU));
52  if (!clusterParametersV.m_caloHitList.empty())
53  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, clusterParametersV, pClusterV));
54  if (!clusterParametersW.m_caloHitList.empty())
55  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Cluster::Create(*this, clusterParametersW, pClusterW));
56 
57  if (!pClusterU && !pClusterV && !pClusterW)
58  throw StatusCodeException(STATUS_CODE_FAILURE);
59 
60  const Pfo *pSlicePfo(nullptr);
61  PandoraContentApi::ParticleFlowObject::Parameters pfoParameters;
62  if (pClusterU)
63  pfoParameters.m_clusterList.push_back(pClusterU);
64  if (pClusterV)
65  pfoParameters.m_clusterList.push_back(pClusterV);
66  if (pClusterW)
67  pfoParameters.m_clusterList.push_back(pClusterW);
68  pfoParameters.m_charge = 0;
69  pfoParameters.m_energy = 0.f;
70  pfoParameters.m_mass = 0.f;
71  pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
72  pfoParameters.m_particleId = 0;
73  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*this, pfoParameters, pSlicePfo));
74  }
75 
76  if (!pClusterList->empty())
77  {
78  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Cluster>(*this, m_sliceClusterListName));
79  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Cluster>(*this, m_sliceClusterListName));
80  }
81 
82  if (!pPfoList->empty())
83  {
84  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<ParticleFlowObject>(*this, m_slicePfoListName));
85  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<ParticleFlowObject>(*this, m_slicePfoListName));
86  }
87 
88  return STATUS_CODE_SUCCESS;
89 }
SlicingAlgorithm::Slice Slice
std::string string
Definition: nybbler.cc:12
HitTypeToNameMap m_caloHitListNames
The hit type to calo hit list name map.
std::string m_slicingListDeletionAlgorithm
The name of the slicing list deletion algorithm.
virtual void RunSlicing(const pandora::Algorithm *const pAlgorithm, const SlicingAlgorithm::HitTypeToNameMap &caloHitListNames, const SlicingAlgorithm::HitTypeToNameMap &clusterListNames, SlicingAlgorithm::SliceList &sliceList)=0
Run the slicing tool.
std::string m_sliceClusterListName
The name of the output slice cluster list.
HitTypeToNameMap m_clusterListNames
The hit type to cluster list name map.
std::vector< Slice > SliceList
std::string m_slicePfoListName
The name of the output slice pfo list.
EventSlicingBaseTool * m_pEventSlicingTool
The address of the event slicing tool.

Member Data Documentation

HitTypeToNameMap lar_content::SlicingAlgorithm::m_caloHitListNames
private

The hit type to calo hit list name map.

Definition at line 53 of file SlicingAlgorithm.h.

HitTypeToNameMap lar_content::SlicingAlgorithm::m_clusterListNames
private

The hit type to cluster list name map.

Definition at line 54 of file SlicingAlgorithm.h.

EventSlicingBaseTool* lar_content::SlicingAlgorithm::m_pEventSlicingTool
private

The address of the event slicing tool.

Definition at line 50 of file SlicingAlgorithm.h.

std::string lar_content::SlicingAlgorithm::m_sliceClusterListName
private

The name of the output slice cluster list.

Definition at line 56 of file SlicingAlgorithm.h.

std::string lar_content::SlicingAlgorithm::m_slicePfoListName
private

The name of the output slice pfo list.

Definition at line 57 of file SlicingAlgorithm.h.

std::string lar_content::SlicingAlgorithm::m_slicingListDeletionAlgorithm
private

The name of the slicing list deletion algorithm.

Definition at line 51 of file SlicingAlgorithm.h.


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