LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::SimpleNeutrinoIdTool Class Reference

SimpleNeutrinoIdTool class. More...

#include "SimpleNeutrinoIdTool.h"

Inheritance diagram for lar_content::SimpleNeutrinoIdTool:
lar_content::SliceIdBaseTool

Public Member Functions

 SimpleNeutrinoIdTool ()
 Default constructor. More...
 
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 slice. More...
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

bool m_selectAllNeutrinos
 First approach: select all neutrinos, as opposed to selecting all cosmics. More...
 
bool m_selectOnlyFirstSliceNeutrinos
 First approach: select first slice neutrinos, cosmics for all subsequent slices. More...
 

Detailed Description

SimpleNeutrinoIdTool class.

Definition at line 19 of file SimpleNeutrinoIdTool.h.

Constructor & Destructor Documentation

lar_content::SimpleNeutrinoIdTool::SimpleNeutrinoIdTool ( )

Default constructor.

Definition at line 18 of file SimpleNeutrinoIdTool.cc.

18  :
21 {
22 }
bool m_selectOnlyFirstSliceNeutrinos
First approach: select first slice neutrinos, cosmics for all subsequent slices.
bool m_selectAllNeutrinos
First approach: select all neutrinos, as opposed to selecting all cosmics.

Member Function Documentation

StatusCode lar_content::SimpleNeutrinoIdTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 58 of file SimpleNeutrinoIdTool.cc.

References m_selectAllNeutrinos, and m_selectOnlyFirstSliceNeutrinos.

59 {
60  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
61  "SelectAllNeutrinos", m_selectAllNeutrinos));
62 
63  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
64  "SelectOnlyFirstSliceNeutrinos", m_selectOnlyFirstSliceNeutrinos));
65 
67  {
68  std::cout << "SimpleNeutrinoIdTool::ReadSettings - exactly one of SelectAllNeutrinos and SelectOnlyFirstSliceNeutrinos must be true" << std::endl;
69  return STATUS_CODE_INVALID_PARAMETER;
70  }
71 
72  return STATUS_CODE_SUCCESS;
73 }
bool m_selectOnlyFirstSliceNeutrinos
First approach: select first slice neutrinos, cosmics for all subsequent slices.
bool m_selectAllNeutrinos
First approach: select all neutrinos, as opposed to selecting all cosmics.
void lar_content::SimpleNeutrinoIdTool::SelectOutputPfos ( const pandora::Algorithm *const  pAlgorithm,
const SliceHypotheses nuSliceHypotheses,
const SliceHypotheses crSliceHypotheses,
pandora::PfoList &  selectedPfos 
)
virtual

Select which reconstruction hypotheses to use; neutrino outcomes or cosmic-ray muon outcomes for each slice.

Parameters
pAlgorithmthe address of the master instance, used to access MCParticles when in training mode
nuSliceHypothesesthe parent pfos representing the neutrino outcome for each slice
crSliceHypothesesthe parent pfos representing the cosmic-ray muon outcome for each slice
sliceNuPfosto receive the list of selected pfos

Implements lar_content::SliceIdBaseTool.

Definition at line 26 of file SimpleNeutrinoIdTool.cc.

References f, m_selectAllNeutrinos, and m_selectOnlyFirstSliceNeutrinos.

27 {
28  if (nuSliceHypotheses.size() != crSliceHypotheses.size())
29  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
30 
31  for (unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
32  {
33  const PfoList &sliceOutput((m_selectAllNeutrinos || (m_selectOnlyFirstSliceNeutrinos && (0 == sliceIndex))) ?
34  nuSliceHypotheses.at(sliceIndex) : 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  {
40  object_creation::ParticleFlowObject::Metadata metadata;
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  {
47  object_creation::ParticleFlowObject::Metadata metadata;
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 }
TFile f
Definition: plotHisto.C:6
bool m_selectOnlyFirstSliceNeutrinos
First approach: select first slice neutrinos, cosmics for all subsequent slices.
bool m_selectAllNeutrinos
First approach: select all neutrinos, as opposed to selecting all cosmics.

Member Data Documentation

bool lar_content::SimpleNeutrinoIdTool::m_selectAllNeutrinos
private

First approach: select all neutrinos, as opposed to selecting all cosmics.

Definition at line 32 of file SimpleNeutrinoIdTool.h.

Referenced by ReadSettings(), and SelectOutputPfos().

bool lar_content::SimpleNeutrinoIdTool::m_selectOnlyFirstSliceNeutrinos
private

First approach: select first slice neutrinos, cosmics for all subsequent slices.

Definition at line 33 of file SimpleNeutrinoIdTool.h.

Referenced by ReadSettings(), and SelectOutputPfos().


The documentation for this class was generated from the following files: