9 #include "Pandora/AlgorithmHeaders.h" 21 CheatingBeamParticleIdTool::CheatingBeamParticleIdTool() :
22 m_minWeightFraction(0.5
f)
31 if (testBeamSliceHypotheses.size() != crSliceHypotheses.size())
32 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
34 for (
unsigned int sliceIndex = 0, nSlices = testBeamSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
36 float beamParticleWeight(0.
f), totalWeight(0.
f);
37 const PfoList &testBeamPfoList(testBeamSliceHypotheses.at(sliceIndex));
39 for (
const Pfo *
const pTestBeamPfo : testBeamPfoList)
42 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
44 PfoList downstreamPfos;
47 float thisBeamParticleWeight(0.
f), thisTotalWeight(0.
f);
50 beamParticleWeight += thisBeamParticleWeight;
51 totalWeight += thisTotalWeight;
54 const float beamWeightFraction(totalWeight < std::numeric_limits<float>::epsilon() ? 0.
f : beamParticleWeight / totalWeight);
58 const PfoList &sliceOutput(testBeamSliceHypotheses.at(sliceIndex));
59 selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
63 const PfoList &sliceOutput(crSliceHypotheses.at(sliceIndex));
64 selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
73 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MinimumWeightFraction",
m_minWeightFraction));
75 return STATUS_CODE_SUCCESS;
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::vector< pandora::PfoList > SliceHypotheses
Header file for the pfo helper class.
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...
Header file for the cheating beam particle id tool class.
static bool IsTestBeam(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a test beam particle.
Header file for the lar monte carlo particle helper helper class.
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
float m_minWeightFraction
The minimum weight fraction for identifying a slice as a beam particle.
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...