CMergeHelper.cxx
Go to the documentation of this file.
1 #include "CMergeHelper.h"
2 
4 
5 namespace cmtool {
6 
8  CMergeHelper::GetManager(size_t mgr_id)
9  {
10  if (_mgr_v.size() <= mgr_id) _mgr_v.resize(mgr_id + 1);
11  return _mgr_v[mgr_id];
12  }
13 
14  void
16  {
17  for (auto& mgr : _mgr_v)
18  mgr.SetAnaFile(fout);
19  }
20 
21  void
23  const std::vector<std::vector<::util::PxHit>>& clusters)
24  {
25  _bk = ::cmtool::CMergeBookKeeper(clusters.size());
26 
27  for (size_t i = 0; i < _mgr_v.size(); ++i) {
28  auto& mgr = _mgr_v[i];
29 
30  mgr.Reset();
31 
32  if (!i)
33  mgr.SetClusters(gser, clusters);
34  else
35  mgr.SetClusters(_mgr_v[i - 1].GetClusters());
36 
37  mgr.Process(gser);
38 
39  auto const& new_bk = mgr.GetBookKeeper();
40 
41  if (!i)
42  _bk = new_bk;
43  else if (new_bk.GetResult().size() < new_bk.size())
44  _bk.Combine(new_bk);
45  }
46  }
47 
48  const std::vector<::cluster::ClusterParamsAlg>&
50  {
51  if (!(_mgr_v.size())) throw CMTException("No manager = no output clusters...");
52  return _mgr_v.back().GetClusters();
53  }
54 }
Class def header for a class CMergeHelper.
struct vector vector
void SetAnaFile(TFile *fout)
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:52
CMergeManager & GetManager(size_t mgr_id)
Definition: CMergeHelper.cxx:8
CMergeBookKeeper _bk
Definition: CMergeHelper.h:54