LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ShowerRecoManager.cxx
Go to the documentation of this file.
1 #ifndef SHOWERRECOMANAGER_CXX
2 #define SHOWERRECOMANAGER_CXX
3 
4 #include "ShowerRecoManager.h"
5 
6 namespace showerreco {
7 
9  : fShowerAlgo(nullptr)
10  , fMatchMgr(nullptr)
11  {
12  fMatch = true;
13  //auto geom = ::larutil::Geometry::GetME();
15  fMatchMgr = new ::cmtool::CMatchManager(geom->Nplanes());
16  }
17 
19  {
21  fMatchMgr->Reset();
22  }
23 
24  ClusterAss_t ShowerRecoManager::Reconstruct (const std::vector<std::vector<util::PxHit> >& clusters,
25  std::vector< ::recob::Shower>& showers)
26  {
27  showers.clear();
28  fMatchMgr->SetClusters(clusters);
29 
30  ClusterAss_t res_ass;
31  // Run matching & retrieve matched cluster indices
32  try{
33  fMatchMgr->Process();
34  }catch( ::cmtool::CMTException &e){
35  e.what();
36  return res_ass;
37  }
38  res_ass = fMatchMgr->GetBookKeeper().GetResult();
39 
40  Process(res_ass, showers);
41 
42  return res_ass;
43  }
44 
45  void ShowerRecoManager::Reconstruct (const std::vector<std::vector<util::PxHit> >& clusters,
46  const ClusterAss_t& ass,
47  std::vector< ::recob::Shower>& showers)
48  {
49  showers.clear();
50  fMatchMgr->SetClusters(clusters);
51 
52  Process(ass,showers);
53  }
54 
56  std::vector< ::recob::Shower>& showers)
57  {
58 
59  for(auto const& pair : ass) {
60 
61  std::vector< ::cluster::ClusterParamsAlg> cpans;
62 
63  cpans.reserve(pair.size());
64 
65  for(auto const& index : pair)
66 
67  cpans.push_back(fMatchMgr->GetInputClusters()[index]);
68 
70  }
71 
72  // Run shower reco
73  showers = fShowerAlgo->Reconstruct();
74  }
75 
76 }
77 
78 #endif
std::vector< std::vector< unsigned int > > ClusterAss_t
virtual void Reset()
Method to reset itself.
void SetClusters(const std::vector< std::vector< util::PxHit > > &clusters)
A simple method to add a cluster.
::showerreco::ShowerRecoAlgBase * fShowerAlgo
Shower reconstruction algorithm.
virtual void AppendInputClusters(const std::vector< cluster::ClusterParamsAlg > &cpan_v)
Setter for a matched combination of clusters.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
const std::vector< cluster::ClusterParamsAlg > & GetInputClusters() const
A getter for input clusters.
Definition: CMManagerBase.h:76
void Process()
A method to execute the main action, to be called per event.
const CMatchBookKeeper & GetBookKeeper() const
A method to obtain book keeper.
Definition: CMatchManager.h:51
bool fMatch
Boolean flag to whether or not to run matching.
ClusterAss_t Reconstruct(const std::vector< std::vector< util::PxHit > > &clusters, std::vector< ::recob::Shower > &showers)
::cmtool::CMatchManager * fMatchMgr
Cluster matching code.
std::vector< recob::Shower > Reconstruct()
Execute reconstruction.
Float_t e
Definition: plot.C:34
virtual const char * what() const
Definition: CMTException.h:33
std::vector< std::vector< unsigned int > > GetResult() const
Method to get result.
void Process(const ClusterAss_t &ass, std::vector< ::recob::Shower > &showers)
virtual void Reset()=0
Function to reset algorithm, to be called @ beginning of each event.
ShowerRecoManager()
Default constructor.
Class def header for a class ShowerRecoManager.