Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
DlClusterCharacterisationAlgorithm.cc
Go to the documentation of this file.
1
10
12
14
15#include <numeric>
16
17using namespace pandora;
18using namespace lar_content;
19
20namespace lar_dl_content
21{
22
26
27//------------------------------------------------------------------------------------------------------------------------------------------
28
32
33//------------------------------------------------------------------------------------------------------------------------------------------
34
36{
37 const OrderedCaloHitList &orderedCaloHitList{pCluster->GetOrderedCaloHitList()};
38 CaloHitList caloHits;
39 orderedCaloHitList.FillCaloHitList(caloHits);
40 const CaloHitList &isolatedHits{pCluster->GetIsolatedCaloHitList()};
41 caloHits.insert(caloHits.end(), isolatedHits.begin(), isolatedHits.end());
42 FloatVector trackLikelihoods;
43 try
44 {
45 for (const CaloHit *pCaloHit : caloHits)
46 {
47 const LArCaloHit *pLArCaloHit{dynamic_cast<const LArCaloHit *>(pCaloHit)};
48 const float pTrack{pLArCaloHit->GetTrackProbability()};
49 const float pShower{pLArCaloHit->GetShowerProbability()};
50 if ((pTrack + pShower) > std::numeric_limits<float>::epsilon())
51 trackLikelihoods.emplace_back(pTrack / (pTrack + pShower));
52 }
53
54 const unsigned long N{trackLikelihoods.size()};
55 if (N > 0)
56 {
57 float mean{std::accumulate(std::begin(trackLikelihoods), std::end(trackLikelihoods), 0.f) / N};
58 if (mean >= 0.5f)
59 return true;
60 else
61 return false;
62 }
63 }
64 catch (const StatusCodeException &)
65 {
66 }
67
68 return true;
69}
70
71//------------------------------------------------------------------------------------------------------------------------------------------
72
77
78} // namespace lar_dl_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the lar calo hit class.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
LAr calo hit class.
Definition LArCaloHit.h:40
float GetTrackProbability() const
Get the probability that the hit is track-like.
Definition LArCaloHit.h:210
bool IsClearTrack(const pandora::Cluster *const pCluster) const
Whether cluster is identified as a clear track.
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.
MANAGED_CONTAINER< const CaloHit * > CaloHitList
std::vector< float > FloatVector
StatusCode
The StatusCode enum.