LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
CheatingVertexCreationAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
13 
15 
16 using namespace pandora;
17 
18 namespace lar_content
19 {
20 
21 CheatingVertexCreationAlgorithm::CheatingVertexCreationAlgorithm() :
22  m_replaceCurrentVertexList(true),
23  m_vertexXCorrection(0.f)
24 {
25 }
26 
27 //------------------------------------------------------------------------------------------------------------------------------------------
28 
30 {
31  const MCParticleList *pMCParticleList(nullptr);
32  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pMCParticleList));
33 
34  const VertexList *pVertexList(nullptr); std::string temporaryListName;
35  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pVertexList, temporaryListName));
36 
37  for (const MCParticle *const pMCParticle : *pMCParticleList)
38  {
39  if (!LArMCParticleHelper::IsNeutrino(pMCParticle))
40  continue;
41 
42  PandoraContentApi::Vertex::Parameters parameters;
43  parameters.m_position = CartesianVector(pMCParticle->GetEndpoint().GetX() + m_vertexXCorrection, pMCParticle->GetEndpoint().GetY(), pMCParticle->GetEndpoint().GetZ());
44  parameters.m_vertexLabel = VERTEX_INTERACTION;
45  parameters.m_vertexType = VERTEX_3D;
46 
47  const Vertex *pVertex(nullptr);
48  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Vertex::Create(*this, parameters, pVertex));
49  }
50 
51  if (!pVertexList->empty())
52  {
53  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList<Vertex>(*this, m_outputVertexListName));
54 
56  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Vertex>(*this, m_outputVertexListName));
57  }
58 
59  return STATUS_CODE_SUCCESS;
60 }
61 
62 //------------------------------------------------------------------------------------------------------------------------------------------
63 
64 StatusCode CheatingVertexCreationAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
65 {
66  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
67  "OutputVertexListName", m_outputVertexListName));
68 
69  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
70  "ReplaceCurrentVertexList", m_replaceCurrentVertexList));
71 
72  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
73  "VertexXCorrection", m_vertexXCorrection));
74 
75  return STATUS_CODE_SUCCESS;
76 }
77 
78 } // namespace lar_content
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_vertexXCorrection
The vertex x correction, added to reported mc neutrino endpoint x value, in cm.
TFile f
Definition: plotHisto.C:6
Header file for the geometry helper class.
Header file for the cheating vertex creation algorithm class.
Header file for the lar monte carlo particle helper helper class.
bool m_replaceCurrentVertexList
Whether to replace the current vertex list with the output list.
std::string m_outputVertexListName
The name under which to save the output vertex list.
std::list< Vertex > VertexList
Definition: DCEL.h:178
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.