Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
CheatingCosmicRayIdentificationAlg.cc
Go to the documentation of this file.
1
10
13
16
17using namespace pandora;
18
19namespace lar_content
20{
21
25
26//------------------------------------------------------------------------------------------------------------------------------------------
27
29{
30 const PfoList *pPfoList(nullptr);
32 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_inputPfoListName, pPfoList));
33
34 if (!pPfoList)
35 {
37 std::cout << "CheatingCosmicRayIdentificationAlg: pfo list " << m_inputPfoListName << " unavailable." << std::endl;
38
39 return STATUS_CODE_SUCCESS;
40 }
41
42 PfoList outputPfoList, outputDaughterPfoList;
43
44 for (const ParticleFlowObject *const pPfo : *pPfoList)
45 {
46 if (!pPfo->GetParentPfoList().empty())
47 continue;
48
49 PfoList downstreamPfos;
50 LArPfoHelper::GetAllDownstreamPfos(pPfo, downstreamPfos);
51
52 float thisNeutrinoWeight(0.f), thisTotalWeight(0.f);
53 CheatingSliceIdBaseTool::GetTargetParticleWeight(&downstreamPfos, thisNeutrinoWeight, thisTotalWeight, LArMCParticleHelper::IsNeutrino);
54
55 if ((thisTotalWeight < std::numeric_limits<float>::epsilon()) || ((thisNeutrinoWeight / thisTotalWeight) < m_maxNeutrinoFraction))
56 outputPfoList.push_back(pPfo);
57 }
58
59 if (!outputPfoList.empty())
60 {
62
63 if (!outputDaughterPfoList.empty())
64 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=,
66 }
67
68 return STATUS_CODE_SUCCESS;
69}
70
71//------------------------------------------------------------------------------------------------------------------------------------------
72
74{
75 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputPfoListName", m_inputPfoListName));
76
77 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputPfoListName", m_outputPfoListName));
78
80 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
81 XmlHelper::ReadValue(xmlHandle, "InputDaughterPfoListName", m_inputDaughterPfoListName));
82
84 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
85 XmlHelper::ReadValue(xmlHandle, "OutputDaughterPfoListName", m_outputDaughterPfoListName));
86
88 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxNeutrinoFraction", m_maxNeutrinoFraction));
89
90 return STATUS_CODE_SUCCESS;
91}
92
93} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cosmic ray identification cheater class.
Header file for the cheating slice id base tool class.
Header file for the lar monte carlo particle helper helper class.
Header file for the pfo helper class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
static pandora::StatusCode SaveList(const pandora::Algorithm &algorithm, const T &t, const std::string &newListName)
Save a provided input object list under a new name.
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
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.
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 bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
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...
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
ParticleFlowObject class.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList