UnattachedDeltaRaysAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArCosmicRay/UnattachedDeltaRaysAlgorithm.cc
3  *
4  * @brief Implementation of the unattached delta rays algorithm class.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 StatusCode UnattachedDeltaRaysAlgorithm::Run()
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  {
27  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
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 
53 StatusCode UnattachedDeltaRaysAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
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
Header file for the pfo helper class.
Header file for the unattached delta rays algorithm class.
QTextStream & endl(QTextStream &s)