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

PcaShowerParticleBuildingAlgorithm class. More...

#include <PcaShowerParticleBuildingAlgorithm.h>

Inheritance diagram for lar_content::PcaShowerParticleBuildingAlgorithm:
lar_content::CustomParticleCreationAlgorithm

Classes

class  Factory
 Factory class for instantiating algorithm. More...
 

Public Member Functions

 PcaShowerParticleBuildingAlgorithm ()
 Default constructor. More...
 

Private Member Functions

void CreatePfo (const pandora::ParticleFlowObject *const pInputPfo, const pandora::ParticleFlowObject *&pOutputPfo) const
 Create specialised Pfo from an generic input Pfo. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

unsigned int m_layerFitHalfWindow
 

Additional Inherited Members

- Protected Member Functions inherited from lar_content::CustomParticleCreationAlgorithm
virtual pandora::StatusCode Run ()
 

Detailed Description

PcaShowerParticleBuildingAlgorithm class.

Definition at line 21 of file PcaShowerParticleBuildingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::PcaShowerParticleBuildingAlgorithm::PcaShowerParticleBuildingAlgorithm ( )

Default constructor.

Definition at line 26 of file PcaShowerParticleBuildingAlgorithm.cc.

Member Function Documentation

void lar_content::PcaShowerParticleBuildingAlgorithm::CreatePfo ( const pandora::ParticleFlowObject *const  pInputPfo,
const pandora::ParticleFlowObject *&  pOutputPfo 
) const
privatevirtual

Create specialised Pfo from an generic input Pfo.

Parameters
pInputPfothe address of the input Pfo
pOutputPfothe address of the output Pfo

Implements lar_content::CustomParticleCreationAlgorithm.

Definition at line 32 of file PcaShowerParticleBuildingAlgorithm.cc.

33 {
34  try
35  {
36  // In cosmic mode, build showers from all daughter pfos, otherwise require that pfo is shower-like
38  {
39  if (!LArPfoHelper::IsShower(pInputPfo))
40  return;
41  }
42  else
43  {
44  if (LArPfoHelper::IsFinalState(pInputPfo))
45  return;
46 
47  if (LArPfoHelper::IsNeutrino(pInputPfo))
48  return;
49  }
50 
51  // Need an input vertex to provide a shower propagation direction
52  const Vertex *const pInputVertex = LArPfoHelper::GetVertex(pInputPfo);
53 
54  // Run the PCA analysis
55  const LArShowerPCA showerPCA(LArPfoHelper::GetPrincipalComponents(pInputPfo, pInputVertex));
56 
57  // Build a new pfo
58  LArShowerPfoFactory pfoFactory;
59  LArShowerPfoParameters pfoParameters;
60  pfoParameters.m_particleId = (LArPfoHelper::IsShower(pInputPfo) ? pInputPfo->GetParticleId() : E_MINUS);
61  pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
62  pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
63  pfoParameters.m_energy = 0.f;
64  pfoParameters.m_momentum = pInputPfo->GetMomentum();
65  pfoParameters.m_propertiesToAdd = pInputPfo->GetPropertiesMap();
66  pfoParameters.m_showerVertex = pInputVertex->GetPosition();
67  pfoParameters.m_showerCentroid = showerPCA.GetCentroid();
68  pfoParameters.m_showerDirection = showerPCA.GetPrimaryAxis();
69  pfoParameters.m_showerSecondaryVector = showerPCA.GetSecondaryAxis();
70  pfoParameters.m_showerTertiaryVector = showerPCA.GetTertiaryAxis();
71  pfoParameters.m_showerEigenValues = showerPCA.GetEigenValues();
72  pfoParameters.m_showerLength = showerPCA.GetAxisLengths();
73  pfoParameters.m_showerOpeningAngle =
74  (showerPCA.GetPrimaryLength() > 0.f ? std::atan(showerPCA.GetSecondaryLength() / showerPCA.GetPrimaryLength()) : 0.f);
75 
76  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*this, pfoParameters, pOutputPfo, pfoFactory));
77 
78  const LArShowerPfo *const pLArPfo = dynamic_cast<const LArShowerPfo *>(pOutputPfo);
79 
80  if (!pLArPfo)
81  throw StatusCodeException(STATUS_CODE_FAILURE);
82 
83  // Build a new vertex - TODO: tune vertex position based on PCA results
84  const Vertex *pOutputVertex = nullptr;
85 
86  PandoraContentApi::Vertex::Parameters vtxParameters;
87  vtxParameters.m_position = pInputVertex->GetPosition();
88  vtxParameters.m_vertexLabel = pInputVertex->GetVertexLabel();
89  vtxParameters.m_vertexType = pInputVertex->GetVertexType();
90 
91  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Vertex::Create(*this, vtxParameters, pOutputVertex));
92  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo<Vertex>(*this, pOutputPfo, pOutputVertex));
93  }
94  catch (StatusCodeException &statusCodeException)
95  {
96  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
97  throw statusCodeException;
98  }
99 }
static LArShowerPCA GetPrincipalComponents(const pandora::CartesianPointVector &pointVector, const pandora::CartesianVector &vertexPosition)
Perform PCA analysis on a set of 3D points and return results.
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
static bool IsShower(const pandora::ParticleFlowObject *const pPfo)
Return shower flag based on Pfo Particle ID.
static bool IsNeutrino(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a neutrino or (antineutrino)
static bool IsFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a primary parent particle.
static bool IsNeutrinoFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a final-state particle from a neutrino (or antineutrino) interaction.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
StatusCode lar_content::PcaShowerParticleBuildingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::CustomParticleCreationAlgorithm.

Definition at line 103 of file PcaShowerParticleBuildingAlgorithm.cc.

104 {
105  PANDORA_RETURN_RESULT_IF_AND_IF(
106  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "LayerFitHalfWindow", m_layerFitHalfWindow));
107 
109 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)

Member Data Documentation

unsigned int lar_content::PcaShowerParticleBuildingAlgorithm::m_layerFitHalfWindow
private

Definition at line 43 of file PcaShowerParticleBuildingAlgorithm.h.


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