9 #include "Pandora/AlgorithmHeaders.h" 10 #include "Pandora/StatusCodes.h" 22 #include <torch/script.h> 23 #include <torch/torch.h> 33 void DLLaterTierHierarchyTool::DLLaterTierNetworkParams::AddCommonParamsToInput(
int &insertIndex,
LArDLHelper::TorchInput &modelInput)
const 35 for (
const float param : {m_parentTrackScore, m_childTrackScore, m_parentNSpacepoints, m_childNSpacepoints, m_separation3D})
37 modelInput[0][insertIndex] = param;
44 void DLLaterTierHierarchyTool::DLLaterTierNetworkParams::AddOrientationParamsToInput(
int &insertIndex,
LArDLHelper::TorchInput &modelInput)
const 46 for (
const float param : {m_parentNuVertexSep, m_childNuVertexSep, m_parentEndRegionNHits, m_parentEndRegionNParticles,
47 m_parentEndRegionRToWall, m_vertexSeparation, m_doesChildConnect, m_overshootStartDCA, m_overshootStartL, m_overshootEndDCA,
48 m_overshootEndL, m_childCPDCA, m_childCPExtrapDistance, m_childCPLRatio, m_parentCPNUpstreamHits, m_parentCPNDownstreamHits,
49 m_parentCPNHitRatio, m_parentCPEigenvalueRatio, m_parentCPOpeningAngle, m_parentIsPOIClosestToNu, m_childIsPOIClosestToNu})
51 modelInput[0][insertIndex] = param;
59 DLLaterTierHierarchyTool::DLLaterTierHierarchyTool() :
61 m_trainingMode(false),
62 m_trajectoryStepSize(1.
f),
63 m_connectionBuffer(50.
f),
73 std::vector<DLLaterTierNetworkParams> &networkParamVector,
float &laterTierScore)
75 networkParamVector.clear();
76 laterTierScore = std::numeric_limits<float>::lowest();
81 const std::pair<float, float> trackScoreParams(
82 {LArPfoHelper::GetTrackScore(parentHierarchyPfo.
GetPfo()), LArPfoHelper::GetTrackScore(childHierarchyPfo.
GetPfo())});
83 const std::pair<float, float> nSpacepointsParams(
84 {LArPfoHelper::GetNumberOfThreeDHits(parentHierarchyPfo.
GetPfo()), LArPfoHelper::GetNumberOfThreeDHits(childHierarchyPfo.
GetPfo())});
85 const float separation3D(LArPfoHelper::GetThreeDSeparation(parentHierarchyPfo.
GetPfo(), childHierarchyPfo.
GetPfo()));
87 const bool isChildTrack(childHierarchyPfo.
GetPfo()->GetParticleId() == 13);
88 std::vector<bool> childOrientationVector(
89 isChildTrack ? std::vector<bool>({
true,
false}) : std::vector<bool>({this->
IsShowerVertexUpstream(parentHierarchyPfo, childHierarchyPfo)}));
92 for (
const bool &useUpstreamForParent : {
true,
false})
94 for (
const bool &useUpstreamForChild : childOrientationVector)
99 this->
SetCommonParams(trackScoreParams, nSpacepointsParams, separation3D, edgeParams);
103 pAlgorithm, parentHierarchyPfo, childHierarchyPfo, pNeutrinoPfo, useUpstreamForParent, useUpstreamForChild, edgeParams));
105 if (statusCode != STATUS_CODE_SUCCESS)
109 networkParamVector.emplace_back(edgeParams);
118 this->
ClassifyTrackTrack(networkParamVector.at(0), networkParamVector.at(1), networkParamVector.at(2), networkParamVector.at(3));
120 laterTierScore = this->
ClassifyTrackShower(networkParamVector.at(0), networkParamVector.at(1));
123 return STATUS_CODE_SUCCESS;
133 if (isUpstreamSet && !isDownstreamSet)
136 if (!isUpstreamSet && isDownstreamSet)
140 if (!isUpstreamSet && !isDownstreamSet)
141 throw StatusCodeException(STATUS_CODE_FAILURE);
143 CartesianPointVector parentPositions3D;
144 LArPfoHelper::GetCoordinateVector(parentHierarchyPfo.
GetPfo(), TPC_3D, parentPositions3D);
146 float upstreamSepSq(std::numeric_limits<float>::max());
147 float downstreamSepSq(std::numeric_limits<float>::max());
149 for (
const CartesianVector &parentPosition3D : parentPositions3D)
154 upstreamSepSq = std::min(upstreamSepSq, thisUpstreamSepSq);
155 downstreamSepSq = std::min(downstreamSepSq, thisDownstreamSepSq);
158 return (upstreamSepSq < downstreamSepSq);
164 const std::pair<float, float> &nSpacepointsParams,
const float separation3D,
DLLaterTierNetworkParams &laterTierNetworkParams)
const 176 const HierarchyPfo &childHierarchyPfo,
const ParticleFlowObject *
const pNeutrinoPfo,
const bool useUpstreamForParent,
180 if (pNeutrinoPfo->GetVertexList().empty())
181 return STATUS_CODE_NOT_INITIALIZED;
183 const Vertex *
const pNeutrinoVertex(LArPfoHelper::GetVertex(pNeutrinoPfo));
184 const CartesianVector nuVertex(
185 pNeutrinoVertex->GetPosition().GetX(), pNeutrinoVertex->GetPosition().GetY(), pNeutrinoVertex->GetPosition().GetZ());
195 if (!parentStart.IsSet())
197 return STATUS_CODE_NOT_INITIALIZED;
199 if (!parentEnd.IsSet())
201 return STATUS_CODE_NOT_INITIALIZED;
203 if (!childStart.IsSet())
205 return STATUS_CODE_NOT_INITIALIZED;
211 this->
SetVertexParams(nuVertex, parentStart.GetPosition(), parentEnd.GetPosition(), childStart.GetPosition(), laterTierNetworkParams);
213 this->
SetConnectionParams(parentHierarchyPfo, parentStart.GetPosition(), childStart, laterTierNetworkParams);
221 return STATUS_CODE_SUCCESS;
227 const CartesianVector &parentEndPos,
const CartesianVector &childStartPos,
DLLaterTierNetworkParams &laterTierNetworkParams)
const 230 laterTierNetworkParams.
m_childNuVertexSep = (childStartPos - nuVertex).GetMagnitude();
231 laterTierNetworkParams.
m_vertexSeparation = (parentEndPos - childStartPos).GetMagnitude();
251 float closestDistance(std::numeric_limits<float>::max());
253 for (
int iAxis : {0, 1, 2})
255 const float parentCoord(iAxis == 0 ? parentEndPos.GetX() : iAxis == 1 ? parentEndPos.GetY() : parentEndPos.GetZ());
259 const float dimensionMin(std::min((parentCoord - boundary.first), (boundary.second - parentCoord)));
261 closestDistance = std::min(closestDistance, dimensionMin);
277 const bool startFromMin((parentStartPos - slidingFitResult.GetGlobalMinLayerPosition()).GetMagnitudeSquared() <
278 (parentStartPos - slidingFitResult.GetGlobalMaxLayerPosition()).GetMagnitudeSquared());
279 const float minL(slidingFitResult.GetLongitudinalDisplacement(slidingFitResult.GetGlobalMinLayerPosition()));
280 const float maxL(slidingFitResult.GetLongitudinalDisplacement(slidingFitResult.GetGlobalMaxLayerPosition()));
282 if (std::fabs(minL - maxL) < std::numeric_limits<float>::epsilon())
288 float slidingL(startFromMin ? minL : 0.
f);
289 float trackLength(0.f);
290 float minDCA(std::numeric_limits<float>::max());
291 float lengthAtConnection(0.f);
295 for (
int i = 0; i < nSteps; i++)
298 float firstEvalL(startFromMin ? firstL : (maxL - firstL));
299 float secondEvalL(startFromMin ? secondL : (maxL - secondL));
300 CartesianVector firstPosition(0.f, 0.f, 0.f);
301 CartesianVector secondPosition(0.f, 0.f, 0.f);
303 if ((slidingFitResult.GetGlobalFitPosition(firstEvalL, firstPosition) != STATUS_CODE_SUCCESS) ||
304 (slidingFitResult.GetGlobalFitPosition(secondEvalL, secondPosition) != STATUS_CODE_SUCCESS))
311 const CartesianVector midPoint((secondPosition + firstPosition) * 0.5f);
315 const float thisDCA((midPoint - extrap.first).GetMagnitude());
317 if (thisDCA < minDCA)
319 if (this->
DoesConnect(firstPosition, secondPosition, extrap.first))
327 (extrap.first - childStart.
GetPosition()).GetMagnitude() * (extrap.second ? 1.f : (-1.f));
328 lengthAtConnection = trackLength + (midPoint - firstPosition).GetMagnitude();
333 trackLength += (secondPosition - firstPosition).GetMagnitude();
336 if (std::fabs(laterTierNetworkParams.
m_doesChildConnect - 1.f) < std::numeric_limits<float>::epsilon())
337 laterTierNetworkParams.
m_childCPLRatio = lengthAtConnection / trackLength;
345 const bool backwardsExtrap(extrapDistance < 0.
f);
348 return std::pair<CartesianVector, bool>({extrapPoint, backwardsExtrap});
355 const CartesianVector displacement(boundary2 - boundary1);
356 const double segmentLength(displacement.GetMagnitude());
357 const CartesianVector unitVector(displacement * (1.
f / segmentLength));
358 const double l(unitVector.GetDotProduct(testPoint - boundary1));
360 if ((l < 0.
f) || (l > segmentLength))
363 const double t(unitVector.GetCrossProduct(testPoint - boundary1).GetMagnitudeSquared());
376 if (std::fabs(laterTierNetworkParams.
m_doesChildConnect - 1.f) < std::numeric_limits<float>::epsilon())
382 (extrapStart.first - parentStart.
GetPosition()).GetMagnitude() * (extrapStart.second ? 1.f : (-1.f));
388 laterTierNetworkParams.
m_overshootEndDCA = (extrapEnd.first - parentEnd.
GetPosition()).GetMagnitude() * (extrapEnd.second ? 1.f : (-1.f));
397 if (std::fabs(laterTierNetworkParams.
m_doesChildConnect - 1.f) > std::numeric_limits<float>::epsilon())
401 CartesianPointVector parentPositions3D;
402 LArPfoHelper::GetCoordinateVector(parentHierarchyPfo.
GetPfo(), TPC_3D, parentPositions3D);
404 CartesianPointVector upstreamGroup, downstreamGroup;
406 for (
const CartesianVector &parentPosition : parentPositions3D)
408 const CartesianVector displacement(parentPosition - laterTierNetworkParams.
m_connectionPoint);
419 CartesianPointVector &group(thisL > 0.
f ? downstreamGroup : upstreamGroup);
420 group.emplace_back(parentPosition);
426 if (upstreamGroup.empty() || downstreamGroup.empty())
434 CartesianVector centroidUp(0.
f, 0.
f, 0.
f);
435 CartesianVector centroidDown(0.
f, 0.
f, 0.
f);
440 LArPcaHelper::RunPca(upstreamGroup, centroidUp, eigenValuesUp, eigenVecsUp);
441 LArPcaHelper::RunPca(downstreamGroup, centroidDown, eigenValuesDown, eigenVecsDown);
444 laterTierNetworkParams.
m_parentCPOpeningAngle = eigenVecsUp.at(0).GetOpeningAngle(eigenVecsDown.at(0)) * (180.
f / 3.14);
447 const float avTransEVaUp((eigenValuesUp.GetY() + eigenValuesUp.GetZ()) * 0.5
f);
448 const float avTransEVaDown((eigenValuesDown.GetY() + eigenValuesDown.GetZ()) * 0.5
f);
450 laterTierNetworkParams.
m_parentCPEigenvalueRatio = avTransEVaUp < std::numeric_limits<double>::epsilon() ? 0.
f : avTransEVaDown / avTransEVaUp;
498 const FloatVector outputUpUp(this->
ClassifyTrackTrackEdge(edgeParamsUpUp, edgeParamsUpDown, edgeParamsDownUp, edgeParamsDownDown));
499 const FloatVector outputUpDown(this->
ClassifyTrackTrackEdge(edgeParamsUpDown, edgeParamsDownUp, edgeParamsDownDown, edgeParamsUpUp));
500 const FloatVector outputDownUp(this->
ClassifyTrackTrackEdge(edgeParamsDownUp, edgeParamsDownDown, edgeParamsUpUp, edgeParamsUpDown));
501 const FloatVector outputDownDown(this->
ClassifyTrackTrackEdge(edgeParamsDownDown, edgeParamsUpUp, edgeParamsUpDown, edgeParamsDownUp));
509 for (
const FloatVector &edgeOutput : {outputUpUp, outputUpDown, outputDownUp, outputDownDown})
511 for (
int i = 0; i < 3; ++i)
513 input[0][insertIndex] = edgeOutput.at(i);
520 const torch::TensorAccessor<float, 2> outputAccessor = output.accessor<float, 2>();
522 return outputAccessor[0][0];
543 const torch::TensorAccessor<float, 2> outputAccessor(output.accessor<
float, 2>());
545 return {outputAccessor[0][0], outputAccessor[0][1], outputAccessor[0][2]};
562 for (
const FloatVector &edgeOutput : {outputUp, outputDown})
564 for (
int i = 0; i < 3; ++i)
566 input[0][insertIndex] = edgeOutput.at(i);
573 const torch::TensorAccessor<float, 2> outputAccessor = output.accessor<float, 2>();
575 return outputAccessor[0][0];
593 const torch::TensorAccessor<float, 2> outputAccessor(output.accessor<
float, 2>());
595 return {outputAccessor[0][0], outputAccessor[0][1], outputAccessor[0][2]};
602 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TrainingMode",
m_trainingMode));
603 PANDORA_RETURN_RESULT_IF_AND_IF(
604 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TrajectoryStepSize",
m_trajectoryStepSize));
605 PANDORA_RETURN_RESULT_IF_AND_IF(
606 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ConnectionBuffer",
m_connectionBuffer));
607 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SearchRegion",
m_searchRegion));
608 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"Normalise",
m_normalise));
610 PANDORA_RETURN_RESULT_IF_AND_IF(
612 PANDORA_RETURN_RESULT_IF_AND_IF(
614 PANDORA_RETURN_RESULT_IF_AND_IF(
616 PANDORA_RETURN_RESULT_IF_AND_IF(
618 PANDORA_RETURN_RESULT_IF_AND_IF(
620 PANDORA_RETURN_RESULT_IF_AND_IF(
622 PANDORA_RETURN_RESULT_IF_AND_IF(
624 PANDORA_RETURN_RESULT_IF_AND_IF(
626 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
628 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
630 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
632 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
634 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
636 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
638 PANDORA_RETURN_RESULT_IF_AND_IF(
639 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"VertexSepMin",
m_normLimits.
m_vertexSepMin));
640 PANDORA_RETURN_RESULT_IF_AND_IF(
641 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"VertexSepMax",
m_normLimits.
m_vertexSepMax));
642 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
644 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
646 PANDORA_RETURN_RESULT_IF_AND_IF(
648 PANDORA_RETURN_RESULT_IF_AND_IF(
650 PANDORA_RETURN_RESULT_IF_AND_IF(
652 PANDORA_RETURN_RESULT_IF_AND_IF(
654 PANDORA_RETURN_RESULT_IF_AND_IF(
656 PANDORA_RETURN_RESULT_IF_AND_IF(
658 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
660 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
662 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
664 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
666 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
668 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
670 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
672 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
674 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
676 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
678 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
680 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
685 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"TrackTrackBranchModelName",
m_trackTrackBranchModelName));
689 PANDORA_RETURN_RESULT_IF(
694 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"TrackShowerBranchModelName",
m_trackShowerBranchModelName));
698 PANDORA_RETURN_RESULT_IF(
float m_parentNuVertexSep
the separation between the neutrino vertex and assumed parent start point
float m_doesChildConnectMin
the m_doesChildConnect minimum range boundary
float m_childCPExtrapDistanceMax
the m_childCPExtrapDistance maximum range boundary
float m_childCPLRatioMin
the m_childCPLRatio minimum range boundary
float m_parentCPEigenvalueRatio
the ratio of the second eigenvalues of the downstream and upstream 3D hit groups (set if the child co...
Header file for the pfo helper class.
float m_trackScoreMin
the m_parent(child)TrackScore minimum range boundary
pandora::StatusCode CalculateNetworkVariables(const pandora::Algorithm *const pAlgorithm, const HierarchyPfo &parentHierarchyPfo, const HierarchyPfo &childHierarchyPfo, const pandora::ParticleFlowObject *const pNeutrinoPfo, const bool useUpstreamForParent, const bool useUpstreamForChild, DLLaterTierNetworkParams &laterTierNetworkParams) const
Function to calculate the DLLaterTierNetworkParams.
void SetConnectionParams(const HierarchyPfo &parentHierarchyPfo, const pandora::CartesianVector &parentStartPos, const ExtremalPoint &childStart, DLLaterTierNetworkParams &laterTierNetworkParams) const
Set the child connection DLLaterTierNetworkParams (m_doesChildConnect, m_connectionPoint, m_connectionDirection, m_childCPDCA, m_childCPExtrapDistance, m_childCPLRatio)
float m_overshootEndL
the extension distance of the child to the DCA point (set if the child doesn't connect) ...
const pandora::ParticleFlowObject * GetPfo() const
Get the pfo.
float m_parentCPNHitRatioMax
the m_parentCPNHitRatio maximum range boundary
pandora::FloatVector ClassifyTrackShowerEdge(const DLLaterTierNetworkParams &edgeParams, const DLLaterTierNetworkParams &otherEdgeParams)
Apply the track-shower orientation edge network - determine whether an edge is signal (with correct o...
void SetParentConnectionPointVars(const HierarchyPfo &parentHierarchyPfo, DLLaterTierNetworkParams &laterTierNetworkParams) const
Set the parent connection point DLLaterTierNetworkParams (m_parentCPNUpstreamHits, m_parentCPNDownstreamHits, m_parentCPNHitRatio, m_parentCPEigenvalueRatio, m_parentCPOpeningAngle)
float m_overshootStartL
the extension distance of the child to the DCA point (set if the child doesn't connect) ...
pandora::CartesianVector EigenValues
float m_childCPExtrapDistanceMin
the m_childCPExtrapDistance minimum range boundary
float m_childCPDCA
the DCA of the child to the connection point (set if the child connects)
float m_separation3DMin
the m_separation3D minimum range boundary
float m_parentEndRegionNHits
the number of 3D hits 'close to' the parent POI
float m_parentEndRegionNParticles
the number of different particles 'close to' the parent POI
pandora::StatusCode Run(const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pNeutrinoPfo, const HierarchyPfo &parentHierarchyPfo, const HierarchyPfo &childHierarchyPfo, std::vector< DLLaterTierNetworkParams > &networkParamVector, float &laterTierScore)
float m_parentCPEigenvalueRatioMin
the m_parentCPEigenvalueRatio minimum range boundary
float m_parentCPNHitRatio
the ratio of the number of downstream hits and upstream 3D hits (set if the child connects) ...
float m_overshootStartDCA
the DCA of the child to the parent startpoint (set if the child doesn't connect)
float m_separation3D
the smallest 3D distance between the parent and child 3D hits
Header file for the principal curve analysis helper class.
float m_vertexSeparation
the separation between the parent and child POIs
LArDLHelper::TorchModel m_trackShowerBranchModel
the track-shower edge model
float m_parentCPOpeningAngleMax
the m_parentCPOpeningAngle maximum range boundary
std::string m_trackShowerBranchModelName
the name of the track-shower edge model file
DLBaseHierarchyTool to calculate variables related to the initial shower region.
float m_overshootEndDCA
the DCA of the child to the parent endpoint (set if the child doesn't connect)
pandora::CartesianVector m_connectionPoint
the connection point of the child on the parent
float m_nuVertexSepMax
the m_parent(child)NuVertexSep maximum range boundary
float m_parentCPNHitsMax
the m_parentCPNUp(Down)streamHits maximum range boundary
bool m_normalise
whether to normalise the network parameters
bool IsShowerVertexUpstream(const HierarchyPfo &parentHierarchyPfo, const HierarchyPfo &childHierarchyPfo) const
Whether the shower POI is the endpoint closest to the neutrino vertex.
float m_parentCPOpeningAngleMin
the m_parentCPOpeningAngle minimum range boundary
float m_childCPDCAMin
the m_childCPDCA minimum range boundary
float m_parentCPNUpstreamHits
the number of 3D parent hits upstream of the connection point (set if the child connects) ...
float m_connectionBuffer
the 'is child connected?' threshold
float m_parentCPEigenvalueRatioMax
the m_parentCPEigenvalueRatio maximum range boundary
NormalisationLimits m_normLimits
struct of the normalisation limits
void AddOrientationParamsToInput(int &insertIndex, LArDLHelper::TorchInput &modelInput) const
Add the orientation dependent later tier network parameters to the model input tensor.
std::pair< float, float > m_yBoundaries
{low, high} y boundaries of the detector
float m_overshootDCAMin
the m_overshootStart(End)DCA minimum range boundary
Header file for the geometry helper class.
void AddCommonParamsToInput(int &insertIndex, LArDLHelper::TorchInput &modelInput) const
Add the orientation independent later tier network parameters to the model input tensor.
std::pair< float, float > GetParticleInfoAboutPfoPosition(const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pPfo, const pandora::CartesianVector &pointOfInterest) const
Return the number of 3D hits and the number of corresponding pfos of a given pfo about a point...
void NormaliseNetworkParams(DLLaterTierNetworkParams &laterTierNetworkParams) const
Shift and normalise the later tier network parameters.
bool IsSet() const
Whether extremal point object has been set.
float m_parentCPOpeningAngle
the opening angle between the first eigenvectors of the downstream and upstream 3D hit groups (set if...
LArDLHelper::TorchModel m_trackShowerClassifierModel
the track-shower classification model
std::string m_trackTrackBranchModelName
the name of the track-track edge model file
float m_overshootLMin
the m_overshootStart(End)L minimum range boundary
void NormaliseNetworkParam(const float minLimit, const float maxLimit, float &networkParam) const
Shift and normalise a network parameter with respect to an input range.
float m_doesChildConnectMax
the m_doesChildConnect maximum range boundary
std::pair< float, float > m_xBoundaries
{low, high} x boundaries of the detector
float m_overshootLMax
the m_overshootStart(End)L maximum range boundary
const ExtremalPoint & GetUpstreamPoint() const
Get the upstream extremal point.
void SetEndRegionParams(const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pParentPfo, const pandora::CartesianVector &parentEndPos, DLLaterTierNetworkParams &laterTierNetworkParams) const
Set the parent endpoint region DLLaterTierNetworkParams (m_parentEndRegionNHits, m_parentEndRegionNPa...
float m_trackScoreMax
the m_parent(child)TrackScore maximum range boundary
float m_searchRegion
the dimensions of the box used to obtain the up/downstream 3D hit groups
float m_nSpacepointsMin
the m_parent(child)NSpacepoints minimum range boundary
const ExtremalPoint & GetDownstreamPoint() const
Get the downstream extremal point.
std::pair< float, float > m_zBoundaries
{low, high} z boundaries of the detector
float m_vertexSepMax
the m_vertexSeparation maximum range boundary
Header file for the lar deep learning helper helper class.
float m_parentCPNHitRatioMin
the m_parentCPNHitRatio minimum range boundary
float m_parentCPNDownstreamHits
the number of 3D parent hits downstream of the connection point (set if the child connects) ...
void SetOvershootParams(const ExtremalPoint &parentStart, const ExtremalPoint &parentEnd, const ExtremalPoint &childStart, DLLaterTierNetworkParams &laterTierNetworkParams) const
Set the overshoot DLLaterTierNetworkParams (m_overshootStartDCA, m_overshootStartL, m_overshootEndDCA, m_overshootEndL)
float m_nSpacepointsMax
the m_parent(child)NSpacepoints maximum range boundary
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float ClassifyTrackTrack(const DLLaterTierNetworkParams &edgeParamsUpUp, const DLLaterTierNetworkParams &edgeParamsUpDown, const DLLaterTierNetworkParams &edgeParamsDownUp, const DLLaterTierNetworkParams &edgeParamsDownDown)
Apply the track-track parent-child classification network.
const pandora::CartesianVector & GetPosition() const
Get the position.
Header file for the file helper class.
float m_parentEndRegionRToWall
the smallest parent POI to detector boundary separation
static void Forward(TorchModel &model, const TorchInputVector &input, TorchOutput &output)
Run a deep learning model.
float m_parentEndRegionNHitsMin
the m_parentEndRegionNHits minimum range boundary
pandora::FloatVector ClassifyTrackTrackEdge(const DLLaterTierNetworkParams &edgeParams, const DLLaterTierNetworkParams &otherEdgeParams1, const DLLaterTierNetworkParams &otherEdgeParams2, const DLLaterTierNetworkParams &otherEdgeParams3)
Apply the track-track orientation edge network - determine whether an edge is signal (with correct or...
float m_parentTrackScore
the track/shower score of the parent pfo
Header file for the lar three dimensional sliding fit result class.
float m_separation3DMax
the m_separation3D maximum range boundary
const ThreeDSlidingFitResult & GetSlidingFitResult() const
Get the pfo's 3D sliding fit result.
float m_parentCPNHitsMin
the m_parentCPNUp(Down)streamHits minimum range boundary
void SetVertexParams(const pandora::CartesianVector &nuVertex, const pandora::CartesianVector &parentStartPos, const pandora::CartesianVector &parentEndPos, const pandora::CartesianVector &childStartPos, DLLaterTierNetworkParams &laterTierNetworkParams) const
Set the vertex related DLLaterTierNetworkParams (m_parentNuVertexSep, m_childNuVertexSep, m_vertexSeparation)
float m_parentEndRegionRToWallMax
the m_parentEndRegionRToWall maximum range boundary
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_childTrackScore
the track/shower score of the child pfo
void SetCommonParams(const std::pair< float, float > &trackScoreParams, const std::pair< float, float > &nSpacepointsParams, const float separation3D, DLLaterTierNetworkParams &laterTierNetworkParams) const
Set the orientation independent DLLaterTierNetworkParams (m_parentTrackScore, m_childTrackScore, m_parentNSpacepoints, m_childNSpacepoints, m_separation3D)
float m_doesChildConnect
whether the backwards trace of the child's path connects to the parent
std::vector< pandora::CartesianVector > EigenVectors
static pandora::StatusCode LoadModel(const std::string &filename, TorchModel &model)
Loads a deep learning model.
ThreeDSlidingFitResult class.
float m_trajectoryStepSize
the size of the steps taken to trace the parent trajectory
std::pair< pandora::CartesianVector, bool > ExtrapolateChildToParent(const pandora::CartesianVector &parentPosition, const ExtremalPoint &childStart) const
Project the (parentPos - childStartPos) vector onto the child direction axis to obtain an extrapolati...
float m_parentEndRegionNParticlesMin
the m_parentEndRegionNParticles minimum range boundary
float m_parentEndRegionNHitsMax
the m_parentEndRegionNHits maximum range boundary
bool m_trainingMode
whether to run the tool in training mode
LArDLHelper::TorchModel m_trackTrackClassifierModel
the track-track classification model
bool DoesConnect(const pandora::CartesianVector &boundary1, const pandora::CartesianVector &boundary2, const pandora::CartesianVector &testPoint) const
Return whether an input position connects to a line defined by two endpoints.
void SetEndRegionRToWall(const pandora::CartesianVector &parentEndPos, DLLaterTierNetworkParams &laterTierNetworkParams) const
Set the m_parentEndRegionRToWall DLLaterTierNetworkParam.
float m_childCPLRatio
the ratio of the parent length at the connection point and the full parent length (set if the child c...
const pandora::CartesianVector & GetDirection() const
Get the direction at the extremal point.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::string m_trackShowerClassifierModelName
the name of the track-shower classification model file
LArDLHelper::TorchModel m_trackTrackBranchModel
the track-track edge model
float m_parentEndRegionNParticlesMax
the m_parentEndRegionNParticles maximum range boundary
LArGeometryHelper::DetectorBoundaries m_detectorBoundaries
the detector boundaries
float m_childCPLRatioMax
the m_childCPLRatio maximum range boundary
float m_childCPExtrapDistance
the extension distance of the child to the DCA point (set if the child connects)
float m_childNSpacepoints
the number of 3D hits in the child pfo
float m_childCPDCAMax
the m_childCPDCA maximum range boundary
float m_parentIsPOIClosestToNu
whether the parent POI is that closest to the neutrino vertex
static void InitialiseInput(const at::IntArrayRef dimensions, TorchInput &tensor)
Create a torch input tensor.
pandora::CartesianVector m_connectionDirection
the parent's direction at the connection point
float m_overshootDCAMax
the m_overshootStart(End)DCA maximum range boundary
std::string m_trackTrackClassifierModelName
the name of the track-track classification model file
float ClassifyTrackShower(const DLLaterTierNetworkParams &edgeParamsUp, const DLLaterTierNetworkParams &edgeParamsDown)
Apply the track-shower parent-child classification network.
float m_parentNSpacepoints
the number of 3D hits in the parent pfo
float m_nuVertexSepMin
the m_parent(child)NuVertexSep minimum range boundary
float m_childIsPOIClosestToNu
whether the child POI is that closest to the neutrino vertex
float m_childNuVertexSep
the separation between the neutrino vertex and assumed child start point
float m_parentEndRegionRToWallMin
the m_parentEndRegionRToWall minimum range boundary
float m_vertexSepMin
the m_vertexSeparation minimum range boundary
void SetDetectorBoundaries()
Set the detector boundaries.