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 
23  void
25  {
27  fMatchMgr->Reset();
28  }
29 
32  detinfo::DetectorClocksData const& clockData,
33  detinfo::DetectorPropertiesData const& detProp,
34  const std::vector<std::vector<util::PxHit>>& clusters,
35  std::vector<::recob::Shower>& showers)
36  {
37  util::GeometryUtilities const gser{geom, clockData, detProp};
38  showers.clear();
39  fMatchMgr->SetClusters(gser, clusters);
40 
41  ClusterAss_t res_ass;
42  // Run matching & retrieve matched cluster indices
43  try {
44  fMatchMgr->Process(gser);
45  }
46  catch (::cmtool::CMTException& e) {
47  e.what();
48  return res_ass;
49  }
50  res_ass = fMatchMgr->GetBookKeeper().GetResult();
51 
52  Process(geom, clockData, detProp, res_ass, showers);
53 
54  return res_ass;
55  }
56 
57  void
59  detinfo::DetectorClocksData const& clockData,
60  detinfo::DetectorPropertiesData const& detProp,
61  const std::vector<std::vector<util::PxHit>>& clusters,
62  const ClusterAss_t& ass,
63  std::vector<::recob::Shower>& showers)
64  {
65  showers.clear();
66  util::GeometryUtilities const gser{geom, clockData, detProp};
67  fMatchMgr->SetClusters(gser, clusters);
68 
69  Process(geom, clockData, detProp, ass, showers);
70  }
71 
72  void
74  detinfo::DetectorClocksData const& clockData,
75  detinfo::DetectorPropertiesData const& detProp,
76  const ClusterAss_t& ass,
77  std::vector<::recob::Shower>& showers)
78  {
79 
80  for (auto const& pair : ass) {
81  std::vector<::cluster::ClusterParamsAlg> cpans;
82 
83  cpans.reserve(pair.size());
84 
85  for (auto const& index : pair)
86  cpans.push_back(fMatchMgr->GetInputClusters()[index]);
87 
89  }
90 
91  // Run shower reco
92  showers = fShowerAlgo->Reconstruct(geom, clockData, detProp);
93  }
94 
95 }
std::vector< std::vector< unsigned int > > ClusterAss_t
Class def header for a class CMatchBookKeeper.
virtual void Reset()
Method to reset itself.
struct vector vector
const char * what() const noexcept override
Definition: CMTException.h:32
::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.
art framework interface to geometry description
virtual void Reset()
Function to reset algorithm, to be called @ beginning of each event.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
const double e
const std::vector< cluster::ClusterParamsAlg > & GetInputClusters() const
A getter for input clusters.
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:54
bool fMatch
Boolean flag to whether or not to run matching.
Description of geometry of one entire detector.
::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.
std::vector< std::vector< unsigned int > > GetResult() const
Method to get result.
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.