Analysis Software
Documentation for sPHENIX simulation 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 
10 {
11  clear();
12 }
13 
14 void GlobalVertexMapv1::identify(std::ostream& os) const
15 {
16  os << "GlobalVertexMapv1: size = " << _map.size() << std::endl;
17  for (auto& m : _map)
18  {
19  m.second->identify(os);
20  }
21  return;
22 }
23 
25 {
26  for (const auto& iter : _map)
27  {
28  delete iter.second;
29  }
30  _map.clear();
31  return;
32 }
33 
34 const GlobalVertex* GlobalVertexMapv1::get(unsigned int id) const
35 {
36  ConstIter iter = _map.find(id);
37  if (iter == _map.end())
38  {
39  return nullptr;
40  }
41  return iter->second;
42 }
43 
45 {
46  Iter iter = _map.find(id);
47  if (iter == _map.end())
48  {
49  return nullptr;
50  }
51  return iter->second;
52 }
53 
55 {
56  unsigned int index = clus->get_id();
57  auto ret = _map.insert(std::make_pair(index, clus));
58  return ret.first->second;
59 }