All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | List of all members
lar_content::CheatingNeutrinoIdTool Class Reference

CheatingNeutrinoIdTool class. More...

#include <CheatingNeutrinoIdTool.h>

Inheritance diagram for lar_content::CheatingNeutrinoIdTool:
lar_content::CheatingSliceIdBaseTool lar_content::SliceIdBaseTool

Public Member Functions

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)
 

Additional Inherited Members

- Static Public Member Functions inherited from lar_content::CheatingSliceIdBaseTool
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. More...
 
static void GetTargetParticleWeight (const pandora::CaloHit *const pCaloHit, float &targetParticleWeight, float &totalWeight, std::function< bool(const pandora::MCParticle *const)> fCriteria)
 Get the target particle weight for a calo hit. More...
 

Detailed Description

CheatingNeutrinoIdTool class.

Definition at line 20 of file CheatingNeutrinoIdTool.h.

Member Function Documentation

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

Definition at line 64 of file CheatingNeutrinoIdTool.cc.

65 {
66  return STATUS_CODE_SUCCESS;
67 }
void lar_content::CheatingNeutrinoIdTool::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::CheatingSliceIdBaseTool.

Definition at line 21 of file CheatingNeutrinoIdTool.cc.

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 }
static bool IsNeutrino(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a neutrino or (antineutrino)
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...
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.

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