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

TrackParticleBuildingAlgorithm class. More...

#include <TrackParticleBuildingAlgorithm.h>

Inheritance diagram for lar_content::TrackParticleBuildingAlgorithm:
lar_content::CustomParticleCreationAlgorithm

Public Member Functions

 TrackParticleBuildingAlgorithm ()
 Default constructor. More...
 

Private Member Functions

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

Private Attributes

unsigned int m_slidingFitHalfWindow
 

Additional Inherited Members

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

Detailed Description

TrackParticleBuildingAlgorithm class.

Definition at line 21 of file TrackParticleBuildingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::TrackParticleBuildingAlgorithm::TrackParticleBuildingAlgorithm ( )

Default constructor.

Definition at line 25 of file TrackParticleBuildingAlgorithm.cc.

Member Function Documentation

void lar_content::TrackParticleBuildingAlgorithm::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 31 of file TrackParticleBuildingAlgorithm.cc.

32 {
33  try
34  {
35  // Need an input vertex to provide a track propagation direction
36  const Vertex *const pInputVertex = LArPfoHelper::GetVertex(pInputPfo);
37 
38  // In cosmic mode, build tracks from all parent pfos, otherwise require that pfo is track-like
40  {
41  if (!LArPfoHelper::IsTrack(pInputPfo))
42  return;
43  }
44  else
45  {
46  if (!LArPfoHelper::IsFinalState(pInputPfo))
47  return;
48 
49  if (LArPfoHelper::IsNeutrino(pInputPfo))
50  return;
51  }
52 
53  // ATTN If wire w pitches vary between TPCs, exception will be raised in initialisation of lar pseudolayer plugin
54  const LArTPC *const pFirstLArTPC(this->GetPandora().GetGeometry()->GetLArTPCMap().begin()->second);
55  const float layerPitch(pFirstLArTPC->GetWirePitchW());
56 
57  // Calculate sliding fit trajectory
58  LArTrackStateVector trackStateVector;
59  LArPfoHelper::GetSlidingFitTrajectory(pInputPfo, pInputVertex, m_slidingFitHalfWindow, layerPitch, trackStateVector);
60 
61  if (trackStateVector.empty())
62  return;
63 
64  // Build track-like pfo from track trajectory (TODO Correct these placeholder parameters)
65  LArTrackPfoFactory trackFactory;
66  LArTrackPfoParameters pfoParameters;
67  pfoParameters.m_particleId = (LArPfoHelper::IsTrack(pInputPfo) ? pInputPfo->GetParticleId() : MU_MINUS);
68  pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
69  pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
70  pfoParameters.m_energy = 0.f;
71  pfoParameters.m_momentum = pInputPfo->GetMomentum();
72  pfoParameters.m_propertiesToAdd = pInputPfo->GetPropertiesMap();
73  pfoParameters.m_trackStateVector = trackStateVector;
74 
75  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::Create(*this, pfoParameters, pOutputPfo, trackFactory));
76 
77  const LArTrackPfo *const pLArPfo = dynamic_cast<const LArTrackPfo *>(pOutputPfo);
78  if (NULL == pLArPfo)
79  throw StatusCodeException(STATUS_CODE_FAILURE);
80 
81  // Now update vertex and direction
82  PandoraContentApi::ParticleFlowObject::Metadata pfodata;
83  pfodata.m_momentum = pLArPfo->GetVertexDirection();
84  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*this, pOutputPfo, pfodata));
85 
86  const Vertex *pOutputVertex(NULL);
87 
88  PandoraContentApi::Vertex::Parameters vtxParameters;
89  vtxParameters.m_position = pLArPfo->GetVertexPosition();
90  vtxParameters.m_vertexLabel = pInputVertex->GetVertexLabel();
91  vtxParameters.m_vertexType = pInputVertex->GetVertexType();
92 
93  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Vertex::Create(*this, vtxParameters, pOutputVertex));
94  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo(*this, pOutputPfo, pOutputVertex));
95  }
96  catch (StatusCodeException &statusCodeException)
97  {
98  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
99  throw statusCodeException;
100  }
101 }
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
static void GetSlidingFitTrajectory(const pandora::CartesianPointVector &pointVector, const pandora::CartesianVector &vertexPosition, const unsigned int layerWindow, const float layerPitch, LArTrackStateVector &trackStateVector, pandora::IntVector *const pIndexVector=nullptr)
Apply 3D sliding fit to a set of 3D points and return track trajectory.
static bool IsTrack(const pandora::ParticleFlowObject *const pPfo)
Return track 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
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
std::vector< LArTrackState > LArTrackStateVector
Definition: LArPfoObjects.h:67
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
GeomAnalyzerI * GetGeometry(void)
Definition: gAtmoEvGen.cxx:433
StatusCode lar_content::TrackParticleBuildingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::CustomParticleCreationAlgorithm.

Definition at line 105 of file TrackParticleBuildingAlgorithm.cc.

106 {
107  PANDORA_RETURN_RESULT_IF_AND_IF(
108  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitHalfWindow", m_slidingFitHalfWindow));
109 
111 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)

Member Data Documentation

unsigned int lar_content::TrackParticleBuildingAlgorithm::m_slidingFitHalfWindow
private

Definition at line 34 of file TrackParticleBuildingAlgorithm.h.


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