Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
CheatingVertexCreationAlgorithm.cc
Go to the documentation of this file.
1
10
13
15
16using namespace pandora;
17
18namespace lar_content
19{
20
21CheatingVertexCreationAlgorithm::CheatingVertexCreationAlgorithm() : m_replaceCurrentVertexList(true), m_vertexXCorrection(0.f)
22{
23}
24
25//------------------------------------------------------------------------------------------------------------------------------------------
26
28{
29 const MCParticleList *pMCParticleList(nullptr);
30 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pMCParticleList));
31
32 const VertexList *pVertexList(nullptr);
33 std::string temporaryListName;
34 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::CreateTemporaryListAndSetCurrent(*this, pVertexList, temporaryListName));
35
36 for (const MCParticle *const pMCParticle : *pMCParticleList)
37 {
38 if (!LArMCParticleHelper::IsNeutrino(pMCParticle))
39 continue;
40
41 PandoraContentApi::Vertex::Parameters parameters;
42 parameters.m_position = CartesianVector(
43 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 {
54
57 }
58
59 return STATUS_CODE_SUCCESS;
60}
61
62//------------------------------------------------------------------------------------------------------------------------------------------
63
65{
66 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputVertexListName", m_outputVertexListName));
67
68 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
69 XmlHelper::ReadValue(xmlHandle, "ReplaceCurrentVertexList", m_replaceCurrentVertexList));
70
72 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexXCorrection", m_vertexXCorrection));
73
74 return STATUS_CODE_SUCCESS;
75}
76
77} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cheating vertex creation algorithm class.
Header file for the geometry helper class.
Header file for the lar monte carlo particle helper helper class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
static pandora::StatusCode ReplaceCurrentList(const pandora::Algorithm &algorithm, const std::string &newListName)
Replace the current list with a pre-saved list; use this new list as a permanent replacement for the ...
static pandora::StatusCode CreateTemporaryListAndSetCurrent(const pandora::Algorithm &algorithm, const T *&pT, std::string &temporaryListName)
Create a temporary list and set it to be the current list, enabling object creation.
static pandora::StatusCode GetCurrentList(const pandora::Algorithm &algorithm, const T *&pT)
Get the current list.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
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.
float m_vertexXCorrection
The vertex x correction, added to reported mc neutrino endpoint x value, in cm.
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
CartesianVector class.
MCParticle class.
Definition MCParticle.h:26
Vertex class.
Definition Vertex.h:26
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
MANAGED_CONTAINER< const MCParticle * > MCParticleList
MANAGED_CONTAINER< const Vertex * > VertexList
StatusCode
The StatusCode enum.