Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
CheatingCosmicRayShowerMatchingAlg.cc
Go to the documentation of this file.
1
10
14
16
17using namespace pandora;
18
19namespace lar_content
20{
21
23{
24 ClusterList candidateClusterList;
25 this->GetCandidateClusters(candidateClusterList);
26
27 const PfoList *pPfoList(nullptr);
28 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_inputPfoListName, pPfoList));
29
30 for (const ParticleFlowObject *const pPfo : *pPfoList)
31 {
32 ClusterList twoDClusters;
33 LArPfoHelper::GetTwoDClusterList(pPfo, twoDClusters);
34
35 for (const Cluster *const pPfoCluster : twoDClusters)
36 this->CosmicRayShowerMatching(pPfo, pPfoCluster, candidateClusterList);
37 }
38
39 return STATUS_CODE_SUCCESS;
40}
41
42//------------------------------------------------------------------------------------------------------------------------------------------
43
45{
46 for (const std::string &clusterListName : m_inputClusterListNames)
47 {
48 const ClusterList *pClusterList(nullptr);
49
50 if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, clusterListName, pClusterList))
51 {
52 std::cout << "CheatingCosmicRayShowerMatchingAlg - Could not access cluster list with name " << clusterListName << std::endl;
53 continue;
54 }
55
56 candidateClusterList.insert(candidateClusterList.end(), pClusterList->begin(), pClusterList->end());
57 }
58}
59
60//------------------------------------------------------------------------------------------------------------------------------------------
61
63 const ParticleFlowObject *const pPfo, const Cluster *const pPfoCluster, const ClusterList &candidateClusterList) const
64{
65 try
66 {
67 const HitType pfoClusterHitType(LArClusterHelper::GetClusterHitType(pPfoCluster));
68 const MCParticle *const pPfoMCParticle(MCParticleHelper::GetMainMCParticle(pPfoCluster));
69 const MCParticle *const pPfoParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pPfoMCParticle));
70
71 for (const Cluster *const pCandidateCluster : candidateClusterList)
72 {
73 if (pfoClusterHitType != LArClusterHelper::GetClusterHitType(pCandidateCluster))
74 continue;
75
76 if (!PandoraContentApi::IsAvailable(*this, pCandidateCluster))
77 continue;
78
79 if (pPfoCluster == pCandidateCluster)
80 continue;
81
82 try
83 {
84 const MCParticle *const pMCParticle(MCParticleHelper::GetMainMCParticle(pCandidateCluster));
85 const MCParticle *const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMCParticle));
86
87 if (!LArMCParticleHelper::IsNeutrino(pParentMCParticle) && (pPfoParentMCParticle == pParentMCParticle))
88 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::AddToPfo(*this, pPfo, pCandidateCluster));
89 }
90 catch (const StatusCodeException &)
91 {
92 }
93 }
94 }
95 catch (const StatusCodeException &)
96 {
97 }
98}
99
100//------------------------------------------------------------------------------------------------------------------------------------------
101
103{
104 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "InputPfoListName", m_inputPfoListName));
105
106 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "InputClusterListNames", m_inputClusterListNames));
107
108 return STATUS_CODE_SUCCESS;
109}
110
111} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cosmic ray shower matching cheater class.
Header file for the cluster helper class.
Header file for the lar monte carlo particle helper helper class.
Header file for the pfo helper class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:43
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
static bool IsAvailable(const pandora::Algorithm &algorithm, const T *const pT)
Is object, or a list of objects, available as a building block.
static pandora::StatusCode AddToPfo(const pandora::Algorithm &algorithm, const pandora::ParticleFlowObject *const pPfo, const T *const pT)
Add a cluster to a particle flow object.
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
void GetCandidateClusters(pandora::ClusterList &candidateClusterList) const
Get the list of candidate clusters for matching with existing pfos.
void CosmicRayShowerMatching(const pandora::ParticleFlowObject *const pPfo, const pandora::Cluster *const pPfoCluster, const pandora::ClusterList &candidateClusterList) const
Perform cosmic ray shower matching for a specific cluster in a pfo.
pandora::StringVector m_inputClusterListNames
The input cluster list names.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
Cluster class.
Definition Cluster.h:31
static const MCParticle * GetMainMCParticle(const T *const pT)
Find the mc particle making the largest contribution to a specified calo hit, track or cluster.
MCParticle class.
Definition MCParticle.h:26
ParticleFlowObject class.
StatusCodeException class.
static StatusCode ReadVectorOfValues(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, std::vector< T > &vector)
Read a vector of values from a (space separated) list in an xml element.
Definition XmlHelper.h:229
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const Cluster * > ClusterList
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList