Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
SimpleNeutrinoIdTool.cc
Go to the documentation of this file.
1
10
12
13using namespace pandora;
14
15namespace lar_content
16{
17
18SimpleNeutrinoIdTool::SimpleNeutrinoIdTool() : m_selectAllNeutrinos(true), m_selectOnlyFirstSliceNeutrinos(false)
19{
20}
21
22//------------------------------------------------------------------------------------------------------------------------------------------
23
24void SimpleNeutrinoIdTool::SelectOutputPfos(const Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses,
25 const SliceHypotheses &crSliceHypotheses, PfoList &selectedPfos)
26{
27 if (nuSliceHypotheses.size() != crSliceHypotheses.size())
28 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
29
30 for (unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
31 {
32 const PfoList &sliceOutput((m_selectAllNeutrinos || (m_selectOnlyFirstSliceNeutrinos && (0 == sliceIndex)))
33 ? nuSliceHypotheses.at(sliceIndex)
34 : crSliceHypotheses.at(sliceIndex));
35
36 const float score(m_selectAllNeutrinos || (m_selectOnlyFirstSliceNeutrinos && (0 == sliceIndex)) ? 1.f : -1.f);
37
38 for (const ParticleFlowObject *const pPfo : crSliceHypotheses.at(sliceIndex))
39 {
41 metadata.m_propertiesToAdd["NuScore"] = score;
42 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*pAlgorithm, pPfo, metadata));
43 }
44
45 for (const ParticleFlowObject *const pPfo : nuSliceHypotheses.at(sliceIndex))
46 {
48 metadata.m_propertiesToAdd["NuScore"] = score;
49 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*pAlgorithm, pPfo, metadata));
50 }
51
52 selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
53 }
54}
55
56//------------------------------------------------------------------------------------------------------------------------------------------
57
59{
61 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SelectAllNeutrinos", m_selectAllNeutrinos));
62
63 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
64 XmlHelper::ReadValue(xmlHandle, "SelectOnlyFirstSliceNeutrinos", m_selectOnlyFirstSliceNeutrinos));
65
67 {
68 std::cout << "SimpleNeutrinoIdTool::ReadSettings - exactly one of SelectAllNeutrinos and SelectOnlyFirstSliceNeutrinos must be true"
69 << std::endl;
70 return STATUS_CODE_INVALID_PARAMETER;
71 }
72
73 return STATUS_CODE_SUCCESS;
74}
75
76} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the neutrino id tool class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:43
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
bool m_selectAllNeutrinos
First approach: select all neutrinos, as opposed to selecting all cosmics.
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...
bool m_selectOnlyFirstSliceNeutrinos
First approach: select first slice neutrinos, cosmics for all subsequent slices.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
Definition Algorithm.h:21
ParticleFlowObject class.
StatusCode AlterMetadata(const object_creation::ParticleFlowObject::Metadata &metadata)
Alter particle flow object metadata parameters.
StatusCodeException class.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
std::vector< pandora::PfoList > SliceHypotheses
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList