LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
CheatingSecondaryVertexAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
14 
16 
17 using namespace pandora;
18 
19 namespace lar_content
20 {
21 
22 CheatingSecondaryVertexAlgorithm::CheatingSecondaryVertexAlgorithm() :
23  m_inputCaloHitListName("CaloHitList2D")
24 {
25 }
26 
27 //------------------------------------------------------------------------------------------------------------------------------------------
28 
30 {
31  const CaloHitList *pCaloHitList2D{nullptr};
32  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_inputCaloHitListName, pCaloHitList2D));
33  LArEventTopology eventTopology(*pCaloHitList2D);
34  eventTopology.ConstructVisibleHierarchy();
35  eventTopology.PruneHierarchy();
36  CartesianPointVector vertices;
37  eventTopology.GetVertices(vertices);
38 
39  const VertexList *pVertexList{nullptr};
40  std::string temporaryListName;
41  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pVertexList, temporaryListName));
42 
43  for (const CartesianVector &position : vertices)
44  {
45  PandoraContentApi::Vertex::Parameters parameters;
46  parameters.m_position = position;
47  parameters.m_vertexLabel = VERTEX_INTERACTION;
48  parameters.m_vertexType = VERTEX_3D;
49 
50  const Vertex *pVertex(nullptr);
51  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Vertex::Create(*this, parameters, pVertex));
52  }
53  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Vertex>(*this, m_outputVertexListName));
54 
55  return STATUS_CODE_SUCCESS;
56 }
57 
58 //------------------------------------------------------------------------------------------------------------------------------------------
59 
60 StatusCode CheatingSecondaryVertexAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
61 {
62  PANDORA_RETURN_RESULT_IF_AND_IF(
63  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "CaloHitList2D", m_inputCaloHitListName));
64  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputVertexListName", m_outputVertexListName));
65 
66  return STATUS_CODE_SUCCESS;
67 }
68 
69 } // namespace lar_content
Header file for the cheating vertex creation algorithm class.
LArEventTopology class.
std::string m_outputVertexListName
The name under which to save the output vertex list.
void GetVertices(pandora::CartesianPointVector &vertices) const
Extract the clear topological vertices from the event.
void ConstructVisibleHierarchy()
Construct a particle hierarchy based on the key topological features in an event. ...
Header file for lar event topology.
Header file for the geometry helper class.
Header file for the lar monte carlo particle helper helper class.
std::string m_inputCaloHitListName
The name of the input calo hit list.
void PruneHierarchy()
Fold or remove particles that aren&#39;t substantive parts of the hierarchy.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::list< Vertex > VertexList
Definition: DCEL.h:169