LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::CheatingCosmicRayIdentificationAlg Class Reference

CheatingCosmicRayIdentificationAlg class. More...

#include "CheatingCosmicRayIdentificationAlg.h"

Inheritance diagram for lar_content::CheatingCosmicRayIdentificationAlg:

Public Member Functions

 CheatingCosmicRayIdentificationAlg ()
 Default constructor. More...
 

Private Member Functions

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

Private Attributes

std::string m_inputPfoListName
 The input pfo list name. More...
 
std::string m_outputPfoListName
 The output pfo list name. More...
 
std::string m_inputDaughterPfoListName
 The input daughter pfo list name (if not specified, will assume same as main input list) More...
 
std::string m_outputDaughterPfoListName
 The output daughter pfo list name (if not specified, will assume same as main output list) More...
 
float m_maxNeutrinoFraction
 The maximum true neutrino fraction in a particle to be labelled as a cosmic ray. More...
 

Detailed Description

Constructor & Destructor Documentation

lar_content::CheatingCosmicRayIdentificationAlg::CheatingCosmicRayIdentificationAlg ( )

Default constructor.

Definition at line 22 of file CheatingCosmicRayIdentificationAlg.cc.

22  :
24 {
25 }
TFile f
Definition: plotHisto.C:6
float m_maxNeutrinoFraction
The maximum true neutrino fraction in a particle to be labelled as a cosmic ray.

Member Function Documentation

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

Definition at line 74 of file CheatingCosmicRayIdentificationAlg.cc.

References m_inputDaughterPfoListName, m_inputPfoListName, m_maxNeutrinoFraction, m_outputDaughterPfoListName, and m_outputPfoListName.

75 {
76  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputPfoListName", m_inputPfoListName));
77 
78  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputPfoListName", m_outputPfoListName));
79 
81  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
82  XmlHelper::ReadValue(xmlHandle, "InputDaughterPfoListName", m_inputDaughterPfoListName));
83 
85  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
86  XmlHelper::ReadValue(xmlHandle, "OutputDaughterPfoListName", m_outputDaughterPfoListName));
87 
88  PANDORA_RETURN_RESULT_IF_AND_IF(
89  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxNeutrinoFraction", m_maxNeutrinoFraction));
90 
91  return STATUS_CODE_SUCCESS;
92 }
std::string m_inputDaughterPfoListName
The input daughter pfo list name (if not specified, will assume same as main input list) ...
std::string m_outputDaughterPfoListName
The output daughter pfo list name (if not specified, will assume same as main output list) ...
float m_maxNeutrinoFraction
The maximum true neutrino fraction in a particle to be labelled as a cosmic ray.
StatusCode lar_content::CheatingCosmicRayIdentificationAlg::Run ( )
private

Definition at line 29 of file CheatingCosmicRayIdentificationAlg.cc.

References f, lar_content::LArPfoHelper::GetAllDownstreamPfos(), lar_content::CheatingSliceIdBaseTool::GetTargetParticleWeight(), lar_content::LArMCParticleHelper::IsNeutrino(), m_inputDaughterPfoListName, m_inputPfoListName, m_maxNeutrinoFraction, m_outputDaughterPfoListName, and m_outputPfoListName.

30 {
31  const PfoList *pPfoList(nullptr);
32  PANDORA_RETURN_RESULT_IF_AND_IF(
33  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_inputPfoListName, pPfoList));
34 
35  if (!pPfoList)
36  {
37  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
38  std::cout << "CheatingCosmicRayIdentificationAlg: pfo list " << m_inputPfoListName << " unavailable." << std::endl;
39 
40  return STATUS_CODE_SUCCESS;
41  }
42 
43  PfoList outputPfoList, outputDaughterPfoList;
44 
45  for (const ParticleFlowObject *const pPfo : *pPfoList)
46  {
47  if (!pPfo->GetParentPfoList().empty())
48  continue;
49 
50  PfoList downstreamPfos;
51  LArPfoHelper::GetAllDownstreamPfos(pPfo, downstreamPfos);
52 
53  float thisNeutrinoWeight(0.f), thisTotalWeight(0.f);
54  CheatingSliceIdBaseTool::GetTargetParticleWeight(&downstreamPfos, thisNeutrinoWeight, thisTotalWeight, LArMCParticleHelper::IsNeutrino);
55 
56  if ((thisTotalWeight < std::numeric_limits<float>::epsilon()) || ((thisNeutrinoWeight / thisTotalWeight) < m_maxNeutrinoFraction))
57  outputPfoList.push_back(pPfo);
58  }
59 
60  if (!outputPfoList.empty())
61  {
62  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_inputPfoListName, m_outputPfoListName, outputPfoList));
63 
64  if (!outputDaughterPfoList.empty())
65  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=,
66  PandoraContentApi::SaveList(*this, m_inputDaughterPfoListName, m_outputDaughterPfoListName, outputDaughterPfoList));
67  }
68 
69  return STATUS_CODE_SUCCESS;
70 }
std::string m_inputDaughterPfoListName
The input daughter pfo list name (if not specified, will assume same as main input list) ...
TFile f
Definition: plotHisto.C:6
std::string m_outputDaughterPfoListName
The output daughter pfo list name (if not specified, will assume same as main output list) ...
float m_maxNeutrinoFraction
The maximum true neutrino fraction in a particle to be labelled as a cosmic ray.
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.

Member Data Documentation

std::string lar_content::CheatingCosmicRayIdentificationAlg::m_inputDaughterPfoListName
private

The input daughter pfo list name (if not specified, will assume same as main input list)

Definition at line 33 of file CheatingCosmicRayIdentificationAlg.h.

Referenced by ReadSettings(), and Run().

std::string lar_content::CheatingCosmicRayIdentificationAlg::m_inputPfoListName
private

The input pfo list name.

Definition at line 31 of file CheatingCosmicRayIdentificationAlg.h.

Referenced by ReadSettings(), and Run().

float lar_content::CheatingCosmicRayIdentificationAlg::m_maxNeutrinoFraction
private

The maximum true neutrino fraction in a particle to be labelled as a cosmic ray.

Definition at line 35 of file CheatingCosmicRayIdentificationAlg.h.

Referenced by ReadSettings(), and Run().

std::string lar_content::CheatingCosmicRayIdentificationAlg::m_outputDaughterPfoListName
private

The output daughter pfo list name (if not specified, will assume same as main output list)

Definition at line 34 of file CheatingCosmicRayIdentificationAlg.h.

Referenced by ReadSettings(), and Run().

std::string lar_content::CheatingCosmicRayIdentificationAlg::m_outputPfoListName
private

The output pfo list name.

Definition at line 32 of file CheatingCosmicRayIdentificationAlg.h.

Referenced by ReadSettings(), and Run().


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