Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
UnattachedDeltaRaysAlgorithm.cc
Go to the documentation of this file.
1
10
12
14
15using namespace pandora;
16
17namespace lar_content
18{
19
21{
22 const PfoList *pPfoList(nullptr);
23 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, m_pfoListName, pPfoList));
24
25 if (!pPfoList || pPfoList->empty())
26 {
28 std::cout << "UnattachedDeltaRaysAlgorithm: pfo list " << m_pfoListName << " unavailable." << std::endl;
29 return STATUS_CODE_SUCCESS;
30 }
31
32 PfoList unattachedDeltaRays;
33
34 for (const Pfo *const pPfo : *pPfoList)
35 {
36 if ((0 == pPfo->GetNParentPfos()) && LArPfoHelper::IsShower(pPfo))
37 unattachedDeltaRays.push_back(pPfo);
38 }
39
40 PfoList allPfosToDelete;
41 LArPfoHelper::GetAllConnectedPfos(unattachedDeltaRays, allPfosToDelete);
42
43 for (const Pfo *const pPfoToDelete : allPfosToDelete)
44 {
45 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::Delete(*this, pPfoToDelete, m_pfoListName));
46 }
47
48 return STATUS_CODE_SUCCESS;
49}
50
51//------------------------------------------------------------------------------------------------------------------------------------------
52
54{
55 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "PfoListName", m_pfoListName));
56
57 return STATUS_CODE_SUCCESS;
58}
59
60} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
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
Header file for the unattached delta rays algorithm class.
static pandora::StatusCode Delete(const pandora::Algorithm &algorithm, const T *const pT)
Delete an object from the current list.
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.
static void GetAllConnectedPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively including all daughters and parents associated with those pf...
static bool IsShower(const pandora::ParticleFlowObject *const pPfo)
Return shower flag based on Pfo Particle ID.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
pandora::StatusCode Run()
Run the algorithm.
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