Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
DlPfoCharacterisationAlgorithm.cc
Go to the documentation of this file.
1
10
13
15
16#include <numeric>
17
18using namespace pandora;
19using namespace lar_content;
20
21namespace lar_dl_content
22{
23
27
28//------------------------------------------------------------------------------------------------------------------------------------------
29
31{
32 const OrderedCaloHitList &orderedCaloHitList{pCluster->GetOrderedCaloHitList()};
33 CaloHitList caloHits;
34 orderedCaloHitList.FillCaloHitList(caloHits);
35 const CaloHitList &isolatedHits{pCluster->GetIsolatedCaloHitList()};
36 caloHits.insert(caloHits.end(), isolatedHits.begin(), isolatedHits.end());
37 FloatVector trackLikelihoods;
38 try
39 {
40 for (const CaloHit *pCaloHit : caloHits)
41 {
42 const LArCaloHit *pLArCaloHit{dynamic_cast<const LArCaloHit *>(pCaloHit)};
43 const float pTrack{pLArCaloHit->GetTrackProbability()};
44 const float pShower{pLArCaloHit->GetShowerProbability()};
45 if ((pTrack + pShower) > std::numeric_limits<float>::epsilon())
46 trackLikelihoods.emplace_back(pTrack / (pTrack + pShower));
47 }
48
49 const unsigned long N{trackLikelihoods.size()};
50 if (N > 0)
51 {
52 float mean{std::accumulate(std::begin(trackLikelihoods), std::end(trackLikelihoods), 0.f) / N};
53 if (mean >= 0.5f)
54 return true;
55 else
56 return false;
57 }
58 }
59 catch (const StatusCodeException &)
60 {
61 }
62
63 return true;
64}
65
66//------------------------------------------------------------------------------------------------------------------------------------------
67
69{
70 ClusterList allClusters;
71 LArPfoHelper::GetTwoDClusterList(pPfo, allClusters);
72 FloatVector trackLikelihoods;
73 for (const Cluster *pCluster : allClusters)
74 {
75 const OrderedCaloHitList &orderedCaloHitList{pCluster->GetOrderedCaloHitList()};
76 CaloHitList caloHits;
77 orderedCaloHitList.FillCaloHitList(caloHits);
78 const CaloHitList &isolatedHits{pCluster->GetIsolatedCaloHitList()};
79 caloHits.insert(caloHits.end(), isolatedHits.begin(), isolatedHits.end());
80 try
81 {
82 for (const CaloHit *pCaloHit : caloHits)
83 {
84 const LArCaloHit *pLArCaloHit{dynamic_cast<const LArCaloHit *>(pCaloHit)};
85 const float pTrack{pLArCaloHit->GetTrackProbability()};
86 const float pShower{pLArCaloHit->GetShowerProbability()};
87 if ((pTrack + pShower) > std::numeric_limits<float>::epsilon())
88 trackLikelihoods.emplace_back(pTrack / (pTrack + pShower));
89 }
90 }
91 catch (const StatusCodeException &)
92 {
93 }
94 }
95
96 const unsigned long N{trackLikelihoods.size()};
97 if (N > 0)
98 {
99 float mean{std::accumulate(std::begin(trackLikelihoods), std::end(trackLikelihoods), 0.f) / N};
100 if (mean >= 0.5f)
101 return true;
102 else
103 return false;
104 }
105
106 return true;
107}
108
109//------------------------------------------------------------------------------------------------------------------------------------------
110
115
116} // namespace lar_dl_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cut based pfo characterisation algorithm class.
Header file for the lar calo hit class.
Header file for the pfo helper class.
LAr calo hit class.
Definition LArCaloHit.h:40
float GetTrackProbability() const
Get the probability that the hit is track-like.
Definition LArCaloHit.h:210
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
bool IsClearTrack(const pandora::Cluster *const pCluster) const
Whether cluster is identified as a clear track.
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.
ParticleFlowObject class.
StatusCodeException class.
MANAGED_CONTAINER< const Cluster * > ClusterList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
std::vector< float > FloatVector
StatusCode
The StatusCode enum.