Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
CheatingNeutrinoIdTool.cc
Go to the documentation of this file.
1
10
12
15
16using namespace pandora;
17
18namespace lar_content
19{
20
21void CheatingNeutrinoIdTool::SelectOutputPfos(const pandora::Algorithm *const /*pAlgorithm*/, const SliceHypotheses &nuSliceHypotheses,
22 const SliceHypotheses &crSliceHypotheses, PfoList &selectedPfos)
23{
24 if (nuSliceHypotheses.size() != crSliceHypotheses.size())
25 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
26
27 float bestNeutrinoWeight(0.f);
28 unsigned int bestSliceIndex(std::numeric_limits<unsigned int>::max());
29
30 for (unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
31 {
32 float neutrinoWeight(0.f);
33 const PfoList &neutrinoPfoList(nuSliceHypotheses.at(sliceIndex));
34
35 for (const Pfo *const pNeutrinoPfo : neutrinoPfoList)
36 {
37 if (!LArPfoHelper::IsNeutrino(pNeutrinoPfo))
38 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
39
40 PfoList downstreamPfos;
41 LArPfoHelper::GetAllDownstreamPfos(pNeutrinoPfo, downstreamPfos);
42
43 float thisNeutrinoWeight(0.f), thisTotalWeight(0.f);
44 CheatingSliceIdBaseTool::GetTargetParticleWeight(&downstreamPfos, thisNeutrinoWeight, thisTotalWeight, LArMCParticleHelper::IsNeutrino);
45 neutrinoWeight += thisNeutrinoWeight;
46 }
47
48 if (neutrinoWeight > bestNeutrinoWeight)
49 {
50 bestNeutrinoWeight = neutrinoWeight;
51 bestSliceIndex = sliceIndex;
52 }
53 }
54
55 for (unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
56 {
57 const PfoList &sliceOutput((bestSliceIndex == sliceIndex) ? nuSliceHypotheses.at(sliceIndex) : crSliceHypotheses.at(sliceIndex));
58 selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
59 }
60}
61
62//------------------------------------------------------------------------------------------------------------------------------------------
63
65{
66 return STATUS_CODE_SUCCESS;
67}
68
69} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cheating neutrino id tool class.
Header file for the lar monte carlo particle helper helper class.
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...
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
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 bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
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::ParticleFlowObject *const pPfo)
Whether a pfo is a neutrino or (antineutrino)
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
Definition Algorithm.h:21
ParticleFlowObject class.
StatusCodeException class.
std::vector< pandora::PfoList > SliceHypotheses
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList