LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DlClusterCharacterisationAlgorithm.cc
Go to the documentation of this file.
1 
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
Header file for the lar calo hit class.
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
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