Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
VertexAssociatedPfosTool.cc
Go to the documentation of this file.
1
10
13
16
18
19using namespace pandora;
20
21namespace lar_content
22{
23
24typedef NeutrinoHierarchyAlgorithm::PfoInfo PfoInfo;
26
28 m_minVertexLongitudinalDistance(-2.5f),
29 m_maxVertexLongitudinalDistance(20.f),
30 m_maxVertexTransverseDistance(3.5f),
31 m_vertexAngularAllowance(3.f)
32{
33}
34
35//------------------------------------------------------------------------------------------------------------------------------------------
36
37void VertexAssociatedPfosTool::Run(const NeutrinoHierarchyAlgorithm *const pAlgorithm, const Vertex *const pNeutrinoVertex, PfoInfoMap &pfoInfoMap)
38{
40 std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
41
42 const CartesianVector &neutrinoVertex(pNeutrinoVertex->GetPosition());
43
44 PfoVector sortedPfos;
45 for (const auto &mapEntry : pfoInfoMap)
46 sortedPfos.push_back(mapEntry.first);
47 std::sort(sortedPfos.begin(), sortedPfos.end(), LArPfoHelper::SortByNHits);
48
49 for (const Pfo *const pPfo : sortedPfos)
50 {
51 PfoInfo *const pPfoInfo(pfoInfoMap.at(pPfo));
52
53 if (pPfoInfo->IsNeutrinoVertexAssociated() || pPfoInfo->GetParentPfo())
54 continue;
55
56 const LArPointingCluster pointingCluster(*(pPfoInfo->GetSlidingFitResult3D()));
57 const bool useInner((pointingCluster.GetInnerVertex().GetPosition() - neutrinoVertex).GetMagnitudeSquared() <
58 (pointingCluster.GetOuterVertex().GetPosition() - neutrinoVertex).GetMagnitudeSquared());
59
60 const LArPointingCluster::Vertex &daughterVertex(useInner ? pointingCluster.GetInnerVertex() : pointingCluster.GetOuterVertex());
61
65 {
66 pPfoInfo->SetNeutrinoVertexAssociation(true);
67 pPfoInfo->SetInnerLayerAssociation(useInner);
68 }
69 }
70}
71
72//------------------------------------------------------------------------------------------------------------------------------------------
73
75{
76 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
77 XmlHelper::ReadValue(xmlHandle, "MinVertexLongitudinalDistance", m_minVertexLongitudinalDistance));
78
79 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
80 XmlHelper::ReadValue(xmlHandle, "MaxVertexLongitudinalDistance", m_maxVertexLongitudinalDistance));
81
82 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
83 XmlHelper::ReadValue(xmlHandle, "MaxVertexTransverseDistance", m_maxVertexTransverseDistance));
84
86 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexAngularAllowance", m_vertexAngularAllowance));
87
88 return STATUS_CODE_SUCCESS;
89}
90
91} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the pfo helper class.
Header file for the lar pointing cluster class.
Header file for the lar three dimensional sliding fit result class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
Header file for the vertex associated pfos tool class.
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
static bool SortByNHits(const pandora::ParticleFlowObject *const pLhs, const pandora::ParticleFlowObject *const pRhs)
Sort pfos by number of constituent hits.
const pandora::CartesianVector & GetPosition() const
Get the vertex position.
static bool IsNode(const pandora::CartesianVector &parentVertex, const LArPointingCluster::Vertex &daughterVertex, const float minLongitudinalDistance, const float maxTransverseDistance)
Whether pointing vertex is adjacent to a given position.
static bool IsEmission(const pandora::CartesianVector &parentVertex, const LArPointingCluster::Vertex &daughterVertex, const float minLongitudinalDistance, const float maxLongitudinalDistance, const float maxTransverseDistance, const float angularAllowance)
Whether pointing vertex is emitted from a given position.
LArPointingCluster class.
const Vertex & GetInnerVertex() const
Get the inner vertex.
const Vertex & GetOuterVertex() const
Get the outer vertex.
bool IsNeutrinoVertexAssociated() const
Whether the pfo is associated with the neutrino vertex.
void SetNeutrinoVertexAssociation(const bool isNeutrinoVertexAssociated)
Set the neutrino vertex association flag.
const pandora::ParticleFlowObject * GetParentPfo() const
Get the address of the parent pfo.
void SetInnerLayerAssociation(const bool isInnerLayerAssociated)
Set the inner layer association flag.
const ThreeDSlidingFitResult * GetSlidingFitResult3D() const
Get the address of the three dimensional sliding fit result.
std::unordered_map< const pandora::ParticleFlowObject *, PfoInfo * > PfoInfoMap
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
float m_maxVertexLongitudinalDistance
Vertex association check: max longitudinal distance cut.
float m_vertexAngularAllowance
Vertex association check: pointing angular allowance in degrees.
void Run(const NeutrinoHierarchyAlgorithm *const pAlgorithm, const pandora::Vertex *const pNeutrinoVertex, NeutrinoHierarchyAlgorithm::PfoInfoMap &pfoInfoMap)
Run the algorithm tool.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
float m_minVertexLongitudinalDistance
Vertex association check: min longitudinal distance cut.
CartesianVector class.
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
ParticleFlowObject class.
const std::string & GetType() const
Get the type.
Definition Process.h:102
const std::string & GetInstanceName() const
Get the instance name.
Definition Process.h:109
Vertex class.
Definition Vertex.h:26
const CartesianVector & GetPosition() const
Get the vertex position.
Definition Vertex.h:103
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
NeutrinoHierarchyAlgorithm::PfoInfo PfoInfo
NeutrinoHierarchyAlgorithm::PfoInfoMap PfoInfoMap
std::vector< const ParticleFlowObject * > PfoVector
StatusCode
The StatusCode enum.