Constructor.
336 const ParticleFlowObject *
const pNeutrino(this->
GetNeutrino(nuPfos));
338 const PfoList &nuFinalStates(pNeutrino->GetDaughterPfoList());
341 CartesianVector nuWeightedDirTotal(0.f, 0.f, 0.f);
342 unsigned int nuNHitsUsedTotal(0);
343 unsigned int nuNHitsTotal(0);
344 CartesianPointVector nuAllSpacePoints;
345 for (
const ParticleFlowObject *
const pPfo : nuFinalStates)
347 CartesianPointVector spacePoints;
350 nuAllSpacePoints.insert(nuAllSpacePoints.end(), spacePoints.begin(), spacePoints.end());
351 nuNHitsTotal += spacePoints.size();
353 if (spacePoints.size() < 5)
357 nuWeightedDirTotal +=
dir *
static_cast<float>(spacePoints.size());
358 nuNHitsUsedTotal += spacePoints.size();
361 if (nuNHitsUsedTotal == 0)
363 const CartesianVector nuWeightedDir(nuWeightedDirTotal * (1.f / static_cast<float>(nuNHitsUsedTotal)));
365 CartesianPointVector pointsInSphere;
368 CartesianVector centroid(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
369 LArPcaHelper::EigenValues eigenValues(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
373 const float nuNFinalStatePfos(static_cast<float>(nuFinalStates.size()));
374 const float nuVertexY(nuVertex.GetY());
375 const float nuWeightedDirZ(nuWeightedDir.GetZ());
376 const float nuNSpacePointsInSphere(static_cast<float>(pointsInSphere.size()));
378 if (eigenValues.GetX() <= std::numeric_limits<float>::epsilon())
380 const float nuEigenRatioInSphere(eigenValues.GetY() / eigenValues.GetX());
383 unsigned int nCRHitsMax(0);
384 unsigned int nCRHitsTotal(0);
385 float crLongestTrackDirY(std::numeric_limits<float>::max());
386 float crLongestTrackDeflection(-std::numeric_limits<float>::max());
388 for (
const ParticleFlowObject *
const pPfo : crPfos)
390 CartesianPointVector spacePoints;
393 nCRHitsTotal += spacePoints.size();
395 if (spacePoints.size() < 5)
398 if (spacePoints.size() > nCRHitsMax)
400 nCRHitsMax = spacePoints.size();
404 crLongestTrackDirY = upperDir.GetY();
405 crLongestTrackDeflection = 1.f - upperDir.GetDotProduct(lowerDir * (-1.f));
411 if (nCRHitsTotal == 0)
414 const float crFracHitsInLongestTrack =
static_cast<float>(nCRHitsMax) / static_cast<float>(nCRHitsTotal);
432 m_featureMap[
"NuNSpacePointsInSphere"] = nuNSpacePointsInSphere;
433 m_featureMap[
"NuEigenRatioInSphere"] = nuEigenRatioInSphere;
434 m_featureMap[
"CRLongestTrackDirY"] = crLongestTrackDirY;
435 m_featureMap[
"CRLongestTrackDeflection"] = crLongestTrackDeflection;
436 m_featureMap[
"CRFracHitsInLongestTrack"] = crFracHitsInLongestTrack;
441 catch (StatusCodeException &)
pandora::CartesianVector EigenValues
const NeutrinoIdTool *const m_pTool
The tool that owns this.
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
LArMvaHelper::DoubleMap m_featureMap
A map between MVA features and their names.
pandora::CartesianVector GetLowerDirection(const pandora::CartesianPointVector &spacePoints) const
Use a sliding fit to get the lower direction of a collection of spacepoints.
bool m_isAvailable
Is the feature vector available.
LArMvaHelper::MvaFeatureVector m_featureVector
The MVA feature vector.
const pandora::ParticleFlowObject * GetNeutrino(const pandora::PfoList &nuPfos) const
Get the recontructed neutrino the input list of neutrino Pfos.
pandora::CartesianVector GetDirectionFromVertex(const pandora::CartesianPointVector &spacePoints, const pandora::CartesianVector &vertex) const
Use a sliding fit to get the direction of a collection of spacepoint near a vertex position...
pandora::CartesianVector GetUpperDirection(const pandora::CartesianPointVector &spacePoints) const
Use a sliding fit to get the upper direction of a collection of spacepoints.
static void RunPca(const T &t, pandora::CartesianVector ¢roid, EigenValues &outputEigenValues, EigenVectors &outputEigenVectors)
Run principal component analysis using input calo hits (TPC_VIEW_U,V,W or TPC_3D; all treated as 3D p...
std::vector< pandora::CartesianVector > EigenVectors
void GetPointsInSphere(const pandora::CartesianPointVector &spacePoints, const pandora::CartesianVector &vertex, const float radius, pandora::CartesianPointVector &spacePointsInSphere) const
Get a vector of spacepoints within a given radius of a vertex point.
void GetSpacePoints(const pandora::ParticleFlowObject *const pPfo, pandora::CartesianPointVector &spacePoints) const
Get the 3D space points in a given pfo.