Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrkrClusterContainerv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrkrClusterContainerv1.cc
1 
8 #include "TrkrCluster.h"
9 
10 #include <cstdlib>
11 
13 {
14  while (m_clusmap.begin() != m_clusmap.end())
15  {
16  delete m_clusmap.begin()->second;
17  m_clusmap.erase(m_clusmap.begin());
18  }
19  return;
20 }
21 
22 void TrkrClusterContainerv1::identify(std::ostream& os) const
23 {
24  os << "-----TrkrClusterContainerv1-----" << std::endl;
25  ConstIterator iter;
26  os << "Number of clusters: " << size() << std::endl;
27  for (iter = m_clusmap.begin(); iter != m_clusmap.end(); ++iter)
28  {
29  int layer = TrkrDefs::getLayer(iter->first);
30  os << "clus key " << iter->first << " layer " << layer << std::endl;
31  (iter->second)->identify();
32  }
33  os << "------------------------------" << std::endl;
34  return;
35 }
36 
38 {
39  const auto [iter, success] = m_clusmap.insert(std::make_pair(key, newclus));
40  if (!success)
41  {
42  std::cout << "TrkrClusterContainerv1::AddClusterSpecifyKey: duplicate key: " << key << " exiting now" << std::endl;
43  exit(1);
44  }
45 }
46 
48 {
49  m_clusmap.erase(key);
50 }
51 
54 {
55  return std::make_pair(m_clusmap.cbegin(), m_clusmap.cend());
56 }
57 
60 {
61  auto it = m_clusmap.find(key);
62  return it == m_clusmap.end() ? nullptr : it->second;
63 }
64 
65 unsigned int TrkrClusterContainerv1::size() const
66 {
67  return m_clusmap.size();
68 }