9 #include "Pandora/AlgorithmHeaders.h" 22 StatusCode CheatingCosmicRayShowerMatchingAlg::Run()
24 ClusterList candidateClusterList;
25 this->GetCandidateClusters(candidateClusterList);
27 const PfoList *pPfoList(
nullptr);
28 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this, m_inputPfoListName, pPfoList));
30 for (
const ParticleFlowObject *
const pPfo : *pPfoList)
32 ClusterList twoDClusters;
33 LArPfoHelper::GetTwoDClusterList(pPfo, twoDClusters);
35 for (
const Cluster *
const pPfoCluster : twoDClusters)
36 this->CosmicRayShowerMatching(pPfo, pPfoCluster, candidateClusterList);
39 return STATUS_CODE_SUCCESS;
44 void CheatingCosmicRayShowerMatchingAlg::GetCandidateClusters(ClusterList &candidateClusterList)
const 46 for (
const std::string &clusterListName : m_inputClusterListNames)
48 const ClusterList *pClusterList(
nullptr);
50 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*
this, clusterListName, pClusterList))
52 std::cout <<
"CheatingCosmicRayShowerMatchingAlg - Could not access cluster list with name " << clusterListName << std::endl;
56 candidateClusterList.insert(candidateClusterList.end(), pClusterList->begin(), pClusterList->end());
62 void CheatingCosmicRayShowerMatchingAlg::CosmicRayShowerMatching(
const ParticleFlowObject *
const pPfo,
const Cluster *
const pPfoCluster,
63 const ClusterList &candidateClusterList)
const 67 const HitType pfoClusterHitType(LArClusterHelper::GetClusterHitType(pPfoCluster));
68 const MCParticle *
const pPfoMCParticle(MCParticleHelper::GetMainMCParticle(pPfoCluster));
69 const MCParticle *
const pPfoParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pPfoMCParticle));
71 for (
const Cluster *
const pCandidateCluster : candidateClusterList)
73 if (pfoClusterHitType != LArClusterHelper::GetClusterHitType(pCandidateCluster))
76 if (!PandoraContentApi::IsAvailable(*
this, pCandidateCluster))
79 if (pPfoCluster == pCandidateCluster)
84 const MCParticle *
const pMCParticle(MCParticleHelper::GetMainMCParticle(pCandidateCluster));
85 const MCParticle *
const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMCParticle));
87 if (!LArMCParticleHelper::IsNeutrino(pParentMCParticle) && (pPfoParentMCParticle == pParentMCParticle))
88 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo(*
this, pPfo, pCandidateCluster));
90 catch (
const StatusCodeException &) {}
93 catch (
const StatusCodeException &) {}
98 StatusCode CheatingCosmicRayShowerMatchingAlg::ReadSettings(
const TiXmlHandle xmlHandle)
100 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
101 "InputPfoListName", m_inputPfoListName));
103 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
104 "InputClusterListNames", m_inputClusterListNames));
106 return STATUS_CODE_SUCCESS;
Header file for the pfo helper class.
Header file for the cosmic ray shower matching cheater class.
Header file for the lar monte carlo particle helper helper class.
Header file for the cluster helper class.