9 #include "Pandora/AlgorithmHeaders.h" 21 void CheatingNeutrinoIdTool::SelectOutputPfos(
const pandora::Algorithm *
const ,
const SliceHypotheses &nuSliceHypotheses,
const SliceHypotheses &crSliceHypotheses, PfoList &selectedPfos)
23 if (nuSliceHypotheses.size() != crSliceHypotheses.size())
24 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
26 float bestNeutrinoWeight(0.
f);
29 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
31 float neutrinoWeight(0.
f);
32 const PfoList &neutrinoPfoList(nuSliceHypotheses.at(sliceIndex));
34 for (
const Pfo *
const pNeutrinoPfo : neutrinoPfoList)
36 if (!LArPfoHelper::IsNeutrino(pNeutrinoPfo))
37 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
39 PfoList downstreamPfos;
40 LArPfoHelper::GetAllDownstreamPfos(pNeutrinoPfo, downstreamPfos);
42 float thisNeutrinoWeight(0.
f), thisTotalWeight(0.
f);
43 CheatingSliceIdBaseTool::GetTargetParticleWeight(&downstreamPfos, thisNeutrinoWeight, thisTotalWeight, LArMCParticleHelper::IsNeutrino);
44 neutrinoWeight += thisNeutrinoWeight;
47 if (neutrinoWeight > bestNeutrinoWeight)
49 bestNeutrinoWeight = neutrinoWeight;
50 bestSliceIndex = sliceIndex;
54 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
56 const PfoList &sliceOutput((bestSliceIndex == sliceIndex) ? nuSliceHypotheses.at(sliceIndex) : crSliceHypotheses.at(sliceIndex));
57 selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
63 StatusCode CheatingNeutrinoIdTool::ReadSettings(
const TiXmlHandle )
65 return STATUS_CODE_SUCCESS;
Header file for the pfo helper class.
Header file for the lar monte carlo particle helper helper class.
std::vector< pandora::PfoList > SliceHypotheses