File indexing completed on 2025-10-17 08:19:25
0001 #include "PhotonClusterContainer.h"
0002
0003 #include "PhotonCluster.h"
0004 #include "PhotonClusterv1.h" // for concrete type id access (set_id via RawCluster side not available here)
0005
0006 #include <iostream>
0007
0008 PhotonClusterContainer::ConstRange PhotonClusterContainer::getClusters() const
0009 {
0010 return std::make_pair(m_clusters.begin(), m_clusters.end());
0011 }
0012
0013 PhotonClusterContainer::Range PhotonClusterContainer::getClusters()
0014 {
0015 return std::make_pair(m_clusters.begin(), m_clusters.end());
0016 }
0017
0018 PhotonClusterContainer::ConstIterator PhotonClusterContainer::AddCluster(PhotonCluster* clus)
0019 {
0020 unsigned int key = m_clusters.size();
0021 while (m_clusters.contains(key))
0022 {
0023 key++;
0024 }
0025
0026 m_clusters[key] = clus;
0027 return m_clusters.find(key);
0028 }
0029
0030 PhotonCluster* PhotonClusterContainer::getCluster(const unsigned int key)
0031 {
0032 ConstIterator it = m_clusters.find(key);
0033 if (it != m_clusters.end())
0034 {
0035 return it->second;
0036 }
0037 return nullptr;
0038 }
0039
0040 const PhotonCluster* PhotonClusterContainer::getCluster(const unsigned int key) const
0041 {
0042 ConstIterator it = m_clusters.find(key);
0043 if (it != m_clusters.end())
0044 {
0045 return it->second;
0046 }
0047 return nullptr;
0048 }
0049
0050 int PhotonClusterContainer::isValid() const { return (!m_clusters.empty()); }
0051
0052 void PhotonClusterContainer::Reset()
0053 {
0054 while (!m_clusters.empty())
0055 {
0056 delete m_clusters.begin()->second;
0057 m_clusters.erase(m_clusters.begin());
0058 }
0059 }
0060
0061 void PhotonClusterContainer::identify(std::ostream& os) const
0062 {
0063 os << "PhotonClusterContainer, number of clusters: " << size() << std::endl;
0064 }