LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ShowerRecoManager.cxx
Go to the documentation of this file.
1 #include "ShowerRecoManager.h"
2 
4 
13 
14 namespace showerreco {
15 
16  ShowerRecoManager::ShowerRecoManager() : fShowerAlgo(nullptr), fMatchMgr(nullptr)
17  {
18  fMatch = true;
20  fMatchMgr = new ::cmtool::CMatchManager(geom->Nplanes());
21  }
22 
24  {
26  fMatchMgr->Reset();
27  }
28 
30  detinfo::DetectorClocksData const& clockData,
31  detinfo::DetectorPropertiesData const& detProp,
32  const std::vector<std::vector<util::PxHit>>& clusters,
33  std::vector<::recob::Shower>& showers)
34  {
35  util::GeometryUtilities const gser{geom, clockData, detProp};
36  showers.clear();
37  fMatchMgr->SetClusters(gser, clusters);
38 
39  ClusterAss_t res_ass;
40  // Run matching & retrieve matched cluster indices
41  try {
42  fMatchMgr->Process(gser);
43  }
44  catch (::cmtool::CMTException& e) {
45  e.what();
46  return res_ass;
47  }
48  res_ass = fMatchMgr->GetBookKeeper().GetResult();
49 
50  Process(geom, clockData, detProp, res_ass, showers);
51 
52  return res_ass;
53  }
54 
56  detinfo::DetectorClocksData const& clockData,
57  detinfo::DetectorPropertiesData const& detProp,
58  const std::vector<std::vector<util::PxHit>>& clusters,
59  const ClusterAss_t& ass,
60  std::vector<::recob::Shower>& showers)
61  {
62  showers.clear();
63  util::GeometryUtilities const gser{geom, clockData, detProp};
64  fMatchMgr->SetClusters(gser, clusters);
65 
66  Process(geom, clockData, detProp, ass, showers);
67  }
68 
70  detinfo::DetectorClocksData const& clockData,
71  detinfo::DetectorPropertiesData const& detProp,
72  const ClusterAss_t& ass,
73  std::vector<::recob::Shower>& showers)
74  {
75 
76  for (auto const& pair : ass) {
77  std::vector<::cluster::ClusterParamsAlg> cpans;
78 
79  cpans.reserve(pair.size());
80 
81  for (auto const& index : pair)
82  cpans.push_back(fMatchMgr->GetInputClusters()[index]);
83 
85  }
86 
87  // Run shower reco
88  showers = fShowerAlgo->Reconstruct(geom, clockData, detProp);
89  }
90 
91 }
std::vector< std::vector< unsigned int > > ClusterAss_t
Class def header for a class CMatchBookKeeper.
virtual void Reset()
Method to reset itself.
const char * what() const noexcept override
Definition: CMTException.h:30
::showerreco::ShowerRecoAlgBase * fShowerAlgo
Shower reconstruction algorithm.
virtual void AppendInputClusters(const std::vector< cluster::ClusterParamsAlg > &cpan_v)
Setter for a matched combination of clusters.
std::vector< recob::Shower > Reconstruct(geo::GeometryCore const &geom, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp)
Execute reconstruction.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
virtual void Reset()
Function to reset algorithm, to be called @ beginning of each event.
const std::vector< cluster::ClusterParamsAlg > & GetInputClusters() const
A getter for input clusters.
Definition: CMManagerBase.h:84
void Process(geo::GeometryCore const &geom, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const ClusterAss_t &ass, std::vector<::recob::Shower > &showers)
Class def header for exception classes in CMTException.
const CMatchBookKeeper & GetBookKeeper() const
A method to obtain book keeper.
Definition: CMatchManager.h:49
bool fMatch
Boolean flag to whether or not to run matching.
Description of geometry of one entire detector.
Definition: GeometryCore.h:119
::cmtool::CMatchManager * fMatchMgr
Cluster matching code.
void SetClusters(util::GeometryUtilities const &gser, const std::vector< std::vector< util::PxHit >> &clusters)
A simple method to add a cluster.
Class def header for a class CMatchManager.
Contains all timing reference information for the detector.
void Process(util::GeometryUtilities const &gser)
A method to execute the main action, to be called per event.
Class def header for a class ShowerRecoAlgBase.
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
Definition: GeometryCore.h:977
Float_t e
Definition: plot.C:35
std::vector< std::vector< unsigned int > > GetResult() const
Method to get result.
art framework interface to geometry description
ClusterAss_t Reconstruct(geo::GeometryCore const &geom, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::vector< std::vector< util::PxHit >> &clusters, std::vector<::recob::Shower > &showers)
ShowerRecoManager()
Default constructor.
Class def header for a class ShowerRecoManager.