Select which reconstruction hypotheses to use; neutrino outcomes or cosmic-ray muon outcomes for each slice.
24 if (nuSliceHypotheses.size() != crSliceHypotheses.size())
25 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
27 float bestNeutrinoWeight(0.
f);
28 unsigned int bestSliceIndex(std::numeric_limits<unsigned int>::max());
30 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
32 float neutrinoWeight(0.
f);
33 const PfoList &neutrinoPfoList(nuSliceHypotheses.at(sliceIndex));
35 for (
const Pfo *
const pNeutrinoPfo : neutrinoPfoList)
38 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
40 PfoList downstreamPfos;
43 float thisNeutrinoWeight(0.
f), thisTotalWeight(0.
f);
45 neutrinoWeight += thisNeutrinoWeight;
48 if (neutrinoWeight > bestNeutrinoWeight)
50 bestNeutrinoWeight = neutrinoWeight;
51 bestSliceIndex = sliceIndex;
55 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
57 const PfoList &sliceOutput((bestSliceIndex == sliceIndex) ? nuSliceHypotheses.at(sliceIndex) : crSliceHypotheses.at(sliceIndex));
58 selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
static bool IsNeutrino(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a neutrino or (antineutrino)
static void GetTargetParticleWeight(const pandora::PfoList *const pPfoList, float &targetParticleWeight, float &totalWeight, std::function< bool(const pandora::MCParticle *const)> fCriteria)
Get the target particle weight in a list of pfos.
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...
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.