Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
DlTrackShowerStreamSelectionAlgorithm.cc
Go to the documentation of this file.
1
10
12
15
17
18#include <numeric>
19
20using namespace pandora;
21using namespace lar_content;
22
23namespace lar_dl_content
24{
25
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}
61//------------------------------------------------------------------------------------------------------------------------------------------
62
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}
74
75} // namespace lar_dl_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the deep learning track shower cluster streaming algorithm.
Header file for the lar calo hit class.
Header file for the lar monte carlo particle helper helper class.
Header file for the lar monitoring helper helper class.
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
LAr calo hit class.
Definition LArCaloHit.h:40
float GetTrackProbability() const
Get the probability that the hit is track-like.
Definition LArCaloHit.h:210
pandora::StringVector m_listNames
The name of the output lists.
ClusterListMap m_clusterListMap
The map from cluster list names to cluster lists.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
virtual pandora::StatusCode AllocateToStreams(const pandora::Cluster *const pCluster)
Allocate a cluster to the appropriate streams.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
CaloHit class.
Definition CaloHit.h:26
Cluster class.
Definition Cluster.h:31
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
Definition Cluster.h:470
const CaloHitList & GetIsolatedCaloHitList() const
Get the isolated calo hit list.
Definition Cluster.h:477
Calo hit lists arranged by pseudo layer.
void FillCaloHitList(CaloHitList &caloHitList) const
Fill a provided calo hit list with all the calo hits in the ordered calo hit list.
StatusCodeException class.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
MANAGED_CONTAINER< const CaloHit * > CaloHitList
std::vector< float > FloatVector
StatusCode
The StatusCode enum.