LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::SlicingAlgorithm Class Reference

SlicingAlgorithm class. More...

#include "SlicingAlgorithm.h"

Inheritance diagram for lar_content::SlicingAlgorithm:

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 29 of file SlicingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::SlicingAlgorithm::SlicingAlgorithm ( )

Default constructor.

Definition at line 20 of file SlicingAlgorithm.cc.

20  :
21  m_pEventSlicingTool(nullptr)
22 {
23 }
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 94 of file SlicingAlgorithm.cc.

References m_caloHitListNames, m_clusterListNames, m_pEventSlicingTool, m_sliceClusterListName, m_slicePfoListName, and m_slicingListDeletionAlgorithm.

95 {
96  AlgorithmTool *pAlgorithmTool(nullptr);
97  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmTool(*this, xmlHandle, "SliceCreation", pAlgorithmTool));
98  m_pEventSlicingTool = dynamic_cast<EventSlicingBaseTool *>(pAlgorithmTool);
99 
100  if (!m_pEventSlicingTool)
101  return STATUS_CODE_INVALID_PARAMETER;
102 
103  PANDORA_RETURN_RESULT_IF(
104  STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithm(*this, xmlHandle, "SlicingListDeletion", m_slicingListDeletionAlgorithm));
105 
106  std::string caloHitListNameU, caloHitListNameV, caloHitListNameW;
107  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListNameU", caloHitListNameU));
108  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListNameV", caloHitListNameV));
109  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputCaloHitListNameW", caloHitListNameW));
110  m_caloHitListNames[TPC_VIEW_U] = caloHitListNameU;
111  m_caloHitListNames[TPC_VIEW_V] = caloHitListNameV;
112  m_caloHitListNames[TPC_VIEW_W] = caloHitListNameW;
113 
114  std::string clusterListNameU, clusterListNameV, clusterListNameW;
115  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameU", clusterListNameU));
116  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameV", clusterListNameV));
117  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputClusterListNameW", clusterListNameW));
118  m_clusterListNames[TPC_VIEW_U] = clusterListNameU;
119  m_clusterListNames[TPC_VIEW_V] = clusterListNameV;
120  m_clusterListNames[TPC_VIEW_W] = clusterListNameW;
121 
122  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputClusterListName", m_sliceClusterListName));
123  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputPfoListName", m_slicePfoListName));
124 
125  return STATUS_CODE_SUCCESS;
126 }
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 27 of file SlicingAlgorithm.cc.

References f, m_caloHitListNames, m_clusterListNames, m_pEventSlicingTool, m_sliceClusterListName, m_slicePfoListName, m_slicingListDeletionAlgorithm, and lar_content::EventSlicingBaseTool::RunSlicing().

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

Member Data Documentation

HitTypeToNameMap lar_content::SlicingAlgorithm::m_caloHitListNames
private

The hit type to calo hit list name map.

Definition at line 44 of file SlicingAlgorithm.h.

Referenced by ReadSettings(), and Run().

HitTypeToNameMap lar_content::SlicingAlgorithm::m_clusterListNames
private

The hit type to cluster list name map.

Definition at line 45 of file SlicingAlgorithm.h.

Referenced by ReadSettings(), and Run().

EventSlicingBaseTool* lar_content::SlicingAlgorithm::m_pEventSlicingTool
private

The address of the event slicing tool.

Definition at line 41 of file SlicingAlgorithm.h.

Referenced by ReadSettings(), and Run().

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

The name of the output slice cluster list.

Definition at line 47 of file SlicingAlgorithm.h.

Referenced by ReadSettings(), and Run().

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

The name of the output slice pfo list.

Definition at line 48 of file SlicingAlgorithm.h.

Referenced by ReadSettings(), and Run().

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

The name of the slicing list deletion algorithm.

Definition at line 42 of file SlicingAlgorithm.h.

Referenced by ReadSettings(), and Run().


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