LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::PfoValidationAlgorithm Class Reference

PfoValidationAlgorithm class. More...

#include "PfoValidationAlgorithm.h"

Inheritance diagram for lar_content::PfoValidationAlgorithm:

Public Member Functions

 PfoValidationAlgorithm ()
 Default constructor. More...
 

Private Member Functions

pandora::StatusCode Run ()
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

std::string m_caloHitListName
 Name of input calo hit list. More...
 
std::string m_pfoListName
 Name of input pfo list. More...
 
LArMCParticleHelper::PrimaryParameters m_parameters
 Parameters used to decide when an MCParticle is reconstructable. More...
 
unsigned int m_nMatchesToShow
 The maximum number of MCParticle to Pfo matches to show. More...
 

Detailed Description

PfoValidationAlgorithm class.

Definition at line 19 of file PfoValidationAlgorithm.h.

Constructor & Destructor Documentation

lar_content::PfoValidationAlgorithm::PfoValidationAlgorithm ( )

Default constructor.

Definition at line 23 of file PfoValidationAlgorithm.cc.

23  :
25 {
26 }
unsigned int m_nMatchesToShow
The maximum number of MCParticle to Pfo matches to show.

Member Function Documentation

StatusCode lar_content::PfoValidationAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 97 of file PfoValidationAlgorithm.cc.

References m_caloHitListName, lar_content::LArMCParticleHelper::PrimaryParameters::m_maxPhotonPropagation, lar_content::LArMCParticleHelper::PrimaryParameters::m_minHitsForGoodView, lar_content::LArMCParticleHelper::PrimaryParameters::m_minHitSharingFraction, lar_content::LArMCParticleHelper::PrimaryParameters::m_minPrimaryGoodHits, lar_content::LArMCParticleHelper::PrimaryParameters::m_minPrimaryGoodViews, m_nMatchesToShow, m_parameters, m_pfoListName, and lar_content::LArMCParticleHelper::PrimaryParameters::m_selectInputHits.

98 {
99  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "CaloHitListName", m_caloHitListName));
100  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "PfoListName", m_pfoListName));
101 
102  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
103  "MinPrimaryGoodHits", m_parameters.m_minPrimaryGoodHits));
104 
105  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
106  "MinHitsForGoodView", m_parameters.m_minHitsForGoodView));
107 
108  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
109  "MinPrimaryGoodViews", m_parameters.m_minPrimaryGoodViews));
110 
111  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
112  "SelectInputHits", m_parameters.m_selectInputHits));
113 
114  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
115  "MaxPhotonPropagation", m_parameters.m_maxPhotonPropagation));
116 
117  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
118  "MinHitSharingFraction", m_parameters.m_minHitSharingFraction));
119 
120  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
121  "NumMatchesToShow", m_nMatchesToShow));
122 
123  return STATUS_CODE_SUCCESS;
124 }
unsigned int m_minPrimaryGoodViews
the minimum number of primary good views
bool m_selectInputHits
whether to select input hits
unsigned int m_minPrimaryGoodHits
the minimum number of primary good Hits
unsigned int m_nMatchesToShow
The maximum number of MCParticle to Pfo matches to show.
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
float m_maxPhotonPropagation
the maximum photon propagation length
float m_minHitSharingFraction
the minimum Hit sharing fraction
LArMCParticleHelper::PrimaryParameters m_parameters
Parameters used to decide when an MCParticle is reconstructable.
std::string m_caloHitListName
Name of input calo hit list.
std::string m_pfoListName
Name of input pfo list.
StatusCode lar_content::PfoValidationAlgorithm::Run ( )
private

Definition at line 30 of file PfoValidationAlgorithm.cc.

References lar_content::LArMonitoringHelper::GetOrderedMCParticleVector(), lar_content::LArMonitoringHelper::GetOrderedPfoVector(), lar_content::LArMCParticleHelper::GetPfoMCParticleHitSharingMaps(), lar_content::LArMCParticleHelper::GetPfoToReconstructable2DHitsMap(), lar_content::LArMCParticleHelper::IsBeamNeutrinoFinalState(), lar_content::LArMCParticleHelper::IsBeamParticle(), lar_content::LArMCParticleHelper::IsCosmicRay(), lar_content::LArPfoHelper::IsFinalState(), m_caloHitListName, m_nMatchesToShow, m_parameters, m_pfoListName, lar_content::LArFormattingHelper::PrintHeader(), lar_content::LArMonitoringHelper::PrintMatchingTable(), lar_content::LArMonitoringHelper::PrintMCParticleTable(), lar_content::LArMonitoringHelper::PrintPfoTable(), and lar_content::LArMCParticleHelper::SelectReconstructableMCParticles().

31 {
32  const MCParticleList *pMCParticleList = nullptr;
33  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pMCParticleList));
34 
35  const CaloHitList *pCaloHitList = nullptr;
36  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_caloHitListName, pCaloHitList));
37 
38  const PfoList *pPfoList = nullptr;
39  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_pfoListName, pPfoList));
40 
41  // Identify reconstructable MCParticles, and get mappings to their good hits
42  LArMCParticleHelper::MCContributionMap nuMCParticlesToGoodHitsMap;
43  LArMCParticleHelper::MCContributionMap beamMCParticlesToGoodHitsMap;
44  LArMCParticleHelper::MCContributionMap crMCParticlesToGoodHitsMap;
45 
47  LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, m_parameters, LArMCParticleHelper::IsBeamParticle, beamMCParticlesToGoodHitsMap);
48  LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, m_parameters, LArMCParticleHelper::IsCosmicRay, crMCParticlesToGoodHitsMap);
49 
50  const LArMCParticleHelper::MCContributionMapVector mcParticlesToGoodHitsMaps{nuMCParticlesToGoodHitsMap, beamMCParticlesToGoodHitsMap, crMCParticlesToGoodHitsMap};
51 
52  // Get the mappings detailing the hits shared between Pfos and reconstructable MCParticles
53  PfoList finalStatePfos;
54 
55  for (const ParticleFlowObject *const pPfo : *pPfoList)
56  {
58  finalStatePfos.push_back(pPfo);
59  }
60 
61  LArMCParticleHelper::PfoContributionMap pfoToReconstructable2DHitsMap;
62  LArMCParticleHelper::GetPfoToReconstructable2DHitsMap(finalStatePfos, mcParticlesToGoodHitsMaps, pfoToReconstructable2DHitsMap);
63 
64  LArMCParticleHelper::PfoToMCParticleHitSharingMap pfoToMCParticleHitSharingMap;
65  LArMCParticleHelper::MCParticleToPfoHitSharingMap mcParticleToPfoHitSharingMap;
66  LArMCParticleHelper::GetPfoMCParticleHitSharingMaps(pfoToReconstructable2DHitsMap, mcParticlesToGoodHitsMaps, pfoToMCParticleHitSharingMap, mcParticleToPfoHitSharingMap);
67 
68  // Print the monte-carlo information for this event
69  MCParticleVector orderedMCParticleVector;
70  LArMonitoringHelper::GetOrderedMCParticleVector(mcParticlesToGoodHitsMaps, orderedMCParticleVector);
71 
72  LArFormattingHelper::PrintHeader("MC : Reconstructable neutrino final state particles");
73  LArMonitoringHelper::PrintMCParticleTable(nuMCParticlesToGoodHitsMap, orderedMCParticleVector);
74 
75  LArFormattingHelper::PrintHeader("MC : Reconstructable primary beam particles");
76  LArMonitoringHelper::PrintMCParticleTable(beamMCParticlesToGoodHitsMap, orderedMCParticleVector);
77 
78  LArFormattingHelper::PrintHeader("MC : Reconstructable primary cosmic-rays");
79  LArMonitoringHelper::PrintMCParticleTable(crMCParticlesToGoodHitsMap, orderedMCParticleVector);
80 
81  // Print the pfo information for this event
82  PfoVector orderedPfoVector;
83  LArMonitoringHelper::GetOrderedPfoVector(pfoToReconstructable2DHitsMap, orderedPfoVector);
84 
85  LArFormattingHelper::PrintHeader("Reco : Primary Pfos");
86  LArMonitoringHelper::PrintPfoTable(pfoToReconstructable2DHitsMap, orderedPfoVector);
87 
88  // Print the raw matching between Pfos and MCParticles
89  LArFormattingHelper::PrintHeader("Raw Reco vs. MC matching");
90  LArMonitoringHelper::PrintMatchingTable(orderedPfoVector, orderedMCParticleVector, mcParticleToPfoHitSharingMap, m_nMatchesToShow);
91 
92  return STATUS_CODE_SUCCESS;
93 }
static void PrintMCParticleTable(const LArMCParticleHelper::MCContributionMap &selectedMCParticleToGoodHitsMaps, const pandora::MCParticleVector &orderedMCParticleVector)
Print details of selected MCParticles to the terminal in a table.
static void GetPfoMCParticleHitSharingMaps(const PfoContributionMap &pfoToReconstructable2DHitsMap, const MCContributionMapVector &selectedMCParticleToHitsMaps, PfoToMCParticleHitSharingMap &pfoToMCParticleHitSharingMap, MCParticleToPfoHitSharingMap &mcParticleToPfoHitSharingMap)
Get the mappings from Pfo -> pair (reconstructable MCparticles, number of reconstructable 2D hits sha...
unsigned int m_nMatchesToShow
The maximum number of MCParticle to Pfo matches to show.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
static void GetOrderedMCParticleVector(const LArMCParticleHelper::MCContributionMapVector &selectedMCParticleToGoodHitsMaps, pandora::MCParticleVector &orderedMCParticleVector)
Order input MCParticles by their number of hits.
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
static void SelectReconstructableMCParticles(const pandora::MCParticleList *pMCParticleList, const pandora::CaloHitList *pCaloHitList, const PrimaryParameters &parameters, std::function< bool(const pandora::MCParticle *const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap)
Select primary, reconstructable mc particles that match given criteria.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
static void GetPfoToReconstructable2DHitsMap(const pandora::PfoList &pfoList, const MCContributionMap &selectedMCParticleToHitsMap, PfoContributionMap &pfoToReconstructable2DHitsMap)
Get mapping from Pfo to reconstructable 2D hits (=good hits belonging to a selected reconstructable M...
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
static void PrintHeader(const std::string &title="", const unsigned int width=140)
Print a header line of a given width.
std::map< const pandora::MCParticle *, PfoToSharedHitsVector > MCParticleToPfoHitSharingMap
static void GetOrderedPfoVector(const LArMCParticleHelper::PfoContributionMap &pfoToReconstructable2DHitsMap, pandora::PfoVector &orderedPfoVector)
Order input Pfos by their number of hits.
std::vector< MCContributionMap > MCContributionMapVector
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
LArMCParticleHelper::PrimaryParameters m_parameters
Parameters used to decide when an MCParticle is reconstructable.
static bool IsFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a primary parent particle.
std::string m_caloHitListName
Name of input calo hit list.
static void PrintMatchingTable(const pandora::PfoVector &orderedPfoVector, const pandora::MCParticleVector &orderedMCParticleVector, const LArMCParticleHelper::MCParticleToPfoHitSharingMap &mcParticleToPfoHitSharingMap, const unsigned int nMatches)
Print the shared good hits between all Pfos and MCParticles.
std::string m_pfoListName
Name of input pfo list.
std::unordered_map< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoContributionMap
static bool IsBeamNeutrinoFinalState(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary neutrino final state MCParticle.
static void PrintPfoTable(const LArMCParticleHelper::PfoContributionMap &pfoToReconstructable2DHitsMap, const pandora::PfoVector &orderedPfoVector)
Print details of input Pfos to the terminal in a table.

Member Data Documentation

std::string lar_content::PfoValidationAlgorithm::m_caloHitListName
private

Name of input calo hit list.

Definition at line 31 of file PfoValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

unsigned int lar_content::PfoValidationAlgorithm::m_nMatchesToShow
private

The maximum number of MCParticle to Pfo matches to show.

Definition at line 34 of file PfoValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

LArMCParticleHelper::PrimaryParameters lar_content::PfoValidationAlgorithm::m_parameters
private

Parameters used to decide when an MCParticle is reconstructable.

Definition at line 33 of file PfoValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

std::string lar_content::PfoValidationAlgorithm::m_pfoListName
private

Name of input pfo list.

Definition at line 32 of file PfoValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().


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