Select which reconstruction hypotheses to use; neutrino outcomes or cosmic-ray muon outcomes for each slice.
45 if (beamSliceHypotheses.size() != crSliceHypotheses.size())
46 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
51 for (
unsigned int sliceIndex = 0, nSlices = beamSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
54 ? beamSliceHypotheses.at(sliceIndex)
55 : crSliceHypotheses.at(sliceIndex));
59 for (
const ParticleFlowObject *
const pPfo : sliceOutput)
61 object_creation::ParticleFlowObject::Metadata
metadata;
62 metadata.m_propertiesToAdd[
"TestBeamScore"] =
score;
63 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*pAlgorithm, pPfo, metadata));
66 selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
73 for (
unsigned int sliceIndex = 0, nSlices = beamSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
75 bool usebeamHypothesis(
false);
79 PfoList allConnectedPfoList;
82 CaloHitList caloHitList3D;
85 CaloHitList selectedCaloHitList;
89 if (!selectedCaloHitList.empty())
91 CartesianVector centroidSel(0.
f, 0.
f, 0.
f);
96 const CartesianVector &majorAxisSel(eigenVecsSel.front());
97 const float supplementaryAngleToBeam(majorAxisSel.GetOpeningAngle(
m_beamDirection));
99 CartesianVector interceptOne(0.
f, 0.
f, 0.
f), interceptTwo(0.
f, 0.
f, 0.
f);
100 this->
GetTPCIntercepts(centroidSel, majorAxisSel, interceptOne, interceptTwo);
108 usebeamHypothesis =
true;
112 catch (
const StatusCodeException &)
114 usebeamHypothesis =
false;
117 const PfoList &sliceOutput(usebeamHypothesis ? beamSliceHypotheses.at(sliceIndex) : crSliceHypotheses.at(sliceIndex));
118 selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
120 const float score(usebeamHypothesis ? 1.
f : -1.
f);
122 for (
const ParticleFlowObject *
const pPfo : sliceOutput)
124 object_creation::ParticleFlowObject::Metadata
metadata;
125 metadata.m_propertiesToAdd[
"TestBeamScore"] =
score;
126 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*pAlgorithm, pPfo, metadata));
pandora::CartesianVector m_beamTPCIntersection
Intersection of beam and global TPC volume.
bool m_selectAllBeamParticles
First approach: select all beam particles, as opposed to selecting all cosmics.
pandora::CartesianVector EigenValues
void GetSelectedCaloHits(const pandora::CaloHitList &inputCaloHitList, pandora::CaloHitList &outputCaloHitList, float &closestHitToFaceDistance) const
Select a given fraction of a slice's calo hits that are closest to the beam spot. ...
float m_closestDistanceCut
Closest distance (of hit to beam spot), used in beam event selection.
float m_angleToBeamCut
Angle between major axis and beam direction, used in beam event selection.
bool m_selectOnlyFirstSliceBeamParticles
First approach: select first slice beam particles, cosmics for all subsequent slices.
static int max(int a, int b)
void GetTPCIntercepts(const pandora::CartesianVector &a0, const pandora::CartesianVector &majorAxis, pandora::CartesianVector &interceptOne, pandora::CartesianVector &interceptTwo) const
Find the intercepts of a line with the protoDUNE detector.
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...
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
std::vector< pandora::CartesianVector > EigenVectors
float m_projectionIntersectionCut
Projection intersection distance cut, used in beam event selection.
pandora::CartesianVector m_beamDirection
Beam direction.
static void GetAllConnectedPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively including all daughters and parents associated with those pf...
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.