EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlobalVertexMapv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GlobalVertexMapv1.cc
1 #include "GlobalVertexMapv1.h"
2 
3 #include "GlobalVertex.h"
4 #include "GlobalVertexMap.h"
5 
6 #include <iterator> // for reverse_iterator
7 #include <utility> // for pair, make_pair
8 
9 using namespace std;
10 
12  : _map()
13 {
14 }
15 
17 {
18  clear();
19 }
20 
21 void GlobalVertexMapv1::identify(ostream& os) const
22 {
23  os << "GlobalVertexMapv1: size = " << _map.size() << endl;
24  return;
25 }
26 
28 {
29  for (Iter iter = _map.begin();
30  iter != _map.end();
31  ++iter)
32  {
33  delete iter->second;
34  }
35  _map.clear();
36  return;
37 }
38 
39 const GlobalVertex* GlobalVertexMapv1::get(unsigned int id) const
40 {
41  ConstIter iter = _map.find(id);
42  if (iter == _map.end()) return nullptr;
43  return iter->second;
44 }
45 
47 {
48  Iter iter = _map.find(id);
49  if (iter == _map.end()) return nullptr;
50  return iter->second;
51 }
52 
54 {
55  unsigned int index = 0;
56  if (!_map.empty()) index = _map.rbegin()->first + 1;
57  _map.insert(make_pair(index, clus));
58  _map[index]->set_id(index);
59  return _map[index];
60 }