LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_dl_content::DlHitValidationAlgorithm Class Reference

DlHitValidationlgorithm class. More...

#include "DlHitValidationAlgorithm.h"

Inheritance diagram for lar_dl_content::DlHitValidationAlgorithm:

Public Member Functions

 DlHitValidationAlgorithm ()
 Default constructor. More...
 
virtual ~DlHitValidationAlgorithm ()
 

Private Member Functions

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

Private Attributes

pandora::StringVector m_caloHitListNames
 Name of input calo hit list. More...
 
int m_confusionU [2][2]
 Confusion matrix for the U view. More...
 
int m_confusionV [2][2]
 Confusion matrix for the V view. More...
 
int m_confusionW [2][2]
 Confusion matrix for the W view. More...
 

Detailed Description

DlHitValidationlgorithm class.

Definition at line 19 of file DlHitValidationAlgorithm.h.

Constructor & Destructor Documentation

lar_dl_content::DlHitValidationAlgorithm::DlHitValidationAlgorithm ( )

Default constructor.

Definition at line 24 of file DlHitValidationAlgorithm.cc.

24  :
25  m_confusionU(),
26  m_confusionV(),
27  m_confusionW()
28 {
29 }
int m_confusionW[2][2]
Confusion matrix for the W view.
int m_confusionU[2][2]
Confusion matrix for the U view.
int m_confusionV[2][2]
Confusion matrix for the V view.
lar_dl_content::DlHitValidationAlgorithm::~DlHitValidationAlgorithm ( )
virtual

Definition at line 33 of file DlHitValidationAlgorithm.cc.

References m_confusionU, m_confusionV, and m_confusionW.

34 {
35  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "u_true_shower", m_confusionU[0][0]));
36  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "u_false_shower", m_confusionU[1][0]));
37  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "u_false_track", m_confusionU[0][1]));
38  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "u_true_track", m_confusionU[1][1]));
39  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "v_true_shower", m_confusionV[0][0]));
40  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "v_false_shower", m_confusionV[1][0]));
41  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "v_false_track", m_confusionV[0][1]));
42  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "v_true_track", m_confusionV[1][1]));
43  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "w_true_shower", m_confusionW[0][0]));
44  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "w_false_shower", m_confusionW[1][0]));
45  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "w_false_track", m_confusionW[0][1]));
46  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "confusion_tree", "w_true_track", m_confusionW[1][1]));
47  PANDORA_MONITORING_API(FillTree(this->GetPandora(), "confusion_tree"));
48  try
49  {
50  PANDORA_MONITORING_API(SaveTree(this->GetPandora(), "confusion_tree", "confusion.root", "UPDATE"));
51  }
52  catch (const StatusCodeException &)
53  {
54  std::cout << "DlHitValidationAlgorithm: Unable to write confusion_tree to file" << std::endl;
55  }
56 }
int m_confusionW[2][2]
Confusion matrix for the W view.
int m_confusionU[2][2]
Confusion matrix for the U view.
int m_confusionV[2][2]
Confusion matrix for the V view.

Member Function Documentation

StatusCode lar_dl_content::DlHitValidationAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 114 of file DlHitValidationAlgorithm.cc.

References m_caloHitListNames.

115 {
116  PANDORA_RETURN_RESULT_IF_AND_IF(
117  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "CaloHitListNames", m_caloHitListNames));
118 
119  return STATUS_CODE_SUCCESS;
120 }
pandora::StringVector m_caloHitListNames
Name of input calo hit list.
StatusCode lar_dl_content::DlHitValidationAlgorithm::Run ( )
private

Definition at line 60 of file DlHitValidationAlgorithm.cc.

References util::abs(), lar_content::LArCaloHit::GetTrackProbability(), m_caloHitListNames, m_confusionU, m_confusionV, m_confusionW, lar_content::LArMCParticleHelper::PrimaryParameters::m_maxPhotonPropagation, and lar_content::LArMCParticleHelper::PrimaryParameters::m_minHitsForGoodView.

61 {
62  const int SHOWER_IDX{0}, TRACK_IDX{1};
63  for (const std::string &listName : m_caloHitListNames)
64  {
65  const CaloHitList *pCaloHitList(nullptr);
66  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, listName, pCaloHitList));
67  const MCParticleList *pMCParticleList(nullptr);
68  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pMCParticleList));
69 
70  const HitType view{pCaloHitList->front()->GetHitType()};
71 
72  if (!(view == TPC_VIEW_U || view == TPC_VIEW_V || view == TPC_VIEW_W))
73  return STATUS_CODE_NOT_ALLOWED;
74 
76  // Only care about reconstructability with respect to the current view, so skip good view check
77  parameters.m_minHitsForGoodView = 0;
78  // Turn off max photo propagation for now, only care about killing off daughters of neutrons
79  parameters.m_maxPhotonPropagation = std::numeric_limits<float>::max();
80  LArMCParticleHelper::MCContributionMap targetMCParticleToHitsMap;
81  LArMCParticleHelper::SelectReconstructableMCParticles(
82  pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsBeamNeutrinoFinalState, targetMCParticleToHitsMap);
83 
84  for (const CaloHit *pCaloHit : *pCaloHitList)
85  {
86  try
87  {
88  const MCParticle *const pMCParticle(MCParticleHelper::GetMainMCParticle(pCaloHit));
89  const int pdg{std::abs(pMCParticle->GetParticleId())};
90  const int truth{(pdg == 11 || pdg == 22) ? SHOWER_IDX : TRACK_IDX};
91  const LArCaloHit *pLArCaloHit{dynamic_cast<const LArCaloHit *>(pCaloHit)};
92  const float pTrack{pLArCaloHit->GetTrackProbability()};
93  const float pShower{pLArCaloHit->GetShowerProbability()};
94  const int cls{(pShower > pTrack) ? SHOWER_IDX : TRACK_IDX};
95  if (view == TPC_VIEW_U)
96  ++m_confusionU[truth][cls];
97  else if (view == TPC_VIEW_V)
98  ++m_confusionV[truth][cls];
99  else
100  ++m_confusionW[truth][cls];
101  }
102  catch (const StatusCodeException &)
103  {
104  continue;
105  }
106  }
107  }
108 
109  return STATUS_CODE_SUCCESS;
110 }
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
int m_confusionW[2][2]
Confusion matrix for the W view.
constexpr auto abs(T v)
Returns the absolute value of the argument.
pandora::StringVector m_caloHitListNames
Name of input calo hit list.
int m_confusionU[2][2]
Confusion matrix for the U view.
LAr calo hit class.
Definition: LArCaloHit.h:39
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
float m_maxPhotonPropagation
the maximum photon propagation length
int m_confusionV[2][2]
Confusion matrix for the V view.
HitType
Definition: HitType.h:12
float GetTrackProbability() const
Get the probability that the hit is track-like.
Definition: LArCaloHit.h:210

Member Data Documentation

pandora::StringVector lar_dl_content::DlHitValidationAlgorithm::m_caloHitListNames
private

Name of input calo hit list.

Definition at line 33 of file DlHitValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

int lar_dl_content::DlHitValidationAlgorithm::m_confusionU[2][2]
private

Confusion matrix for the U view.

Definition at line 34 of file DlHitValidationAlgorithm.h.

Referenced by Run(), and ~DlHitValidationAlgorithm().

int lar_dl_content::DlHitValidationAlgorithm::m_confusionV[2][2]
private

Confusion matrix for the V view.

Definition at line 35 of file DlHitValidationAlgorithm.h.

Referenced by Run(), and ~DlHitValidationAlgorithm().

int lar_dl_content::DlHitValidationAlgorithm::m_confusionW[2][2]
private

Confusion matrix for the W view.

Definition at line 36 of file DlHitValidationAlgorithm.h.

Referenced by Run(), and ~DlHitValidationAlgorithm().


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