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