9 #include "Pandora/AlgorithmHeaders.h" 26 TwoDShowerFitFeatureTool::TwoDShowerFitFeatureTool() : m_slidingShowerFitWindow(3), m_slidingLinearFitWindow(10000)
34 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
35 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
41 const float straightLineLength =
43 if (straightLineLength > std::numeric_limits<float>::epsilon())
46 catch (
const StatusCodeException &)
50 featureVector.push_back(ratio);
57 PANDORA_RETURN_RESULT_IF_AND_IF(
58 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingShowerFitWindow",
m_slidingShowerFitWindow));
60 PANDORA_RETURN_RESULT_IF_AND_IF(
61 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingLinearFitWindow",
m_slidingLinearFitWindow));
63 return STATUS_CODE_SUCCESS;
77 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
78 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
80 float dTdLWidth(-1.
f), straightLineLengthLarge(-1.
f), diffWithStraightLineMean(-1.
f), diffWithStraightLineSigma(-1.
f),
81 maxFitGapLength(-1.
f), rmsSlidingLinearFit(-1.
f);
83 dTdLWidth, maxFitGapLength, rmsSlidingLinearFit);
85 if (straightLineLengthLarge > std::numeric_limits<float>::epsilon())
87 diffWithStraightLineMean /= straightLineLengthLarge;
88 diffWithStraightLineSigma /= straightLineLengthLarge;
89 dTdLWidth /= straightLineLengthLarge;
90 maxFitGapLength /= straightLineLengthLarge;
91 rmsSlidingLinearFit /= straightLineLengthLarge;
94 featureVector.push_back(straightLineLengthLarge);
95 featureVector.push_back(diffWithStraightLineMean);
96 featureVector.push_back(diffWithStraightLineSigma);
97 featureVector.push_back(dTdLWidth);
98 featureVector.push_back(maxFitGapLength);
99 featureVector.push_back(rmsSlidingLinearFit);
105 float &diffWithStraightLineMean,
float &diffWithStraightLineSigma,
float &dTdLWidth,
float &maxFitGapLength,
float &rmsSlidingLinearFit)
const 114 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
116 straightLineLengthLarge =
118 rmsSlidingLinearFit = 0.f;
128 rmsSlidingLinearFit += layerFitResult.
GetRms();
130 CartesianVector thisFitPosition(0.
f, 0.
f, 0.
f);
137 throw StatusCodeException(STATUS_CODE_FAILURE);
139 diffWithStraightLineVector.push_back(static_cast<float>(std::fabs(layerFitResult.
GetFitT() - iterLarge->second.GetFitT())));
141 const float thisGapLength((thisFitPosition - previousFitPosition).GetMagnitude());
142 const float minZ(
std::min(thisFitPosition.GetZ(), previousFitPosition.GetZ()));
143 const float maxZ(
std::max(thisFitPosition.GetZ(), previousFitPosition.GetZ()));
145 if ((maxZ - minZ) > std::numeric_limits<float>::epsilon())
148 const float correctedGapLength(thisGapLength * (1.
f - gapZ / (maxZ - minZ)));
150 if (correctedGapLength > maxFitGapLength)
151 maxFitGapLength = correctedGapLength;
156 previousFitPosition = thisFitPosition;
159 if (diffWithStraightLineVector.empty())
160 throw StatusCodeException(STATUS_CODE_FAILURE);
162 diffWithStraightLineMean = 0.f;
163 diffWithStraightLineSigma = 0.f;
165 for (
const float diffWithStraightLine : diffWithStraightLineVector)
166 diffWithStraightLineMean += diffWithStraightLine;
168 diffWithStraightLineMean /=
static_cast<float>(diffWithStraightLineVector.size());
170 for (
const float diffWithStraightLine : diffWithStraightLineVector)
171 diffWithStraightLineSigma += (diffWithStraightLine - diffWithStraightLineMean) * (diffWithStraightLine - diffWithStraightLineMean);
173 if (diffWithStraightLineSigma < 0.
f)
174 throw StatusCodeException(STATUS_CODE_FAILURE);
176 diffWithStraightLineSigma = std::sqrt(diffWithStraightLineSigma / static_cast<float>(diffWithStraightLineVector.size()));
177 dTdLWidth = dTdLMax - dTdLMin;
179 catch (
const StatusCodeException &)
181 straightLineLengthLarge = -1.f;
182 diffWithStraightLineMean = -1.f;
183 diffWithStraightLineSigma = -1.f;
185 maxFitGapLength = -1.f;
186 rmsSlidingLinearFit = -1.f;
194 PANDORA_RETURN_RESULT_IF_AND_IF(
195 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingLinearFitWindow",
m_slidingLinearFitWindow));
197 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
200 return STATUS_CODE_SUCCESS;
215 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
216 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
218 float straightLineLength(-1.
f),
ratio(-1.
f);
223 if (straightLineLength > std::numeric_limits<float>::epsilon())
226 catch (
const StatusCodeException &)
230 featureVector.push_back(ratio);
237 PANDORA_RETURN_RESULT_IF_AND_IF(
238 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingLinearFitWindow",
m_slidingLinearFitWindow));
240 return STATUS_CODE_SUCCESS;
255 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
256 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
258 CaloHitList parent3DHitList;
260 const unsigned int nParentHits3D(parent3DHitList.size());
262 PfoList allDaughtersPfoList;
264 const unsigned int nDaughterPfos(allDaughtersPfoList.empty() ? 0 : allDaughtersPfoList.size() - 1);
266 unsigned int nDaughterHits3DTotal(0);
268 if (nDaughterPfos > 0)
271 allDaughtersPfoList.pop_front();
273 for (
const ParticleFlowObject *
const pDaughterPfo : allDaughtersPfoList)
275 CaloHitList daughter3DHitList;
277 nDaughterHits3DTotal += daughter3DHitList.size();
284 (nParentHits3D > 0) ? static_cast<double>(nDaughterHits3DTotal) / static_cast<double>(nParentHits3D) : 0.);
286 featureVector.push_back(nDaughters);
287 featureVector.push_back(nDaughterHits3D);
288 featureVector.push_back(daughterParentNHitsRatio);
295 return STATUS_CODE_SUCCESS;
310 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
311 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
313 ClusterList clusterList;
315 float diffWithStraightLineMean(0.
f), maxFitGapLength(0.
f), rmsSlidingLinearFit(0.
f);
317 unsigned int nClustersUsed(0);
319 for (
const Cluster *
const pCluster : clusterList)
321 float straightLineLengthLargeCluster(-1.
f), diffWithStraightLineMeanCluster(-1.
f), maxFitGapLengthCluster(-1.
f),
322 rmsSlidingLinearFitCluster(-1.
f);
325 pCluster, straightLineLengthLargeCluster, diffWithStraightLineMeanCluster, maxFitGapLengthCluster, rmsSlidingLinearFitCluster);
327 if (straightLineLengthLargeCluster > std::numeric_limits<float>::epsilon())
329 diffWithStraightLineMeanCluster /= straightLineLengthLargeCluster;
330 maxFitGapLengthCluster /= straightLineLengthLargeCluster;
331 rmsSlidingLinearFitCluster /= straightLineLengthLargeCluster;
333 diffWithStraightLineMean += diffWithStraightLineMeanCluster;
334 maxFitGapLength += maxFitGapLengthCluster;
335 rmsSlidingLinearFit += rmsSlidingLinearFitCluster;
341 if (nClustersUsed > 0)
343 const float nClusters(static_cast<float>(nClustersUsed));
345 diff = diffWithStraightLineMean / nClusters;
346 gap = maxFitGapLength / nClusters;
347 rms = rmsSlidingLinearFit / nClusters;
350 featureVector.push_back(length);
351 featureVector.push_back(diff);
352 featureVector.push_back(gap);
353 featureVector.push_back(rms);
359 float &diffWithStraightLineMean,
float &maxFitGapLength,
float &rmsSlidingLinearFit)
const 368 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
370 straightLineLengthLarge =
372 rmsSlidingLinearFit = 0.f;
382 rmsSlidingLinearFit += layerFitResult.
GetRms();
384 CartesianVector thisFitPosition(0.
f, 0.
f, 0.
f);
391 throw StatusCodeException(STATUS_CODE_FAILURE);
393 diffWithStraightLineVector.push_back(static_cast<float>(std::fabs(layerFitResult.
GetFitT() - iterLarge->second.GetFitT())));
395 const float thisGapLength((thisFitPosition - previousFitPosition).GetMagnitude());
396 const float minZ(
std::min(thisFitPosition.GetZ(), previousFitPosition.GetZ()));
397 const float maxZ(
std::max(thisFitPosition.GetZ(), previousFitPosition.GetZ()));
399 if ((maxZ - minZ) > std::numeric_limits<float>::epsilon())
402 const float correctedGapLength(thisGapLength * (1.
f - gapZ / (maxZ - minZ)));
404 if (correctedGapLength > maxFitGapLength)
405 maxFitGapLength = correctedGapLength;
409 maxFitGapLength = 0.f;
414 previousFitPosition = thisFitPosition;
417 if (diffWithStraightLineVector.empty())
418 throw StatusCodeException(STATUS_CODE_FAILURE);
420 diffWithStraightLineMean = 0.f;
422 for (
const float diffWithStraightLine : diffWithStraightLineVector)
423 diffWithStraightLineMean += diffWithStraightLine;
425 diffWithStraightLineMean /=
static_cast<float>(diffWithStraightLineVector.size());
427 catch (
const StatusCodeException &)
429 straightLineLengthLarge = -1.f;
430 diffWithStraightLineMean = -1.f;
431 maxFitGapLength = -1.f;
432 rmsSlidingLinearFit = -1.f;
440 PANDORA_RETURN_RESULT_IF_AND_IF(
441 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingLinearFitWindow",
m_slidingLinearFitWindow));
443 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
446 return STATUS_CODE_SUCCESS;
461 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
462 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
467 (void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
469 if (!pVertexList || pVertexList->empty())
471 featureVector.push_back(vertexDistance);
475 unsigned int nInteractionVertices(0);
476 const Vertex *pInteractionVertex(
nullptr);
478 for (
const Vertex *pVertex : *pVertexList)
480 if ((pVertex->GetVertexLabel() == VERTEX_INTERACTION) && (pVertex->GetVertexType() == VERTEX_3D))
482 ++nInteractionVertices;
483 pInteractionVertex = pVertex;
487 if (pInteractionVertex && (1 == nInteractionVertices))
491 vertexDistance = (pInteractionVertex->GetPosition() -
LArPfoHelper::GetVertex(pInputPfo)->GetPosition()).GetMagnitude();
493 catch (
const StatusCodeException &)
495 CaloHitList threeDCaloHitList;
498 if (!threeDCaloHitList.empty())
499 vertexDistance = (pInteractionVertex->GetPosition() - (threeDCaloHitList.front())->GetPositionVector()).GetMagnitude();
503 featureVector.push_back(vertexDistance);
510 return STATUS_CODE_SUCCESS;
525 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
526 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
529 CaloHitList threeDCaloHitList;
533 if (!threeDCaloHitList.empty())
535 CartesianPointVector pointVectorStart, pointVectorEnd;
536 this->
Divide3DCaloHitList(pAlgorithm, threeDCaloHitList, pointVectorStart, pointVectorEnd);
539 if ((pointVectorStart.size() > 1) && (pointVectorEnd.size() > 1))
544 CartesianVector centroidStart(0.
f, 0.
f, 0.
f), centroidEnd(0.
f, 0.
f, 0.
f);
551 const float openingAngle(this->
OpeningAngle(eigenVecsStart.at(0), eigenVecsStart.at(1), eigenValuesStart));
552 const float closingAngle(this->
OpeningAngle(eigenVecsEnd.at(0), eigenVecsEnd.at(1), eigenValuesEnd));
553 diffAngle = std::fabs(openingAngle - closingAngle);
555 catch (
const StatusCodeException &)
565 featureVector.push_back(diffAngle);
571 CartesianPointVector &pointVectorStart, CartesianPointVector &pointVectorEnd)
574 (void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
576 if (threeDCaloHitList.empty() || !pVertexList || pVertexList->empty())
579 unsigned int nInteractionVertices(0);
580 const Vertex *pInteractionVertex(
nullptr);
582 for (
const Vertex *pVertex : *pVertexList)
584 if ((pVertex->GetVertexLabel() == VERTEX_INTERACTION) && (pVertex->GetVertexType() == VERTEX_3D))
586 ++nInteractionVertices;
587 pInteractionVertex = pVertex;
591 if (pInteractionVertex && (1 == nInteractionVertices))
594 CaloHitVector threeDCaloHitVector(threeDCaloHitList.begin(), threeDCaloHitList.end());
595 std::sort(threeDCaloHitVector.begin(), threeDCaloHitVector.end(),
598 unsigned int iHit(1);
599 const unsigned int nHits(threeDCaloHitVector.size());
601 for (
const CaloHit *
const pCaloHit : threeDCaloHitVector)
603 if (static_cast<float>(iHit) /
static_cast<float>(nHits) <=
m_hitFraction)
604 pointVectorStart.push_back(pCaloHit->GetPositionVector());
606 if (static_cast<float>(iHit) /
static_cast<float>(nHits) >= 1.
f -
m_hitFraction)
607 pointVectorEnd.push_back(pCaloHit->GetPositionVector());
618 const float principalMagnitude(principal.GetMagnitude());
619 const float secondaryMagnitude(secondary.GetMagnitude());
621 if (std::fabs(principalMagnitude) < std::numeric_limits<float>::epsilon())
623 std::cout <<
"ThreeDOpeningAngleFeatureTool::OpeningAngle - The principal eigenvector is 0." <<
std::endl;
624 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
626 else if (std::fabs(secondaryMagnitude) < std::numeric_limits<float>::epsilon())
631 const float cosTheta(principal.GetDotProduct(secondary) / (principalMagnitude * secondaryMagnitude));
635 std::cout <<
"PcaShowerParticleBuildingAlgorithm::OpeningAngle - cos(theta) reportedly greater than 1." <<
std::endl;
636 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
639 const float sinTheta(std::sqrt(1.
f - cosTheta * cosTheta));
641 if (eigenValues.GetX() < std::numeric_limits<float>::epsilon())
643 std::cout <<
"PcaShowerParticleBuildingAlgorithm::OpeningAngle - principal eigenvalue less than or equal to 0." <<
std::endl;
644 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
646 else if (eigenValues.GetY() < std::numeric_limits<float>::epsilon())
651 return std::atan(std::sqrt(eigenValues.GetY()) * sinTheta / std::sqrt(eigenValues.GetX()));
658 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"HitFraction",
m_hitFraction));
660 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"DefaultValue",
m_defaultValue));
662 return STATUS_CODE_SUCCESS;
677 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
678 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
683 CaloHitList threeDCaloHitList;
686 if (!threeDCaloHitList.empty())
690 CartesianVector centroid(0.
f, 0.
f, 0.
f);
695 const float principalEigenvalue(eigenValues.GetX()), secondaryEigenvalue(eigenValues.GetY()), tertiaryEigenvalue(eigenValues.GetZ());
697 if (principalEigenvalue > std::numeric_limits<float>::epsilon())
699 pca1 = secondaryEigenvalue / principalEigenvalue;
700 pca2 = tertiaryEigenvalue / principalEigenvalue;
709 catch (
const StatusCodeException &)
714 featureVector.push_back(pca1);
715 featureVector.push_back(pca2);
722 return STATUS_CODE_SUCCESS;
737 if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
738 std::cout <<
"----> Running Algorithm Tool: " << this->GetInstanceName() <<
", " << this->GetType() <<
std::endl;
740 float totalCharge(-1.
f), chargeSigma(-1.
f), chargeMean(-1.
f), endCharge(-1.
f);
743 ClusterList clusterListW;
746 if (!clusterListW.empty())
749 if (chargeMean > std::numeric_limits<float>::epsilon())
750 charge1 = chargeSigma / chargeMean;
752 if (totalCharge > std::numeric_limits<float>::epsilon())
753 charge2 = endCharge / totalCharge;
755 featureVector.push_back(charge1);
756 featureVector.push_back(charge2);
762 float &totalCharge,
float &chargeSigma,
float &chargeMean,
float &endCharge)
769 CaloHitList orderedCaloHitList;
773 unsigned int hitCounter(0);
774 const unsigned int nTotalHits(orderedCaloHitList.size());
776 for (
const CaloHit *
const pCaloHit : orderedCaloHitList)
779 const float pCaloHitCharge(pCaloHit->GetInputEnergy());
781 if (pCaloHitCharge >= 0.
f)
783 totalCharge += pCaloHitCharge;
784 chargeVector.push_back(pCaloHitCharge);
787 endCharge += pCaloHitCharge;
791 if (!chargeVector.empty())
793 chargeMean = totalCharge /
static_cast<float>(chargeVector.size());
795 for (
const float charge : chargeVector)
796 chargeSigma += (charge - chargeMean) * (charge - chargeMean);
798 chargeSigma = std::sqrt(chargeSigma / static_cast<float>(chargeVector.size()));
805 const Algorithm *
const pAlgorithm,
const pandora::Cluster *
const pCluster, CaloHitList &caloHitList)
808 (void)PandoraContentApi::GetCurrentList(*pAlgorithm, pVertexList);
810 if (!pVertexList || pVertexList->empty())
813 unsigned int nInteractionVertices(0);
814 const Vertex *pInteractionVertex(
nullptr);
816 for (
const Vertex *pVertex : *pVertexList)
818 if ((pVertex->GetVertexLabel() == VERTEX_INTERACTION) && (pVertex->GetVertexType() == VERTEX_3D))
820 ++nInteractionVertices;
821 pInteractionVertex = pVertex;
825 if (pInteractionVertex && (1 == nInteractionVertices))
830 CaloHitList clusterCaloHitList;
831 pCluster->GetOrderedCaloHitList().FillCaloHitList(clusterCaloHitList);
834 caloHitList.insert(caloHitList.end(), clusterCaloHitList.begin(), clusterCaloHitList.end());
842 PANDORA_RETURN_RESULT_IF_AND_IF(
843 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EndChargeFraction",
m_endChargeFraction));
845 return STATUS_CODE_SUCCESS;
859 const float distanceL((left->GetPositionVector() -
m_neutrinoVertex).GetMagnitudeSquared());
860 const float distanceR((right->GetPositionVector() -
m_neutrinoVertex).GetMagnitudeSquared());
861 return distanceL < distanceR;
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void OrderCaloHitsByDistanceToVertex(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, pandora::CaloHitList &caloHitList)
Function to order the calo hit list by distance to neutrino vertex.
Header file for the pfo helper class.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
Header file for the cut based cluster characterisation algorithm class.
MvaTypes::MvaFeatureVector MvaFeatureVector
float m_hitFraction
Fraction of hits in start and end of pfo.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
static void GetClusters(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::ClusterList &clusterList)
Get a list of clusters of a particular hit type from a list of pfos.
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
pandora::CartesianVector EigenValues
static float GetThreeDLengthSquared(const pandora::ParticleFlowObject *const pPfo)
Calculate length of Pfo using 3D clusters.
static float CalculateGapDeltaZ(const pandora::Pandora &pandora, const float minZ, const float maxZ, const pandora::HitType hitType)
Calculate the total distance within a given 2D region that is composed of detector gaps...
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
static float GetVertexDistance(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
Get the distance between the interaction vertex (if present in the current vertex list) and a provide...
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
unsigned int m_slidingShowerFitWindow
The sliding shower fit window.
Header file for the principal curve analysis helper class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
ThreeDOpeningAngleFeatureTool()
Default constructor.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
TwoDLinearFitFeatureTool()
Default constructor.
ThreeDLinearFitFeatureTool()
Default constructor.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void CalculateVariablesSlidingLinearFit(const pandora::Cluster *const pCluster, float &straightLineLengthLarge, float &diffWithStraigthLineMean, float &maxFitGapLength, float &rmsSlidingLinearFit) const
Calculation of several variables related to sliding linear fit.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
Header file for the geometry helper class.
ThreeDPCAFeatureTool()
Default constructor.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
bool operator()(const pandora::CaloHit *const left, const pandora::CaloHit *const right) const
operator <
double GetFitT() const
Get the fitted t coordinate.
InitializedDouble class used to define mva features.
unsigned int m_slidingLinearFitWindowLarge
The sliding linear fit window - should be large, providing a simple linear fit.
Header file for the cluster helper class.
float OpeningAngle(const pandora::CartesianVector &principal, const pandora::CartesianVector &secondary, const pandora::CartesianVector &eigenValues) const
Use the results of principal component analysis to calculate an opening angle.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
TwoDVertexDistanceFeatureTool()
Default constructor.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
Header file for the lar two dimensional sliding fit result class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::CartesianVector m_neutrinoVertex
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
static int max(int a, int b)
double GetGradient() const
Get the fitted gradient dt/dz.
const LayerFitResultMap & GetLayerFitResultMap() const
Get the layer fit result map.
VertexComparator class for comparison of two points wrt neutrino vertex position. ...
double GetRms() const
Get the rms of the fit residuals.
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...
VertexComparator(const pandora::CartesianVector vertexPosition2D)
Constructor.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
std::vector< pandora::CartesianVector > EigenVectors
static void GetAllDownstreamPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively, of all daughters associated with those pfos in an input lis...
void GetGlobalPosition(const float rL, const float rT, pandora::CartesianVector &position) const
Get global coordinates for given sliding linear fit coordinates.
unsigned int m_slidingLinearFitWindowLarge
The sliding linear fit window - should be large, providing a simple linear fit.
float m_defaultValue
Default value to return, in case calculation not feasible.
void CalculateChargeVariables(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, float &totalCharge, float &chargeSigma, float &chargeMean, float &endCharge)
Calculation of the charge variables.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pInputPfo)
void Divide3DCaloHitList(const pandora::Algorithm *const pAlgorithm, const pandora::CaloHitList &threeDCaloHitList, pandora::CartesianPointVector &pointVectorStart, pandora::CartesianPointVector &pointVectorEnd)
Obtain positions at the vertex and non-vertex end of a list of three dimensional calo hits...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
ThreeDVertexDistanceFeatureTool()
Default constructor.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Dft::FloatVector FloatVector
float m_endChargeFraction
Fraction of hits that will be considered to calculate end charge (default 10%)
double GetL() const
Get the l coordinate.
static float GetShowerFitWidth(const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster, const unsigned int showerFitWindow)
Get a measure of the width of a cluster, using a sliding shower fit result.
ThreeDChargeFeatureTool()
Default constructor.
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
unsigned int m_slidingLinearFitWindow
The sliding linear fit window.
void CalculateVariablesSlidingLinearFit(const pandora::Cluster *const pCluster, float &straightLineLengthLarge, float &diffWithStraigthLineMean, float &diffWithStraightLineSigma, float &dTdLWidth, float &maxFitGapLength, float &rmsSlidingLinearFit) const
Calculation of several variables related to sliding linear fit.
static void GetCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of calo hits of a particular hit type from a list of pfos.
PfoHierarchyFeatureTool()
Default constructor.
std::list< Vertex > VertexList
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
TwoDSlidingFitResult class.
int GetLayer(const float rL) const
Get layer number for given sliding linear fit longitudinal coordinate.
QTextStream & endl(QTextStream &s)
void Run(LArMvaHelper::MvaFeatureVector &featureVector, const pandora::Algorithm *const pAlgorithm, const pandora::Cluster *const pCluster)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)