LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::LArHierarchyHelper::MatchInfo Class Reference

MatcheInfo class. More...

#include "LArHierarchyHelper.h"

Public Member Functions

 MatchInfo (const MCHierarchy &mcHierarchy, const RecoHierarchy &recoHierarchy)
 Default constructor. More...
 
 MatchInfo (const MCHierarchy &mcHierarchy, const RecoHierarchy &recoHierarchy, const QualityCuts &qualityCuts)
 Constructor. More...
 
void Match ()
 Match the nodes in the MC and reco hierarchies. More...
 
const MCMatchesVectorGetMatches (const pandora::MCParticle *const pRoot) const
 Retrieve the vector of matches (this will include null matches - i.e. MC nodes with no corresponding reco) More...
 
const RecoHierarchy::NodeVectorGetUnmatchedReco () const
 Retrieve the vector of unmatched reco nodes. More...
 
unsigned int GetNMCNodes (const pandora::MCParticle *const pRoot) const
 Retrieve the number of MC nodes available to match. More...
 
unsigned int GetNNeutrinoMCNodes (const pandora::MCParticle *const pRoot) const
 Retrieve the number of neutrino interaction derived MC nodes available to match. More...
 
unsigned int GetNCosmicRayMCNodes (const pandora::MCParticle *const pRoot) const
 Retrieve the number of cosmic ray derived MC nodes available to match. More...
 
unsigned int GetNTestBeamMCNodes (const pandora::MCParticle *const pRoot) const
 Retrieve the number of test beam derived MC nodes available to match. More...
 
const MCHierarchyGetMCHierarchy () const
 Retrieve the MC hierarchy used for the matching. More...
 
const RecoHierarchyGetRecoHierarchy () const
 Retrieve the reco hierarchy used for the matching. More...
 
void GetRootMCParticles (pandora::MCParticleList &rootMCParticles) const
 Retrieve the root MC particles of the interaction hierarchies. More...
 
const QualityCutsGetQualityCuts () const
 Retrieve the quality cuts for matching. More...
 
void Print (const MCHierarchy &mcHierarchy) const
 Prints information about which reco nodes are matched to the MC nodes, information about hit sharing, purity and completeness. More...
 

Private Attributes

const MCHierarchym_mcHierarchy
 The MC hierarchy for the matching procedure. More...
 
const RecoHierarchym_recoHierarchy
 The Reco hierarchy for the matching procedure. More...
 
InteractionInfo m_matches
 The map between an interaction and the vector of good matches from MC to reco. More...
 
RecoHierarchy::NodeVector m_unmatchedReco
 The vector of unmatched reco nodes. More...
 
QualityCuts m_qualityCuts
 The quality cuts to be applied to matches. More...
 

Detailed Description

MatcheInfo class.

Definition at line 737 of file LArHierarchyHelper.h.

Constructor & Destructor Documentation

lar_content::LArHierarchyHelper::MatchInfo::MatchInfo ( const MCHierarchy mcHierarchy,
const RecoHierarchy recoHierarchy 
)

Default constructor.

Parameters
mcHierarchyThe MC hierarchy
recoHierarchyThe reco hierarchy

Definition at line 1276 of file LArHierarchyHelper.cc.

1276  :
1277  MatchInfo(mcHierarchy, recoHierarchy, QualityCuts())
1278 {
1279 }
MatchInfo(const MCHierarchy &mcHierarchy, const RecoHierarchy &recoHierarchy)
Default constructor.
lar_content::LArHierarchyHelper::MatchInfo::MatchInfo ( const MCHierarchy mcHierarchy,
const RecoHierarchy recoHierarchy,
const QualityCuts qualityCuts 
)

Constructor.

Parameters
mcHierarchyThe MC hierarchy
recoHierarchyThe reco hierarchy
qualityCutsThe quality cuts to be applied to matched nodes

Definition at line 1283 of file LArHierarchyHelper.cc.

References m_qualityCuts, and m_recoHierarchy.

1283  :
1284  m_mcHierarchy{mcHierarchy},
1285  m_recoHierarchy{recoHierarchy},
1286  m_qualityCuts{qualityCuts}
1287 {
1288 }
QualityCuts m_qualityCuts
The quality cuts to be applied to matches.
const MCHierarchy & m_mcHierarchy
The MC hierarchy for the matching procedure.
const RecoHierarchy & m_recoHierarchy
The Reco hierarchy for the matching procedure.

Member Function Documentation

const LArHierarchyHelper::MCMatchesVector & lar_content::LArHierarchyHelper::MatchInfo::GetMatches ( const pandora::MCParticle *const  pRoot) const
inline

Retrieve the vector of matches (this will include null matches - i.e. MC nodes with no corresponding reco)

Parameters
pRootThe root of the interaction hierarchy
Returns
The vector of matches

Definition at line 1009 of file LArHierarchyHelper.h.

Referenced by Print(), lar_content::HierarchyValidationAlgorithm::Run(), and lar_content::HierarchyMonitoringAlgorithm::Run().

1010 {
1011  if (m_matches.find(pRoot) == m_matches.end())
1012  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
1013 
1014  return m_matches.at(pRoot);
1015 }
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
const LArHierarchyHelper::MCHierarchy & lar_content::LArHierarchyHelper::MatchInfo::GetMCHierarchy ( ) const
inline

Retrieve the MC hierarchy used for the matching.

Returns
The MCHierarchy used for matching

Definition at line 1026 of file LArHierarchyHelper.h.

Referenced by lar_content::HierarchyMonitoringAlgorithm::Run().

1027 {
1028  return m_mcHierarchy;
1029 }
const MCHierarchy & m_mcHierarchy
The MC hierarchy for the matching procedure.
unsigned int lar_content::LArHierarchyHelper::MatchInfo::GetNCosmicRayMCNodes ( const pandora::MCParticle *const  pRoot) const

Retrieve the number of cosmic ray derived MC nodes available to match.

Parameters
pRootThe root of the interaction hierarchy
Returns
The number of MC nodes available to match

Definition at line 1428 of file LArHierarchyHelper.cc.

References m_matches.

Referenced by Print().

1429 {
1430  if (m_matches.find(pRoot) == m_matches.end())
1431  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
1432 
1433  unsigned int nNodes{0};
1434  for (const MCMatches &match : m_matches.at(pRoot))
1435  {
1436  const MCHierarchy::Node *pNode{match.GetMC()};
1437  if (pNode->IsCosmicRay())
1438  ++nNodes;
1439  }
1440 
1441  return nNodes;
1442 }
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
unsigned int lar_content::LArHierarchyHelper::MatchInfo::GetNMCNodes ( const pandora::MCParticle *const  pRoot) const

Retrieve the number of MC nodes available to match.

Parameters
pRootThe root of the interaction hierarchy
Returns
The number of MC nodes available to match

Definition at line 1400 of file LArHierarchyHelper.cc.

References m_matches.

Referenced by lar_content::HierarchyValidationAlgorithm::Run().

1401 {
1402  if (m_matches.find(pRoot) == m_matches.end())
1403  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
1404 
1405  return static_cast<unsigned int>(m_matches.at(pRoot).size());
1406 }
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
unsigned int lar_content::LArHierarchyHelper::MatchInfo::GetNNeutrinoMCNodes ( const pandora::MCParticle *const  pRoot) const

Retrieve the number of neutrino interaction derived MC nodes available to match.

Parameters
pRootThe root of the interaction hierarchy
Returns
The number of MC nodes available to match

Definition at line 1410 of file LArHierarchyHelper.cc.

References m_matches.

Referenced by Print().

1411 {
1412  if (m_matches.find(pRoot) == m_matches.end())
1413  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
1414 
1415  unsigned int nNodes{0};
1416  for (const MCMatches &match : m_matches.at(pRoot))
1417  {
1418  const MCHierarchy::Node *pNode{match.GetMC()};
1419  if (!(pNode->IsCosmicRay() || pNode->IsTestBeamParticle()))
1420  ++nNodes;
1421  }
1422 
1423  return nNodes;
1424 }
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
unsigned int lar_content::LArHierarchyHelper::MatchInfo::GetNTestBeamMCNodes ( const pandora::MCParticle *const  pRoot) const

Retrieve the number of test beam derived MC nodes available to match.

Parameters
pRootThe root of the interaction hierarchy
Returns
The number of MC nodes available to match

Definition at line 1446 of file LArHierarchyHelper.cc.

References m_matches.

Referenced by Print().

1447 {
1448  if (m_matches.find(pRoot) == m_matches.end())
1449  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
1450 
1451  unsigned int nNodes{0};
1452  for (const MCMatches &match : m_matches.at(pRoot))
1453  {
1454  const MCHierarchy::Node *pNode{match.GetMC()};
1455  if (pNode->IsTestBeamParticle())
1456  ++nNodes;
1457  }
1458 
1459  return nNodes;
1460 }
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
const LArHierarchyHelper::QualityCuts & lar_content::LArHierarchyHelper::MatchInfo::GetQualityCuts ( ) const
inline

Retrieve the quality cuts for matching.

Returns
The quality cuts

Definition at line 1040 of file LArHierarchyHelper.h.

Referenced by lar_content::HierarchyMonitoringAlgorithm::Run(), and lar_content::HierarchyValidationAlgorithm::Run().

1041 {
1042  return m_qualityCuts;
1043 }
QualityCuts m_qualityCuts
The quality cuts to be applied to matches.
const LArHierarchyHelper::RecoHierarchy & lar_content::LArHierarchyHelper::MatchInfo::GetRecoHierarchy ( ) const
inline

Retrieve the reco hierarchy used for the matching.

Returns
The RecoHierarchy used for matching

Definition at line 1033 of file LArHierarchyHelper.h.

Referenced by lar_content::HierarchyMonitoringAlgorithm::Run(), and lar_content::HierarchyValidationAlgorithm::Run().

1034 {
1035  return m_recoHierarchy;
1036 }
const RecoHierarchy & m_recoHierarchy
The Reco hierarchy for the matching procedure.
void lar_content::LArHierarchyHelper::MatchInfo::GetRootMCParticles ( pandora::MCParticleList &  rootMCParticles) const

Retrieve the root MC particles of the interaction hierarchies.

Parameters
rootMCParticlesThe output list of root MC particles

Definition at line 1578 of file LArHierarchyHelper.cc.

References m_matches.

Referenced by lar_content::HierarchyMonitoringAlgorithm::Run(), and lar_content::HierarchyValidationAlgorithm::Run().

1579 {
1580  for (auto iter = m_matches.begin(); iter != m_matches.end(); ++iter)
1581  rootMCParticles.emplace_back(iter->first);
1582 }
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
const LArHierarchyHelper::RecoHierarchy::NodeVector & lar_content::LArHierarchyHelper::MatchInfo::GetUnmatchedReco ( ) const
inline

Retrieve the vector of unmatched reco nodes.

Definition at line 1019 of file LArHierarchyHelper.h.

Referenced by Print().

1020 {
1021  return m_unmatchedReco;
1022 }
RecoHierarchy::NodeVector m_unmatchedReco
The vector of unmatched reco nodes.
void lar_content::LArHierarchyHelper::MatchInfo::Match ( )

Match the nodes in the MC and reco hierarchies.

Definition at line 1292 of file LArHierarchyHelper.cc.

References lar_content::LArHierarchyHelper::MCMatches::AddRecoMatch(), util::begin(), util::end(), lar_content::LArHierarchyHelper::MCHierarchy::Node::GetCaloHits(), lar_content::LArHierarchyHelper::RecoHierarchy::Node::GetCaloHits(), lar_content::LArHierarchyHelper::MCHierarchy::GetFlattenedNodes(), lar_content::LArHierarchyHelper::RecoHierarchy::GetFlattenedNodes(), lar_content::LArHierarchyHelper::MCMatches::GetMC(), lar_content::LArHierarchyHelper::MCHierarchy::GetRootMCParticles(), lar_content::LArHierarchyHelper::RecoHierarchy::GetRootPfos(), m_matches, m_mcHierarchy, m_recoHierarchy, and m_unmatchedReco.

Referenced by lar_content::LArHierarchyHelper::MatchHierarchies().

1293 {
1294  MCParticleList rootMCParticles;
1295  m_mcHierarchy.GetRootMCParticles(rootMCParticles);
1296  PfoList rootPfos;
1297  m_recoHierarchy.GetRootPfos(rootPfos);
1298  std::map<const MCHierarchy::Node *, MCMatches> mcToMatchMap;
1299 
1300  for (const MCParticle *const pRootMC : rootMCParticles)
1301  {
1302  MCHierarchy::NodeVector mcNodes;
1303  m_mcHierarchy.GetFlattenedNodes(pRootMC, mcNodes);
1304  for (const ParticleFlowObject *const pRootPfo : rootPfos)
1305  {
1306  RecoHierarchy::NodeVector recoNodes;
1307  m_recoHierarchy.GetFlattenedNodes(pRootPfo, recoNodes);
1308 
1309  std::sort(mcNodes.begin(), mcNodes.end(),
1310  [](const MCHierarchy::Node *lhs, const MCHierarchy::Node *rhs)
1311  { return lhs->GetCaloHits().size() > rhs->GetCaloHits().size(); });
1312  std::sort(recoNodes.begin(), recoNodes.end(),
1313  [](const RecoHierarchy::Node *lhs, const RecoHierarchy::Node *rhs)
1314  { return lhs->GetCaloHits().size() > rhs->GetCaloHits().size(); });
1315 
1316  for (const RecoHierarchy::Node *pRecoNode : recoNodes)
1317  {
1318  const CaloHitList &recoHits{pRecoNode->GetCaloHits()};
1319  const MCHierarchy::Node *pBestNode{nullptr};
1320  size_t bestSharedHits{0};
1321  for (const MCHierarchy::Node *pMCNode : mcNodes)
1322  {
1323  if (!pMCNode->IsReconstructable())
1324  continue;
1325  const CaloHitList &mcHits{pMCNode->GetCaloHits()};
1326  CaloHitVector intersection;
1327  std::set_intersection(mcHits.begin(), mcHits.end(), recoHits.begin(), recoHits.end(), std::back_inserter(intersection));
1328 
1329  if (!intersection.empty())
1330  {
1331  const size_t sharedHits{intersection.size()};
1332  if (sharedHits > bestSharedHits)
1333  {
1334  bestSharedHits = sharedHits;
1335  pBestNode = pMCNode;
1336  }
1337  }
1338  }
1339  if (pBestNode)
1340  {
1341  auto iter{mcToMatchMap.find(pBestNode)};
1342  if (iter != mcToMatchMap.end())
1343  {
1344  MCMatches &match(iter->second);
1345  match.AddRecoMatch(pRecoNode, static_cast<int>(bestSharedHits));
1346  }
1347  else
1348  {
1349  MCMatches match(pBestNode);
1350  match.AddRecoMatch(pRecoNode, static_cast<int>(bestSharedHits));
1351  mcToMatchMap.insert(std::make_pair(pBestNode, match));
1352  }
1353  }
1354  else
1355  {
1356  m_unmatchedReco.emplace_back(pRecoNode);
1357  }
1358  }
1359  }
1360  }
1361 
1362  for (auto [pMCNode, matches] : mcToMatchMap)
1363  {
1364  // We need to figure out which MC interaction hierarchy the matches belongs to
1365  for (const MCParticle *const pRootMC : rootMCParticles)
1366  {
1367  MCHierarchy::NodeVector mcNodes;
1368  m_mcHierarchy.GetFlattenedNodes(pRootMC, mcNodes);
1369  if (std::find(mcNodes.begin(), mcNodes.end(), pMCNode) != mcNodes.end())
1370  {
1371  m_matches[pRootMC].emplace_back(matches);
1372  break;
1373  }
1374  }
1375  }
1376 
1377  const auto predicate = [](const MCMatches &lhs, const MCMatches &rhs)
1378  { return lhs.GetMC()->GetCaloHits().size() > rhs.GetMC()->GetCaloHits().size(); };
1379 
1380  for (const MCParticle *const pRootMC : rootMCParticles)
1381  {
1382  std::sort(m_matches[pRootMC].begin(), m_matches[pRootMC].end(), predicate);
1383 
1384  MCHierarchy::NodeVector mcNodes;
1385  m_mcHierarchy.GetFlattenedNodes(pRootMC, mcNodes);
1386 
1387  for (const MCHierarchy::Node *pMCNode : mcNodes)
1388  {
1389  if (pMCNode->IsReconstructable() && mcToMatchMap.find(pMCNode) == mcToMatchMap.end())
1390  {
1391  MCMatches match(pMCNode);
1392  m_matches[pRootMC].emplace_back(match);
1393  }
1394  }
1395  }
1396 }
void GetRootMCParticles(pandora::MCParticleList &rootMCParticles) const
Retrieve the root MC particles of the interaction hierarchies.
void GetFlattenedNodes(const pandora::MCParticle *const pRoot, NodeVector &nodeVector) const
Retrieve a flat vector of the ndoes in the hierarchy.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
const MCHierarchy & m_mcHierarchy
The MC hierarchy for the matching procedure.
const RecoHierarchy & m_recoHierarchy
The Reco hierarchy for the matching procedure.
void GetRootPfos(pandora::PfoList &rootPfos) const
Retrieve the root particle flow objects of the interaction hierarchies.
void GetFlattenedNodes(const pandora::ParticleFlowObject *const pRoot, NodeVector &nodeVector) const
Retrieve a flat vector of the nodes in the hierarchy.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
RecoHierarchy::NodeVector m_unmatchedReco
The vector of unmatched reco nodes.
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
void lar_content::LArHierarchyHelper::MatchInfo::Print ( const MCHierarchy mcHierarchy) const

Prints information about which reco nodes are matched to the MC nodes, information about hit sharing, purity and completeness.

Parameters
mcHierarchyThe MC hierarchy

Definition at line 1464 of file LArHierarchyHelper.cc.

References f, lar_content::LArInteractionTypeHelper::GetInteractionDescriptor(), lar_content::LArHierarchyHelper::MCHierarchy::Node::GetLeadingMCParticle(), GetMatches(), GetNCosmicRayMCNodes(), GetNNeutrinoMCNodes(), GetNTestBeamMCNodes(), lar_content::LArHierarchyHelper::MCHierarchy::Node::GetParticleId(), lar_content::LArHierarchyHelper::MCHierarchy::GetRootMCParticles(), GetUnmatchedReco(), lar_content::LArMCParticleHelper::IsBeamParticle(), lar_content::LArMCParticleHelper::IsCosmicRay(), lar_content::LArMCParticleHelper::IsNeutrino(), m_matches, lar_content::LArMCParticleHelper::SortByMomentum(), and util::to_string().

Referenced by lar_content::HierarchyMonitoringAlgorithm::Run(), and lar_content::HierarchyValidationAlgorithm::Run().

1465 {
1466  (void)mcHierarchy;
1467  MCParticleList rootMCParticles;
1468  mcHierarchy.GetRootMCParticles(rootMCParticles);
1469 
1470  for (const MCParticle *const pRootMC : rootMCParticles)
1471  {
1472  const LArHierarchyHelper::MCMatchesVector &matches{this->GetMatches(pRootMC)};
1473 
1474  MCParticleList primaries;
1475  for (const LArHierarchyHelper::MCMatches &match : matches)
1476  {
1477  const LArHierarchyHelper::MCHierarchy::Node *pMCNode{match.GetMC()};
1478  if (pMCNode->GetHierarchyTier() == 1)
1479  {
1480  const MCParticle *const pLeadingMC{pMCNode->GetLeadingMCParticle()};
1481  primaries.emplace_back(pLeadingMC);
1482  }
1483  }
1484  primaries.sort(LArMCParticleHelper::SortByMomentum);
1485  const InteractionDescriptor descriptor{LArInteractionTypeHelper::GetInteractionDescriptor(primaries)};
1486 
1487  const LArMCParticle *const pLArRoot{dynamic_cast<const LArMCParticle *const>(pRootMC)};
1488  if (pLArRoot)
1489  std::cout << "=== MC Interaction : PDG " << std::to_string(pLArRoot->GetParticleId())
1490  << " Energy: " << std::to_string(pLArRoot->GetEnergy()) << " Type: " << descriptor.ToString() << std::endl;
1491  else
1492  std::cout << "=== MC Interaction : PDG " << std::to_string(pRootMC->GetParticleId())
1493  << " Energy: " << std::to_string(pRootMC->GetEnergy()) << " Type: " << descriptor.ToString() << std::endl;
1494 
1495  unsigned int nNeutrinoMCParticles{this->GetNNeutrinoMCNodes(pRootMC)}, nNeutrinoRecoParticles{0};
1496  unsigned int nCosmicMCParticles{this->GetNCosmicRayMCNodes(pRootMC)}, nCosmicRecoParticles{0};
1497  unsigned int nTestBeamMCParticles{this->GetNTestBeamMCNodes(pRootMC)}, nTestBeamRecoParticles{0};
1498  std::cout << " === Matches ===" << std::endl;
1499  std::cout << std::fixed << std::setprecision(2);
1500  for (const MCMatches &match : m_matches.at(pRootMC))
1501  {
1502  const MCHierarchy::Node *pMCNode{match.GetMC()};
1503  const int pdg{pMCNode->GetParticleId()};
1504  const size_t mcHits{pMCNode->GetCaloHits().size()};
1505  const std::string tag{pMCNode->IsTestBeamParticle() ? "(Beam) " : pMCNode->IsCosmicRay() ? "(Cosmic) " : ""};
1506  std::cout << " MC " << tag << pdg << " hits " << mcHits << std::endl;
1507  const RecoHierarchy::NodeVector &nodeVector{match.GetRecoMatches()};
1508 
1509  for (const RecoHierarchy::Node *pRecoNode : nodeVector)
1510  {
1511  const unsigned int recoHits{static_cast<unsigned int>(pRecoNode->GetCaloHits().size())};
1512  const unsigned int sharedHits{match.GetSharedHits(pRecoNode)};
1513  const float purity{match.GetPurity(pRecoNode)};
1514  const float completeness{match.GetCompleteness(pRecoNode)};
1515  if (completeness > 0.1f)
1516  std::cout << " Matched " << sharedHits << " out of " << recoHits << " with purity " << purity << " and completeness "
1517  << completeness << std::endl;
1518  else
1519  std::cout << " (Below threshold) " << sharedHits << " out of " << recoHits << " with purity " << purity
1520  << " and completeness " << completeness << std::endl;
1521  }
1522  if (nodeVector.empty())
1523  {
1524  std::cout << " Unmatched" << std::endl;
1525  }
1526  else if (match.IsQuality(this->GetQualityCuts()))
1527  {
1528  if (pMCNode->IsTestBeamParticle())
1529  ++nTestBeamRecoParticles;
1530  else if (pMCNode->IsCosmicRay())
1531  ++nCosmicRecoParticles;
1532  else
1533  ++nNeutrinoRecoParticles;
1534  }
1535  }
1536 
1537  if (LArMCParticleHelper::IsNeutrino(pRootMC))
1538  {
1539  std::cout << " Neutrino Interaction Summary:" << std::endl;
1540  if (nNeutrinoMCParticles)
1541  {
1542  std::cout << " Good final state particles: " << nNeutrinoRecoParticles << " of " << nNeutrinoMCParticles << " : "
1543  << (100 * nNeutrinoRecoParticles / static_cast<float>(nNeutrinoMCParticles)) << "%" << std::endl;
1544  }
1545  }
1546  else if (LArMCParticleHelper::IsCosmicRay(pRootMC))
1547  {
1548  std::cout << " Cosmic Ray Interaction Summary:" << std::endl;
1549  std::cout << std::fixed << std::setprecision(1);
1550  if (nCosmicMCParticles)
1551  {
1552  std::cout << " Good cosmics: " << nCosmicRecoParticles << " of " << nCosmicMCParticles << " : "
1553  << (100 * nCosmicRecoParticles / static_cast<float>(nCosmicMCParticles)) << "%" << std::endl;
1554  }
1555  }
1556  else if (LArMCParticleHelper::IsBeamParticle(pRootMC))
1557  {
1558  std::cout << " Test Beam Interaction Summary:" << std::endl;
1559  std::cout << std::fixed << std::setprecision(1);
1560  if (nTestBeamMCParticles)
1561  {
1562  std::cout << " Good test beam particles: " << nTestBeamRecoParticles << " of " << nTestBeamMCParticles << " : "
1563  << (100 * nTestBeamRecoParticles / static_cast<float>(nTestBeamMCParticles)) << "%" << std::endl;
1564  }
1565  if (nCosmicMCParticles)
1566  {
1567  std::cout << " Matched cosmics: " << nCosmicRecoParticles << " of " << nCosmicMCParticles << " : "
1568  << (100 * nCosmicRecoParticles / static_cast<float>(nCosmicMCParticles)) << "%" << std::endl;
1569  }
1570  }
1571  if (!this->GetUnmatchedReco().empty())
1572  std::cout << " Unmatched reco: " << this->GetUnmatchedReco().size() << std::endl;
1573  }
1574 }
const MCMatchesVector & GetMatches(const pandora::MCParticle *const pRoot) const
Retrieve the vector of matches (this will include null matches - i.e. MC nodes with no corresponding ...
TFile f
Definition: plotHisto.C:6
unsigned int GetNTestBeamMCNodes(const pandora::MCParticle *const pRoot) const
Retrieve the number of test beam derived MC nodes available to match.
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
const RecoHierarchy::NodeVector & GetUnmatchedReco() const
Retrieve the vector of unmatched reco nodes.
std::vector< MCMatches > MCMatchesVector
unsigned int GetNNeutrinoMCNodes(const pandora::MCParticle *const pRoot) const
Retrieve the number of neutrino interaction derived MC nodes available to match.
static InteractionDescriptor GetInteractionDescriptor(const pandora::MCParticleList &mcPrimaryList)
Get the interaction descriptor of an event.
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
unsigned int GetNCosmicRayMCNodes(const pandora::MCParticle *const pRoot) const
Retrieve the number of cosmic ray derived MC nodes available to match.

Member Data Documentation

InteractionInfo lar_content::LArHierarchyHelper::MatchInfo::m_matches
private

The map between an interaction and the vector of good matches from MC to reco.

Definition at line 852 of file LArHierarchyHelper.h.

Referenced by GetNCosmicRayMCNodes(), GetNMCNodes(), GetNNeutrinoMCNodes(), GetNTestBeamMCNodes(), GetRootMCParticles(), Match(), and Print().

const MCHierarchy& lar_content::LArHierarchyHelper::MatchInfo::m_mcHierarchy
private

The MC hierarchy for the matching procedure.

Definition at line 850 of file LArHierarchyHelper.h.

Referenced by Match().

QualityCuts lar_content::LArHierarchyHelper::MatchInfo::m_qualityCuts
private

The quality cuts to be applied to matches.

Definition at line 854 of file LArHierarchyHelper.h.

Referenced by MatchInfo().

const RecoHierarchy& lar_content::LArHierarchyHelper::MatchInfo::m_recoHierarchy
private

The Reco hierarchy for the matching procedure.

Definition at line 851 of file LArHierarchyHelper.h.

Referenced by Match(), and MatchInfo().

RecoHierarchy::NodeVector lar_content::LArHierarchyHelper::MatchInfo::m_unmatchedReco
private

The vector of unmatched reco nodes.

Definition at line 853 of file LArHierarchyHelper.h.

Referenced by Match().


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