LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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...
 

Static Public Member Functions

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...
 

Private Member Functions

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

Detailed Description

CheatingNeutrinoIdTool class.

Definition at line 20 of file CheatingNeutrinoIdTool.h.

Member Function Documentation

static void lar_content::CheatingSliceIdBaseTool::GetTargetParticleWeight ( const pandora::PfoList *const  pPfoList,
float &  targetParticleWeight,
float &  totalWeight,
std::function< bool(const pandora::MCParticle *const)>  fCriteria 
)
staticinherited

Get the target particle weight in a list of pfos.

Parameters
pPfoListaddress of the pfo list
targetParticleWeightthe target particle weight
totalWeightthe total weight
fCriteriaa function which returns a bool (= shouldSelect) for a given input MCParticle

Referenced by lar_content::CheatingCosmicRayTaggingTool::FindAmbiguousPfos(), lar_content::CheatingCosmicRayIdentificationAlg::Run(), and lar_content::CheatingBeamParticleIdTool::SelectOutputPfos().

static void lar_content::CheatingSliceIdBaseTool::GetTargetParticleWeight ( const pandora::CaloHit *const  pCaloHit,
float &  targetParticleWeight,
float &  totalWeight,
std::function< bool(const pandora::MCParticle *const)>  fCriteria 
)
staticinherited

Get the target particle weight for a calo hit.

Parameters
pCaloHitaddress of the calo hit
targetParticleWeightthe target particle weight
totalWeightthe total weight
fCriteriaa function which returns a bool (= shouldSelect) for a given input MCParticle
StatusCode lar_content::CheatingNeutrinoIdTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 63 of file CheatingNeutrinoIdTool.cc.

64 {
65  return STATUS_CODE_SUCCESS;
66 }
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.

References f, and max.

22 {
23  if (nuSliceHypotheses.size() != crSliceHypotheses.size())
24  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
25 
26  float bestNeutrinoWeight(0.f);
27  unsigned int bestSliceIndex(std::numeric_limits<unsigned int>::max());
28 
29  for (unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
30  {
31  float neutrinoWeight(0.f);
32  const PfoList &neutrinoPfoList(nuSliceHypotheses.at(sliceIndex));
33 
34  for (const Pfo *const pNeutrinoPfo : neutrinoPfoList)
35  {
36  if (!LArPfoHelper::IsNeutrino(pNeutrinoPfo))
37  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
38 
39  PfoList downstreamPfos;
40  LArPfoHelper::GetAllDownstreamPfos(pNeutrinoPfo, downstreamPfos);
41 
42  float thisNeutrinoWeight(0.f), thisTotalWeight(0.f);
43  CheatingSliceIdBaseTool::GetTargetParticleWeight(&downstreamPfos, thisNeutrinoWeight, thisTotalWeight, LArMCParticleHelper::IsNeutrino);
44  neutrinoWeight += thisNeutrinoWeight;
45  }
46 
47  if (neutrinoWeight > bestNeutrinoWeight)
48  {
49  bestNeutrinoWeight = neutrinoWeight;
50  bestSliceIndex = sliceIndex;
51  }
52  }
53 
54  for (unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
55  {
56  const PfoList &sliceOutput((bestSliceIndex == sliceIndex) ? nuSliceHypotheses.at(sliceIndex) : crSliceHypotheses.at(sliceIndex));
57  selectedPfos.insert(selectedPfos.end(), sliceOutput.begin(), sliceOutput.end());
58  }
59 }
TFile f
Definition: plotHisto.C:6
Int_t max
Definition: plot.C:27
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: