LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CMergeHelper.cxx
Go to the documentation of this file.
2 
4 
5 namespace cmtool {
6 
8  {
9  if (_mgr_v.size() <= mgr_id) _mgr_v.resize(mgr_id + 1);
10  return _mgr_v[mgr_id];
11  }
12 
13  void CMergeHelper::SetAnaFile(TFile* fout)
14  {
15  for (auto& mgr : _mgr_v)
16  mgr.SetAnaFile(fout);
17  }
18 
20  const std::vector<std::vector<::util::PxHit>>& clusters)
21  {
22  _bk = ::cmtool::CMergeBookKeeper(clusters.size());
23 
24  for (size_t i = 0; i < _mgr_v.size(); ++i) {
25  auto& mgr = _mgr_v[i];
26 
27  mgr.Reset();
28 
29  if (!i)
30  mgr.SetClusters(gser, clusters);
31  else
32  mgr.SetClusters(_mgr_v[i - 1].GetClusters());
33 
34  mgr.Process(gser);
35 
36  auto const& new_bk = mgr.GetBookKeeper();
37 
38  if (!i)
39  _bk = new_bk;
40  else if (new_bk.GetResult().size() < new_bk.size())
41  _bk.Combine(new_bk);
42  }
43  }
44 
45  const std::vector<::cluster::ClusterParamsAlg>& CMergeHelper::GetClusters() const
46  {
47  if (!(_mgr_v.size())) throw CMTException("No manager = no output clusters...");
48  return _mgr_v.back().GetClusters();
49  }
50 }
Class def header for a class CMergeHelper.
void SetAnaFile(TFile *fout)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
void Process(util::GeometryUtilities const &gser, const std::vector< std::vector<::util::PxHit >> &clusters)
Class def header for exception classes in CMTException.
const std::vector<::cluster::ClusterParamsAlg > & GetClusters() const
void Combine(const CMergeBookKeeper &another)
std::vector<::cmtool::CMergeManager > _mgr_v
Definition: CMergeHelper.h:44
CMergeManager & GetManager(size_t mgr_id)
Definition: CMergeHelper.cxx:7
CMergeBookKeeper _bk
Definition: CMergeHelper.h:46