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

DlTrackShowerStreamSelectionAlgorithm class. More...

#include "DlTrackShowerStreamSelectionAlgorithm.h"

Inheritance diagram for lar_dl_content::DlTrackShowerStreamSelectionAlgorithm:
lar_content::StreamSelectionAlgorithm

Public Member Functions

 DlTrackShowerStreamSelectionAlgorithm ()=default
 Default constructor. More...
 
virtual ~DlTrackShowerStreamSelectionAlgorithm ()=default
 

Protected Types

typedef std::map< std::string, pandora::ClusterList > ClusterListMap
 

Protected Member Functions

virtual pandora::StatusCode AllocateToStreams (const pandora::Cluster *const pCluster)
 Allocate a cluster to the appropriate streams. More...
 

Protected Attributes

std::string m_inputListName
 The input list name if not using the current list. More...
 
std::string m_listType
 The type of the input lists (currently only Cluster is supported) More...
 
pandora::StringVector m_listNames
 The name of the output lists. More...
 
ClusterListMap m_clusterListMap
 The map from cluster list names to cluster lists. More...
 

Private Member Functions

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

Private Attributes

std::string m_trackListName
 The name of the track list. More...
 
std::string m_showerListName
 The name of the shower list. More...
 

Detailed Description

Member Typedef Documentation

typedef std::map<std::string, pandora::ClusterList> lar_content::StreamSelectionAlgorithm::ClusterListMap
protectedinherited

Definition at line 30 of file StreamSelectionAlgorithm.h.

Constructor & Destructor Documentation

lar_dl_content::DlTrackShowerStreamSelectionAlgorithm::DlTrackShowerStreamSelectionAlgorithm ( )
default

Default constructor.

virtual lar_dl_content::DlTrackShowerStreamSelectionAlgorithm::~DlTrackShowerStreamSelectionAlgorithm ( )
virtualdefault

Member Function Documentation

StatusCode lar_dl_content::DlTrackShowerStreamSelectionAlgorithm::AllocateToStreams ( const pandora::Cluster *const  pCluster)
protectedvirtual

Allocate a cluster to the appropriate streams.

Parameters
pClusterThe cluster to allocate to a stream
Returns
The StatusCode

Implements lar_content::StreamSelectionAlgorithm.

Definition at line 26 of file DlTrackShowerStreamSelectionAlgorithm.cc.

References util::begin(), util::end(), f, lar_content::LArCaloHit::GetTrackProbability(), and pmtana::mean().

27 {
28  const OrderedCaloHitList &orderedCaloHitList{pCluster->GetOrderedCaloHitList()};
29  CaloHitList caloHits;
30  orderedCaloHitList.FillCaloHitList(caloHits);
31  const CaloHitList &isolatedHits{pCluster->GetIsolatedCaloHitList()};
32  caloHits.insert(caloHits.end(), isolatedHits.begin(), isolatedHits.end());
33  FloatVector trackLikelihoods;
34  try
35  {
36  for (const CaloHit *pCaloHit : caloHits)
37  {
38  const LArCaloHit *pLArCaloHit{dynamic_cast<const LArCaloHit *>(pCaloHit)};
39  const float pTrack{pLArCaloHit->GetTrackProbability()};
40  const float pShower{pLArCaloHit->GetShowerProbability()};
41  if ((pTrack + pShower) > std::numeric_limits<float>::epsilon())
42  trackLikelihoods.emplace_back(pTrack / (pTrack + pShower));
43  }
44 
45  const unsigned long N{trackLikelihoods.size()};
46  if (N > 0)
47  {
48  float mean{std::accumulate(std::begin(trackLikelihoods), std::end(trackLikelihoods), 0.f) / N};
49  if (mean >= 0.5f)
50  m_clusterListMap.at(m_trackListName).emplace_back(pCluster);
51  else
52  m_clusterListMap.at(m_showerListName).emplace_back(pCluster);
53  }
54  }
55  catch (const StatusCodeException &)
56  {
57  }
58 
59  return STATUS_CODE_SUCCESS;
60 }
LAr calo hit class.
Definition: LArCaloHit.h:39
TFile f
Definition: plotHisto.C:6
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
ClusterListMap m_clusterListMap
The map from cluster list names to cluster lists.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
float GetTrackProbability() const
Get the probability that the hit is track-like.
Definition: LArCaloHit.h:210
StatusCode lar_dl_content::DlTrackShowerStreamSelectionAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 63 of file DlTrackShowerStreamSelectionAlgorithm.cc.

64 {
65  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, StreamSelectionAlgorithm::ReadSettings(xmlHandle));
66  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "TrackListName", m_trackListName));
67  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "ShowerListName", m_showerListName));
68 
69  m_listNames.emplace_back(m_trackListName);
70  m_listNames.emplace_back(m_showerListName);
71 
72  return STATUS_CODE_SUCCESS;
73 }
pandora::StringVector m_listNames
The name of the output lists.

Member Data Documentation

ClusterListMap lar_content::StreamSelectionAlgorithm::m_clusterListMap
protectedinherited

The map from cluster list names to cluster lists.

Definition at line 46 of file StreamSelectionAlgorithm.h.

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

std::string lar_content::StreamSelectionAlgorithm::m_inputListName
protectedinherited

The input list name if not using the current list.

Definition at line 43 of file StreamSelectionAlgorithm.h.

Referenced by lar_content::StreamSelectionAlgorithm::ReadSettings(), and lar_content::StreamSelectionAlgorithm::Run().

pandora::StringVector lar_content::StreamSelectionAlgorithm::m_listNames
protectedinherited
std::string lar_content::StreamSelectionAlgorithm::m_listType
protectedinherited

The type of the input lists (currently only Cluster is supported)

Definition at line 44 of file StreamSelectionAlgorithm.h.

Referenced by lar_content::StreamSelectionAlgorithm::ReadSettings(), and lar_content::StreamSelectionAlgorithm::StreamSelectionAlgorithm().

std::string lar_dl_content::DlTrackShowerStreamSelectionAlgorithm::m_showerListName
private

The name of the shower list.

Definition at line 45 of file DlTrackShowerStreamSelectionAlgorithm.h.

std::string lar_dl_content::DlTrackShowerStreamSelectionAlgorithm::m_trackListName
private

The name of the track list.

Definition at line 44 of file DlTrackShowerStreamSelectionAlgorithm.h.


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