Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::LArHierarchyHelper::MCMatches Class Reference

MCMatches class. More...

#include <LArHierarchyHelper.h>

Public Member Functions

 MCMatches (const MCHierarchy::Node *pMCParticle)
 Constructor. More...
 
void AddRecoMatch (const RecoHierarchy::Node *pReco, const int nSharedHits)
 Add a reconstructed node as a match for this MC node. More...
 
const MCHierarchy::NodeGetMC () const
 Retrieve the MC node. More...
 
const RecoHierarchy::NodeVectorGetRecoMatches () const
 Retrieve the vector of matched reco nodes. More...
 
unsigned int GetSharedHits (const RecoHierarchy::Node *pReco) const
 Retrieve the number of shared hits in the match. More...
 
float GetPurity (const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
 Retrieve the purity of the match. More...
 
float GetPurity (const RecoHierarchy::Node *pReco, const pandora::HitType view, const bool adcWeighted=false) const
 Retrieve the purity of the match. More...
 
float GetCompleteness (const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
 Retrieve the completeness of the match. More...
 
float GetCompleteness (const RecoHierarchy::Node *pReco, const pandora::HitType view, const bool adcWeighted=false) const
 Retrieve the completeness of the match. More...
 
size_t GetNRecoMatches () const
 Get the number of reco nodes matched (both above and below quality cut thresholds) to the MC node. More...
 
bool IsQuality (const QualityCuts &qualityCuts) const
 Get whether this match passes quality cuts. More...
 

Private Member Functions

float GetPurity (const pandora::CaloHitVector &intersection, const pandora::CaloHitList &recoHits, const bool adcWeighted) const
 Core purity calculation given intersecting hits and reco hits. More...
 
float GetCompleteness (const pandora::CaloHitVector &intersection, const pandora::CaloHitList &mcHits, const bool adcWeighted) const
 Core completeness calculation given intersecting hits and MC hits. More...
 

Private Attributes

const MCHierarchy::Nodem_pMCParticle
 MC node associated with any matches. More...
 
RecoHierarchy::NodeVector m_recoNodes
 Matched reco nodes. More...
 
pandora::IntVector m_sharedHits
 Number of shared hits for each match. More...
 

Detailed Description

MCMatches class.

Definition at line 590 of file LArHierarchyHelper.h.

Constructor & Destructor Documentation

lar_content::LArHierarchyHelper::MCMatches::MCMatches ( const MCHierarchy::Node pMCParticle)

Constructor.

Parameters
pMCParticleThe MCParticle being matched

Definition at line 999 of file LArHierarchyHelper.cc.

999  : m_pMCParticle{pMCParticle}
1000 {
1001 }
const MCHierarchy::Node * m_pMCParticle
MC node associated with any matches.

Member Function Documentation

void lar_content::LArHierarchyHelper::MCMatches::AddRecoMatch ( const RecoHierarchy::Node pReco,
const int  nSharedHits 
)

Add a reconstructed node as a match for this MC node.

Parameters
pRecoThe reconstructed node that matches this MC node
nSharedHitsThe number of hits shared betweeb reco and MC nodes

Definition at line 1005 of file LArHierarchyHelper.cc.

1006 {
1007  m_recoNodes.emplace_back(pReco);
1008  m_sharedHits.emplace_back(nSharedHits);
1009 }
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
pandora::IntVector m_sharedHits
Number of shared hits for each match.
float lar_content::LArHierarchyHelper::MCMatches::GetCompleteness ( const RecoHierarchy::Node pReco,
const bool  adcWeighted = false 
) const

Retrieve the completeness of the match.

Parameters
pRecoThe reco node to consider
adcWeightedWhether or not to weight completeness according to the charge contribution
Returns
The completeness of the match

Definition at line 1065 of file LArHierarchyHelper.cc.

1066 {
1067  auto iter{std::find(m_recoNodes.begin(), m_recoNodes.end(), pReco)};
1068  if (iter == m_recoNodes.end())
1069  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
1070 
1071  const CaloHitList &recoHits{pReco->GetCaloHits()};
1072  const CaloHitList &mcHits{m_pMCParticle->GetCaloHits()};
1073  CaloHitVector intersection;
1074  std::set_intersection(mcHits.begin(), mcHits.end(), recoHits.begin(), recoHits.end(), std::back_inserter(intersection));
1075 
1076  return this->GetCompleteness(intersection, mcHits, adcWeighted);
1077 }
const MCHierarchy::Node * m_pMCParticle
MC node associated with any matches.
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
const pandora::CaloHitList & GetCaloHits() const
Retrieve the CaloHits associated with this node.
float GetCompleteness(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the completeness of the match.
float lar_content::LArHierarchyHelper::MCMatches::GetCompleteness ( const RecoHierarchy::Node pReco,
const pandora::HitType  view,
const bool  adcWeighted = false 
) const

Retrieve the completeness of the match.

Parameters
pRecoThe reco node to consider
viewThe view for which purity should be calculated
adcWeightedWhether or not to weight completeness according to the charge contribution
Returns
The completeness of the match
float lar_content::LArHierarchyHelper::MCMatches::GetCompleteness ( const pandora::CaloHitVector &  intersection,
const pandora::CaloHitList &  mcHits,
const bool  adcWeighted 
) const
private

Core completeness calculation given intersecting hits and MC hits.

Parameters
intersectionThe intersecting reco and MC hits
mcHitsThe MC hits
adcWeightedWhether or not to weight completeness according to the charge contribution
Returns
The completeness of the match
const LArHierarchyHelper::MCHierarchy::Node * lar_content::LArHierarchyHelper::MCMatches::GetMC ( ) const
inline

Retrieve the MC node.

Returns
The MC node

Definition at line 1000 of file LArHierarchyHelper.h.

1001 {
1002  return m_pMCParticle;
1003 }
const MCHierarchy::Node * m_pMCParticle
MC node associated with any matches.
size_t lar_content::LArHierarchyHelper::MCMatches::GetNRecoMatches ( ) const
inline

Get the number of reco nodes matched (both above and below quality cut thresholds) to the MC node.

Returns
The number of reco nodes matched to the MC node

Definition at line 1014 of file LArHierarchyHelper.h.

1015 {
1016  return m_recoNodes.size();
1017 }
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
float lar_content::LArHierarchyHelper::MCMatches::GetPurity ( const RecoHierarchy::Node pReco,
const bool  adcWeighted = false 
) const

Retrieve the purity of the match.

Parameters
pRecoThe reco node to consider
adcWeightedWhether or not to weight purity according to the charge contribution
Returns
The purity of the match

Definition at line 1025 of file LArHierarchyHelper.cc.

1026 {
1027  auto iter{std::find(m_recoNodes.begin(), m_recoNodes.end(), pReco)};
1028  if (iter == m_recoNodes.end())
1029  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
1030 
1031  const CaloHitList &recoHits{pReco->GetCaloHits()};
1032  const CaloHitList &mcHits{m_pMCParticle->GetCaloHits()};
1033  CaloHitVector intersection;
1034  std::set_intersection(mcHits.begin(), mcHits.end(), recoHits.begin(), recoHits.end(), std::back_inserter(intersection));
1035 
1036  return this->GetPurity(intersection, recoHits, adcWeighted);
1037 }
const MCHierarchy::Node * m_pMCParticle
MC node associated with any matches.
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
const pandora::CaloHitList & GetCaloHits() const
Retrieve the CaloHits associated with this node.
float GetPurity(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the purity of the match.
float lar_content::LArHierarchyHelper::MCMatches::GetPurity ( const RecoHierarchy::Node pReco,
const pandora::HitType  view,
const bool  adcWeighted = false 
) const

Retrieve the purity of the match.

Parameters
pRecoThe reco node to consider
viewThe view for which purity should be calculated
adcWeightedWhether or not to weight purity according to the charge contribution
Returns
The purity of the match
float lar_content::LArHierarchyHelper::MCMatches::GetPurity ( const pandora::CaloHitVector &  intersection,
const pandora::CaloHitList &  recoHits,
const bool  adcWeighted 
) const
private

Core purity calculation given intersecting hits and reco hits.

Parameters
intersectionThe intersecting reco and MC hits
recoHitsThe reco hits
adcWeightedWhether or not to weight purity according to the charge contribution
Returns
The purity of the match
const LArHierarchyHelper::RecoHierarchy::NodeVector & lar_content::LArHierarchyHelper::MCMatches::GetRecoMatches ( ) const
inline

Retrieve the vector of matched reco nodes.

Returns
The vector of matched reco nodes

Definition at line 1007 of file LArHierarchyHelper.h.

1008 {
1009  return m_recoNodes;
1010 }
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
unsigned int lar_content::LArHierarchyHelper::MCMatches::GetSharedHits ( const RecoHierarchy::Node pReco) const

Retrieve the number of shared hits in the match.

Parameters
pRecoThe reco node to consider
Returns
The number of shared hits

Definition at line 1013 of file LArHierarchyHelper.cc.

1014 {
1015  auto iter{std::find(m_recoNodes.begin(), m_recoNodes.end(), pReco)};
1016  if (iter == m_recoNodes.end())
1017  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
1018  int index = iter - m_recoNodes.begin();
1019 
1020  return static_cast<int>(m_sharedHits[index]);
1021 }
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
pandora::IntVector m_sharedHits
Number of shared hits for each match.
bool lar_content::LArHierarchyHelper::MCMatches::IsQuality ( const QualityCuts qualityCuts) const

Get whether this match passes quality cuts.

Parameters
qualityCutsThe quality cuts to pass
Returns
Whether or not this match passes quality cuts

Definition at line 1161 of file LArHierarchyHelper.cc.

1162 {
1163  if (m_recoNodes.size() != 1)
1164  return false;
1165 
1166  if (this->GetPurity(m_recoNodes.front()) < qualityCuts.m_minPurity)
1167  return false;
1168 
1169  if (this->GetCompleteness(m_recoNodes.front()) < qualityCuts.m_minCompleteness)
1170  return false;
1171 
1172  return true;
1173 }
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
float GetPurity(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the purity of the match.
float GetCompleteness(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the completeness of the match.

Member Data Documentation

const MCHierarchy::Node* lar_content::LArHierarchyHelper::MCMatches::m_pMCParticle
private

MC node associated with any matches.

Definition at line 712 of file LArHierarchyHelper.h.

RecoHierarchy::NodeVector lar_content::LArHierarchyHelper::MCMatches::m_recoNodes
private

Matched reco nodes.

Definition at line 713 of file LArHierarchyHelper.h.

pandora::IntVector lar_content::LArHierarchyHelper::MCMatches::m_sharedHits
private

Number of shared hits for each match.

Definition at line 714 of file LArHierarchyHelper.h.


The documentation for this class was generated from the following files: