9 #include "Pandora/AlgorithmHeaders.h"
13 #include "Helpers/MCParticleHelper.h"
30 m_useTrainingMode(
false),
31 m_selectNuanceCode(
false),
32 m_nuance(-
std::numeric_limits<int>::max()),
34 m_minCompleteness(0.9f),
35 m_minProbability(0.0f),
37 m_persistFeatures(
false),
38 m_filePathEnvironmentVariable(
"FW_SEARCH_PATH")
48 if (nuSliceHypotheses.size() != crSliceHypotheses.size())
49 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
51 const unsigned int nSlices(nuSliceHypotheses.size());
56 this->GetSliceFeatures(
this, nuSliceHypotheses, crSliceHypotheses, sliceFeaturesVector);
58 if (m_useTrainingMode)
61 this->SelectAllPfos(pAlgorithm, crSliceHypotheses, selectedPfos);
63 unsigned int bestSliceIndex(std::numeric_limits<unsigned int>::max());
64 if (!this->GetBestMCSliceIndex(pAlgorithm, nuSliceHypotheses, crSliceHypotheses, bestSliceIndex))
67 for (
unsigned int sliceIndex = 0; sliceIndex < nSlices; ++sliceIndex)
69 const SliceFeatures &features(sliceFeaturesVector.at(sliceIndex));
70 if (!features.IsFeatureVectorAvailable())
81 this->SelectPfosByProbability(pAlgorithm, nuSliceHypotheses, crSliceHypotheses, sliceFeaturesVector, selectedPfos);
90 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
91 sliceFeaturesVector.push_back(
SliceFeatures(nuSliceHypotheses.at(sliceIndex), crSliceHypotheses.at(sliceIndex), pTool));
98 const SliceHypotheses &crSliceHypotheses,
unsigned int &bestSliceIndex)
const
100 unsigned int nHitsInBestSlice(0), nNuHitsInBestSlice(0);
103 const CaloHitList *pAllReconstructedCaloHitList(
nullptr);
104 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*pAlgorithm, pAllReconstructedCaloHitList));
106 const MCParticleList *pMCParticleList(
nullptr);
107 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*pAlgorithm, pMCParticleList));
114 CaloHitList reconstructableCaloHitList;
119 const int nuNHitsTotal(this->CountNeutrinoInducedHits(reconstructableCaloHitList));
120 const CaloHitSet reconstructableCaloHitSet(reconstructableCaloHitList.begin(), reconstructableCaloHitList.end());
122 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
124 CaloHitList reconstructedCaloHitList;
125 this->Collect2DHits(crSliceHypotheses.at(sliceIndex), reconstructedCaloHitList, reconstructableCaloHitSet);
127 for (
const ParticleFlowObject *
const pNeutrino : nuSliceHypotheses.at(sliceIndex))
129 const PfoList &nuFinalStates(pNeutrino->GetDaughterPfoList());
130 this->Collect2DHits(nuFinalStates, reconstructedCaloHitList, reconstructableCaloHitSet);
133 const unsigned int nNuHits(this->CountNeutrinoInducedHits(reconstructedCaloHitList));
135 if (nNuHits > nNuHitsInBestSlice)
137 nNuHitsInBestSlice = nNuHits;
138 nHitsInBestSlice = reconstructedCaloHitList.size();
139 bestSliceIndex = sliceIndex;
144 const float purity(nHitsInBestSlice > 0 ? static_cast<float>(nNuHitsInBestSlice) / static_cast<float>(nHitsInBestSlice) : 0.f);
145 const float completeness(nuNHitsTotal > 0 ? static_cast<float>(nNuHitsInBestSlice) / static_cast<float>(nuNHitsTotal) : 0.f);
146 return this->PassesQualityCuts(pAlgorithm, purity, completeness);
151 template <
typename T>
154 if (purity < m_minPurity || completeness < m_minCompleteness)
156 if (m_selectNuanceCode && (this->GetNuanceCode(pAlgorithm) != m_nuance))
164 template <
typename T>
167 CaloHitList collectedHits;
172 for (
const CaloHit *
const pCaloHit : collectedHits)
174 const CaloHit *
const pParentHit =
static_cast<const CaloHit *
>(pCaloHit->GetParentAddress());
175 if (!reconstructableCaloHitSet.count(pParentHit))
179 if (std::find(reconstructedCaloHitList.begin(), reconstructedCaloHitList.end(), pParentHit) == reconstructedCaloHitList.end())
180 reconstructedCaloHitList.push_back(pParentHit);
186 template <
typename T>
189 unsigned int nNuHits(0);
190 for (
const CaloHit *
const pCaloHit : caloHitList)
197 catch (
const StatusCodeException &)
207 template <
typename T>
210 const MCParticleList *pMCParticleList =
nullptr;
211 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*pAlgorithm, pMCParticleList));
216 if (trueNeutrinos.size() != 1)
218 std::cout <<
"NeutrinoIdTool::GetNuanceCode - Error: number of true neutrinos in event must be exactly one" << std::endl;
219 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
227 template <
typename T>
230 for (
const PfoList &pfos : hypotheses)
232 for (
const ParticleFlowObject *
const pPfo : pfos)
234 object_creation::ParticleFlowObject::Metadata metadata;
235 metadata.m_propertiesToAdd[
"NuScore"] = -1.f;
236 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*pAlgorithm, pPfo, metadata));
239 this->SelectPfos(pfos, selectedPfos);
245 template <
typename T>
250 std::vector<UintFloatPair> sliceIndexProbabilityPairs;
251 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
253 const float nuProbability(sliceFeaturesVector.at(sliceIndex).GetNeutrinoProbability(m_mva));
255 for (
const ParticleFlowObject *
const pPfo : crSliceHypotheses.at(sliceIndex))
257 object_creation::ParticleFlowObject::Metadata metadata;
258 metadata.m_propertiesToAdd[
"NuScore"] = nuProbability;
260 if (m_persistFeatures)
263 sliceFeaturesVector.at(sliceIndex).GetFeatureMap(featureMap);
265 for (
auto const &[
name,
value] : featureMap)
266 metadata.m_propertiesToAdd[
name] =
value;
269 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*pAlgorithm, pPfo, metadata));
272 for (
const ParticleFlowObject *
const pPfo : nuSliceHypotheses.at(sliceIndex))
274 object_creation::ParticleFlowObject::Metadata metadata;
275 metadata.m_propertiesToAdd[
"NuScore"] = nuProbability;
277 if (m_persistFeatures)
280 sliceFeaturesVector.at(sliceIndex).GetFeatureMap(featureMap);
282 for (
auto const &[
name,
value] : featureMap)
283 metadata.m_propertiesToAdd[
name] =
value;
286 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*pAlgorithm, pPfo, metadata));
289 if (nuProbability < m_minProbability)
291 this->SelectPfos(crSliceHypotheses.at(sliceIndex), selectedPfos);
295 sliceIndexProbabilityPairs.push_back(
UintFloatPair(sliceIndex, nuProbability));
299 std::sort(sliceIndexProbabilityPairs.begin(), sliceIndexProbabilityPairs.end(),
303 unsigned int nNuSlices(0);
304 for (
const UintFloatPair &slice : sliceIndexProbabilityPairs)
306 if (nNuSlices < m_maxNeutrinos)
308 this->SelectPfos(nuSliceHypotheses.at(slice.first), selectedPfos);
313 this->SelectPfos(crSliceHypotheses.at(slice.first), selectedPfos);
319 template <
typename T>
322 selectedPfos.insert(selectedPfos.end(), pfos.begin(), pfos.end());
329 template <
typename T>
331 m_isAvailable(
false),
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 &)
449 template <
typename T>
452 return m_isAvailable;
457 template <
typename T>
461 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
463 featureVector.insert(featureVector.end(), m_featureVector.begin(), m_featureVector.end());
468 template <
typename T>
472 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
474 featureMap.insert(m_featureMap.begin(), m_featureMap.end());
479 template <
typename T>
483 if (!this->IsFeatureVectorAvailable())
487 this->GetFeatureVector(featureVector);
493 template <
typename T>
497 if (nuPfos.size() != 1)
498 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
500 return nuPfos.front();
505 template <
typename T>
508 ClusterList clusters3D;
511 if (clusters3D.size() > 1)
512 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
514 if (clusters3D.empty())
517 CaloHitList caloHits;
518 clusters3D.front()->GetOrderedCaloHitList().FillCaloHitList(caloHits);
520 for (
const CaloHit *
const pCaloHit : caloHits)
521 spacePoints.push_back(pCaloHit->GetPositionVector());
526 template <
typename T>
529 return this->GetDirection(spacePoints, [&](
const CartesianVector &pointA,
const CartesianVector &pointB) {
530 return ((pointA - vertex).GetMagnitude() < (pointB - vertex).GetMagnitude());
536 template <
typename T>
539 return this->GetDirection(
540 spacePoints, [&](
const CartesianVector &pointA,
const CartesianVector &pointB) {
return (pointA.GetY() > pointB.GetY()); });
545 template <
typename T>
548 return this->GetDirection(
549 spacePoints, [&](
const CartesianVector &pointA,
const CartesianVector &pointB) {
return (pointA.GetY() < pointB.GetY()); });
554 template <
typename T>
556 std::function<
bool(
const CartesianVector &pointA,
const CartesianVector &pointB)> fShouldChooseA)
const
559 const LArTPC *
const pFirstLArTPC(m_pTool->GetPandora().GetGeometry()->GetLArTPCMap().begin()->second);
560 const float layerPitch(pFirstLArTPC->GetWirePitchW());
563 const CartesianVector endMin(fit.GetGlobalMinLayerPosition());
564 const CartesianVector endMax(fit.GetGlobalMaxLayerPosition());
565 const CartesianVector dirMin(fit.GetGlobalMinLayerDirection());
566 const CartesianVector dirMax(fit.GetGlobalMaxLayerDirection());
568 const bool isMinStart(fShouldChooseA(endMin, endMax));
569 const CartesianVector startPoint(isMinStart ? endMin : endMax);
570 const CartesianVector endPoint(isMinStart ? endMax : endMin);
571 const CartesianVector startDir(isMinStart ? dirMin : dirMax);
573 const bool shouldFlip((endPoint - startPoint).GetUnitVector().GetDotProduct(startDir) < 0.f);
574 return (shouldFlip ? startDir * (-1.f) : startDir);
579 template <
typename T>
581 const float radius, CartesianPointVector &spacePointsInSphere)
const
583 for (
const CartesianVector &point : spacePoints)
585 if ((point - vertex).GetMagnitudeSquared() <= radius * radius)
586 spacePointsInSphere.push_back(point);
592 template <
typename T>
595 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"UseTrainingMode",
m_useTrainingMode));
599 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"TrainingOutputFileName",
m_trainingOutputFile));
602 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinimumPurity",
m_minPurity));
604 PANDORA_RETURN_RESULT_IF_AND_IF(
605 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinimumCompleteness",
m_minCompleteness));
607 PANDORA_RETURN_RESULT_IF_AND_IF(
608 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SelectNuanceCode",
m_selectNuanceCode));
612 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"NuanceCode",
m_nuance));
615 PANDORA_RETURN_RESULT_IF_AND_IF(
616 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinimumNeutrinoProbability",
m_minProbability));
618 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MaximumNeutrinos",
m_maxNeutrinos));
620 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"PersistFeatures",
m_persistFeatures));
622 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
628 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MvaName", mvaName));
630 std::string mvaFileName;
631 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MvaFileName", mvaFileName));
634 m_mva.Initialize(fullMvaFileName, mvaName);
637 return STATUS_CODE_SUCCESS;
bool PassesQualityCuts(const pandora::Algorithm *const pAlgorithm, const float purity, const float completeness) const
Determine if the event passes the selection cuts for training and has the required NUANCE code...
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Header file for the pfo helper class.
bool m_selectInputHits
whether to select input hits
MvaTypes::MvaFeatureVector MvaFeatureVector
bool GetBestMCSliceIndex(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, unsigned int &bestSliceIndex) const
Get the slice with the most neutrino induced hits using Monte-Carlo information.
SliceFeatures(const pandora::PfoList &nuPfos, const pandora::PfoList &crPfos, const NeutrinoIdTool *const pTool)
Constructor.
static pandora::StatusCode ProduceTrainingExample(const std::string &trainingOutputFile, const bool result, TCONTAINER &&featureContainer)
Produce a training example with the given features and result.
void GetFeatureMap(LArMvaHelper::DoubleMap &featureMap) const
Get the feature map for the MVA.
bool IsFeatureVectorAvailable() const
Check if all features were calculable.
float m_minProbability
Minimum probability required to classify a slice as the neutrino.
int GetNuanceCode(const pandora::Algorithm *const pAlgorithm) const
Use the current MCParticle list to get the nuance code of the neutrino in the event.
pandora::CartesianVector EigenValues
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
void SelectOutputPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, pandora::PfoList &selectedPfos)
Select which reconstruction hypotheses to use; neutrino outcomes or cosmic-ray muon outcomes for each...
void SelectAllPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &hypotheses, pandora::PfoList &selectedPfos) const
Select all pfos under the same hypothesis.
LArMvaHelper::DoubleMap m_featureMap
A map between MVA features and their names.
Header file for the principal curve analysis helper class.
static void GetMCPrimaryMap(const pandora::MCParticleList *const pMCParticleList, MCRelationMap &mcPrimaryMap)
Get mapping from individual mc particles (in a provided list) and their primary parent mc particles...
static unsigned int GetNuanceCode(const pandora::MCParticle *const pMCParticle)
Get the nuance code of an MCParticle.
float m_minCompleteness
Minimum completeness of the best slice to use event for training.
float m_maxPhotonPropagation
the maximum photon propagation length
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to mva files.
void Collect2DHits(const pandora::PfoList &pfos, pandora::CaloHitList &reconstructedCaloHitList, const pandora::CaloHitSet &reconstructableCaloHitSet) const
Collect all 2D hits in a supplied list of Pfos and push them on to an existing hit list...
bool m_selectNuanceCode
Should select training events by nuance code.
unsigned int m_maxNeutrinos
The maximum number of neutrinos to select in any one event.
unsigned int CountNeutrinoInducedHits(const pandora::CaloHitList &caloHitList) const
Count the number of neutrino induced hits in a given list using MC information.
std::pair< unsigned int, float > UintFloatPair
void GetFeatureVector(LArMvaHelper::MvaFeatureVector &featureVector) const
Get the feature vector for the MVA.
float GetNeutrinoProbability(const T &t) const
Get the probability that this slice contains a neutrino interaction.
pandora::CartesianVector GetLowerDirection(const pandora::CartesianPointVector &spacePoints) const
Use a sliding fit to get the lower direction of a collection of spacepoints.
void GetSliceFeatures(const NeutrinoIdTool *const pTool, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, SliceFeaturesVector &sliceFeaturesVector) const
Get the features of each slice.
std::map< std::string, double > DoubleMap
Header file for the lar monte carlo particle helper helper class.
int m_nuance
Nuance code to select for training.
bool m_isAvailable
Is the feature vector available.
void SelectPfos(const pandora::PfoList &pfos, pandora::PfoList &selectedPfos) const
Add the given pfos to the selected Pfo list.
bool m_useTrainingMode
Should use training mode. If true, training examples will be written to the output file...
std::vector< pandora::PfoList > SliceHypotheses
float m_minPurity
Minimum purity of the best slice to use event for training.
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.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
static std::string FindFileInPath(const std::string &unqualifiedFileName, const std::string &environmentVariable, const std::string &delimiter=":")
Find the fully-qualified file name by searching through a list of delimiter-separated paths in a name...
Header file for the file helper class.
static void GetThreeDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 3D clusters from an input pfo.
void SelectPfosByProbability(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, const SliceFeaturesVector &sliceFeaturesVector, pandora::PfoList &selectedPfos) const
Select pfos based on the probability that their slice contains a neutrino interaction.
std::vector< SliceFeatures > SliceFeaturesVector
Header file for the lar three dimensional sliding fit result class.
bool m_persistFeatures
If true, the mva features will be persisted in the metadata.
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.
pandora::CartesianVector GetDirection(const pandora::CartesianPointVector &spacePoints, std::function< bool(const pandora::CartesianVector &pointA, const pandora::CartesianVector &pointB)> fShouldChooseA) const
Use a sliding fit to get the 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...
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
static void GetTrueNeutrinos(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &trueNeutrinos)
Get neutrino MC particles from an input MC particle list.
std::vector< pandora::CartesianVector > EigenVectors
ThreeDSlidingFitResult class.
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.
std::string m_trainingOutputFile
Output file name for training examples.
static double CalculateProbability(const MvaInterface &classifier, TCONTAINER &&featureContainer)
Use the trained mva to calculate a classification probability for an example.
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.
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
BEGIN_PROLOG could also be cout
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
static void SelectCaloHits(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToTargetMCMap, pandora::CaloHitList &selectedCaloHitList, const bool selectInputHits, const float maxPhotonPropagation)
Select a subset of calo hits representing those that represent "reconstructable" regions of the event...