LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
cmtool::CMatchBookKeeper Class Reference

#include "CMatchBookKeeper.h"

Public Member Functions

 CMatchBookKeeper ()
 Default constructor. More...
 
virtual ~CMatchBookKeeper ()
 Default destructor. More...
 
void Reset ()
 Reset method. More...
 
void Match (const std::vector< unsigned int > &matched_indexes, const float &score)
 Method to register matched clusters. More...
 
std::vector< std::vector< unsigned int > > GetResult () const
 Method to get result. More...
 
void PassResult (std::vector< std::vector< unsigned int > > &result) const
 Method to pass result. More...
 

Protected Attributes

std::multimap< float, std::vector< unsigned int > > _register
 

Detailed Description

User defined class CMatchBookKeeper ... these comments are used to generate doxygen documentation!

Definition at line 28 of file CMatchBookKeeper.h.

Constructor & Destructor Documentation

cmtool::CMatchBookKeeper::CMatchBookKeeper ( )

Default constructor.

Definition at line 8 of file CMatchBookKeeper.cxx.

References Reset().

9  {
10  Reset();
11  }
void Reset()
Reset method.
virtual cmtool::CMatchBookKeeper::~CMatchBookKeeper ( )
inlinevirtual

Default destructor.

Definition at line 36 of file CMatchBookKeeper.h.

References GetResult(), Match(), PassResult(), Reset(), and lar::dump::vector().

36 {};

Member Function Documentation

std::vector< std::vector< unsigned int > > cmtool::CMatchBookKeeper::GetResult ( ) const

Method to get result.

Definition at line 25 of file CMatchBookKeeper.cxx.

References PassResult().

Referenced by showerreco::ShowerRecoManager::Reconstruct(), and ~CMatchBookKeeper().

26  {
27  std::vector<std::vector<unsigned int> > res;
28 
29  PassResult(res);
30 
31  return res;
32 
33  }
void PassResult(std::vector< std::vector< unsigned int > > &result) const
Method to pass result.
void cmtool::CMatchBookKeeper::Match ( const std::vector< unsigned int > &  matched_indexes,
const float &  score 
)

Method to register matched clusters.

Definition at line 18 of file CMatchBookKeeper.cxx.

References _register.

Referenced by cmtool::CMatchManager::IterationProcess(), and ~CMatchBookKeeper().

20  {
21  _register.insert(std::make_pair(score,matched_indexes));
22  }
std::multimap< float, std::vector< unsigned int > > _register
void cmtool::CMatchBookKeeper::PassResult ( std::vector< std::vector< unsigned int > > &  result) const

Method to pass result.

Definition at line 36 of file CMatchBookKeeper.cxx.

References _register.

Referenced by GetResult(), and ~CMatchBookKeeper().

37  {
38  result.clear();
39 
40  // Rough guess: assume half of registered pairs are good
41  result.reserve((unsigned int)(_register.size()/2));
42 
43  std::vector<bool> used_index;
44 
45  for( auto riter = _register.rbegin();
46  riter != _register.rend();
47  ++riter) {
48 
49  bool valid_set = true;
50 
51  for(auto const& index : (*riter).second) {
52 
53  if(index >= used_index.size())
54 
55  used_index.resize(index+1,false);
56 
57  else if(used_index.at(index)) valid_set = false;
58 
59  }
60 
61  if(valid_set) {
62 
63  result.push_back((*riter).second);
64 
65  for(auto& index : (*riter).second)
66 
67  used_index.at(index) = true;
68 
69  }
70 
71  }
72 
73  }
std::multimap< float, std::vector< unsigned int > > _register
void cmtool::CMatchBookKeeper::Reset ( )

Reset method.

Definition at line 13 of file CMatchBookKeeper.cxx.

References _register.

Referenced by CMatchBookKeeper(), cmtool::CMatchManager::Reset(), and ~CMatchBookKeeper().

14  {
15  _register.clear();
16  }
std::multimap< float, std::vector< unsigned int > > _register

Member Data Documentation

std::multimap<float,std::vector<unsigned int> > cmtool::CMatchBookKeeper::_register
protected

Definition at line 53 of file CMatchBookKeeper.h.

Referenced by Match(), PassResult(), and Reset().


The documentation for this class was generated from the following files: