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