DlClusterCharacterisationAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArTrackShowerId/DlClusterCharacterisationAlgorithm.cc
3  *
4  * @brief Implementation of the deep learning based cluster characterisation algorithm class.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
14 
15 #include <numeric>
16 
17 using namespace pandora;
18 using namespace lar_content;
19 
20 namespace lar_dl_content
21 {
22 
23 DlClusterCharacterisationAlgorithm::DlClusterCharacterisationAlgorithm()
24 {
25 }
26 
27 //------------------------------------------------------------------------------------------------------------------------------------------
28 
29 DlClusterCharacterisationAlgorithm::~DlClusterCharacterisationAlgorithm()
30 {
31 }
32 
33 //------------------------------------------------------------------------------------------------------------------------------------------
34 
35 bool DlClusterCharacterisationAlgorithm::IsClearTrack(const Cluster *const pCluster) const
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 
73 StatusCode DlClusterCharacterisationAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
74 {
75  return ClusterCharacterisationBaseAlgorithm::ReadSettings(xmlHandle);
76 }
77 
78 } // namespace lar_dl_content
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Header file for the lar calo hit class.
LAr calo hit class.
Definition: LArCaloHit.h:39
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
Dft::FloatVector FloatVector
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16
float GetTrackProbability() const
Get the probability that the hit is track-like.
Definition: LArCaloHit.h:210